Lines Matching refs:cipher

37 #include "cipher.h"
71 MODULE_PARM_DESC(cipher_pri, "Priority for cipher algos");
154 if ((ctx->cipher.mode == CIPHER_MODE_XTS) &&
219 if ((ctx->cipher.mode == CIPHER_MODE_XTS) &&
282 * handle_skcipher_req() - Submit as much of a block cipher request as fits in
324 cipher_parms.alg = ctx->cipher.alg;
325 cipher_parms.mode = ctx->cipher.mode;
350 if ((ctx->cipher.mode == CIPHER_MODE_CBC) &&
366 if ((ctx->cipher.mode == CIPHER_MODE_CBC) &&
375 } else if (ctx->cipher.mode == CIPHER_MODE_CTR) {
383 * any other cipher alg.
435 if ((ctx->cipher.mode == CIPHER_MODE_XTS) &&
449 if ((ctx->cipher.mode == CIPHER_MODE_XTS) &&
466 * handle_skcipher_resp() - Process a block cipher SPU response. Updates the
485 if ((ctx->cipher.mode == CIPHER_MODE_XTS) &&
501 &iproc_priv.cipher_cnt[ctx->cipher.alg][ctx->cipher.mode]);
833 data_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode, chunksize);
1058 data_padlen = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1062 data_padlen = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1064 assoc_buf_len = spu->spu_assoc_resp_len(ctx->cipher.mode,
1069 if (ctx->cipher.mode == CIPHER_MODE_CCM)
1300 cipher_parms.alg = ctx->cipher.alg;
1301 cipher_parms.mode = ctx->cipher.mode;
1353 if (spu->spu_assoc_resp_len(ctx->cipher.mode,
1359 aead_parms.iv_len = spu->spu_aead_ivlen(ctx->cipher.mode,
1366 aead_parms.aad_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1370 aead_parms.data_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1373 if (ctx->cipher.mode == CIPHER_MODE_CCM) {
1379 ctx->cipher.mode,
1388 spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1405 ctx->cipher.mode,
1410 ctx->cipher.mode,
1416 if (spu_req_incl_icv(ctx->cipher.mode, rctx->is_encrypt)) {
1482 if (((ctx->cipher.mode == CIPHER_MODE_GCM) ||
1483 (ctx->cipher.mode == CIPHER_MODE_CCM)) && !rctx->is_encrypt) {
1569 if (ctx->cipher.alg == CIPHER_ALG_AES) {
1570 if (ctx->cipher.mode == CIPHER_MODE_CCM)
1572 else if (ctx->cipher.mode == CIPHER_MODE_GCM)
1740 if (ctx->cipher.mode == CIPHER_MODE_CBC ||
1741 ctx->cipher.mode == CIPHER_MODE_CTR ||
1742 ctx->cipher.mode == CIPHER_MODE_OFB ||
1743 ctx->cipher.mode == CIPHER_MODE_XTS ||
1744 ctx->cipher.mode == CIPHER_MODE_GCM ||
1745 ctx->cipher.mode == CIPHER_MODE_CCM) {
1763 static int des_setkey(struct crypto_skcipher *cipher, const u8 *key,
1766 struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
1769 err = verify_skcipher_des_key(cipher, key);
1777 static int threedes_setkey(struct crypto_skcipher *cipher, const u8 *key,
1780 struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
1783 err = verify_skcipher_des3_key(cipher, key);
1791 static int aes_setkey(struct crypto_skcipher *cipher, const u8 *key,
1794 struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
1796 if (ctx->cipher.mode == CIPHER_MODE_XTS)
1818 static int skcipher_setkey(struct crypto_skcipher *cipher, const u8 *key,
1822 struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
1830 switch (ctx->cipher.alg) {
1832 err = des_setkey(cipher, key, keylen);
1835 err = threedes_setkey(cipher, key, keylen);
1838 err = aes_setkey(cipher, key, keylen);
1841 pr_err("%s() Error: unknown cipher alg\n", __func__);
1851 if ((ctx->cipher.alg == CIPHER_ALG_AES) &&
1852 (ctx->cipher.mode == CIPHER_MODE_XTS)) {
1865 cipher_parms.iv_len = crypto_skcipher_ivsize(cipher);
1868 cipher_parms.alg = ctx->cipher.alg;
1869 cipher_parms.mode = ctx->cipher.mode;
2516 if (((ctx->cipher.mode == CIPHER_MODE_GCM) ||
2517 (ctx->cipher.mode == CIPHER_MODE_CCM)) &&
2527 if ((ctx->cipher.mode == CIPHER_MODE_CCM) &&
2540 if ((ctx->cipher.mode == CIPHER_MODE_CCM) &&
2552 if (ctx->cipher.mode == CIPHER_MODE_GCM &&
2553 ctx->cipher.alg == CIPHER_ALG_AES &&
2661 if (ctx->cipher.mode == CIPHER_MODE_CBC ||
2662 ctx->cipher.mode == CIPHER_MODE_CTR ||
2663 ctx->cipher.mode == CIPHER_MODE_OFB ||
2664 ctx->cipher.mode == CIPHER_MODE_XTS ||
2665 ctx->cipher.mode == CIPHER_MODE_GCM) {
2669 } else if (ctx->cipher.mode == CIPHER_MODE_CCM) {
2719 static int aead_authenc_setkey(struct crypto_aead *cipher,
2723 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2724 struct crypto_tfm *tfm = crypto_aead_tfm(cipher);
2728 flow_log("%s() aead:%p key:%p keylen:%u\n", __func__, cipher, key,
2750 if (verify_aead_des_key(cipher, keys.enckey, keys.enckeylen))
2756 if (verify_aead_des3_key(cipher, keys.enckey, keys.enckeylen))
2777 pr_err("%s() Error: Unknown cipher alg\n", __func__);
2814 static int aead_gcm_ccm_setkey(struct crypto_aead *cipher,
2818 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2819 struct crypto_tfm *tfm = crypto_aead_tfm(cipher);
2887 * @cipher: AEAD structure
2896 static int aead_gcm_esp_setkey(struct crypto_aead *cipher,
2899 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2914 return aead_gcm_ccm_setkey(cipher, key, keylen);
2919 * @cipher: AEAD structure
2928 static int rfc4543_gcm_esp_setkey(struct crypto_aead *cipher,
2931 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2947 return aead_gcm_ccm_setkey(cipher, key, keylen);
2952 * @cipher: AEAD structure
2961 static int aead_ccm_esp_setkey(struct crypto_aead *cipher,
2964 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2978 return aead_gcm_ccm_setkey(cipher, key, keylen);
2981 static int aead_setauthsize(struct crypto_aead *cipher, unsigned int authsize)
2983 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
4097 ctx->cipher = cipher_alg->cipher_info;
4100 ctx->max_payload = spu->spu_ctx_max_payload(ctx->cipher.alg,
4101 ctx->cipher.mode,
4178 flow_log("%s() creating fallback cipher\n", __func__);
4677 dev_dbg(dev, " unregistered cipher %s\n",