summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2023-12-12 08:48:23 -0800
committerJohn Wiegley <johnw@newartisans.com>2024-08-05 08:35:56 -0700
commit3a8817a57f0a79f721f1da258fa870f161caa1ba (patch)
tree9229365bff3085070b7242b7e989bac4ac339783
parentd496c8a95f6bd43daf981d6274ec616c2348d040 (diff)
downloadfork-ledger-3a8817a57f0a79f721f1da258fa870f161caa1ba.tar.gz
fork-ledger-3a8817a57f0a79f721f1da258fa870f161caa1ba.tar.bz2
fork-ledger-3a8817a57f0a79f721f1da258fa870f161caa1ba.zip
Remove most changes to sha512.cc
-rw-r--r--src/sha512.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/sha512.cc b/src/sha512.cc
index 8e639f93..4d13a002 100644
--- a/src/sha512.cc
+++ b/src/sha512.cc
@@ -1,3 +1,5 @@
+#define uint8_t unsigned char // <-- added by John Wiegley for compilation
+
/*
* FILE: sha2.c
* AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/
@@ -41,9 +43,7 @@
* $Id: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $
*/
#include <string.h> /* memcpy()/memset() or bcopy()/bzero() */
-#include <stdint.h> /* memcpy()/memset() or bcopy()/bzero() */
#include <assert.h> /* assert() */
-#include <sys/types.h>
extern "C" {
@@ -59,6 +59,12 @@ typedef struct _SHA512_CTX {
} SHA512_CTX;
#endif /* do we have sha512 header defs */
+void SHA512_Init(SHA512_CTX*);
+void SHA512_Update(SHA512_CTX*, void*, size_t);
+void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
+unsigned char *SHA512(void *data, unsigned int data_len, unsigned char *digest);
+
+
/*** SHA-256/384/512 Machine Architecture Definitions *****************/
/*
* BYTE_ORDER NOTE:
@@ -433,7 +439,7 @@ static void SHA512_Last(SHA512_CTX* context) {
SHA512_Transform(context, (sha2_word64*)context->buffer);
}
-void SHA512_Final(uint8_t digest[], SHA512_CTX* context) {
+void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
sha2_word64 *d = (sha2_word64*)digest;
/* Sanity check: */
@@ -462,8 +468,8 @@ void SHA512_Final(uint8_t digest[], SHA512_CTX* context) {
MEMSET_BZERO(context, sizeof(SHA512_CTX));
}
-uint8_t *
-SHA512(void *data, unsigned int data_len, uint8_t *digest)
+unsigned char *
+SHA512(void *data, unsigned int data_len, unsigned char *digest)
{
SHA512_CTX ctx;
SHA512_Init(&ctx);