Lines Matching refs:ablkctx

105 	return ctx->crypto_ctx->ablkctx;  in ABLK_CTX()
597 static int generate_copy_rrkey(struct ablk_ctx *ablkctx, in generate_copy_rrkey() argument
600 if (ablkctx->ciph_mode == CHCR_SCMD_CIPHER_MODE_AES_CBC) { in generate_copy_rrkey()
601 memcpy(key_ctx->key, ablkctx->rrkey, ablkctx->enckey_len); in generate_copy_rrkey()
604 ablkctx->key + (ablkctx->enckey_len >> 1), in generate_copy_rrkey()
605 ablkctx->enckey_len >> 1); in generate_copy_rrkey()
606 memcpy(key_ctx->key + (ablkctx->enckey_len >> 1), in generate_copy_rrkey()
607 ablkctx->rrkey, ablkctx->enckey_len >> 1); in generate_copy_rrkey()
810 struct ablk_ctx *ablkctx = ABLK_CTX(ctx); in create_cipher_wr() local
830 kctx_len = roundup(ablkctx->enckey_len, 16); in create_cipher_wr()
854 ablkctx->ciph_mode, in create_cipher_wr()
859 chcr_req->key_ctx.ctx_hdr = ablkctx->key_ctx_hdr; in create_cipher_wr()
865 generate_copy_rrkey(ablkctx, &chcr_req->key_ctx); in create_cipher_wr()
867 if ((ablkctx->ciph_mode == CHCR_SCMD_CIPHER_MODE_AES_CBC) || in create_cipher_wr()
868 (ablkctx->ciph_mode == CHCR_SCMD_CIPHER_MODE_AES_CTR)) { in create_cipher_wr()
869 memcpy(chcr_req->key_ctx.key, ablkctx->key, in create_cipher_wr()
870 ablkctx->enckey_len); in create_cipher_wr()
872 memcpy(chcr_req->key_ctx.key, ablkctx->key + in create_cipher_wr()
873 (ablkctx->enckey_len >> 1), in create_cipher_wr()
874 ablkctx->enckey_len >> 1); in create_cipher_wr()
876 (ablkctx->enckey_len >> 1), in create_cipher_wr()
877 ablkctx->key, in create_cipher_wr()
878 ablkctx->enckey_len >> 1); in create_cipher_wr()
891 ablkctx->ciph_mode == CHCR_SCMD_CIPHER_MODE_AES_CBC); in create_cipher_wr()
894 if (reqctx->op && (ablkctx->ciph_mode == in create_cipher_wr()
924 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(cipher)); in chcr_cipher_fallback_setkey() local
926 crypto_skcipher_clear_flags(ablkctx->sw_cipher, in chcr_cipher_fallback_setkey()
928 crypto_skcipher_set_flags(ablkctx->sw_cipher, in chcr_cipher_fallback_setkey()
930 return crypto_skcipher_setkey(ablkctx->sw_cipher, key, keylen); in chcr_cipher_fallback_setkey()
937 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(cipher)); in chcr_aes_cbc_setkey() local
948 memcpy(ablkctx->key, key, keylen); in chcr_aes_cbc_setkey()
949 ablkctx->enckey_len = keylen; in chcr_aes_cbc_setkey()
950 get_aes_decrypt_key(ablkctx->rrkey, ablkctx->key, keylen << 3); in chcr_aes_cbc_setkey()
954 ablkctx->key_ctx_hdr = FILL_KEY_CTX_HDR(ck_size, CHCR_KEYCTX_NO_KEY, in chcr_aes_cbc_setkey()
956 ablkctx->ciph_mode = CHCR_SCMD_CIPHER_MODE_AES_CBC; in chcr_aes_cbc_setkey()
959 ablkctx->enckey_len = 0; in chcr_aes_cbc_setkey()
968 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(cipher)); in chcr_aes_ctr_setkey() local
978 memcpy(ablkctx->key, key, keylen); in chcr_aes_ctr_setkey()
979 ablkctx->enckey_len = keylen; in chcr_aes_ctr_setkey()
983 ablkctx->key_ctx_hdr = FILL_KEY_CTX_HDR(ck_size, CHCR_KEYCTX_NO_KEY, in chcr_aes_ctr_setkey()
985 ablkctx->ciph_mode = CHCR_SCMD_CIPHER_MODE_AES_CTR; in chcr_aes_ctr_setkey()
989 ablkctx->enckey_len = 0; in chcr_aes_ctr_setkey()
998 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(cipher)); in chcr_aes_rfc3686_setkey() local
1005 memcpy(ablkctx->nonce, key + (keylen - CTR_RFC3686_NONCE_SIZE), in chcr_aes_rfc3686_setkey()
1015 memcpy(ablkctx->key, key, keylen); in chcr_aes_rfc3686_setkey()
1016 ablkctx->enckey_len = keylen; in chcr_aes_rfc3686_setkey()
1020 ablkctx->key_ctx_hdr = FILL_KEY_CTX_HDR(ck_size, CHCR_KEYCTX_NO_KEY, in chcr_aes_rfc3686_setkey()
1022 ablkctx->ciph_mode = CHCR_SCMD_CIPHER_MODE_AES_CTR; in chcr_aes_rfc3686_setkey()
1026 ablkctx->enckey_len = 0; in chcr_aes_rfc3686_setkey()
1065 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(tfm)); in chcr_update_tweak() local
1076 keylen = ablkctx->enckey_len / 2; in chcr_update_tweak()
1077 key = ablkctx->key + keylen; in chcr_update_tweak()
1081 if (KEY_CONTEXT_CK_SIZE_G(ntohl(ablkctx->key_ctx_hdr)) in chcr_update_tweak()
1169 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(tfm)); in chcr_handle_cipher_resp() local
1189 CIP_SPACE_LEFT(ablkctx->enckey_len), in chcr_handle_cipher_resp()
1208 err = chcr_cipher_fallback(ablkctx->sw_cipher, req, req->iv, in chcr_handle_cipher_resp()
1257 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(tfm)); in process_cipher() local
1268 if ((ablkctx->enckey_len == 0) || (ivsize > AES_BLOCK_SIZE) || in process_cipher()
1277 ablkctx->enckey_len, req->cryptlen, ivsize); in process_cipher()
1295 kctx_len = roundup(ablkctx->enckey_len, 16); in process_cipher()
1307 CIP_SPACE_LEFT(ablkctx->enckey_len), in process_cipher()
1320 memcpy(reqctx->iv, ablkctx->nonce, CTR_RFC3686_NONCE_SIZE); in process_cipher()
1338 err = chcr_cipher_fallback(ablkctx->sw_cipher, req, in process_cipher()
1477 struct ablk_ctx *ablkctx = ABLK_CTX(ctx); in chcr_init_tfm() local
1479 ablkctx->sw_cipher = crypto_alloc_skcipher(alg->base.cra_name, 0, in chcr_init_tfm()
1481 if (IS_ERR(ablkctx->sw_cipher)) { in chcr_init_tfm()
1483 return PTR_ERR(ablkctx->sw_cipher); in chcr_init_tfm()
1487 crypto_skcipher_reqsize(ablkctx->sw_cipher)); in chcr_init_tfm()
1496 struct ablk_ctx *ablkctx = ABLK_CTX(ctx); in chcr_rfc3686_init() local
1501 ablkctx->sw_cipher = crypto_alloc_skcipher("ctr(aes)", 0, in chcr_rfc3686_init()
1503 if (IS_ERR(ablkctx->sw_cipher)) { in chcr_rfc3686_init()
1505 return PTR_ERR(ablkctx->sw_cipher); in chcr_rfc3686_init()
1508 crypto_skcipher_reqsize(ablkctx->sw_cipher)); in chcr_rfc3686_init()
1516 struct ablk_ctx *ablkctx = ABLK_CTX(ctx); in chcr_exit_tfm() local
1518 crypto_free_skcipher(ablkctx->sw_cipher); in chcr_exit_tfm()
2255 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(cipher)); in chcr_aes_xts_setkey() local
2263 memcpy(ablkctx->key, key, key_len); in chcr_aes_xts_setkey()
2264 ablkctx->enckey_len = key_len; in chcr_aes_xts_setkey()
2265 get_aes_decrypt_key(ablkctx->rrkey, ablkctx->key, key_len << 2); in chcr_aes_xts_setkey()
2273 memmove(ablkctx->key + 32, ablkctx->key + 24, 24); in chcr_aes_xts_setkey()
2274 memset(ablkctx->key + 24, 0, 8); in chcr_aes_xts_setkey()
2275 memset(ablkctx->key + 56, 0, 8); in chcr_aes_xts_setkey()
2276 ablkctx->enckey_len = 64; in chcr_aes_xts_setkey()
2277 ablkctx->key_ctx_hdr = in chcr_aes_xts_setkey()
2282 ablkctx->key_ctx_hdr = in chcr_aes_xts_setkey()
2289 ablkctx->ciph_mode = CHCR_SCMD_CIPHER_MODE_AES_XTS; in chcr_aes_xts_setkey()
2292 ablkctx->enckey_len = 0; in chcr_aes_xts_setkey()