summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/sha/sha512.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/lib/libcrypto/sha/sha512.c b/src/lib/libcrypto/sha/sha512.c
index 3fe20de51b..9b4b2cf337 100644
--- a/src/lib/libcrypto/sha/sha512.c
+++ b/src/lib/libcrypto/sha/sha512.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sha512.c,v 1.26 2023/04/11 10:26:29 jsing Exp $ */ 1/* $OpenBSD: sha512.c,v 1.27 2023/04/11 10:32:21 jsing Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -581,28 +581,9 @@ SHA512_Final(unsigned char *md, SHA512_CTX *c)
581 sha512_block_data_order(c, p, 1); 581 sha512_block_data_order(c, p, 1);
582 } 582 }
583 583
584 memset (p + n, 0, sizeof(c->u) - 16 - n); 584 memset(p + n, 0, sizeof(c->u) - 16 - n);
585#if BYTE_ORDER == BIG_ENDIAN 585 c->u.d[SHA_LBLOCK - 2] = htobe64(c->Nh);
586 c->u.d[SHA_LBLOCK - 2] = c->Nh; 586 c->u.d[SHA_LBLOCK - 1] = htobe64(c->Nl);
587 c->u.d[SHA_LBLOCK - 1] = c->Nl;
588#else
589 p[sizeof(c->u) - 1] = (unsigned char)(c->Nl);
590 p[sizeof(c->u) - 2] = (unsigned char)(c->Nl >> 8);
591 p[sizeof(c->u) - 3] = (unsigned char)(c->Nl >> 16);
592 p[sizeof(c->u) - 4] = (unsigned char)(c->Nl >> 24);
593 p[sizeof(c->u) - 5] = (unsigned char)(c->Nl >> 32);
594 p[sizeof(c->u) - 6] = (unsigned char)(c->Nl >> 40);
595 p[sizeof(c->u) - 7] = (unsigned char)(c->Nl >> 48);
596 p[sizeof(c->u) - 8] = (unsigned char)(c->Nl >> 56);
597 p[sizeof(c->u) - 9] = (unsigned char)(c->Nh);
598 p[sizeof(c->u) - 10] = (unsigned char)(c->Nh >> 8);
599 p[sizeof(c->u) - 11] = (unsigned char)(c->Nh >> 16);
600 p[sizeof(c->u) - 12] = (unsigned char)(c->Nh >> 24);
601 p[sizeof(c->u) - 13] = (unsigned char)(c->Nh >> 32);
602 p[sizeof(c->u) - 14] = (unsigned char)(c->Nh >> 40);
603 p[sizeof(c->u) - 15] = (unsigned char)(c->Nh >> 48);
604 p[sizeof(c->u) - 16] = (unsigned char)(c->Nh >> 56);
605#endif
606 587
607 sha512_block_data_order(c, p, 1); 588 sha512_block_data_order(c, p, 1);
608 589