-/* $OpenBSD: sha512.c,v 1.32 2023/04/12 04:54:16 jsing Exp $ */
+/* $OpenBSD: sha512.c,v 1.33 2023/04/14 10:41:34 jsing Exp $ */
/* ====================================================================
* Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved.
*
int
SHA384_Init(SHA512_CTX *c)
{
+ memset(c, 0, sizeof(*c));
+
c->h[0] = U64(0xcbbb9d5dc1059ed8);
c->h[1] = U64(0x629a292a367cd507);
c->h[2] = U64(0x9159015a3070dd17);
c->h[6] = U64(0xdb0c2e0d64f98fa7);
c->h[7] = U64(0x47b5481dbefa4fa4);
- c->Nl = 0;
- c->Nh = 0;
- c->num = 0;
c->md_len = SHA384_DIGEST_LENGTH;
+
return 1;
}
int
SHA512_Init(SHA512_CTX *c)
{
+ memset(c, 0, sizeof(*c));
+
c->h[0] = U64(0x6a09e667f3bcc908);
c->h[1] = U64(0xbb67ae8584caa73b);
c->h[2] = U64(0x3c6ef372fe94f82b);
c->h[6] = U64(0x1f83d9abfb41bd6b);
c->h[7] = U64(0x5be0cd19137e2179);
- c->Nl = 0;
- c->Nh = 0;
- c->num = 0;
c->md_len = SHA512_DIGEST_LENGTH;
+
return 1;
}