Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/openssl/dist/crypto/evp Provide SHAR384 ...



details:   https://anonhg.NetBSD.org/src/rev/7688b3769f8b
branches:  trunk
changeset: 359523:7688b3769f8b
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Feb 13 22:35:47 2018 +0000

description:
Provide SHAR384 flavors: The OpenSSL SHA512_Final implementation is re-used
to implement SHA384_Final, but does the right thing by checking the internally
kept digest size. The NetBSD libc implementation provides two entry points
that write a different size digest, so if we use the SHA512_Final from here
we end up overwriting memory.

diffstat:

 crypto/external/bsd/openssl/dist/crypto/evp/m_sha1.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r c1b09c91d263 -r 7688b3769f8b crypto/external/bsd/openssl/dist/crypto/evp/m_sha1.c
--- a/crypto/external/bsd/openssl/dist/crypto/evp/m_sha1.c      Tue Feb 13 22:32:10 2018 +0000
+++ b/crypto/external/bsd/openssl/dist/crypto/evp/m_sha1.c      Tue Feb 13 22:35:47 2018 +0000
@@ -178,6 +178,16 @@
     return SHA384_Init(EVP_MD_CTX_md_data(ctx));
 }
 
+static int update384(EVP_MD_CTX *ctx, const void *data, size_t count)
+{
+    return SHA384_Update(EVP_MD_CTX_md_data(ctx), data, count);
+}
+
+static int final384(EVP_MD_CTX *ctx, unsigned char *md)
+{
+    return SHA384_Final(md, EVP_MD_CTX_md_data(ctx));
+}
+
 static int init512(EVP_MD_CTX *ctx)
 {
     return SHA512_Init(EVP_MD_CTX_md_data(ctx));
@@ -200,8 +210,8 @@
     SHA384_DIGEST_LENGTH,
     EVP_MD_FLAG_DIGALGID_ABSENT,
     init384,
-    update512,
-    final512,
+    update384,
+    final384,
     NULL,
     NULL,
     SHA512_CBLOCK,



Home | Main Index | Thread Index | Old Index