Skip to content

Commit

Permalink
Remove most changes to sha512.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
jwiegley committed Aug 5, 2024
1 parent d496c8a commit 3a8817a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/sha512.cc
Original file line number Diff line number Diff line change
@@ -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/
Expand Down Expand Up @@ -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" {

Expand All @@ -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:
Expand Down Expand Up @@ -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: */
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3a8817a

Please sign in to comment.