Changeset View
Changeset View
Standalone View
Standalone View
sys/opencrypto/cryptodev.c
Show First 20 Lines • Show All 438 Lines • ▼ Show 20 Lines | case CRYPTO_AES_ICM: | ||||
txform = &enc_xform_aes_icm; | txform = &enc_xform_aes_icm; | ||||
break; | break; | ||||
case CRYPTO_AES_NIST_GCM_16: | case CRYPTO_AES_NIST_GCM_16: | ||||
txform = &enc_xform_aes_nist_gcm; | txform = &enc_xform_aes_nist_gcm; | ||||
break; | break; | ||||
case CRYPTO_CHACHA20: | case CRYPTO_CHACHA20: | ||||
txform = &enc_xform_chacha20; | txform = &enc_xform_chacha20; | ||||
break; | break; | ||||
case CRYPTO_AES_CCM_16: | |||||
txform = &enc_xform_ccm; | |||||
break; | |||||
default: | default: | ||||
CRYPTDEB("invalid cipher"); | CRYPTDEB("invalid cipher"); | ||||
SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); | SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
switch (sop->mac) { | switch (sop->mac) { | ||||
Show All 28 Lines | case CRYPTO_AES_128_NIST_GMAC: | ||||
break; | break; | ||||
case CRYPTO_AES_192_NIST_GMAC: | case CRYPTO_AES_192_NIST_GMAC: | ||||
thash = &auth_hash_nist_gmac_aes_192; | thash = &auth_hash_nist_gmac_aes_192; | ||||
break; | break; | ||||
case CRYPTO_AES_256_NIST_GMAC: | case CRYPTO_AES_256_NIST_GMAC: | ||||
thash = &auth_hash_nist_gmac_aes_256; | thash = &auth_hash_nist_gmac_aes_256; | ||||
break; | break; | ||||
case CRYPTO_AES_128_CCM_CBC_MAC: | |||||
thash = &auth_hash_ccm_cbc_mac_128; | |||||
break; | |||||
case CRYPTO_AES_192_CCM_CBC_MAC: | |||||
thash = &auth_hash_ccm_cbc_mac_192; | |||||
break; | |||||
case CRYPTO_AES_256_CCM_CBC_MAC: | |||||
thash = &auth_hash_ccm_cbc_mac_256; | |||||
break; | |||||
#ifdef notdef | #ifdef notdef | ||||
case CRYPTO_MD5: | case CRYPTO_MD5: | ||||
thash = &auth_hash_md5; | thash = &auth_hash_md5; | ||||
break; | break; | ||||
#endif | #endif | ||||
case CRYPTO_SHA1: | case CRYPTO_SHA1: | ||||
thash = &auth_hash_sha1; | thash = &auth_hash_sha1; | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 504 Lines • ▼ Show 20 Lines | cryptodev_aead( | ||||
} | } | ||||
/* | /* | ||||
* For GCM, crd_len covers only the AAD. For other ciphers | * For GCM, crd_len covers only the AAD. For other ciphers | ||||
* chained with an HMAC, crd_len covers both the AAD and the | * chained with an HMAC, crd_len covers both the AAD and the | ||||
* cipher text. | * cipher text. | ||||
*/ | */ | ||||
crda->crd_skip = 0; | crda->crd_skip = 0; | ||||
if (cse->cipher == CRYPTO_AES_NIST_GCM_16) | if (cse->cipher == CRYPTO_AES_NIST_GCM_16 || | ||||
cse->cipher == CRYPTO_AES_CCM_16) | |||||
crda->crd_len = caead->aadlen; | crda->crd_len = caead->aadlen; | ||||
else | else | ||||
crda->crd_len = caead->aadlen + caead->len; | crda->crd_len = caead->aadlen + caead->len; | ||||
crda->crd_inject = caead->aadlen + caead->len; | crda->crd_inject = caead->aadlen + caead->len; | ||||
crda->crd_alg = cse->mac; | crda->crd_alg = cse->mac; | ||||
crda->crd_key = cse->mackey; | crda->crd_key = cse->mackey; | ||||
crda->crd_klen = cse->mackeylen * 8; | crda->crd_klen = cse->mackeylen * 8; | ||||
▲ Show 20 Lines • Show All 469 Lines • Show Last 20 Lines |