summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2023-03-29 04:24:08 +0000
committerjsing <>2023-03-29 04:24:08 +0000
commit74eda82875b28355460dcde47004692ba86d3a48 (patch)
tree535c0e6de608bb6351f598bf66fbd8e84570b2a6
parent39fbad4eb1ab08304ccfa63df1b00c2325c8f890 (diff)
downloadopenbsd-74eda82875b28355460dcde47004692ba86d3a48.tar.gz
openbsd-74eda82875b28355460dcde47004692ba86d3a48.tar.bz2
openbsd-74eda82875b28355460dcde47004692ba86d3a48.zip
Inline initial hash data values for SHA1.
This follows what is done for other SHA implementations. ok miod@ tb@
-rw-r--r--src/lib/libcrypto/sha/sha1dgst.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/lib/libcrypto/sha/sha1dgst.c b/src/lib/libcrypto/sha/sha1dgst.c
index 604b0d8ba5..0822d038be 100644
--- a/src/lib/libcrypto/sha/sha1dgst.c
+++ b/src/lib/libcrypto/sha/sha1dgst.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha1dgst.c,v 1.22 2023/03/26 19:30:45 jsing Exp $ */ 1/* $OpenBSD: sha1dgst.c,v 1.23 2023/03/29 04:24:08 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -96,21 +96,17 @@ void sha1_block_data_order(SHA_CTX *c, const void *p, size_t num);
96 96
97#include "md32_common.h" 97#include "md32_common.h"
98 98
99#define INIT_DATA_h0 0x67452301UL
100#define INIT_DATA_h1 0xefcdab89UL
101#define INIT_DATA_h2 0x98badcfeUL
102#define INIT_DATA_h3 0x10325476UL
103#define INIT_DATA_h4 0xc3d2e1f0UL
104
105int 99int
106SHA1_Init(SHA_CTX *c) 100SHA1_Init(SHA_CTX *c)
107{ 101{
108 memset (c, 0, sizeof(*c)); 102 memset(c, 0, sizeof(*c));
109 c->h0 = INIT_DATA_h0; 103
110 c->h1 = INIT_DATA_h1; 104 c->h0 = 0x67452301UL;
111 c->h2 = INIT_DATA_h2; 105 c->h1 = 0xefcdab89UL;
112 c->h3 = INIT_DATA_h3; 106 c->h2 = 0x98badcfeUL;
113 c->h4 = INIT_DATA_h4; 107 c->h3 = 0x10325476UL;
108 c->h4 = 0xc3d2e1f0UL;
109
114 return 1; 110 return 1;
115} 111}
116 112