Changeset View
Changeset View
Standalone View
Standalone View
sys/opencrypto/ktls_ocf.c
Show First 20 Lines • Show All 410 Lines • ▼ Show 20 Lines | ktls_ocf_tls12_aead_encrypt(struct ktls_session *tls, | ||||
if (inplace) | if (inplace) | ||||
tag_uio = &uio; | tag_uio = &uio; | ||||
else | else | ||||
tag_uio = &out_uio; | tag_uio = &out_uio; | ||||
/* Duplicate iovec and append vector for tag. */ | /* Duplicate iovec and append vector for tag. */ | ||||
memcpy(iov, tag_uio->uio_iov, outiovcnt * sizeof(struct iovec)); | memcpy(iov, tag_uio->uio_iov, outiovcnt * sizeof(struct iovec)); | ||||
iov[outiovcnt].iov_base = trailer; | iov[outiovcnt].iov_base = trailer; | ||||
iov[outiovcnt].iov_len = AES_GMAC_HASH_LEN; | iov[outiovcnt].iov_len = tls->params.tls_tlen; | ||||
tag_uio->uio_iov = iov; | tag_uio->uio_iov = iov; | ||||
tag_uio->uio_iovcnt++; | tag_uio->uio_iovcnt++; | ||||
crp.crp_digest_start = tag_uio->uio_resid; | crp.crp_digest_start = tag_uio->uio_resid; | ||||
tag_uio->uio_resid += AES_GMAC_HASH_LEN; | tag_uio->uio_resid += tls->params.tls_tlen; | ||||
crp.crp_op = CRYPTO_OP_ENCRYPT | CRYPTO_OP_COMPUTE_DIGEST; | crp.crp_op = CRYPTO_OP_ENCRYPT | CRYPTO_OP_COMPUTE_DIGEST; | ||||
crp.crp_flags = CRYPTO_F_CBIMM | CRYPTO_F_IV_SEPARATE; | crp.crp_flags = CRYPTO_F_CBIMM | CRYPTO_F_IV_SEPARATE; | ||||
crypto_use_uio(&crp, &uio); | crypto_use_uio(&crp, &uio); | ||||
if (!inplace) | if (!inplace) | ||||
crypto_use_output_uio(&crp, &out_uio); | crypto_use_output_uio(&crp, &out_uio); | ||||
if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) | if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | ktls_ocf_tls12_aead_decrypt(struct ktls_session *tls, | ||||
if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) | if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16) | ||||
counter_u64_add(ocf_tls12_gcm_crypts, 1); | counter_u64_add(ocf_tls12_gcm_crypts, 1); | ||||
else | else | ||||
counter_u64_add(ocf_tls12_chacha20_crypts, 1); | counter_u64_add(ocf_tls12_chacha20_crypts, 1); | ||||
error = ktls_ocf_dispatch(os, &crp); | error = ktls_ocf_dispatch(os, &crp); | ||||
crypto_destroyreq(&crp); | crypto_destroyreq(&crp); | ||||
*trailer_len = AES_GMAC_HASH_LEN; | *trailer_len = tls->params.tls_tlen; | ||||
return (error); | return (error); | ||||
} | } | ||||
static int | static int | ||||
ktls_ocf_tls13_aead_encrypt(struct ktls_session *tls, | ktls_ocf_tls13_aead_encrypt(struct ktls_session *tls, | ||||
const struct tls_record_layer *hdr, uint8_t *trailer, struct iovec *iniov, | const struct tls_record_layer *hdr, uint8_t *trailer, struct iovec *iniov, | ||||
struct iovec *outiov, int iniovcnt, int outiovcnt, uint64_t seqno, | struct iovec *outiov, int iniovcnt, int outiovcnt, uint64_t seqno, | ||||
uint8_t record_type) | uint8_t record_type) | ||||
▲ Show 20 Lines • Show All 290 Lines • Show Last 20 Lines |