Changeset View
Changeset View
Standalone View
Standalone View
sys/opencrypto/cryptodev.c
Show First 20 Lines • Show All 435 Lines • ▼ Show 20 Lines | case CRYPTO_CAMELLIA_CBC: | ||||
txform = &enc_xform_camellia; | txform = &enc_xform_camellia; | ||||
break; | break; | ||||
case CRYPTO_AES_ICM: | 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_AES_CCM_16: | |||||
txform = &enc_xform_ccm; | |||||
break; | |||||
case CRYPTO_CHACHA20: | case CRYPTO_CHACHA20: | ||||
txform = &enc_xform_chacha20; | txform = &enc_xform_chacha20; | ||||
break; | 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); | ||||
Show All 24 Lines | case CRYPTO_AES_128_NIST_GMAC: | ||||
thash = &auth_hash_nist_gmac_aes_128; | thash = &auth_hash_nist_gmac_aes_128; | ||||
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; | |||||
jmg: why the blank line here? | |||||
#ifdef notdef | #ifdef notdef | ||||
case CRYPTO_MD5: | case CRYPTO_MD5: | ||||
thash = &auth_hash_md5; | thash = &auth_hash_md5; | ||||
break; | break; | ||||
case CRYPTO_SHA1: | case CRYPTO_SHA1: | ||||
thash = &auth_hash_sha1; | thash = &auth_hash_sha1; | ||||
break; | break; | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 486 Lines • ▼ Show 20 Lines | cryptodev_aead( | ||||
if ((error = copyin(caead->src, (char *)cod->uio.uio_iov[0].iov_base + | if ((error = copyin(caead->src, (char *)cod->uio.uio_iov[0].iov_base + | ||||
caead->aadlen, caead->len))) { | caead->aadlen, caead->len))) { | ||||
SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); | SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); | ||||
goto bail; | goto bail; | ||||
} | } | ||||
/* | /* | ||||
* For GCM, crd_len covers only the AAD. For other ciphers | * For GCM and CCM, 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 471 Lines • Show Last 20 Lines |
why the blank line here?