Lines Matching refs:ad
503 static int sa_set_sc_enc(struct algo_data *ad, const u8 *key, u16 key_sz, in sa_set_sc_enc() argument
512 mci = ad->mci_enc; in sa_set_sc_enc()
514 mci = ad->mci_dec; in sa_set_sc_enc()
520 if (ad->inv_key && !enc) { in sa_set_sc_enc()
532 static void sa_set_sc_auth(struct algo_data *ad, const u8 *key, u16 key_sz, in sa_set_sc_auth() argument
542 sc_buf[1] |= ad->auth_ctrl; in sa_set_sc_auth()
545 if (ad->keyed_mac) in sa_set_sc_auth()
546 ad->prep_iopad(ad, key, key_sz, ipad, opad); in sa_set_sc_auth()
719 struct algo_data *ad, u8 enc, u32 *swinfo) in sa_init_sc() argument
729 if (ad->auth_eng.eng_id) { in sa_init_sc()
731 first_engine = ad->enc_eng.eng_id; in sa_init_sc()
733 first_engine = ad->auth_eng.eng_id; in sa_init_sc()
736 auth_sc_offset = enc_sc_offset + ad->enc_eng.sc_size; in sa_init_sc()
738 if (!ad->hash_size) in sa_init_sc()
740 ad->hash_size = roundup(ad->hash_size, 8); in sa_init_sc()
742 } else if (ad->enc_eng.eng_id && !ad->auth_eng.eng_id) { in sa_init_sc()
744 first_engine = ad->enc_eng.eng_id; in sa_init_sc()
746 ad->hash_size = ad->iv_out_size; in sa_init_sc()
758 if (ad->enc_eng.sc_size) { in sa_init_sc()
759 if (sa_set_sc_enc(ad, enc_key, enc_key_sz, enc, in sa_init_sc()
765 if (ad->auth_eng.sc_size) in sa_init_sc()
766 sa_set_sc_auth(ad, auth_key, auth_key_sz, in sa_init_sc()
776 SA_SW_INFO_FLAG_EVICT, ad->hash_size, swinfo); in sa_init_sc()
886 unsigned int keylen, struct algo_data *ad) in sa_cipher_setkey() argument
898 ad->enc_eng.eng_id = SA_ENG_ID_EM1; in sa_cipher_setkey()
899 ad->enc_eng.sc_size = SA_CTX_ENC_TYPE1_SZ; in sa_cipher_setkey()
902 cfg.enc_eng_id = ad->enc_eng.eng_id; in sa_cipher_setkey()
914 ad, 1, &ctx->enc.epib[1])) in sa_cipher_setkey()
927 ad, 0, &ctx->dec.epib[1])) in sa_cipher_setkey()
930 cfg.enc_eng_id = ad->enc_eng.eng_id; in sa_cipher_setkey()
938 ctx->iv_idx = ad->iv_idx; in sa_cipher_setkey()
950 struct algo_data ad = { 0 }; in sa_aes_cbc_setkey() local
957 ad.mci_enc = mci_cbc_enc_array[key_idx]; in sa_aes_cbc_setkey()
958 ad.mci_dec = mci_cbc_dec_array[key_idx]; in sa_aes_cbc_setkey()
959 ad.inv_key = true; in sa_aes_cbc_setkey()
960 ad.ealg_id = SA_EALG_ID_AES_CBC; in sa_aes_cbc_setkey()
961 ad.iv_idx = 4; in sa_aes_cbc_setkey()
962 ad.iv_out_size = 16; in sa_aes_cbc_setkey()
964 return sa_cipher_setkey(tfm, key, keylen, &ad); in sa_aes_cbc_setkey()
970 struct algo_data ad = { 0 }; in sa_aes_ecb_setkey() local
977 ad.mci_enc = mci_ecb_enc_array[key_idx]; in sa_aes_ecb_setkey()
978 ad.mci_dec = mci_ecb_dec_array[key_idx]; in sa_aes_ecb_setkey()
979 ad.inv_key = true; in sa_aes_ecb_setkey()
980 ad.ealg_id = SA_EALG_ID_AES_ECB; in sa_aes_ecb_setkey()
982 return sa_cipher_setkey(tfm, key, keylen, &ad); in sa_aes_ecb_setkey()
988 struct algo_data ad = { 0 }; in sa_3des_cbc_setkey() local
990 ad.mci_enc = mci_cbc_3des_enc_array; in sa_3des_cbc_setkey()
991 ad.mci_dec = mci_cbc_3des_dec_array; in sa_3des_cbc_setkey()
992 ad.ealg_id = SA_EALG_ID_3DES_CBC; in sa_3des_cbc_setkey()
993 ad.iv_idx = 6; in sa_3des_cbc_setkey()
994 ad.iv_out_size = 8; in sa_3des_cbc_setkey()
996 return sa_cipher_setkey(tfm, key, keylen, &ad); in sa_3des_cbc_setkey()
1002 struct algo_data ad = { 0 }; in sa_3des_ecb_setkey() local
1004 ad.mci_enc = mci_ecb_3des_enc_array; in sa_3des_ecb_setkey()
1005 ad.mci_dec = mci_ecb_3des_dec_array; in sa_3des_ecb_setkey()
1007 return sa_cipher_setkey(tfm, key, keylen, &ad); in sa_3des_ecb_setkey()
1452 static int sa_sha_setup(struct sa_tfm_ctx *ctx, struct algo_data *ad) in sa_sha_setup() argument
1458 ad->enc_eng.sc_size = SA_CTX_ENC_TYPE1_SZ; in sa_sha_setup()
1459 ad->auth_eng.eng_id = SA_ENG_ID_AM1; in sa_sha_setup()
1460 ad->auth_eng.sc_size = SA_CTX_AUTH_TYPE2_SZ; in sa_sha_setup()
1464 cfg.aalg = ad->aalg_id; in sa_sha_setup()
1465 cfg.enc_eng_id = ad->enc_eng.eng_id; in sa_sha_setup()
1466 cfg.auth_eng_id = ad->auth_eng.eng_id; in sa_sha_setup()
1474 ad, 0, &ctx->enc.epib[1])) in sa_sha_setup()
1629 struct algo_data ad = { 0 }; in sa_sha1_cra_init() local
1634 ad.aalg_id = SA_AALG_ID_SHA1; in sa_sha1_cra_init()
1635 ad.hash_size = SHA1_DIGEST_SIZE; in sa_sha1_cra_init()
1636 ad.auth_ctrl = SA_AUTH_SW_CTRL_SHA1; in sa_sha1_cra_init()
1638 sa_sha_setup(ctx, &ad); in sa_sha1_cra_init()
1645 struct algo_data ad = { 0 }; in sa_sha256_cra_init() local
1650 ad.aalg_id = SA_AALG_ID_SHA2_256; in sa_sha256_cra_init()
1651 ad.hash_size = SHA256_DIGEST_SIZE; in sa_sha256_cra_init()
1652 ad.auth_ctrl = SA_AUTH_SW_CTRL_SHA256; in sa_sha256_cra_init()
1654 sa_sha_setup(ctx, &ad); in sa_sha256_cra_init()
1661 struct algo_data ad = { 0 }; in sa_sha512_cra_init() local
1666 ad.aalg_id = SA_AALG_ID_SHA2_512; in sa_sha512_cra_init()
1667 ad.hash_size = SHA512_DIGEST_SIZE; in sa_sha512_cra_init()
1668 ad.auth_ctrl = SA_AUTH_SW_CTRL_SHA512; in sa_sha512_cra_init()
1670 sa_sha_setup(ctx, &ad); in sa_sha512_cra_init()
1802 struct algo_data *ad) in sa_aead_setkey() argument
1818 ad->ctx = ctx; in sa_aead_setkey()
1819 ad->enc_eng.eng_id = SA_ENG_ID_EM1; in sa_aead_setkey()
1820 ad->enc_eng.sc_size = SA_CTX_ENC_TYPE1_SZ; in sa_aead_setkey()
1821 ad->auth_eng.eng_id = SA_ENG_ID_AM1; in sa_aead_setkey()
1822 ad->auth_eng.sc_size = SA_CTX_AUTH_TYPE2_SZ; in sa_aead_setkey()
1823 ad->mci_enc = mci_cbc_enc_no_iv_array[key_idx]; in sa_aead_setkey()
1824 ad->mci_dec = mci_cbc_dec_no_iv_array[key_idx]; in sa_aead_setkey()
1825 ad->inv_key = true; in sa_aead_setkey()
1826 ad->keyed_mac = true; in sa_aead_setkey()
1827 ad->ealg_id = SA_EALG_ID_AES_CBC; in sa_aead_setkey()
1828 ad->prep_iopad = sa_prepare_iopads; in sa_aead_setkey()
1832 cfg.aalg = ad->aalg_id; in sa_aead_setkey()
1833 cfg.enc_eng_id = ad->enc_eng.eng_id; in sa_aead_setkey()
1834 cfg.auth_eng_id = ad->auth_eng.eng_id; in sa_aead_setkey()
1842 ad, 1, &ctx->enc.epib[1])) in sa_aead_setkey()
1856 ad, 0, &ctx->dec.epib[1])) in sa_aead_setkey()
1886 struct algo_data ad = { 0 }; in sa_aead_cbc_sha1_setkey() local
1888 ad.ealg_id = SA_EALG_ID_AES_CBC; in sa_aead_cbc_sha1_setkey()
1889 ad.aalg_id = SA_AALG_ID_HMAC_SHA1; in sa_aead_cbc_sha1_setkey()
1890 ad.hash_size = SHA1_DIGEST_SIZE; in sa_aead_cbc_sha1_setkey()
1891 ad.auth_ctrl = SA_AUTH_SW_CTRL_SHA1; in sa_aead_cbc_sha1_setkey()
1893 return sa_aead_setkey(authenc, key, keylen, &ad); in sa_aead_cbc_sha1_setkey()
1899 struct algo_data ad = { 0 }; in sa_aead_cbc_sha256_setkey() local
1901 ad.ealg_id = SA_EALG_ID_AES_CBC; in sa_aead_cbc_sha256_setkey()
1902 ad.aalg_id = SA_AALG_ID_HMAC_SHA2_256; in sa_aead_cbc_sha256_setkey()
1903 ad.hash_size = SHA256_DIGEST_SIZE; in sa_aead_cbc_sha256_setkey()
1904 ad.auth_ctrl = SA_AUTH_SW_CTRL_SHA256; in sa_aead_cbc_sha256_setkey()
1906 return sa_aead_setkey(authenc, key, keylen, &ad); in sa_aead_cbc_sha256_setkey()