Lines Matching refs:csp
105 const struct crypto_session_params *csp; in swcr_encdec() local
135 csp = crypto_get_params(crp->crp_session); in swcr_encdec()
137 crp->crp_cipher_key, csp->csp_cipher_klen); in swcr_encdec()
320 const struct crypto_session_params *csp; in swcr_authcompute() local
330 csp = crypto_get_params(crp->crp_session); in swcr_authcompute()
333 csp->csp_auth_klen); in swcr_authcompute()
357 if (csp->csp_flags & CSP_F_ESN) in swcr_authcompute()
977 const struct crypto_session_params *csp) in swcr_setup_cipher() argument
984 txf = crypto_cipher(csp); in swcr_setup_cipher()
985 MPASS(txf->ivsize == csp->csp_ivlen); in swcr_setup_cipher()
992 if (csp->csp_cipher_key != NULL) { in swcr_setup_cipher()
994 csp->csp_cipher_key, csp->csp_cipher_klen); in swcr_setup_cipher()
1004 const struct crypto_session_params *csp) in swcr_setup_auth() argument
1011 axf = crypto_auth_hash(csp); in swcr_setup_auth()
1013 if (csp->csp_auth_mlen < 0 || csp->csp_auth_mlen > axf->hashsize) in swcr_setup_auth()
1015 if (csp->csp_auth_mlen == 0) in swcr_setup_auth()
1018 swa->sw_mlen = csp->csp_auth_mlen; in swcr_setup_auth()
1023 switch (csp->csp_auth_alg) { in swcr_setup_auth()
1036 if (csp->csp_auth_key != NULL) { in swcr_setup_auth()
1037 swcr_authprepare(axf, swa, csp->csp_auth_key, in swcr_setup_auth()
1038 csp->csp_auth_klen); in swcr_setup_auth()
1041 if (csp->csp_mode == CSP_MODE_DIGEST) in swcr_setup_auth()
1050 if (csp->csp_mode == CSP_MODE_DIGEST) in swcr_setup_auth()
1055 axf->Setkey(swa->sw_ictx, csp->csp_auth_key, in swcr_setup_auth()
1056 csp->csp_auth_klen); in swcr_setup_auth()
1057 if (csp->csp_mode == CSP_MODE_DIGEST) in swcr_setup_auth()
1067 if (csp->csp_auth_klen == 0 || csp->csp_auth_key != NULL) in swcr_setup_auth()
1068 axf->Setkey(swa->sw_ictx, csp->csp_auth_key, in swcr_setup_auth()
1069 csp->csp_auth_klen); in swcr_setup_auth()
1071 if (csp->csp_mode == CSP_MODE_DIGEST) in swcr_setup_auth()
1076 axf->Setkey(swa->sw_ictx, csp->csp_auth_key, in swcr_setup_auth()
1077 csp->csp_auth_klen); in swcr_setup_auth()
1078 if (csp->csp_mode == CSP_MODE_DIGEST) in swcr_setup_auth()
1088 const struct crypto_session_params *csp) in swcr_setup_gcm() argument
1093 if (csp->csp_ivlen != AES_GCM_IV_LEN) in swcr_setup_gcm()
1098 switch (csp->csp_cipher_klen * 8) { in swcr_setup_gcm()
1112 if (csp->csp_auth_mlen < 0 || csp->csp_auth_mlen > axf->hashsize) in swcr_setup_gcm()
1114 if (csp->csp_auth_mlen == 0) in swcr_setup_gcm()
1117 swa->sw_mlen = csp->csp_auth_mlen; in swcr_setup_gcm()
1122 if (csp->csp_cipher_key != NULL) in swcr_setup_gcm()
1123 axf->Setkey(swa->sw_ictx, csp->csp_cipher_key, in swcr_setup_gcm()
1124 csp->csp_cipher_klen); in swcr_setup_gcm()
1127 return (swcr_setup_cipher(ses, csp)); in swcr_setup_gcm()
1132 const struct crypto_session_params *csp) in swcr_setup_ccm() argument
1137 if (csp->csp_ivlen != AES_CCM_IV_LEN) in swcr_setup_ccm()
1142 switch (csp->csp_cipher_klen * 8) { in swcr_setup_ccm()
1156 if (csp->csp_auth_mlen < 0 || csp->csp_auth_mlen > axf->hashsize) in swcr_setup_ccm()
1158 if (csp->csp_auth_mlen == 0) in swcr_setup_ccm()
1161 swa->sw_mlen = csp->csp_auth_mlen; in swcr_setup_ccm()
1166 if (csp->csp_cipher_key != NULL) in swcr_setup_ccm()
1167 axf->Setkey(swa->sw_ictx, csp->csp_cipher_key, in swcr_setup_ccm()
1168 csp->csp_cipher_klen); in swcr_setup_ccm()
1171 return (swcr_setup_cipher(ses, csp)); in swcr_setup_ccm()
1175 swcr_auth_supported(const struct crypto_session_params *csp) in swcr_auth_supported() argument
1179 axf = crypto_auth_hash(csp); in swcr_auth_supported()
1182 switch (csp->csp_auth_alg) { in swcr_auth_supported()
1192 switch (csp->csp_auth_klen * 8) { in swcr_auth_supported()
1200 if (csp->csp_auth_key == NULL) in swcr_auth_supported()
1202 if (csp->csp_ivlen != AES_GCM_IV_LEN) in swcr_auth_supported()
1206 if (csp->csp_auth_klen != POLY1305_KEY_LEN) in swcr_auth_supported()
1210 switch (csp->csp_auth_klen * 8) { in swcr_auth_supported()
1218 if (csp->csp_auth_key == NULL) in swcr_auth_supported()
1220 if (csp->csp_ivlen != AES_CCM_IV_LEN) in swcr_auth_supported()
1228 swcr_cipher_supported(const struct crypto_session_params *csp) in swcr_cipher_supported() argument
1232 txf = crypto_cipher(csp); in swcr_cipher_supported()
1235 if (csp->csp_cipher_alg != CRYPTO_NULL_CBC && in swcr_cipher_supported()
1236 txf->ivsize != csp->csp_ivlen) in swcr_cipher_supported()
1244 swcr_probesession(device_t dev, const struct crypto_session_params *csp) in swcr_probesession() argument
1246 if ((csp->csp_flags & ~(SUPPORTED_SES)) != 0) in swcr_probesession()
1248 switch (csp->csp_mode) { in swcr_probesession()
1250 switch (csp->csp_cipher_alg) { in swcr_probesession()
1258 switch (csp->csp_cipher_alg) { in swcr_probesession()
1263 if (!swcr_cipher_supported(csp)) in swcr_probesession()
1269 if (!swcr_auth_supported(csp)) in swcr_probesession()
1273 switch (csp->csp_cipher_alg) { in swcr_probesession()
1283 switch (csp->csp_cipher_alg) { in swcr_probesession()
1288 switch (csp->csp_auth_alg) { in swcr_probesession()
1294 if (!swcr_cipher_supported(csp) || in swcr_probesession()
1295 !swcr_auth_supported(csp)) in swcr_probesession()
1310 const struct crypto_session_params *csp) in swcr_newsession() argument
1324 switch (csp->csp_mode) { in swcr_newsession()
1326 switch (csp->csp_cipher_alg) { in swcr_newsession()
1339 switch (csp->csp_cipher_alg) { in swcr_newsession()
1349 error = swcr_setup_cipher(ses, csp); in swcr_newsession()
1355 error = swcr_setup_auth(ses, csp); in swcr_newsession()
1358 switch (csp->csp_cipher_alg) { in swcr_newsession()
1360 error = swcr_setup_gcm(ses, csp); in swcr_newsession()
1365 error = swcr_setup_ccm(ses, csp); in swcr_newsession()
1377 switch (csp->csp_cipher_alg) { in swcr_newsession()
1382 switch (csp->csp_auth_alg) { in swcr_newsession()
1389 error = swcr_setup_auth(ses, csp); in swcr_newsession()
1392 if (csp->csp_cipher_alg == CRYPTO_NULL_CBC) { in swcr_newsession()
1398 error = swcr_setup_cipher(ses, csp); in swcr_newsession()