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()
66 /* SHA-224 */
106 return __crypto_sha256_export(&SHA224_CTX(desc)->ctx, out); in crypto_sha224_export()
111 return __crypto_sha256_import(&SHA224_CTX(desc)->ctx, in); in crypto_sha224_import()
116 return __crypto_sha256_export_core(&SHA224_CTX(desc)->ctx, out); in crypto_sha224_export_core()
121 return __crypto_sha256_import_core(&SHA224_CTX(desc)->ctx, in); in crypto_sha224_import_core()
124 /* SHA-256 */
164 return __crypto_sha256_export(&SHA256_CTX(desc)->ctx, out); in crypto_sha256_export()
169 return __crypto_sha256_import(&SHA256_CTX(desc)->ctx, in); in crypto_sha256_import()
174 return __crypto_sha256_export_core(&SHA256_CTX(desc)->ctx, out); in crypto_sha256_export_core()
179 return __crypto_sha256_import_core(&SHA256_CTX(desc)->ctx, in); in crypto_sha256_import_core()
182 /* HMAC-SHA224 */
196 hmac_sha224_init(HMAC_SHA224_CTX(desc), HMAC_SHA224_KEY(desc->tfm)); in crypto_hmac_sha224_init()
217 hmac_sha224(HMAC_SHA224_KEY(desc->tfm), data, len, out); in crypto_hmac_sha224_digest()
223 return __crypto_sha256_export(&HMAC_SHA224_CTX(desc)->ctx.sha_ctx, out); in crypto_hmac_sha224_export()
230 ctx->ctx.ostate = HMAC_SHA224_KEY(desc->tfm)->key.ostate; in crypto_hmac_sha224_import()
231 return __crypto_sha256_import(&ctx->ctx.sha_ctx, in); in crypto_hmac_sha224_import()
236 return __crypto_sha256_export_core(&HMAC_SHA224_CTX(desc)->ctx.sha_ctx, in crypto_hmac_sha224_export_core()
245 ctx->ctx.ostate = HMAC_SHA224_KEY(desc->tfm)->key.ostate; in crypto_hmac_sha224_import_core()
246 return __crypto_sha256_import_core(&ctx->ctx.sha_ctx, in); in crypto_hmac_sha224_import_core()
249 /* HMAC-SHA256 */
263 hmac_sha256_init(HMAC_SHA256_CTX(desc), HMAC_SHA256_KEY(desc->tfm)); in crypto_hmac_sha256_init()
284 hmac_sha256(HMAC_SHA256_KEY(desc->tfm), data, len, out); in crypto_hmac_sha256_digest()
290 return __crypto_sha256_export(&HMAC_SHA256_CTX(desc)->ctx.sha_ctx, out); in crypto_hmac_sha256_export()
297 ctx->ctx.ostate = HMAC_SHA256_KEY(desc->tfm)->key.ostate; in crypto_hmac_sha256_import()
298 return __crypto_sha256_import(&ctx->ctx.sha_ctx, in); in crypto_hmac_sha256_import()
303 return __crypto_sha256_export_core(&HMAC_SHA256_CTX(desc)->ctx.sha_ctx, in crypto_hmac_sha256_export_core()
312 ctx->ctx.ostate = HMAC_SHA256_KEY(desc->tfm)->key.ostate; in crypto_hmac_sha256_import_core()
313 return __crypto_sha256_import_core(&ctx->ctx.sha_ctx, in); in crypto_hmac_sha256_import_core()
321 .base.cra_driver_name = "sha224-lib",
339 .base.cra_driver_name = "sha256-lib",
357 .base.cra_driver_name = "hmac-sha224-lib",
377 .base.cra_driver_name = "hmac-sha256-lib",
410 MODULE_DESCRIPTION("Crypto API support for SHA-224, SHA-256, HMAC-SHA224, and HMAC-SHA256");
413 MODULE_ALIAS_CRYPTO("sha224-lib");
415 MODULE_ALIAS_CRYPTO("sha256-lib");
417 MODULE_ALIAS_CRYPTO("hmac-sha224-lib");
419 MODULE_ALIAS_CRYPTO("hmac-sha256-lib");