Lines Matching refs:cipher
154 if ((ctx->cipher.mode == CIPHER_MODE_XTS) && in spu_ablkcipher_rx_sg_create()
168 if (ctx->cipher.alg == CIPHER_ALG_RC4) in spu_ablkcipher_rx_sg_create()
223 if ((ctx->cipher.mode == CIPHER_MODE_XTS) && in spu_ablkcipher_tx_sg_create()
329 cipher_parms.alg = ctx->cipher.alg; in handle_ablkcipher_req()
330 cipher_parms.mode = ctx->cipher.mode; in handle_ablkcipher_req()
355 if ((ctx->cipher.mode == CIPHER_MODE_CBC) && in handle_ablkcipher_req()
371 if ((ctx->cipher.mode == CIPHER_MODE_CBC) && in handle_ablkcipher_req()
380 } else if (ctx->cipher.mode == CIPHER_MODE_CTR) { in handle_ablkcipher_req()
394 if (ctx->cipher.alg == CIPHER_ALG_RC4) { in handle_ablkcipher_req()
467 if ((ctx->cipher.mode == CIPHER_MODE_XTS) && in handle_ablkcipher_req()
481 if ((ctx->cipher.mode == CIPHER_MODE_XTS) && in handle_ablkcipher_req()
519 if ((ctx->cipher.mode == CIPHER_MODE_XTS) && in handle_ablkcipher_resp()
530 if (ctx->cipher.alg == CIPHER_ALG_RC4) in handle_ablkcipher_resp()
538 &iproc_priv.cipher_cnt[ctx->cipher.alg][ctx->cipher.mode]); in handle_ablkcipher_resp()
870 data_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode, chunksize); in handle_ahash_req()
1096 data_padlen = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode, in spu_aead_rx_sg_create()
1100 data_padlen = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode, in spu_aead_rx_sg_create()
1102 assoc_buf_len = spu->spu_assoc_resp_len(ctx->cipher.mode, in spu_aead_rx_sg_create()
1107 if (ctx->cipher.mode == CIPHER_MODE_CCM) in spu_aead_rx_sg_create()
1338 cipher_parms.alg = ctx->cipher.alg; in handle_aead_req()
1339 cipher_parms.mode = ctx->cipher.mode; in handle_aead_req()
1391 if (spu->spu_assoc_resp_len(ctx->cipher.mode, in handle_aead_req()
1397 aead_parms.iv_len = spu->spu_aead_ivlen(ctx->cipher.mode, in handle_aead_req()
1404 aead_parms.aad_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode, in handle_aead_req()
1408 aead_parms.data_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode, in handle_aead_req()
1411 if (ctx->cipher.mode == CIPHER_MODE_CCM) { in handle_aead_req()
1417 ctx->cipher.mode, in handle_aead_req()
1426 spu->spu_gcm_ccm_pad_len(ctx->cipher.mode, in handle_aead_req()
1443 ctx->cipher.mode, in handle_aead_req()
1448 ctx->cipher.mode, in handle_aead_req()
1454 if (spu_req_incl_icv(ctx->cipher.mode, rctx->is_encrypt)) { in handle_aead_req()
1520 if (((ctx->cipher.mode == CIPHER_MODE_GCM) || in handle_aead_req()
1521 (ctx->cipher.mode == CIPHER_MODE_CCM)) && !rctx->is_encrypt) { in handle_aead_req()
1607 if (ctx->cipher.alg == CIPHER_ALG_AES) { in handle_aead_resp()
1608 if (ctx->cipher.mode == CIPHER_MODE_CCM) in handle_aead_resp()
1610 else if (ctx->cipher.mode == CIPHER_MODE_GCM) in handle_aead_resp()
1778 if (ctx->cipher.mode == CIPHER_MODE_CBC || in ablkcipher_enqueue()
1779 ctx->cipher.mode == CIPHER_MODE_CTR || in ablkcipher_enqueue()
1780 ctx->cipher.mode == CIPHER_MODE_OFB || in ablkcipher_enqueue()
1781 ctx->cipher.mode == CIPHER_MODE_XTS || in ablkcipher_enqueue()
1782 ctx->cipher.mode == CIPHER_MODE_GCM || in ablkcipher_enqueue()
1783 ctx->cipher.mode == CIPHER_MODE_CCM) { in ablkcipher_enqueue()
1801 static int des_setkey(struct crypto_ablkcipher *cipher, const u8 *key, in des_setkey() argument
1804 struct iproc_ctx_s *ctx = crypto_ablkcipher_ctx(cipher); in des_setkey()
1807 err = verify_ablkcipher_des_key(cipher, key); in des_setkey()
1815 static int threedes_setkey(struct crypto_ablkcipher *cipher, const u8 *key, in threedes_setkey() argument
1818 struct iproc_ctx_s *ctx = crypto_ablkcipher_ctx(cipher); in threedes_setkey()
1821 err = verify_ablkcipher_des3_key(cipher, key); in threedes_setkey()
1829 static int aes_setkey(struct crypto_ablkcipher *cipher, const u8 *key, in aes_setkey() argument
1832 struct iproc_ctx_s *ctx = crypto_ablkcipher_ctx(cipher); in aes_setkey()
1834 if (ctx->cipher.mode == CIPHER_MODE_XTS) in aes_setkey()
1849 crypto_ablkcipher_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN); in aes_setkey()
1857 static int rc4_setkey(struct crypto_ablkcipher *cipher, const u8 *key, in rc4_setkey() argument
1860 struct iproc_ctx_s *ctx = crypto_ablkcipher_ctx(cipher); in rc4_setkey()
1877 static int ablkcipher_setkey(struct crypto_ablkcipher *cipher, const u8 *key, in ablkcipher_setkey() argument
1881 struct iproc_ctx_s *ctx = crypto_ablkcipher_ctx(cipher); in ablkcipher_setkey()
1889 switch (ctx->cipher.alg) { in ablkcipher_setkey()
1891 err = des_setkey(cipher, key, keylen); in ablkcipher_setkey()
1894 err = threedes_setkey(cipher, key, keylen); in ablkcipher_setkey()
1897 err = aes_setkey(cipher, key, keylen); in ablkcipher_setkey()
1900 err = rc4_setkey(cipher, key, keylen); in ablkcipher_setkey()
1910 if (ctx->cipher.alg != CIPHER_ALG_RC4) { in ablkcipher_setkey()
1915 if ((ctx->cipher.alg == CIPHER_ALG_AES) && in ablkcipher_setkey()
1916 (ctx->cipher.mode == CIPHER_MODE_XTS)) { in ablkcipher_setkey()
1929 cipher_parms.iv_len = crypto_ablkcipher_ivsize(cipher); in ablkcipher_setkey()
1932 cipher_parms.alg = ctx->cipher.alg; in ablkcipher_setkey()
1933 cipher_parms.mode = ctx->cipher.mode; in ablkcipher_setkey()
2579 if (((ctx->cipher.mode == CIPHER_MODE_GCM) || in aead_need_fallback()
2580 (ctx->cipher.mode == CIPHER_MODE_CCM)) && in aead_need_fallback()
2590 if ((ctx->cipher.mode == CIPHER_MODE_CCM) && in aead_need_fallback()
2603 if ((ctx->cipher.mode == CIPHER_MODE_CCM) && in aead_need_fallback()
2615 if (ctx->cipher.mode == CIPHER_MODE_GCM && in aead_need_fallback()
2616 ctx->cipher.alg == CIPHER_ALG_AES && in aead_need_fallback()
2761 if (ctx->cipher.mode == CIPHER_MODE_CBC || in aead_enqueue()
2762 ctx->cipher.mode == CIPHER_MODE_CTR || in aead_enqueue()
2763 ctx->cipher.mode == CIPHER_MODE_OFB || in aead_enqueue()
2764 ctx->cipher.mode == CIPHER_MODE_XTS || in aead_enqueue()
2765 ctx->cipher.mode == CIPHER_MODE_GCM) { in aead_enqueue()
2769 } else if (ctx->cipher.mode == CIPHER_MODE_CCM) { in aead_enqueue()
2819 static int aead_authenc_setkey(struct crypto_aead *cipher, in aead_authenc_setkey() argument
2823 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher); in aead_authenc_setkey()
2824 struct crypto_tfm *tfm = crypto_aead_tfm(cipher); in aead_authenc_setkey()
2828 flow_log("%s() aead:%p key:%p keylen:%u\n", __func__, cipher, key, in aead_authenc_setkey()
2850 if (verify_aead_des_key(cipher, keys.enckey, keys.enckeylen)) in aead_authenc_setkey()
2856 if (verify_aead_des3_key(cipher, keys.enckey, keys.enckeylen)) in aead_authenc_setkey()
2919 crypto_aead_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN); in aead_authenc_setkey()
2923 static int aead_gcm_ccm_setkey(struct crypto_aead *cipher, in aead_gcm_ccm_setkey() argument
2927 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher); in aead_gcm_ccm_setkey()
2928 struct crypto_tfm *tfm = crypto_aead_tfm(cipher); in aead_gcm_ccm_setkey()
2995 crypto_aead_set_flags(cipher, CRYPTO_TFM_RES_BAD_KEY_LEN); in aead_gcm_ccm_setkey()
3010 static int aead_gcm_esp_setkey(struct crypto_aead *cipher, in aead_gcm_esp_setkey() argument
3013 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher); in aead_gcm_esp_setkey()
3024 return aead_gcm_ccm_setkey(cipher, key, keylen); in aead_gcm_esp_setkey()
3038 static int rfc4543_gcm_esp_setkey(struct crypto_aead *cipher, in rfc4543_gcm_esp_setkey() argument
3041 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher); in rfc4543_gcm_esp_setkey()
3053 return aead_gcm_ccm_setkey(cipher, key, keylen); in rfc4543_gcm_esp_setkey()
3067 static int aead_ccm_esp_setkey(struct crypto_aead *cipher, in aead_ccm_esp_setkey() argument
3070 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher); in aead_ccm_esp_setkey()
3080 return aead_gcm_ccm_setkey(cipher, key, keylen); in aead_ccm_esp_setkey()
3083 static int aead_setauthsize(struct crypto_aead *cipher, unsigned int authsize) in aead_setauthsize() argument
3085 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher); in aead_setauthsize()
4268 ctx->cipher = cipher_alg->cipher_info; in generic_cra_init()
4271 ctx->max_payload = spu->spu_ctx_max_payload(ctx->cipher.alg, in generic_cra_init()
4272 ctx->cipher.mode, in generic_cra_init()