Changeset View
Changeset View
Standalone View
Standalone View
head/sys/opencrypto/crypto.c
Show First 20 Lines • Show All 737 Lines • ▼ Show 20 Lines | |||||
static bool | static bool | ||||
alg_is_aead(int alg) | alg_is_aead(int alg) | ||||
{ | { | ||||
return (alg_type(alg) == ALG_AEAD); | return (alg_type(alg) == ALG_AEAD); | ||||
} | } | ||||
#define SUPPORTED_SES (CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD | CSP_F_ESN) | |||||
/* Various sanity checks on crypto session parameters. */ | /* Various sanity checks on crypto session parameters. */ | ||||
static bool | static bool | ||||
check_csp(const struct crypto_session_params *csp) | check_csp(const struct crypto_session_params *csp) | ||||
{ | { | ||||
struct auth_hash *axf; | struct auth_hash *axf; | ||||
/* Mode-independent checks. */ | /* Mode-independent checks. */ | ||||
if ((csp->csp_flags & ~(CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD)) != | if ((csp->csp_flags & ~(SUPPORTED_SES)) != 0) | ||||
0) | |||||
return (false); | return (false); | ||||
if (csp->csp_ivlen < 0 || csp->csp_cipher_klen < 0 || | if (csp->csp_ivlen < 0 || csp->csp_cipher_klen < 0 || | ||||
csp->csp_auth_klen < 0 || csp->csp_auth_mlen < 0) | csp->csp_auth_klen < 0 || csp->csp_auth_mlen < 0) | ||||
return (false); | return (false); | ||||
if (csp->csp_auth_key != NULL && csp->csp_auth_klen == 0) | if (csp->csp_auth_key != NULL && csp->csp_auth_klen == 0) | ||||
return (false); | return (false); | ||||
if (csp->csp_cipher_key != NULL && csp->csp_cipher_klen == 0) | if (csp->csp_cipher_key != NULL && csp->csp_cipher_klen == 0) | ||||
return (false); | return (false); | ||||
▲ Show 20 Lines • Show All 1,519 Lines • Show Last 20 Lines |