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
487 if ((ctx->cipher.mode == CIPHER_MODE_XTS) &&
503 &iproc_priv.cipher_cnt[ctx->cipher.alg][ctx->cipher.mode]);
835 data_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode, chunksize);
1061 data_padlen = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1065 data_padlen = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1067 assoc_buf_len = spu->spu_assoc_resp_len(ctx->cipher.mode,
1072 if (ctx->cipher.mode == CIPHER_MODE_CCM)
1303 cipher_parms.alg = ctx->cipher.alg;
1304 cipher_parms.mode = ctx->cipher.mode;
1356 if (spu->spu_assoc_resp_len(ctx->cipher.mode,
1362 aead_parms.iv_len = spu->spu_aead_ivlen(ctx->cipher.mode,
1369 aead_parms.aad_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1373 aead_parms.data_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1376 if (ctx->cipher.mode == CIPHER_MODE_CCM) {
1382 ctx->cipher.mode,
1391 spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1408 ctx->cipher.mode,
1413 ctx->cipher.mode,
1419 if (spu_req_incl_icv(ctx->cipher.mode, rctx->is_encrypt)) {
1485 if (((ctx->cipher.mode == CIPHER_MODE_GCM) ||
1486 (ctx->cipher.mode == CIPHER_MODE_CCM)) && !rctx->is_encrypt) {
1572 if (ctx->cipher.alg == CIPHER_ALG_AES) {
1573 if (ctx->cipher.mode == CIPHER_MODE_CCM)
1575 else if (ctx->cipher.mode == CIPHER_MODE_GCM)
1743 if (ctx->cipher.mode == CIPHER_MODE_CBC ||
1744 ctx->cipher.mode == CIPHER_MODE_CTR ||
1745 ctx->cipher.mode == CIPHER_MODE_OFB ||
1746 ctx->cipher.mode == CIPHER_MODE_XTS ||
1747 ctx->cipher.mode == CIPHER_MODE_GCM ||
1748 ctx->cipher.mode == CIPHER_MODE_CCM) {
1766 static int des_setkey(struct crypto_skcipher *cipher, const u8 *key,
1769 struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
1772 err = verify_skcipher_des_key(cipher, key);
1780 static int threedes_setkey(struct crypto_skcipher *cipher, const u8 *key,
1783 struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
1786 err = verify_skcipher_des3_key(cipher, key);
1794 static int aes_setkey(struct crypto_skcipher *cipher, const u8 *key,
1797 struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
1799 if (ctx->cipher.mode == CIPHER_MODE_XTS)
1821 static int skcipher_setkey(struct crypto_skcipher *cipher, const u8 *key,
1825 struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
1833 switch (ctx->cipher.alg) {
1835 err = des_setkey(cipher, key, keylen);
1838 err = threedes_setkey(cipher, key, keylen);
1841 err = aes_setkey(cipher, key, keylen);
1844 pr_err("%s() Error: unknown cipher alg\n", __func__);
1854 if ((ctx->cipher.alg == CIPHER_ALG_AES) &&
1855 (ctx->cipher.mode == CIPHER_MODE_XTS)) {
1868 cipher_parms.iv_len = crypto_skcipher_ivsize(cipher);
1871 cipher_parms.alg = ctx->cipher.alg;
1872 cipher_parms.mode = ctx->cipher.mode;
2518 if (((ctx->cipher.mode == CIPHER_MODE_GCM) ||
2519 (ctx->cipher.mode == CIPHER_MODE_CCM)) &&
2529 if ((ctx->cipher.mode == CIPHER_MODE_CCM) &&
2542 if ((ctx->cipher.mode == CIPHER_MODE_CCM) &&
2554 if (ctx->cipher.mode == CIPHER_MODE_GCM &&
2555 ctx->cipher.alg == CIPHER_ALG_AES &&
2604 /* Store the cipher tfm and then use the fallback tfm */
2700 if (ctx->cipher.mode == CIPHER_MODE_CBC ||
2701 ctx->cipher.mode == CIPHER_MODE_CTR ||
2702 ctx->cipher.mode == CIPHER_MODE_OFB ||
2703 ctx->cipher.mode == CIPHER_MODE_XTS ||
2704 ctx->cipher.mode == CIPHER_MODE_GCM) {
2708 } else if (ctx->cipher.mode == CIPHER_MODE_CCM) {
2758 static int aead_authenc_setkey(struct crypto_aead *cipher,
2762 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2763 struct crypto_tfm *tfm = crypto_aead_tfm(cipher);
2767 flow_log("%s() aead:%p key:%p keylen:%u\n", __func__, cipher, key,
2789 if (verify_aead_des_key(cipher, keys.enckey, keys.enckeylen))
2795 if (verify_aead_des3_key(cipher, keys.enckey, keys.enckeylen))
2816 pr_err("%s() Error: Unknown cipher alg\n", __func__);
2853 static int aead_gcm_ccm_setkey(struct crypto_aead *cipher,
2857 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2858 struct crypto_tfm *tfm = crypto_aead_tfm(cipher);
2926 * @cipher: AEAD structure
2935 static int aead_gcm_esp_setkey(struct crypto_aead *cipher,
2938 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2953 return aead_gcm_ccm_setkey(cipher, key, keylen);
2958 * cipher: AEAD structure
2967 static int rfc4543_gcm_esp_setkey(struct crypto_aead *cipher,
2970 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2986 return aead_gcm_ccm_setkey(cipher, key, keylen);
2991 * @cipher: AEAD structure
3000 static int aead_ccm_esp_setkey(struct crypto_aead *cipher,
3003 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
3017 return aead_gcm_ccm_setkey(cipher, key, keylen);
3020 static int aead_setauthsize(struct crypto_aead *cipher, unsigned int authsize)
3022 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
4193 ctx->cipher = cipher_alg->cipher_info;
4196 ctx->max_payload = spu->spu_ctx_max_payload(ctx->cipher.alg,
4197 ctx->cipher.mode,
4270 flow_log("%s() creating fallback cipher\n", __func__);
4766 dev_dbg(dev, " unregistered cipher %s\n",