Lines Matching defs:cipher

38 #include "cipher.h"
72 MODULE_PARM_DESC(cipher_pri, "Priority for cipher algos");
154 if ((ctx->cipher.mode == CIPHER_MODE_XTS) &&
218 if ((ctx->cipher.mode == CIPHER_MODE_XTS) &&
281 * handle_skcipher_req() - Submit as much of a block cipher request as fits in
323 cipher_parms.alg = ctx->cipher.alg;
324 cipher_parms.mode = ctx->cipher.mode;
349 if ((ctx->cipher.mode == CIPHER_MODE_CBC) &&
365 if ((ctx->cipher.mode == CIPHER_MODE_CBC) &&
374 } else if (ctx->cipher.mode == CIPHER_MODE_CTR) {
382 * any other cipher alg.
434 if ((ctx->cipher.mode == CIPHER_MODE_XTS) &&
448 if ((ctx->cipher.mode == CIPHER_MODE_XTS) &&
465 * handle_skcipher_resp() - Process a block cipher SPU response. Updates the
484 if ((ctx->cipher.mode == CIPHER_MODE_XTS) &&
500 &iproc_priv.cipher_cnt[ctx->cipher.alg][ctx->cipher.mode]);
830 data_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode, chunksize);
1055 data_padlen = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1059 data_padlen = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1061 assoc_buf_len = spu->spu_assoc_resp_len(ctx->cipher.mode,
1066 if (ctx->cipher.mode == CIPHER_MODE_CCM)
1295 cipher_parms.alg = ctx->cipher.alg;
1296 cipher_parms.mode = ctx->cipher.mode;
1348 if (spu->spu_assoc_resp_len(ctx->cipher.mode,
1354 aead_parms.iv_len = spu->spu_aead_ivlen(ctx->cipher.mode,
1361 aead_parms.aad_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1365 aead_parms.data_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1368 if (ctx->cipher.mode == CIPHER_MODE_CCM) {
1374 ctx->cipher.mode,
1383 spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
1400 ctx->cipher.mode,
1405 ctx->cipher.mode,
1411 if (spu_req_incl_icv(ctx->cipher.mode, rctx->is_encrypt)) {
1477 if (((ctx->cipher.mode == CIPHER_MODE_GCM) ||
1478 (ctx->cipher.mode == CIPHER_MODE_CCM)) && !rctx->is_encrypt) {
1564 if (ctx->cipher.alg == CIPHER_ALG_AES) {
1565 if (ctx->cipher.mode == CIPHER_MODE_CCM)
1567 else if (ctx->cipher.mode == CIPHER_MODE_GCM)
1735 if (ctx->cipher.mode == CIPHER_MODE_CBC ||
1736 ctx->cipher.mode == CIPHER_MODE_CTR ||
1737 ctx->cipher.mode == CIPHER_MODE_OFB ||
1738 ctx->cipher.mode == CIPHER_MODE_XTS ||
1739 ctx->cipher.mode == CIPHER_MODE_GCM ||
1740 ctx->cipher.mode == CIPHER_MODE_CCM) {
1758 static int des_setkey(struct crypto_skcipher *cipher, const u8 *key,
1761 struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
1764 err = verify_skcipher_des_key(cipher, key);
1772 static int threedes_setkey(struct crypto_skcipher *cipher, const u8 *key,
1775 struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
1778 err = verify_skcipher_des3_key(cipher, key);
1786 static int aes_setkey(struct crypto_skcipher *cipher, const u8 *key,
1789 struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
1791 if (ctx->cipher.mode == CIPHER_MODE_XTS)
1813 static int skcipher_setkey(struct crypto_skcipher *cipher, const u8 *key,
1817 struct iproc_ctx_s *ctx = crypto_skcipher_ctx(cipher);
1825 switch (ctx->cipher.alg) {
1827 err = des_setkey(cipher, key, keylen);
1830 err = threedes_setkey(cipher, key, keylen);
1833 err = aes_setkey(cipher, key, keylen);
1836 pr_err("%s() Error: unknown cipher alg\n", __func__);
1846 if ((ctx->cipher.alg == CIPHER_ALG_AES) &&
1847 (ctx->cipher.mode == CIPHER_MODE_XTS)) {
1860 cipher_parms.iv_len = crypto_skcipher_ivsize(cipher);
1863 cipher_parms.alg = ctx->cipher.alg;
1864 cipher_parms.mode = ctx->cipher.mode;
2514 if (((ctx->cipher.mode == CIPHER_MODE_GCM) ||
2515 (ctx->cipher.mode == CIPHER_MODE_CCM)) &&
2525 if ((ctx->cipher.mode == CIPHER_MODE_CCM) &&
2538 if ((ctx->cipher.mode == CIPHER_MODE_CCM) &&
2550 if (ctx->cipher.mode == CIPHER_MODE_GCM &&
2551 ctx->cipher.alg == CIPHER_ALG_AES &&
2659 if (ctx->cipher.mode == CIPHER_MODE_CBC ||
2660 ctx->cipher.mode == CIPHER_MODE_CTR ||
2661 ctx->cipher.mode == CIPHER_MODE_OFB ||
2662 ctx->cipher.mode == CIPHER_MODE_XTS ||
2663 ctx->cipher.mode == CIPHER_MODE_GCM) {
2667 } else if (ctx->cipher.mode == CIPHER_MODE_CCM) {
2717 static int aead_authenc_setkey(struct crypto_aead *cipher,
2721 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2722 struct crypto_tfm *tfm = crypto_aead_tfm(cipher);
2726 flow_log("%s() aead:%p key:%p keylen:%u\n", __func__, cipher, key,
2748 if (verify_aead_des_key(cipher, keys.enckey, keys.enckeylen))
2754 if (verify_aead_des3_key(cipher, keys.enckey, keys.enckeylen))
2775 pr_err("%s() Error: Unknown cipher alg\n", __func__);
2812 static int aead_gcm_ccm_setkey(struct crypto_aead *cipher,
2816 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2817 struct crypto_tfm *tfm = crypto_aead_tfm(cipher);
2885 * @cipher: AEAD structure
2894 static int aead_gcm_esp_setkey(struct crypto_aead *cipher,
2897 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2912 return aead_gcm_ccm_setkey(cipher, key, keylen);
2917 * @cipher: AEAD structure
2926 static int rfc4543_gcm_esp_setkey(struct crypto_aead *cipher,
2929 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2945 return aead_gcm_ccm_setkey(cipher, key, keylen);
2950 * @cipher: AEAD structure
2959 static int aead_ccm_esp_setkey(struct crypto_aead *cipher,
2962 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
2976 return aead_gcm_ccm_setkey(cipher, key, keylen);
2979 static int aead_setauthsize(struct crypto_aead *cipher, unsigned int authsize)
2981 struct iproc_ctx_s *ctx = crypto_aead_ctx(cipher);
4095 ctx->cipher = cipher_alg->cipher_info;
4098 ctx->max_payload = spu->spu_ctx_max_payload(ctx->cipher.alg,
4099 ctx->cipher.mode,
4176 flow_log("%s() creating fallback cipher\n", __func__);
4675 dev_dbg(dev, " unregistered cipher %s\n",