summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/sha/sha256.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/sha/sha256.c')
-rw-r--r--src/lib/libcrypto/sha/sha256.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/libcrypto/sha/sha256.c b/src/lib/libcrypto/sha/sha256.c
index 5d002ca62c..f60073bf76 100644
--- a/src/lib/libcrypto/sha/sha256.c
+++ b/src/lib/libcrypto/sha/sha256.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha256.c,v 1.33 2025/02/14 12:01:58 jsing Exp $ */ 1/* $OpenBSD: sha256.c,v 1.34 2026/04/25 05:47:03 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -72,6 +72,9 @@ void sha256_block_data_order(SHA256_CTX *ctx, const void *_in, size_t num);
72void sha256_block_generic(SHA256_CTX *ctx, const void *_in, size_t num); 72void sha256_block_generic(SHA256_CTX *ctx, const void *_in, size_t num);
73 73
74#ifndef HAVE_SHA256_BLOCK_GENERIC 74#ifndef HAVE_SHA256_BLOCK_GENERIC
75/*
76 * SHA-256 constants - see FIPS 180-4 section 4.2.2.
77 */
75static const SHA_LONG K256[64] = { 78static const SHA_LONG K256[64] = {
76 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, 79 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
77 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, 80 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
@@ -291,6 +294,7 @@ SHA224_Init(SHA256_CTX *c)
291{ 294{
292 memset(c, 0, sizeof(*c)); 295 memset(c, 0, sizeof(*c));
293 296
297 /* FIPS 180-4 section 5.3.2. */
294 c->h[0] = 0xc1059ed8UL; 298 c->h[0] = 0xc1059ed8UL;
295 c->h[1] = 0x367cd507UL; 299 c->h[1] = 0x367cd507UL;
296 c->h[2] = 0x3070dd17UL; 300 c->h[2] = 0x3070dd17UL;
@@ -340,6 +344,7 @@ SHA256_Init(SHA256_CTX *c)
340{ 344{
341 memset(c, 0, sizeof(*c)); 345 memset(c, 0, sizeof(*c));
342 346
347 /* FIPS 180-4 section 5.3.3. */
343 c->h[0] = 0x6a09e667UL; 348 c->h[0] = 0x6a09e667UL;
344 c->h[1] = 0xbb67ae85UL; 349 c->h[1] = 0xbb67ae85UL;
345 c->h[2] = 0x3c6ef372UL; 350 c->h[2] = 0x3c6ef372UL;