Lines Matching +full:p +full:- +full:384

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Crypto API support for SHA-384, SHA-512, HMAC-SHA384, and HMAC-SHA512
5 * Copyright (c) Jean-Luc Cooke <jlcooke@certainkey.com>
18 * library SHA context, except the value in bytecount_lo must be block-aligned
33 u8 *p = out; in __crypto_sha512_export() local
36 ctx.bytecount_lo -= partial; in __crypto_sha512_export()
37 memcpy(p, &ctx, sizeof(ctx)); in __crypto_sha512_export()
38 p += sizeof(ctx); in __crypto_sha512_export()
39 *p = partial; in __crypto_sha512_export()
45 const u8 *p = in; in __crypto_sha512_import() local
47 memcpy(ctx, p, sizeof(*ctx)); in __crypto_sha512_import()
48 p += sizeof(*ctx); in __crypto_sha512_import()
49 ctx->bytecount_lo += *p; in __crypto_sha512_import()
66 /* SHA-384 */
108 return __crypto_sha512_export(&SHA384_CTX(desc)->ctx, out); in crypto_sha384_export()
113 return __crypto_sha512_import(&SHA384_CTX(desc)->ctx, in); in crypto_sha384_import()
118 return __crypto_sha512_export_core(&SHA384_CTX(desc)->ctx, out); in crypto_sha384_export_core()
123 return __crypto_sha512_import_core(&SHA384_CTX(desc)->ctx, in); in crypto_sha384_import_core()
126 /* SHA-512 */
170 return __crypto_sha512_export(&SHA512_CTX(desc)->ctx, out); in crypto_sha512_export()
175 return __crypto_sha512_import(&SHA512_CTX(desc)->ctx, in); in crypto_sha512_import()
180 return __crypto_sha512_export_core(&SHA512_CTX(desc)->ctx, out); in crypto_sha512_export_core()
185 return __crypto_sha512_import_core(&SHA512_CTX(desc)->ctx, in); in crypto_sha512_import_core()
188 /* HMAC-SHA384 */
202 hmac_sha384_init(HMAC_SHA384_CTX(desc), HMAC_SHA384_KEY(desc->tfm)); in crypto_hmac_sha384_init()
223 hmac_sha384(HMAC_SHA384_KEY(desc->tfm), data, len, out); in crypto_hmac_sha384_digest()
229 return __crypto_sha512_export(&HMAC_SHA384_CTX(desc)->ctx.sha_ctx, out); in crypto_hmac_sha384_export()
236 ctx->ctx.ostate = HMAC_SHA384_KEY(desc->tfm)->key.ostate; in crypto_hmac_sha384_import()
237 return __crypto_sha512_import(&ctx->ctx.sha_ctx, in); in crypto_hmac_sha384_import()
242 return __crypto_sha512_export_core(&HMAC_SHA384_CTX(desc)->ctx.sha_ctx, in crypto_hmac_sha384_export_core()
251 ctx->ctx.ostate = HMAC_SHA384_KEY(desc->tfm)->key.ostate; in crypto_hmac_sha384_import_core()
252 return __crypto_sha512_import_core(&ctx->ctx.sha_ctx, in); in crypto_hmac_sha384_import_core()
255 /* HMAC-SHA512 */
269 hmac_sha512_init(HMAC_SHA512_CTX(desc), HMAC_SHA512_KEY(desc->tfm)); in crypto_hmac_sha512_init()
290 hmac_sha512(HMAC_SHA512_KEY(desc->tfm), data, len, out); in crypto_hmac_sha512_digest()
296 return __crypto_sha512_export(&HMAC_SHA512_CTX(desc)->ctx.sha_ctx, out); in crypto_hmac_sha512_export()
303 ctx->ctx.ostate = HMAC_SHA512_KEY(desc->tfm)->key.ostate; in crypto_hmac_sha512_import()
304 return __crypto_sha512_import(&ctx->ctx.sha_ctx, in); in crypto_hmac_sha512_import()
309 return __crypto_sha512_export_core(&HMAC_SHA512_CTX(desc)->ctx.sha_ctx, in crypto_hmac_sha512_export_core()
318 ctx->ctx.ostate = HMAC_SHA512_KEY(desc->tfm)->key.ostate; in crypto_hmac_sha512_import_core()
319 return __crypto_sha512_import_core(&ctx->ctx.sha_ctx, in); in crypto_hmac_sha512_import_core()
327 .base.cra_driver_name = "sha384-lib",
345 .base.cra_driver_name = "sha512-lib",
363 .base.cra_driver_name = "hmac-sha384-lib",
383 .base.cra_driver_name = "hmac-sha512-lib",
416 MODULE_DESCRIPTION("Crypto API support for SHA-384, SHA-512, HMAC-SHA384, and HMAC-SHA512");
419 MODULE_ALIAS_CRYPTO("sha384-lib");
421 MODULE_ALIAS_CRYPTO("sha512-lib");
423 MODULE_ALIAS_CRYPTO("hmac-sha384-lib");
425 MODULE_ALIAS_CRYPTO("hmac-sha512-lib");