Lines Matching refs:ablkctx

106 	return ctx->crypto_ctx->ablkctx;  in ABLK_CTX()
593 static int generate_copy_rrkey(struct ablk_ctx *ablkctx, in generate_copy_rrkey() argument
596 if (ablkctx->ciph_mode == CHCR_SCMD_CIPHER_MODE_AES_CBC) { in generate_copy_rrkey()
597 memcpy(key_ctx->key, ablkctx->rrkey, ablkctx->enckey_len); in generate_copy_rrkey()
600 ablkctx->key + (ablkctx->enckey_len >> 1), in generate_copy_rrkey()
601 ablkctx->enckey_len >> 1); in generate_copy_rrkey()
602 memcpy(key_ctx->key + (ablkctx->enckey_len >> 1), in generate_copy_rrkey()
603 ablkctx->rrkey, ablkctx->enckey_len >> 1); in generate_copy_rrkey()
803 struct ablk_ctx *ablkctx = ABLK_CTX(ctx); in create_cipher_wr() local
823 kctx_len = roundup(ablkctx->enckey_len, 16); in create_cipher_wr()
847 ablkctx->ciph_mode, in create_cipher_wr()
852 chcr_req->key_ctx.ctx_hdr = ablkctx->key_ctx_hdr; in create_cipher_wr()
858 generate_copy_rrkey(ablkctx, &chcr_req->key_ctx); in create_cipher_wr()
860 if ((ablkctx->ciph_mode == CHCR_SCMD_CIPHER_MODE_AES_CBC) || in create_cipher_wr()
861 (ablkctx->ciph_mode == CHCR_SCMD_CIPHER_MODE_AES_CTR)) { in create_cipher_wr()
862 memcpy(chcr_req->key_ctx.key, ablkctx->key, in create_cipher_wr()
863 ablkctx->enckey_len); in create_cipher_wr()
865 memcpy(chcr_req->key_ctx.key, ablkctx->key + in create_cipher_wr()
866 (ablkctx->enckey_len >> 1), in create_cipher_wr()
867 ablkctx->enckey_len >> 1); in create_cipher_wr()
869 (ablkctx->enckey_len >> 1), in create_cipher_wr()
870 ablkctx->key, in create_cipher_wr()
871 ablkctx->enckey_len >> 1); in create_cipher_wr()
884 ablkctx->ciph_mode == CHCR_SCMD_CIPHER_MODE_AES_CBC); in create_cipher_wr()
887 if (reqctx->op && (ablkctx->ciph_mode == in create_cipher_wr()
917 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(cipher)); in chcr_cipher_fallback_setkey() local
919 crypto_skcipher_clear_flags(ablkctx->sw_cipher, in chcr_cipher_fallback_setkey()
921 crypto_skcipher_set_flags(ablkctx->sw_cipher, in chcr_cipher_fallback_setkey()
923 return crypto_skcipher_setkey(ablkctx->sw_cipher, key, keylen); in chcr_cipher_fallback_setkey()
930 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(cipher)); in chcr_aes_cbc_setkey() local
941 memcpy(ablkctx->key, key, keylen); in chcr_aes_cbc_setkey()
942 ablkctx->enckey_len = keylen; in chcr_aes_cbc_setkey()
943 get_aes_decrypt_key(ablkctx->rrkey, ablkctx->key, keylen << 3); in chcr_aes_cbc_setkey()
947 ablkctx->key_ctx_hdr = FILL_KEY_CTX_HDR(ck_size, CHCR_KEYCTX_NO_KEY, in chcr_aes_cbc_setkey()
949 ablkctx->ciph_mode = CHCR_SCMD_CIPHER_MODE_AES_CBC; in chcr_aes_cbc_setkey()
952 ablkctx->enckey_len = 0; in chcr_aes_cbc_setkey()
961 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(cipher)); in chcr_aes_ctr_setkey() local
971 memcpy(ablkctx->key, key, keylen); in chcr_aes_ctr_setkey()
972 ablkctx->enckey_len = keylen; in chcr_aes_ctr_setkey()
976 ablkctx->key_ctx_hdr = FILL_KEY_CTX_HDR(ck_size, CHCR_KEYCTX_NO_KEY, in chcr_aes_ctr_setkey()
978 ablkctx->ciph_mode = CHCR_SCMD_CIPHER_MODE_AES_CTR; in chcr_aes_ctr_setkey()
982 ablkctx->enckey_len = 0; in chcr_aes_ctr_setkey()
991 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(cipher)); in chcr_aes_rfc3686_setkey() local
998 memcpy(ablkctx->nonce, key + (keylen - CTR_RFC3686_NONCE_SIZE), in chcr_aes_rfc3686_setkey()
1008 memcpy(ablkctx->key, key, keylen); in chcr_aes_rfc3686_setkey()
1009 ablkctx->enckey_len = keylen; in chcr_aes_rfc3686_setkey()
1013 ablkctx->key_ctx_hdr = FILL_KEY_CTX_HDR(ck_size, CHCR_KEYCTX_NO_KEY, in chcr_aes_rfc3686_setkey()
1015 ablkctx->ciph_mode = CHCR_SCMD_CIPHER_MODE_AES_CTR; in chcr_aes_rfc3686_setkey()
1019 ablkctx->enckey_len = 0; in chcr_aes_rfc3686_setkey()
1058 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(tfm)); in chcr_update_tweak() local
1069 keylen = ablkctx->enckey_len / 2; in chcr_update_tweak()
1070 key = ablkctx->key + keylen; in chcr_update_tweak()
1074 if (KEY_CONTEXT_CK_SIZE_G(ntohl(ablkctx->key_ctx_hdr)) in chcr_update_tweak()
1162 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(tfm)); in chcr_handle_cipher_resp() local
1182 CIP_SPACE_LEFT(ablkctx->enckey_len), in chcr_handle_cipher_resp()
1201 err = chcr_cipher_fallback(ablkctx->sw_cipher, req, req->iv, in chcr_handle_cipher_resp()
1250 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(tfm)); in process_cipher() local
1261 if ((ablkctx->enckey_len == 0) || (ivsize > AES_BLOCK_SIZE) || in process_cipher()
1270 ablkctx->enckey_len, req->cryptlen, ivsize); in process_cipher()
1288 kctx_len = roundup(ablkctx->enckey_len, 16); in process_cipher()
1300 CIP_SPACE_LEFT(ablkctx->enckey_len), in process_cipher()
1313 memcpy(reqctx->iv, ablkctx->nonce, CTR_RFC3686_NONCE_SIZE); in process_cipher()
1331 err = chcr_cipher_fallback(ablkctx->sw_cipher, req, in process_cipher()
1470 struct ablk_ctx *ablkctx = ABLK_CTX(ctx); in chcr_init_tfm() local
1472 ablkctx->sw_cipher = crypto_alloc_skcipher(alg->base.cra_name, 0, in chcr_init_tfm()
1474 if (IS_ERR(ablkctx->sw_cipher)) { in chcr_init_tfm()
1476 return PTR_ERR(ablkctx->sw_cipher); in chcr_init_tfm()
1480 crypto_skcipher_reqsize(ablkctx->sw_cipher)); in chcr_init_tfm()
1489 struct ablk_ctx *ablkctx = ABLK_CTX(ctx); in chcr_rfc3686_init() local
1494 ablkctx->sw_cipher = crypto_alloc_skcipher("ctr(aes)", 0, in chcr_rfc3686_init()
1496 if (IS_ERR(ablkctx->sw_cipher)) { in chcr_rfc3686_init()
1498 return PTR_ERR(ablkctx->sw_cipher); in chcr_rfc3686_init()
1501 crypto_skcipher_reqsize(ablkctx->sw_cipher)); in chcr_rfc3686_init()
1509 struct ablk_ctx *ablkctx = ABLK_CTX(ctx); in chcr_exit_tfm() local
1511 crypto_free_skcipher(ablkctx->sw_cipher); in chcr_exit_tfm()
2249 struct ablk_ctx *ablkctx = ABLK_CTX(c_ctx(cipher)); in chcr_aes_xts_setkey() local
2257 memcpy(ablkctx->key, key, key_len); in chcr_aes_xts_setkey()
2258 ablkctx->enckey_len = key_len; in chcr_aes_xts_setkey()
2259 get_aes_decrypt_key(ablkctx->rrkey, ablkctx->key, key_len << 2); in chcr_aes_xts_setkey()
2267 memmove(ablkctx->key + 32, ablkctx->key + 24, 24); in chcr_aes_xts_setkey()
2268 memset(ablkctx->key + 24, 0, 8); in chcr_aes_xts_setkey()
2269 memset(ablkctx->key + 56, 0, 8); in chcr_aes_xts_setkey()
2270 ablkctx->enckey_len = 64; in chcr_aes_xts_setkey()
2271 ablkctx->key_ctx_hdr = in chcr_aes_xts_setkey()
2276 ablkctx->key_ctx_hdr = in chcr_aes_xts_setkey()
2283 ablkctx->ciph_mode = CHCR_SCMD_CIPHER_MODE_AES_XTS; in chcr_aes_xts_setkey()
2286 ablkctx->enckey_len = 0; in chcr_aes_xts_setkey()