Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgbe/crypto/t4_keyctx.c
Show First 20 Lines • Show All 343 Lines • ▼ Show 20 Lines | t4_copy_partial_hash(int alg, union authctx *auth_ctx, void *dst) | ||||
case CRYPTO_SHA2_512_HMAC: | case CRYPTO_SHA2_512_HMAC: | ||||
for (i = 0; i < SHA2_512_HASH_LEN / 8; i++) | for (i = 0; i < SHA2_512_HASH_LEN / 8; i++) | ||||
u64[i] = htobe64(auth_ctx->sha512ctx.state[i]); | u64[i] = htobe64(auth_ctx->sha512ctx.state[i]); | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
void | void | ||||
t4_init_hmac_digest(struct auth_hash *axf, u_int partial_digest_len, | t4_init_hmac_digest(const struct auth_hash *axf, u_int partial_digest_len, | ||||
const char *key, int klen, char *dst) | const char *key, int klen, char *dst) | ||||
{ | { | ||||
union authctx auth_ctx; | union authctx auth_ctx; | ||||
hmac_init_ipad(axf, key, klen, &auth_ctx); | hmac_init_ipad(axf, key, klen, &auth_ctx); | ||||
t4_copy_partial_hash(axf->type, &auth_ctx, dst); | t4_copy_partial_hash(axf->type, &auth_ctx, dst); | ||||
dst += roundup2(partial_digest_len, 16); | dst += roundup2(partial_digest_len, 16); | ||||
▲ Show 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | else { | ||||
} | } | ||||
} | } | ||||
} | } | ||||
void | void | ||||
t4_tls_key_ctx(const struct ktls_session *tls, int direction, | t4_tls_key_ctx(const struct ktls_session *tls, int direction, | ||||
struct tls_keyctx *kctx) | struct tls_keyctx *kctx) | ||||
{ | { | ||||
struct auth_hash *axf; | const struct auth_hash *axf; | ||||
u_int mac_key_size; | u_int mac_key_size; | ||||
char *hash; | char *hash; | ||||
/* Key context header. */ | /* Key context header. */ | ||||
if (direction == KTLS_TX) { | if (direction == KTLS_TX) { | ||||
kctx->u.txhdr.ctxlen = t4_tls_key_info_size(tls) / 16; | kctx->u.txhdr.ctxlen = t4_tls_key_info_size(tls) / 16; | ||||
kctx->u.txhdr.dualck_to_txvalid = | kctx->u.txhdr.dualck_to_txvalid = | ||||
V_TLS_KEYCTX_TX_WR_SALT_PRESENT(1) | | V_TLS_KEYCTX_TX_WR_SALT_PRESENT(1) | | ||||
▲ Show 20 Lines • Show All 137 Lines • Show Last 20 Lines |