Changeset View
Changeset View
Standalone View
Standalone View
sys/mips/cavium/cryptocteon/cryptocteon.c
Show First 20 Lines • Show All 381 Lines • ▼ Show 20 Lines | cryptocteon_process(device_t dev, struct cryptop *crp, int hint) | ||||
if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) | if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) | ||||
(*od->octo_encrypt)(od, od->octo_iov, iovcnt, iovlen, | (*od->octo_encrypt)(od, od->octo_iov, iovcnt, iovlen, | ||||
auth_off, auth_len, crypt_off, crypt_len, icv, ivp); | auth_off, auth_len, crypt_off, crypt_len, icv, ivp); | ||||
else | else | ||||
(*od->octo_decrypt)(od, od->octo_iov, iovcnt, iovlen, | (*od->octo_decrypt)(od, od->octo_iov, iovcnt, iovlen, | ||||
auth_off, auth_len, crypt_off, crypt_len, icv, ivp); | auth_off, auth_len, crypt_off, crypt_len, icv, ivp); | ||||
if (csp->csp_auth_alg != 0) { | if (csp->csp_auth_alg != 0 && | ||||
(crp->crp_op & CRYPTO_OP_SKIP_DIGEST) == 0) { | |||||
if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { | if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { | ||||
crypto_copydata(crp, crp->crp_digest_start, | crypto_copydata(crp, crp->crp_digest_start, | ||||
od->octo_mlen, icv2); | od->octo_mlen, icv2); | ||||
if (timingsafe_bcmp(icv, icv2, od->octo_mlen) != 0) | if (timingsafe_bcmp(icv, icv2, od->octo_mlen) != 0) | ||||
crp->crp_etype = EBADMSG; | crp->crp_etype = EBADMSG; | ||||
} else | } else | ||||
crypto_copyback(crp, crp->crp_digest_start, | crypto_copyback(crp, crp->crp_digest_start, | ||||
od->octo_mlen, icv); | od->octo_mlen, icv); | ||||
Show All 26 Lines |