diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/evp/m_sha1.c | 79 |
1 files changed, 78 insertions, 1 deletions
diff --git a/src/lib/libcrypto/evp/m_sha1.c b/src/lib/libcrypto/evp/m_sha1.c index 92d8c30a8c..b7f4705d86 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.22 2023/04/09 15:47:41 jsing Exp $ */ | 1 | /* $OpenBSD: m_sha1.c,v 1.23 2023/04/16 16:42:06 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 | * |
| @@ -71,6 +71,7 @@ | |||
| 71 | #endif | 71 | #endif |
| 72 | 72 | ||
| 73 | #include "evp_local.h" | 73 | #include "evp_local.h" |
| 74 | #include "sha_internal.h" | ||
| 74 | 75 | ||
| 75 | static int | 76 | static int |
| 76 | sha1_init(EVP_MD_CTX *ctx) | 77 | sha1_init(EVP_MD_CTX *ctx) |
| @@ -271,4 +272,80 @@ EVP_sha512(void) | |||
| 271 | { | 272 | { |
| 272 | return &sha512_md; | 273 | return &sha512_md; |
| 273 | } | 274 | } |
| 275 | |||
| 276 | static int | ||
| 277 | sha512_224_init(EVP_MD_CTX *ctx) | ||
| 278 | { | ||
| 279 | return SHA512_224_Init(ctx->md_data); | ||
| 280 | } | ||
| 281 | |||
| 282 | static int | ||
| 283 | sha512_224_update(EVP_MD_CTX *ctx, const void *data, size_t count) | ||
| 284 | { | ||
| 285 | return SHA512_224_Update(ctx->md_data, data, count); | ||
| 286 | } | ||
| 287 | |||
| 288 | static int | ||
| 289 | sha512_224_final(EVP_MD_CTX *ctx, unsigned char *md) | ||
| 290 | { | ||
| 291 | return SHA512_224_Final(md, ctx->md_data); | ||
| 292 | } | ||
| 293 | |||
| 294 | static const EVP_MD sha512_224_md = { | ||
| 295 | .type = NID_sha512_224, | ||
| 296 | .pkey_type = NID_sha512_224WithRSAEncryption, | ||
| 297 | .md_size = SHA512_224_DIGEST_LENGTH, | ||
| 298 | .flags = EVP_MD_FLAG_DIGALGID_ABSENT, | ||
| 299 | .init = sha512_224_init, | ||
| 300 | .update = sha512_224_update, | ||
| 301 | .final = sha512_224_final, | ||
| 302 | .copy = NULL, | ||
| 303 | .cleanup = NULL, | ||
| 304 | .block_size = SHA512_CBLOCK, | ||
| 305 | .ctx_size = sizeof(EVP_MD *) + sizeof(SHA512_CTX), | ||
| 306 | }; | ||
| 307 | |||
| 308 | const EVP_MD * | ||
| 309 | EVP_sha512_224(void) | ||
| 310 | { | ||
| 311 | return &sha512_224_md; | ||
| 312 | } | ||
| 313 | |||
| 314 | static int | ||
| 315 | sha512_256_init(EVP_MD_CTX *ctx) | ||
| 316 | { | ||
| 317 | return SHA512_256_Init(ctx->md_data); | ||
| 318 | } | ||
| 319 | |||
| 320 | static int | ||
| 321 | sha512_256_update(EVP_MD_CTX *ctx, const void *data, size_t count) | ||
| 322 | { | ||
| 323 | return SHA512_256_Update(ctx->md_data, data, count); | ||
| 324 | } | ||
| 325 | |||
| 326 | static int | ||
| 327 | sha512_256_final(EVP_MD_CTX *ctx, unsigned char *md) | ||
| 328 | { | ||
| 329 | return SHA512_256_Final(md, ctx->md_data); | ||
| 330 | } | ||
| 331 | |||
| 332 | static const EVP_MD sha512_256_md = { | ||
| 333 | .type = NID_sha512_256, | ||
| 334 | .pkey_type = NID_sha512_256WithRSAEncryption, | ||
| 335 | .md_size = SHA512_256_DIGEST_LENGTH, | ||
| 336 | .flags = EVP_MD_FLAG_DIGALGID_ABSENT, | ||
| 337 | .init = sha512_256_init, | ||
| 338 | .update = sha512_256_update, | ||
| 339 | .final = sha512_256_final, | ||
| 340 | .copy = NULL, | ||
| 341 | .cleanup = NULL, | ||
| 342 | .block_size = SHA512_CBLOCK, | ||
| 343 | .ctx_size = sizeof(EVP_MD *) + sizeof(SHA512_CTX), | ||
| 344 | }; | ||
| 345 | |||
| 346 | const EVP_MD * | ||
| 347 | EVP_sha512_256(void) | ||
| 348 | { | ||
| 349 | return &sha512_256_md; | ||
| 350 | } | ||
| 274 | #endif /* ifndef OPENSSL_NO_SHA512 */ | 351 | #endif /* ifndef OPENSSL_NO_SHA512 */ |
