summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/evp/m_sha1.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c
index 5b38666892..16aab86292 100644
--- a/src/lib/libcrypto/evp/m_sha1.c
+++ b/src/lib/libcrypto/evp/m_sha1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: m_sha1.c,v 1.20 2022/11/26 16:08:52 tb Exp $ */ 1/* $OpenBSD: m_sha1.c,v 1.21 2023/04/09 15:40:09 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 *
@@ -73,19 +73,19 @@
73#include "evp_local.h" 73#include "evp_local.h"
74 74
75static int 75static int
76init(EVP_MD_CTX *ctx) 76sha1_init(EVP_MD_CTX *ctx)
77{ 77{
78 return SHA1_Init(ctx->md_data); 78 return SHA1_Init(ctx->md_data);
79} 79}
80 80
81static int 81static int
82update(EVP_MD_CTX *ctx, const void *data, size_t count) 82sha1_update(EVP_MD_CTX *ctx, const void *data, size_t count)
83{ 83{
84 return SHA1_Update(ctx->md_data, data, count); 84 return SHA1_Update(ctx->md_data, data, count);
85} 85}
86 86
87static int 87static int
88final(EVP_MD_CTX *ctx, unsigned char *md) 88sha1_final(EVP_MD_CTX *ctx, unsigned char *md)
89{ 89{
90 return SHA1_Final(md, ctx->md_data); 90 return SHA1_Final(md, ctx->md_data);
91} 91}
@@ -95,9 +95,9 @@ static const EVP_MD sha1_md = {
95 .pkey_type = NID_sha1WithRSAEncryption, 95 .pkey_type = NID_sha1WithRSAEncryption,
96 .md_size = SHA_DIGEST_LENGTH, 96 .md_size = SHA_DIGEST_LENGTH,
97 .flags = EVP_MD_FLAG_DIGALGID_ABSENT, 97 .flags = EVP_MD_FLAG_DIGALGID_ABSENT,
98 .init = init, 98 .init = sha1_init,
99 .update = update, 99 .update = sha1_update,
100 .final = final, 100 .final = sha1_final,
101 .copy = NULL, 101 .copy = NULL,
102 .cleanup = NULL, 102 .cleanup = NULL,
103 .block_size = SHA_CBLOCK, 103 .block_size = SHA_CBLOCK,
@@ -107,19 +107,19 @@ static const EVP_MD sha1_md = {
107const EVP_MD * 107const EVP_MD *
108EVP_sha1(void) 108EVP_sha1(void)
109{ 109{
110 return (&sha1_md); 110 return &sha1_md;
111} 111}
112#endif 112#endif
113 113
114#ifndef OPENSSL_NO_SHA256 114#ifndef OPENSSL_NO_SHA256
115static int 115static int
116init224(EVP_MD_CTX *ctx) 116sha224_init(EVP_MD_CTX *ctx)
117{ 117{
118 return SHA224_Init(ctx->md_data); 118 return SHA224_Init(ctx->md_data);
119} 119}
120 120
121static int 121static int
122init256(EVP_MD_CTX *ctx) 122sha256_init(EVP_MD_CTX *ctx)
123{ 123{
124 return SHA256_Init(ctx->md_data); 124 return SHA256_Init(ctx->md_data);
125} 125}
@@ -129,13 +129,13 @@ init256(EVP_MD_CTX *ctx)
129 * there anyway, so we can spare few CPU cycles:-) 129 * there anyway, so we can spare few CPU cycles:-)
130 */ 130 */
131static int 131static int
132update256(EVP_MD_CTX *ctx, const void *data, size_t count) 132sha256_update(EVP_MD_CTX *ctx, const void *data, size_t count)
133{ 133{
134 return SHA256_Update(ctx->md_data, data, count); 134 return SHA256_Update(ctx->md_data, data, count);
135} 135}
136 136
137static int 137static int
138final256(EVP_MD_CTX *ctx, unsigned char *md) 138sha256_final(EVP_MD_CTX *ctx, unsigned char *md)
139{ 139{
140 return SHA256_Final(md, ctx->md_data); 140 return SHA256_Final(md, ctx->md_data);
141} 141}
@@ -145,9 +145,9 @@ static const EVP_MD sha224_md = {
145 .pkey_type = NID_sha224WithRSAEncryption, 145 .pkey_type = NID_sha224WithRSAEncryption,
146 .md_size = SHA224_DIGEST_LENGTH, 146 .md_size = SHA224_DIGEST_LENGTH,
147 .flags = EVP_MD_FLAG_DIGALGID_ABSENT, 147 .flags = EVP_MD_FLAG_DIGALGID_ABSENT,
148 .init = init224, 148 .init = sha224_init,
149 .update = update256, 149 .update = sha256_update,
150 .final = final256, 150 .final = sha256_final,
151 .copy = NULL, 151 .copy = NULL,
152 .cleanup = NULL, 152 .cleanup = NULL,
153 .block_size = SHA256_CBLOCK, 153 .block_size = SHA256_CBLOCK,
@@ -165,9 +165,9 @@ static const EVP_MD sha256_md = {
165 .pkey_type = NID_sha256WithRSAEncryption, 165 .pkey_type = NID_sha256WithRSAEncryption,
166 .md_size = SHA256_DIGEST_LENGTH, 166 .md_size = SHA256_DIGEST_LENGTH,
167 .flags = EVP_MD_FLAG_DIGALGID_ABSENT, 167 .flags = EVP_MD_FLAG_DIGALGID_ABSENT,
168 .init = init256, 168 .init = sha256_init,
169 .update = update256, 169 .update = sha256_update,
170 .final = final256, 170 .final = sha256_final,
171 .copy = NULL, 171 .copy = NULL,
172 .cleanup = NULL, 172 .cleanup = NULL,
173 .block_size = SHA256_CBLOCK, 173 .block_size = SHA256_CBLOCK,
@@ -177,31 +177,31 @@ static const EVP_MD sha256_md = {
177const EVP_MD * 177const EVP_MD *
178EVP_sha256(void) 178EVP_sha256(void)
179{ 179{
180 return (&sha256_md); 180 return &sha256_md;
181} 181}
182#endif /* ifndef OPENSSL_NO_SHA256 */ 182#endif /* ifndef OPENSSL_NO_SHA256 */
183 183
184#ifndef OPENSSL_NO_SHA512 184#ifndef OPENSSL_NO_SHA512
185static int 185static int
186init384(EVP_MD_CTX *ctx) 186sha384_init(EVP_MD_CTX *ctx)
187{ 187{
188 return SHA384_Init(ctx->md_data); 188 return SHA384_Init(ctx->md_data);
189} 189}
190 190
191static int 191static int
192init512(EVP_MD_CTX *ctx) 192sha512_init(EVP_MD_CTX *ctx)
193{ 193{
194 return SHA512_Init(ctx->md_data); 194 return SHA512_Init(ctx->md_data);
195} 195}
196/* See comment in SHA224/256 section */ 196/* See comment in SHA224/256 section */
197static int 197static int
198update512(EVP_MD_CTX *ctx, const void *data, size_t count) 198sha512_update(EVP_MD_CTX *ctx, const void *data, size_t count)
199{ 199{
200 return SHA512_Update(ctx->md_data, data, count); 200 return SHA512_Update(ctx->md_data, data, count);
201} 201}
202 202
203static int 203static int
204final512(EVP_MD_CTX *ctx, unsigned char *md) 204sha512_final(EVP_MD_CTX *ctx, unsigned char *md)
205{ 205{
206 return SHA512_Final(md, ctx->md_data); 206 return SHA512_Final(md, ctx->md_data);
207} 207}
@@ -211,9 +211,9 @@ static const EVP_MD sha384_md = {
211 .pkey_type = NID_sha384WithRSAEncryption, 211 .pkey_type = NID_sha384WithRSAEncryption,
212 .md_size = SHA384_DIGEST_LENGTH, 212 .md_size = SHA384_DIGEST_LENGTH,
213 .flags = EVP_MD_FLAG_DIGALGID_ABSENT, 213 .flags = EVP_MD_FLAG_DIGALGID_ABSENT,
214 .init = init384, 214 .init = sha384_init,
215 .update = update512, 215 .update = sha512_update,
216 .final = final512, 216 .final = sha512_final,
217 .copy = NULL, 217 .copy = NULL,
218 .cleanup = NULL, 218 .cleanup = NULL,
219 .block_size = SHA512_CBLOCK, 219 .block_size = SHA512_CBLOCK,
@@ -223,7 +223,7 @@ static const EVP_MD sha384_md = {
223const EVP_MD * 223const EVP_MD *
224EVP_sha384(void) 224EVP_sha384(void)
225{ 225{
226 return (&sha384_md); 226 return &sha384_md;
227} 227}
228 228
229static const EVP_MD sha512_md = { 229static const EVP_MD sha512_md = {
@@ -231,9 +231,9 @@ static const EVP_MD sha512_md = {
231 .pkey_type = NID_sha512WithRSAEncryption, 231 .pkey_type = NID_sha512WithRSAEncryption,
232 .md_size = SHA512_DIGEST_LENGTH, 232 .md_size = SHA512_DIGEST_LENGTH,
233 .flags = EVP_MD_FLAG_DIGALGID_ABSENT, 233 .flags = EVP_MD_FLAG_DIGALGID_ABSENT,
234 .init = init512, 234 .init = sha512_init,
235 .update = update512, 235 .update = sha512_update,
236 .final = final512, 236 .final = sha512_final,
237 .copy = NULL, 237 .copy = NULL,
238 .cleanup = NULL, 238 .cleanup = NULL,
239 .block_size = SHA512_CBLOCK, 239 .block_size = SHA512_CBLOCK,
@@ -243,6 +243,6 @@ static const EVP_MD sha512_md = {
243const EVP_MD * 243const EVP_MD *
244EVP_sha512(void) 244EVP_sha512(void)
245{ 245{
246 return (&sha512_md); 246 return &sha512_md;
247} 247}
248#endif /* ifndef OPENSSL_NO_SHA512 */ 248#endif /* ifndef OPENSSL_NO_SHA512 */