Lines Matching refs:sctx
97 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in setkey_fallback_cip() local
100 sctx->fallback.cip->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; in setkey_fallback_cip()
101 sctx->fallback.cip->base.crt_flags |= (tfm->crt_flags & in setkey_fallback_cip()
104 ret = crypto_cipher_setkey(sctx->fallback.cip, in_key, key_len); in setkey_fallback_cip()
107 tfm->crt_flags |= (sctx->fallback.cip->base.crt_flags & in setkey_fallback_cip()
116 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in aes_set_key() local
126 sctx->key_len = key_len; in aes_set_key()
128 memcpy(sctx->key, in_key, key_len); in aes_set_key()
137 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in aes_encrypt() local
139 if (unlikely(need_fallback(sctx->key_len))) { in aes_encrypt()
140 crypto_cipher_encrypt_one(sctx->fallback.cip, out, in); in aes_encrypt()
144 switch (sctx->key_len) { in aes_encrypt()
146 crypt_s390_km(KM_AES_128_ENCRYPT, &sctx->key, out, in, in aes_encrypt()
150 crypt_s390_km(KM_AES_192_ENCRYPT, &sctx->key, out, in, in aes_encrypt()
154 crypt_s390_km(KM_AES_256_ENCRYPT, &sctx->key, out, in, in aes_encrypt()
162 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in aes_decrypt() local
164 if (unlikely(need_fallback(sctx->key_len))) { in aes_decrypt()
165 crypto_cipher_decrypt_one(sctx->fallback.cip, out, in); in aes_decrypt()
169 switch (sctx->key_len) { in aes_decrypt()
171 crypt_s390_km(KM_AES_128_DECRYPT, &sctx->key, out, in, in aes_decrypt()
175 crypt_s390_km(KM_AES_192_DECRYPT, &sctx->key, out, in, in aes_decrypt()
179 crypt_s390_km(KM_AES_256_DECRYPT, &sctx->key, out, in, in aes_decrypt()
188 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in fallback_init_cip() local
190 sctx->fallback.cip = crypto_alloc_cipher(name, 0, in fallback_init_cip()
193 if (IS_ERR(sctx->fallback.cip)) { in fallback_init_cip()
196 return PTR_ERR(sctx->fallback.cip); in fallback_init_cip()
204 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in fallback_exit_cip() local
206 crypto_free_cipher(sctx->fallback.cip); in fallback_exit_cip()
207 sctx->fallback.cip = NULL; in fallback_exit_cip()
235 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in setkey_fallback_blk() local
238 sctx->fallback.blk->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; in setkey_fallback_blk()
239 sctx->fallback.blk->base.crt_flags |= (tfm->crt_flags & in setkey_fallback_blk()
242 ret = crypto_blkcipher_setkey(sctx->fallback.blk, key, len); in setkey_fallback_blk()
245 tfm->crt_flags |= (sctx->fallback.blk->base.crt_flags & in setkey_fallback_blk()
257 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in fallback_blk_dec() local
260 desc->tfm = sctx->fallback.blk; in fallback_blk_dec()
274 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in fallback_blk_enc() local
277 desc->tfm = sctx->fallback.blk; in fallback_blk_enc()
288 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in ecb_aes_set_key() local
293 sctx->key_len = key_len; in ecb_aes_set_key()
299 sctx->enc = KM_AES_128_ENCRYPT; in ecb_aes_set_key()
300 sctx->dec = KM_AES_128_DECRYPT; in ecb_aes_set_key()
303 sctx->enc = KM_AES_192_ENCRYPT; in ecb_aes_set_key()
304 sctx->dec = KM_AES_192_DECRYPT; in ecb_aes_set_key()
307 sctx->enc = KM_AES_256_ENCRYPT; in ecb_aes_set_key()
308 sctx->dec = KM_AES_256_DECRYPT; in ecb_aes_set_key()
342 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in ecb_aes_encrypt() local
345 if (unlikely(need_fallback(sctx->key_len))) in ecb_aes_encrypt()
349 return ecb_aes_crypt(desc, sctx->enc, sctx->key, &walk); in ecb_aes_encrypt()
356 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in ecb_aes_decrypt() local
359 if (unlikely(need_fallback(sctx->key_len))) in ecb_aes_decrypt()
363 return ecb_aes_crypt(desc, sctx->dec, sctx->key, &walk); in ecb_aes_decrypt()
369 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in fallback_init_blk() local
371 sctx->fallback.blk = crypto_alloc_blkcipher(name, 0, in fallback_init_blk()
374 if (IS_ERR(sctx->fallback.blk)) { in fallback_init_blk()
377 return PTR_ERR(sctx->fallback.blk); in fallback_init_blk()
385 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in fallback_exit_blk() local
387 crypto_free_blkcipher(sctx->fallback.blk); in fallback_exit_blk()
388 sctx->fallback.blk = NULL; in fallback_exit_blk()
417 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in cbc_aes_set_key() local
422 sctx->key_len = key_len; in cbc_aes_set_key()
428 sctx->enc = KMC_AES_128_ENCRYPT; in cbc_aes_set_key()
429 sctx->dec = KMC_AES_128_DECRYPT; in cbc_aes_set_key()
432 sctx->enc = KMC_AES_192_ENCRYPT; in cbc_aes_set_key()
433 sctx->dec = KMC_AES_192_DECRYPT; in cbc_aes_set_key()
436 sctx->enc = KMC_AES_256_ENCRYPT; in cbc_aes_set_key()
437 sctx->dec = KMC_AES_256_DECRYPT; in cbc_aes_set_key()
447 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in cbc_aes_crypt() local
459 memcpy(param.key, sctx->key, sctx->key_len); in cbc_aes_crypt()
483 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in cbc_aes_encrypt() local
486 if (unlikely(need_fallback(sctx->key_len))) in cbc_aes_encrypt()
490 return cbc_aes_crypt(desc, sctx->enc, &walk); in cbc_aes_encrypt()
497 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in cbc_aes_decrypt() local
500 if (unlikely(need_fallback(sctx->key_len))) in cbc_aes_decrypt()
504 return cbc_aes_crypt(desc, sctx->dec, &walk); in cbc_aes_decrypt()
743 struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); in ctr_aes_set_key() local
747 sctx->enc = KMCTR_AES_128_ENCRYPT; in ctr_aes_set_key()
748 sctx->dec = KMCTR_AES_128_DECRYPT; in ctr_aes_set_key()
751 sctx->enc = KMCTR_AES_192_ENCRYPT; in ctr_aes_set_key()
752 sctx->dec = KMCTR_AES_192_DECRYPT; in ctr_aes_set_key()
755 sctx->enc = KMCTR_AES_256_ENCRYPT; in ctr_aes_set_key()
756 sctx->dec = KMCTR_AES_256_DECRYPT; in ctr_aes_set_key()
778 struct s390_aes_ctx *sctx, struct blkcipher_walk *walk) in ctr_aes_crypt() argument
800 ret = crypt_s390_kmctr(func, sctx->key, out, in, in ctr_aes_crypt()
833 ret = crypt_s390_kmctr(func, sctx->key, buf, in, in ctr_aes_crypt()
850 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in ctr_aes_encrypt() local
854 return ctr_aes_crypt(desc, sctx->enc, sctx, &walk); in ctr_aes_encrypt()
861 struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); in ctr_aes_decrypt() local
865 return ctr_aes_crypt(desc, sctx->dec, sctx, &walk); in ctr_aes_decrypt()