Lines Matching refs:csp
624 const struct crypto_session_params *csp; in sec_complete_one() local
639 csp = crypto_get_params(crp->crp_session); in sec_complete_one()
640 dlen = csp->csp_auth_mlen != 0 ? csp->csp_auth_mlen : in sec_complete_one()
642 switch (csp->csp_mode) { in sec_complete_one()
679 check_cipher(const struct crypto_session_params *csp) in check_cipher() argument
682 switch (csp->csp_cipher_alg) { in check_cipher()
685 if (csp->csp_ivlen != AES_BLOCK_LEN) in check_cipher()
687 return (csp->csp_cipher_klen == 16 || in check_cipher()
688 csp->csp_cipher_klen == 24 || in check_cipher()
689 csp->csp_cipher_klen == 32); in check_cipher()
691 if (csp->csp_ivlen != AES_XTS_IV_LEN) in check_cipher()
693 return (csp->csp_cipher_klen == 32 || in check_cipher()
694 csp->csp_cipher_klen == 64); in check_cipher()
701 check_aead(const struct crypto_session_params *csp) in check_aead() argument
704 switch (csp->csp_cipher_alg) { in check_aead()
706 if (csp->csp_auth_mlen != 0 && in check_aead()
707 csp->csp_auth_mlen != AES_GMAC_HASH_LEN) in check_aead()
709 return (csp->csp_cipher_klen == 16 || in check_aead()
710 csp->csp_cipher_klen == 24 || in check_aead()
711 csp->csp_cipher_klen == 32); in check_aead()
713 return (csp->csp_cipher_klen == 16 || in check_aead()
714 csp->csp_cipher_klen == 24 || in check_aead()
715 csp->csp_cipher_klen == 32); in check_aead()
755 check_digest(const struct crypto_session_params *csp) in check_digest() argument
761 if (csp->csp_auth_alg == CRYPTO_AES_NIST_GMAC) { in check_digest()
762 if (csp->csp_ivlen != AES_GCM_IV_LEN) in check_digest()
764 if (csp->csp_auth_mlen > AES_GMAC_HASH_LEN) in check_digest()
766 return (csp->csp_auth_klen == 16 || in check_digest()
767 csp->csp_auth_klen == 24 || in check_digest()
768 csp->csp_auth_klen == 32); in check_digest()
771 if (!sec_hash_params(csp->csp_auth_alg, &alg, &dlen, &skeylen)) in check_digest()
774 if ((skeylen != 0) != (csp->csp_auth_klen != 0)) in check_digest()
776 return (csp->csp_auth_mlen <= dlen); in check_digest()
780 check_eta(const struct crypto_session_params *csp) in check_eta() argument
788 if ((csp->csp_flags & CSP_F_ESN) != 0) in check_eta()
794 if (csp->csp_cipher_alg == CRYPTO_AES_XTS) in check_eta()
797 if (csp->csp_auth_klen == 0) in check_eta()
799 return (check_cipher(csp) && check_digest(csp)); in check_eta()
829 sec_sw_gen_split_key(const struct crypto_session_params *csp, in sec_sw_gen_split_key() argument
836 axf = crypto_auth_hash(csp); in sec_sw_gen_split_key()
837 hmac_init_ipad(axf, csp->csp_auth_key, csp->csp_auth_klen, &ictx); in sec_sw_gen_split_key()
838 hmac_init_opad(axf, csp->csp_auth_key, csp->csp_auth_klen, &octx); in sec_sw_gen_split_key()
843 switch (csp->csp_auth_alg) { in sec_sw_gen_split_key()
1044 sec_ccm_prep(struct sec_job *job, const struct crypto_session_params *csp) in sec_ccm_prep() argument
1050 u_int i, lfield = 15 - csp->csp_ivlen; in sec_ccm_prep()
1067 memcpy(b0 + 1, job->iv, csp->csp_ivlen); in sec_ccm_prep()
1072 memcpy(ctr0 + 1, job->iv, csp->csp_ivlen); in sec_ccm_prep()
1084 sec_cipher_ivlen(const struct crypto_session_params *csp) in sec_cipher_ivlen() argument
1087 if (csp->csp_cipher_alg == CRYPTO_AES_XTS) in sec_cipher_ivlen()
1089 return (csp->csp_ivlen); in sec_cipher_ivlen()
1136 const struct crypto_session_params *csp, int enc, uint32_t *sdlenp) in sec_shd_build_cipher() argument
1142 switch (csp->csp_cipher_alg) { in sec_shd_build_cipher()
1159 ctx_offset = sec_cipher_ctx_offset(csp->csp_cipher_alg); in sec_shd_build_cipher()
1166 if (csp->csp_cipher_klen > 0) in sec_shd_build_cipher()
1167 sec_desc_key_imm(&b, KEY_CLASS_1, csp->csp_cipher_key, in sec_shd_build_cipher()
1168 csp->csp_cipher_klen); in sec_shd_build_cipher()
1170 if (csp->csp_cipher_alg == CRYPTO_AES_XTS) { in sec_shd_build_cipher()
1180 csp->csp_ivlen, 0); in sec_shd_build_cipher()
1204 if (csp->csp_cipher_alg == CRYPTO_AES_XTS) in sec_shd_build_cipher()
1217 const struct crypto_session_params *csp, int enc, uint32_t *sdlenp) in sec_shd_build_digest() argument
1227 if (csp->csp_auth_alg == CRYPTO_AES_NIST_GMAC) { in sec_shd_build_digest()
1228 sess->digestlen = csp->csp_auth_mlen != 0 ? in sec_shd_build_digest()
1229 csp->csp_auth_mlen : AES_GMAC_HASH_LEN; in sec_shd_build_digest()
1231 sec_desc_key_imm(&b, KEY_CLASS_1, csp->csp_auth_key, in sec_shd_build_digest()
1232 csp->csp_auth_klen); in sec_shd_build_digest()
1237 if (!sec_hash_params(csp->csp_auth_alg, &alg, &dlen, &skeylen)) in sec_shd_build_digest()
1291 const struct crypto_session_params *csp, int enc, uint32_t *sdlenp) in sec_shd_build_aead() argument
1295 switch (csp->csp_cipher_alg) { in sec_shd_build_aead()
1305 sess->digestlen = csp->csp_auth_mlen != 0 ? csp->csp_auth_mlen : 16; in sec_shd_build_aead()
1311 if (csp->csp_cipher_klen > 0) in sec_shd_build_aead()
1312 sec_desc_key_imm(&b, KEY_CLASS_1, csp->csp_cipher_key, in sec_shd_build_aead()
1313 csp->csp_cipher_klen); in sec_shd_build_aead()
1323 const struct crypto_session_params *csp, int enc, uint32_t *sdlenp) in sec_shd_build_eta() argument
1329 if (!sec_hash_params(csp->csp_auth_alg, &alg, &dlen, &skeylen)) in sec_shd_build_eta()
1331 sess->digestlen = csp->csp_auth_mlen != 0 ? csp->csp_auth_mlen : dlen; in sec_shd_build_eta()
1333 switch (csp->csp_cipher_alg) { in sec_shd_build_eta()
1350 sec_desc_key_imm(&b, KEY_CLASS_1, csp->csp_cipher_key, in sec_shd_build_eta()
1351 csp->csp_cipher_klen); in sec_shd_build_eta()
1374 sec_probe_session(device_t dev, const struct crypto_session_params *csp) in sec_probe_session() argument
1377 switch (csp->csp_mode) { in sec_probe_session()
1379 if (!check_cipher(csp)) in sec_probe_session()
1383 if (!check_digest(csp)) in sec_probe_session()
1387 if (!check_aead(csp)) in sec_probe_session()
1391 if (!check_eta(csp)) in sec_probe_session()
1402 const struct crypto_session_params *csp) in sec_new_session() argument
1412 if ((csp->csp_mode == CSP_MODE_DIGEST || in sec_new_session()
1413 csp->csp_mode == CSP_MODE_ETA) && csp->csp_auth_klen > 0 && in sec_new_session()
1414 csp->csp_auth_alg != CRYPTO_AES_NIST_GMAC) { in sec_new_session()
1418 if (!sec_hash_params(csp->csp_auth_alg, &alg, &dlen, &skeylen)) in sec_new_session()
1421 sec_sw_gen_split_key(csp, sess->skey, skeylen); in sec_new_session()
1426 switch (csp->csp_mode) { in sec_new_session()
1428 error = sec_shd_build_cipher(sess, csp, enc, &sdlen); in sec_new_session()
1431 error = sec_shd_build_digest(sess, csp, enc, &sdlen); in sec_new_session()
1434 error = sec_shd_build_aead(sess, csp, enc, &sdlen); in sec_new_session()
1437 error = sec_shd_build_eta(sess, csp, enc, &sdlen); in sec_new_session()
1532 sec_job_build_sgts(struct sec_job *job, const struct crypto_session_params *csp) in sec_job_build_sgts() argument
1538 int iv_slot = csp->csp_ivlen > 0 ? 1 : 0; in sec_job_build_sgts()
1540 if (csp->csp_mode == CSP_MODE_AEAD || in sec_job_build_sgts()
1541 csp->csp_mode == CSP_MODE_ETA) { in sec_job_build_sgts()
1544 bool ccm = csp->csp_mode == CSP_MODE_AEAD && in sec_job_build_sgts()
1545 csp->csp_cipher_alg == CRYPTO_AES_CCM_16; in sec_job_build_sgts()
1556 job->in_sgt[in_i].length = csp->csp_ivlen; in sec_job_build_sgts()
1614 if (!encrypt && csp->csp_mode == CSP_MODE_AEAD) { in sec_job_build_sgts()
1633 job->in_sgt[0].length = sec_cipher_ivlen(csp); in sec_job_build_sgts()
1691 const struct crypto_session_params *csp) in sec_jd_build_cipher() argument
1698 uint32_t in_len = sec_cipher_ivlen(csp) + job->crp->crp_payload_length; in sec_jd_build_cipher()
1706 if (csp->csp_cipher_alg == CRYPTO_AES_XTS && in sec_jd_build_cipher()
1792 const struct crypto_session_params *csp; in sec_jd_build_aead() local
1802 csp = crypto_get_params(job->crp->crp_session); in sec_jd_build_aead()
1804 ivlen = csp->csp_ivlen; in sec_jd_build_aead()
1940 const struct crypto_session_params *csp; in sec_jd_build_eta() local
1946 csp = crypto_get_params(job->crp->crp_session); in sec_jd_build_eta()
1949 ivlen = csp->csp_ivlen; in sec_jd_build_eta()
1966 ctx_offset = sec_cipher_ctx_offset(csp->csp_cipher_alg); in sec_jd_build_eta()
2001 const struct crypto_session_params *csp; in sec_jd_build_gmac() local
2006 csp = crypto_get_params(job->crp->crp_session); in sec_jd_build_gmac()
2007 ivlen = csp->csp_ivlen; in sec_jd_build_gmac()
2053 const struct crypto_session_params *csp; in sec_process() local
2084 csp = crypto_get_params(crp->crp_session); in sec_process()
2085 if (csp->csp_ivlen > 0) in sec_process()
2087 if (csp->csp_cipher_alg == CRYPTO_AES_XTS) in sec_process()
2089 if (csp->csp_cipher_alg == CRYPTO_AES_CCM_16) { in sec_process()
2090 error = sec_ccm_prep(job, csp); in sec_process()
2095 error = sec_job_build_sgts(job, csp); in sec_process()
2102 switch (csp->csp_mode) { in sec_process()
2104 if (csp->csp_auth_alg == CRYPTO_AES_NIST_GMAC) in sec_process()
2110 if (csp->csp_cipher_alg == CRYPTO_AES_CCM_16) in sec_process()
2119 error = sec_jd_build_cipher(job, csp); in sec_process()