summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/sha/sha1.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/sha/sha1.c (renamed from src/lib/libcrypto/sha/sha1dgst.c)23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/lib/libcrypto/sha/sha1dgst.c b/src/lib/libcrypto/sha/sha1.c
index 32e320abef..25c87e9bc3 100644
--- a/src/lib/libcrypto/sha/sha1dgst.c
+++ b/src/lib/libcrypto/sha/sha1.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha1dgst.c,v 1.25 2023/03/29 05:31:43 jsing Exp $ */ 1/* $OpenBSD: sha1.c,v 1.5 2023/04/11 10:39:50 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 *
@@ -436,6 +436,25 @@ sha1_block_data_order(SHA_CTX *c, const void *p, size_t num)
436 } 436 }
437} 437}
438#endif 438#endif
439
440#endif 439#endif
440
441unsigned char *
442SHA1(const unsigned char *d, size_t n, unsigned char *md)
443{
444 SHA_CTX c;
445 static unsigned char m[SHA_DIGEST_LENGTH];
446
447 if (md == NULL)
448 md = m;
449
450 if (!SHA1_Init(&c))
451 return NULL;
452 SHA1_Update(&c, d, n);
453 SHA1_Final(md, &c);
454
455 explicit_bzero(&c, sizeof(c));
456
457 return (md);
458}
459
441#endif 460#endif