Lines Matching +full:sha +full:- +full:256

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Crypto API support for SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256
5 * Copyright (c) Jean-Luc Cooke <jlcooke@certainkey.com>
19 * library SHA context, except the value in bytecount must be block-aligned and
36 ctx.bytecount -= partial; in __crypto_sha256_export()
49 ctx->bytecount += *p; in __crypto_sha256_import()
53 /* SHA-224 */
93 return __crypto_sha256_export(&SHA224_CTX(desc)->ctx, out); in crypto_sha224_export()
98 return __crypto_sha256_import(&SHA224_CTX(desc)->ctx, in); in crypto_sha224_import()
101 /* SHA-256 */
141 return __crypto_sha256_export(&SHA256_CTX(desc)->ctx, out); in crypto_sha256_export()
146 return __crypto_sha256_import(&SHA256_CTX(desc)->ctx, in); in crypto_sha256_import()
149 /* HMAC-SHA224 */
163 hmac_sha224_init(HMAC_SHA224_CTX(desc), HMAC_SHA224_KEY(desc->tfm)); in crypto_hmac_sha224_init()
184 hmac_sha224(HMAC_SHA224_KEY(desc->tfm), data, len, out); in crypto_hmac_sha224_digest()
190 return __crypto_sha256_export(&HMAC_SHA224_CTX(desc)->ctx.sha_ctx, out); in crypto_hmac_sha224_export()
197 ctx->ctx.ostate = HMAC_SHA224_KEY(desc->tfm)->key.ostate; in crypto_hmac_sha224_import()
198 return __crypto_sha256_import(&ctx->ctx.sha_ctx, in); in crypto_hmac_sha224_import()
201 /* HMAC-SHA256 */
215 hmac_sha256_init(HMAC_SHA256_CTX(desc), HMAC_SHA256_KEY(desc->tfm)); in crypto_hmac_sha256_init()
236 hmac_sha256(HMAC_SHA256_KEY(desc->tfm), data, len, out); in crypto_hmac_sha256_digest()
242 return __crypto_sha256_export(&HMAC_SHA256_CTX(desc)->ctx.sha_ctx, out); in crypto_hmac_sha256_export()
249 ctx->ctx.ostate = HMAC_SHA256_KEY(desc->tfm)->key.ostate; in crypto_hmac_sha256_import()
250 return __crypto_sha256_import(&ctx->ctx.sha_ctx, in); in crypto_hmac_sha256_import()
258 .base.cra_driver_name = "sha224-lib",
274 .base.cra_driver_name = "sha256-lib",
290 .base.cra_driver_name = "hmac-sha224-lib",
308 .base.cra_driver_name = "hmac-sha256-lib",
339 MODULE_DESCRIPTION("Crypto API support for SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256");
342 MODULE_ALIAS_CRYPTO("sha224-lib");
344 MODULE_ALIAS_CRYPTO("sha256-lib");
346 MODULE_ALIAS_CRYPTO("hmac-sha224-lib");
348 MODULE_ALIAS_CRYPTO("hmac-sha256-lib");