Changeset View
Changeset View
Standalone View
Standalone View
sys/opencrypto/cryptosoft.c
Show First 20 Lines • Show All 531 Lines • ▼ Show 20 Lines | if (crp->crp_aad != NULL) { | ||||
} | } | ||||
if (resid > 0) { | if (resid > 0) { | ||||
memset(blk, 0, blksz); | memset(blk, 0, blksz); | ||||
crypto_cursor_copydata(&cc_in, resid, blk); | crypto_cursor_copydata(&cc_in, resid, blk); | ||||
axf->Update(&ctx, blk, blksz); | axf->Update(&ctx, blk, blksz); | ||||
} | } | ||||
} | } | ||||
if (crp->crp_cipher_key != NULL) | |||||
exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, | |||||
crypto_get_params(crp->crp_session)->csp_cipher_klen); | |||||
exf->reinit(swe->sw_kschedule, iv); | exf->reinit(swe->sw_kschedule, iv); | ||||
/* Do encryption with MAC */ | /* Do encryption with MAC */ | ||||
crypto_cursor_init(&cc_in, &crp->crp_buf); | crypto_cursor_init(&cc_in, &crp->crp_buf); | ||||
crypto_cursor_advance(&cc_in, crp->crp_payload_start); | crypto_cursor_advance(&cc_in, crp->crp_payload_start); | ||||
if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { | if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { | ||||
crypto_cursor_init(&cc_out, &crp->crp_obuf); | crypto_cursor_init(&cc_out, &crp->crp_obuf); | ||||
crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); | crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); | ||||
▲ Show 20 Lines • Show All 202 Lines • ▼ Show 20 Lines | swcr_ccm(struct swcr_session *ses, struct cryptop *crp) | ||||
if (crp->crp_aad != NULL) | if (crp->crp_aad != NULL) | ||||
error = axf->Update(&ctx, crp->crp_aad, crp->crp_aad_length); | error = axf->Update(&ctx, crp->crp_aad, crp->crp_aad_length); | ||||
else | else | ||||
error = crypto_apply(crp, crp->crp_aad_start, | error = crypto_apply(crp, crp->crp_aad_start, | ||||
crp->crp_aad_length, axf->Update, &ctx); | crp->crp_aad_length, axf->Update, &ctx); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
if (crp->crp_cipher_key != NULL) | |||||
exf->setkey(swe->sw_kschedule, crp->crp_cipher_key, | |||||
crypto_get_params(crp->crp_session)->csp_cipher_klen); | |||||
exf->reinit(swe->sw_kschedule, iv); | exf->reinit(swe->sw_kschedule, iv); | ||||
/* Do encryption/decryption with MAC */ | /* Do encryption/decryption with MAC */ | ||||
crypto_cursor_init(&cc_in, &crp->crp_buf); | crypto_cursor_init(&cc_in, &crp->crp_buf); | ||||
crypto_cursor_advance(&cc_in, crp->crp_payload_start); | crypto_cursor_advance(&cc_in, crp->crp_payload_start); | ||||
if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { | if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { | ||||
crypto_cursor_init(&cc_out, &crp->crp_obuf); | crypto_cursor_init(&cc_out, &crp->crp_obuf); | ||||
crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); | crypto_cursor_advance(&cc_out, crp->crp_payload_output_start); | ||||
▲ Show 20 Lines • Show All 946 Lines • Show Last 20 Lines |