Lines Matching refs:sctx
98 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in setkey_fallback_cip() local
101 sctx->fallback.cip->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; in setkey_fallback_cip()
102 sctx->fallback.cip->base.crt_flags |= (tfm->crt_flags & in setkey_fallback_cip()
105 ret = crypto_cipher_setkey(sctx->fallback.cip, in_key, key_len); in setkey_fallback_cip()
108 tfm->crt_flags |= (sctx->fallback.cip->base.crt_flags & in setkey_fallback_cip()
117 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in aes_set_key() local
127 sctx->key_len = key_len; in aes_set_key()
129 memcpy(sctx->key, in_key, key_len); in aes_set_key()
138 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in aes_encrypt() local
140 if (unlikely(need_fallback(sctx->key_len))) { in aes_encrypt()
141 crypto_cipher_encrypt_one(sctx->fallback.cip, out, in); in aes_encrypt()
145 switch (sctx->key_len) { in aes_encrypt()
147 crypt_s390_km(KM_AES_128_ENCRYPT, &sctx->key, out, in, in aes_encrypt()
151 crypt_s390_km(KM_AES_192_ENCRYPT, &sctx->key, out, in, in aes_encrypt()
155 crypt_s390_km(KM_AES_256_ENCRYPT, &sctx->key, out, in, in aes_encrypt()
163 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in aes_decrypt() local
165 if (unlikely(need_fallback(sctx->key_len))) { in aes_decrypt()
166 crypto_cipher_decrypt_one(sctx->fallback.cip, out, in); in aes_decrypt()
170 switch (sctx->key_len) { in aes_decrypt()
172 crypt_s390_km(KM_AES_128_DECRYPT, &sctx->key, out, in, in aes_decrypt()
176 crypt_s390_km(KM_AES_192_DECRYPT, &sctx->key, out, in, in aes_decrypt()
180 crypt_s390_km(KM_AES_256_DECRYPT, &sctx->key, out, in, in aes_decrypt()
189 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in fallback_init_cip() local
191 sctx->fallback.cip = crypto_alloc_cipher(name, 0, in fallback_init_cip()
194 if (IS_ERR(sctx->fallback.cip)) { in fallback_init_cip()
197 return PTR_ERR(sctx->fallback.cip); in fallback_init_cip()
205 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in fallback_exit_cip() local
207 crypto_free_cipher(sctx->fallback.cip); in fallback_exit_cip()
208 sctx->fallback.cip = NULL; in fallback_exit_cip()
236 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in setkey_fallback_blk() local
239 sctx->fallback.blk->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; in setkey_fallback_blk()
240 sctx->fallback.blk->base.crt_flags |= (tfm->crt_flags & in setkey_fallback_blk()
243 ret = crypto_blkcipher_setkey(sctx->fallback.blk, key, len); in setkey_fallback_blk()
246 tfm->crt_flags |= (sctx->fallback.blk->base.crt_flags & in setkey_fallback_blk()
258 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in fallback_blk_dec() local
261 desc->tfm = sctx->fallback.blk; in fallback_blk_dec()
275 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in fallback_blk_enc() local
278 desc->tfm = sctx->fallback.blk; in fallback_blk_enc()
289 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in ecb_aes_set_key() local
294 sctx->key_len = key_len; in ecb_aes_set_key()
300 sctx->enc = KM_AES_128_ENCRYPT; in ecb_aes_set_key()
301 sctx->dec = KM_AES_128_DECRYPT; in ecb_aes_set_key()
304 sctx->enc = KM_AES_192_ENCRYPT; in ecb_aes_set_key()
305 sctx->dec = KM_AES_192_DECRYPT; in ecb_aes_set_key()
308 sctx->enc = KM_AES_256_ENCRYPT; in ecb_aes_set_key()
309 sctx->dec = KM_AES_256_DECRYPT; in ecb_aes_set_key()
343 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in ecb_aes_encrypt() local
346 if (unlikely(need_fallback(sctx->key_len))) in ecb_aes_encrypt()
350 return ecb_aes_crypt(desc, sctx->enc, sctx->key, &walk); in ecb_aes_encrypt()
357 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in ecb_aes_decrypt() local
360 if (unlikely(need_fallback(sctx->key_len))) in ecb_aes_decrypt()
364 return ecb_aes_crypt(desc, sctx->dec, sctx->key, &walk); in ecb_aes_decrypt()
370 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in fallback_init_blk() local
372 sctx->fallback.blk = crypto_alloc_blkcipher(name, 0, in fallback_init_blk()
375 if (IS_ERR(sctx->fallback.blk)) { in fallback_init_blk()
378 return PTR_ERR(sctx->fallback.blk); in fallback_init_blk()
386 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in fallback_exit_blk() local
388 crypto_free_blkcipher(sctx->fallback.blk); in fallback_exit_blk()
389 sctx->fallback.blk = NULL; in fallback_exit_blk()
418 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in cbc_aes_set_key() local
423 sctx->key_len = key_len; in cbc_aes_set_key()
429 sctx->enc = KMC_AES_128_ENCRYPT; in cbc_aes_set_key()
430 sctx->dec = KMC_AES_128_DECRYPT; in cbc_aes_set_key()
433 sctx->enc = KMC_AES_192_ENCRYPT; in cbc_aes_set_key()
434 sctx->dec = KMC_AES_192_DECRYPT; in cbc_aes_set_key()
437 sctx->enc = KMC_AES_256_ENCRYPT; in cbc_aes_set_key()
438 sctx->dec = KMC_AES_256_DECRYPT; in cbc_aes_set_key()
448 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in cbc_aes_crypt() local
460 memcpy(param.key, sctx->key, sctx->key_len); in cbc_aes_crypt()
484 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in cbc_aes_encrypt() local
487 if (unlikely(need_fallback(sctx->key_len))) in cbc_aes_encrypt()
491 return cbc_aes_crypt(desc, sctx->enc, &walk); in cbc_aes_encrypt()
498 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in cbc_aes_decrypt() local
501 if (unlikely(need_fallback(sctx->key_len))) in cbc_aes_decrypt()
505 return cbc_aes_crypt(desc, sctx->dec, &walk); in cbc_aes_decrypt()
744 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in ctr_aes_set_key() local
748 sctx->enc = KMCTR_AES_128_ENCRYPT; in ctr_aes_set_key()
749 sctx->dec = KMCTR_AES_128_DECRYPT; in ctr_aes_set_key()
752 sctx->enc = KMCTR_AES_192_ENCRYPT; in ctr_aes_set_key()
753 sctx->dec = KMCTR_AES_192_DECRYPT; in ctr_aes_set_key()
756 sctx->enc = KMCTR_AES_256_ENCRYPT; in ctr_aes_set_key()
757 sctx->dec = KMCTR_AES_256_DECRYPT; in ctr_aes_set_key()
779 struct s390_aes_ctx *sctx, struct blkcipher_walk *walk) in ctr_aes_crypt() argument
801 ret = crypt_s390_kmctr(func, sctx->key, out, in, in ctr_aes_crypt()
834 ret = crypt_s390_kmctr(func, sctx->key, buf, in, in ctr_aes_crypt()
851 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in ctr_aes_encrypt() local
855 return ctr_aes_crypt(desc, sctx->enc, sctx, &walk); in ctr_aes_encrypt()
862 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in ctr_aes_decrypt() local
866 return ctr_aes_crypt(desc, sctx->dec, sctx, &walk); in ctr_aes_decrypt()