Changeset View
Changeset View
Standalone View
Standalone View
sys/opencrypto/cryptosoft.c
Show First 20 Lines • Show All 313 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
u_char aalg[HASH_MAX_LEN]; | u_char aalg[HASH_MAX_LEN]; | ||||
const struct crypto_session_params *csp; | const struct crypto_session_params *csp; | ||||
struct swcr_auth *sw; | struct swcr_auth *sw; | ||||
const struct auth_hash *axf; | const struct auth_hash *axf; | ||||
union authctx ctx; | union authctx ctx; | ||||
int err; | int err; | ||||
if (crp->crp_op & CRYPTO_OP_SKIP_DIGEST) | |||||
return (0); | |||||
sw = &ses->swcr_auth; | sw = &ses->swcr_auth; | ||||
axf = sw->sw_axf; | axf = sw->sw_axf; | ||||
csp = crypto_get_params(crp->crp_session); | csp = crypto_get_params(crp->crp_session); | ||||
if (crp->crp_auth_key != NULL) { | if (crp->crp_auth_key != NULL) { | ||||
swcr_authprepare(axf, sw, crp->crp_auth_key, | swcr_authprepare(axf, sw, crp->crp_auth_key, | ||||
csp->csp_auth_klen); | csp->csp_auth_klen); | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | swcr_gmac(struct swcr_session *ses, struct cryptop *crp) | ||||
const u_char *inblk; | const u_char *inblk; | ||||
union authctx ctx; | union authctx ctx; | ||||
struct swcr_auth *swa; | struct swcr_auth *swa; | ||||
const struct auth_hash *axf; | const struct auth_hash *axf; | ||||
uint32_t *blkp; | uint32_t *blkp; | ||||
size_t len; | size_t len; | ||||
int blksz, error, ivlen, resid; | int blksz, error, ivlen, resid; | ||||
if (crp->crp_op & CRYPTO_OP_SKIP_DIGEST) | |||||
return (0); | |||||
swa = &ses->swcr_auth; | swa = &ses->swcr_auth; | ||||
axf = swa->sw_axf; | axf = swa->sw_axf; | ||||
bcopy(swa->sw_ictx, &ctx, axf->ctxsize); | bcopy(swa->sw_ictx, &ctx, axf->ctxsize); | ||||
blksz = GMAC_BLOCK_LEN; | blksz = GMAC_BLOCK_LEN; | ||||
KASSERT(axf->blocksize == blksz, ("%s: axf block size mismatch", | KASSERT(axf->blocksize == blksz, ("%s: axf block size mismatch", | ||||
__func__)); | __func__)); | ||||
▲ Show 20 Lines • Show All 287 Lines • ▼ Show 20 Lines | swcr_ccm_cbc_mac(struct swcr_session *ses, struct cryptop *crp) | ||||
u_char iv[AES_BLOCK_LEN]; | u_char iv[AES_BLOCK_LEN]; | ||||
u_char blk[CCM_CBC_BLOCK_LEN]; | u_char blk[CCM_CBC_BLOCK_LEN]; | ||||
u_char tag[AES_CBC_MAC_HASH_LEN]; | u_char tag[AES_CBC_MAC_HASH_LEN]; | ||||
union authctx ctx; | union authctx ctx; | ||||
const struct crypto_session_params *csp; | const struct crypto_session_params *csp; | ||||
struct swcr_auth *swa; | struct swcr_auth *swa; | ||||
const struct auth_hash *axf; | const struct auth_hash *axf; | ||||
int error, ivlen, len; | int error, ivlen, len; | ||||
if (crp->crp_op & CRYPTO_OP_SKIP_DIGEST) | |||||
return (0); | |||||
csp = crypto_get_params(crp->crp_session); | csp = crypto_get_params(crp->crp_session); | ||||
swa = &ses->swcr_auth; | swa = &ses->swcr_auth; | ||||
axf = swa->sw_axf; | axf = swa->sw_axf; | ||||
bcopy(swa->sw_ictx, &ctx, axf->ctxsize); | bcopy(swa->sw_ictx, &ctx, axf->ctxsize); | ||||
/* Initialize the IV */ | /* Initialize the IV */ | ||||
▲ Show 20 Lines • Show All 1,051 Lines • Show Last 20 Lines |