Lines Matching defs:tfm
620 static int safexcel_ahash_exit_inv(struct crypto_tfm *tfm)
622 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(tfm);
636 ahash_request_set_tfm(req, __crypto_ahash_cast(tfm));
637 ctx = crypto_tfm_ctx(req->base.tfm);
916 static int safexcel_ahash_cra_init(struct crypto_tfm *tfm)
918 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(tfm);
920 container_of(__crypto_ahash_alg(tfm->__crt_alg),
928 crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
959 static void safexcel_ahash_cra_exit(struct crypto_tfm *tfm)
961 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(tfm);
970 ret = safexcel_ahash_exit_inv(tfm);
1145 struct crypto_ahash *tfm;
1150 tfm = crypto_alloc_ahash(alg, 0, 0);
1151 if (IS_ERR(tfm))
1152 return PTR_ERR(tfm);
1154 areq = ahash_request_alloc(tfm, GFP_KERNEL);
1160 crypto_ahash_clear_flags(tfm, ~0);
1161 blocksize = crypto_tfm_alg_blocksize(crypto_ahash_tfm(tfm));
1186 crypto_free_ahash(tfm);
1214 static int safexcel_hmac_alg_setkey(struct crypto_ahash *tfm, const u8 *key,
1218 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
1223 static int safexcel_hmac_sha1_setkey(struct crypto_ahash *tfm, const u8 *key,
1226 return safexcel_hmac_alg_setkey(tfm, key, keylen, "safexcel-sha1",
1376 static int safexcel_hmac_sha224_setkey(struct crypto_ahash *tfm, const u8 *key,
1379 return safexcel_hmac_alg_setkey(tfm, key, keylen, "safexcel-sha224",
1448 static int safexcel_hmac_sha256_setkey(struct crypto_ahash *tfm, const u8 *key,
1451 return safexcel_hmac_alg_setkey(tfm, key, keylen, "safexcel-sha256",
1634 static int safexcel_hmac_sha512_setkey(struct crypto_ahash *tfm, const u8 *key,
1637 return safexcel_hmac_alg_setkey(tfm, key, keylen, "safexcel-sha512",
1706 static int safexcel_hmac_sha384_setkey(struct crypto_ahash *tfm, const u8 *key,
1709 return safexcel_hmac_alg_setkey(tfm, key, keylen, "safexcel-sha384",
1859 static int safexcel_hmac_md5_setkey(struct crypto_ahash *tfm, const u8 *key,
1862 return safexcel_hmac_alg_setkey(tfm, key, keylen, "safexcel-md5",
1908 static int safexcel_crc32_cra_init(struct crypto_tfm *tfm)
1910 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(tfm);
1911 int ret = safexcel_ahash_cra_init(tfm);
1940 static int safexcel_crc32_setkey(struct crypto_ahash *tfm, const u8 *key,
1943 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(crypto_ahash_tfm(tfm));
2012 static int safexcel_cbcmac_setkey(struct crypto_ahash *tfm, const u8 *key,
2015 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(crypto_ahash_tfm(tfm));
2080 static int safexcel_xcbcmac_setkey(struct crypto_ahash *tfm, const u8 *key,
2083 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(crypto_ahash_tfm(tfm));
2094 crypto_cipher_set_flags(ctx->kaes, crypto_ahash_get_flags(tfm) &
2110 crypto_cipher_set_flags(ctx->kaes, crypto_ahash_get_flags(tfm) &
2126 static int safexcel_xcbcmac_cra_init(struct crypto_tfm *tfm)
2128 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(tfm);
2130 safexcel_ahash_cra_init(tfm);
2135 static void safexcel_xcbcmac_cra_exit(struct crypto_tfm *tfm)
2137 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(tfm);
2140 safexcel_ahash_cra_exit(tfm);
2175 static int safexcel_cmac_setkey(struct crypto_ahash *tfm, const u8 *key,
2178 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(crypto_ahash_tfm(tfm));
2194 crypto_cipher_set_flags(ctx->kaes, crypto_ahash_get_flags(tfm) &
2328 static int safexcel_hmac_sm3_setkey(struct crypto_ahash *tfm, const u8 *key,
2331 return safexcel_hmac_alg_setkey(tfm, key, keylen, "safexcel-sm3",
2402 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
2403 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2420 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
2421 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2457 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
2458 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2467 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
2468 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2477 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
2478 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2492 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
2493 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2512 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
2513 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2522 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
2523 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2531 static int safexcel_sha3_cra_init(struct crypto_tfm *tfm)
2533 struct crypto_ahash *ahash = __crypto_ahash_cast(tfm);
2534 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(tfm);
2536 safexcel_ahash_cra_init(tfm);
2539 ctx->fback = crypto_alloc_ahash(crypto_tfm_alg_name(tfm), 0,
2554 static void safexcel_sha3_cra_exit(struct crypto_tfm *tfm)
2556 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(tfm);
2559 safexcel_ahash_cra_exit(tfm);
2595 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
2596 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2653 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
2654 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2711 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
2712 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2767 static int safexcel_hmac_sha3_cra_init(struct crypto_tfm *tfm, const char *alg)
2769 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(tfm);
2772 ret = safexcel_sha3_cra_init(tfm);
2787 ctx->shdesc->tfm = ctx->shpre;
2791 static void safexcel_hmac_sha3_cra_exit(struct crypto_tfm *tfm)
2793 struct safexcel_ahash_ctx *ctx = crypto_tfm_ctx(tfm);
2798 safexcel_ahash_cra_exit(tfm);
2801 static int safexcel_hmac_sha3_setkey(struct crypto_ahash *tfm, const u8 *key,
2804 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2807 if (keylen > crypto_ahash_blocksize(tfm)) {
2820 if (keylen > crypto_ahash_blocksize(tfm) / 2)
2824 crypto_ahash_blocksize(tfm) / 2,
2825 keylen - crypto_ahash_blocksize(tfm) / 2);
2832 if (keylen <= crypto_ahash_blocksize(tfm) / 2) {
2836 crypto_ahash_blocksize(tfm) / 2);
2838 key + crypto_ahash_blocksize(tfm) / 2,
2839 keylen - crypto_ahash_blocksize(tfm) / 2);
2844 if (keylen <= crypto_ahash_blocksize(tfm) / 2) {
2846 crypto_ahash_blocksize(tfm) / 2 - keylen);
2847 memset(&ctx->base.opad, 0, crypto_ahash_blocksize(tfm) / 2);
2850 crypto_ahash_blocksize(tfm) / 2, 0,
2851 crypto_ahash_blocksize(tfm) - keylen);
2861 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
2862 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2893 static int safexcel_hmac_sha3_224_cra_init(struct crypto_tfm *tfm)
2895 return safexcel_hmac_sha3_cra_init(tfm, "sha3-224");
2932 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
2933 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
2964 static int safexcel_hmac_sha3_256_cra_init(struct crypto_tfm *tfm)
2966 return safexcel_hmac_sha3_cra_init(tfm, "sha3-256");
3003 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
3004 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
3035 static int safexcel_hmac_sha3_384_cra_init(struct crypto_tfm *tfm)
3037 return safexcel_hmac_sha3_cra_init(tfm, "sha3-384");
3074 struct crypto_ahash *tfm = crypto_ahash_reqtfm(areq);
3075 struct safexcel_ahash_ctx *ctx = crypto_ahash_ctx(tfm);
3106 static int safexcel_hmac_sha3_512_cra_init(struct crypto_tfm *tfm)
3108 return safexcel_hmac_sha3_cra_init(tfm, "sha3-512");