uint8_t Pad_Byte)
{
/*
* Check to see if the current message block is too small to hold
* the initial padding bits and length. If so, we will pad the
* block, process it, and then continue padding into a second
* block.
*/
if (context->Message_Block_Index >= (SHA256_Message_Block_Size-8)) {
context->Message_Block[context->Message_Block_Index++] = Pad_Byte;
while (context->Message_Block_Index < SHA256_Message_Block_Size)
context->Message_Block[context->Message_Block_Index++] = 0;
SHA224_256ProcessMessageBlock(context);
} else
context->Message_Block[context->Message_Block_Index++] = Pad_Byte;
while (context->Message_Block_Index < (SHA256_Message_Block_Size-8))
context->Message_Block[context->Message_Block_Index++] = 0;
/*
* Store the message length as the last 8 octets
*/
context->Message_Block[56] = (uint8_t)(context->Length_High >> 24);
context->Message_Block[57] = (uint8_t)(context->Length_High >> 16);
context->Message_Block[58] = (uint8_t)(context->Length_High >> 8);
context->Message_Block[59] = (uint8_t)(context->Length_High);
context->Message_Block[60] = (uint8_t)(context->Length_Low >> 24);
context->Message_Block[61] = (uint8_t)(context->Length_Low >> 16);
context->Message_Block[62] = (uint8_t)(context->Length_Low >> 8);
context->Message_Block[63] = (uint8_t)(context->Length_Low);
SHA224_256ProcessMessageBlock(context);
}
/*
* SHA224_256ProcessMessageBlock
*
* Description:
* This function will process the next 512 bits of the message
* stored in the Message_Block array.
*
* Parameters:
* context: [in/out]
* The SHA context to update
*
* Returns:
* Nothing.
*
* Comments:
* Many of the variable names in this code, especially the
* single character names, were used because those were the
* names used in the publication.
*/
static void SHA224_256ProcessMessageBlock(SHA256Context *context)
{
/* Constants defined in FIPS-180-2, section 4.2.2 */
static const uint32_t K[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,
0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01,
0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7,
0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152,
0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc,
0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,
0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,
0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,
0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
};
int t, t4; /* Loop counter */
uint32_t temp1, temp2; /* Temporary word value */
uint32_t W[64]; /* Word sequence */
uint32_t A, B, C, D, E, F, G, H; /* Word buffers */
/*
* Initialize the first 16 words in the array W
*/
for (t = t4 = 0; t < 16; t++, t4 += 4)
W[t] = (((uint32_t)context->Message_Block[t4]) << 24) |
(((uint32_t)context->Message_Block[t4 + 1]) << 16) |
(((uint32_t)context->Message_Block[t4 + 2]) << 8) |
(((uint32_t)context->Message_Block[t4 + 3]));
for (t = 16; t < 64; t++)
W[t] = SHA256_sigma1(W[t-2]) + W[t-7] +
SHA256_sigma0(W[t-15]) + W[t-16];
A = context->Intermediate_Hash[0];
B = context->Intermediate_Hash[1];
C = context->Intermediate_Hash[2];
D = context->Intermediate_Hash[3];
E = context->Intermediate_Hash[4];
F = context->Intermediate_Hash[5];
G = context->Intermediate_Hash[6];
H = context->Intermediate_Hash[7];
for (t = 0; t < 64; t++) {
temp1 = H + SHA256_SIGMA1(E) + SHA_Ch(E,F,G) + K[t] + W[t];
temp2 = SHA256_SIGMA0(A) + SHA_Maj(A,B,C);
H = G;
G = F;
F = E;
E = D + temp1;
D = C;
C = B;
B = A;
A = temp1 + temp2;
}
context->Intermediate_Hash[0] += A;
context->Intermediate_Hash[1] += B;
context->Intermediate_Hash[2] += C;
context->Intermediate_Hash[3] += D;
context->Intermediate_Hash[4] += E;
context->Intermediate_Hash[5] += F;
context->Intermediate_Hash[6] += G;
context->Intermediate_Hash[7] += H;
context->Message_Block_Index = 0;
}
/*
* SHA224_256Reset
*
* Description:
* This helper function will initialize the SHA256Context in
* preparation for computing a new SHA256 message digest.
*
* Parameters:
* context: [in/out]
* The context to reset.
* H0
* The initial hash value to use.
*
* Returns:
* sha Error Code.
*/
static int SHA224_256Reset(SHA256Context *context, uint32_t *H0)
{
if (!context)
return shaNull;
context->Length_Low = 0;
context->Length_High = 0;
context->Message_Block_Index = 0;
context->Intermediate_Hash[0] = H0[0];
context->Intermediate_Hash[1] = H0[1];
context->Intermediate_Hash[2] = H0[2];
context->Intermediate_Hash[3] = H0[3];
context->Intermediate_Hash[4] = H0[4];
context->Intermediate_Hash[5] = H0[5];
context->Intermediate_Hash[6] = H0[6];
context->Intermediate_Hash[7] = H0[7];
context->Computed = 0;
context->Corrupted = 0;
return shaSuccess;
}
/*
* SHA224_256ResultN
*
* Description:
* This helper function will return the 224-bit or 256-bit message
* digest into the Message_Digest array provided by the caller.
* NOTE: The first octet of hash is stored in the 0th element,
* the last octet of hash in the 28th/32nd element.
*
* Parameters:
* context: [in/out]
* The context to use to calculate the SHA hash.
* Message_Digest: [out]
* Where the digest is returned.
* HashSize: [in]
* The size of the hash, either 28 or 32.
*
* Returns:
* sha Error Code.
*/
static int SHA224_256ResultN(SHA256Context *context,
uint8_t Message_Digest[], int HashSize)
{
int i;
if (!context || !Message_Digest)
return shaNull;
if (context->Corrupted)
return context->Corrupted;
if (!context->Computed)
SHA224_256Finalize(context, 0x80);
for (i = 0; i < HashSize; ++i)
Message_Digest[i] = (uint8_t)
(context->Intermediate_Hash[i>>2] >> 8 * ( 3 - ( i & 0x03 ) ));
return shaSuccess;
}
8.2.3. sha384-512.c
/*************************** sha384-512.c ***************************/
/********************* See RFC 4634 for details *********************/
/*
* Description:
* This file implements the Secure Hash Signature Standard
* algorithms as defined in the National Institute of Standards
* and Technology Federal Information Processing Standards
* Publication (FIPS PUB) 180-1 published on April 17, 1995, 180-2
* published on August 1, 2002, and the FIPS PUB 180-2 Change
* Notice published on February 28, 2004.
*
* A combined document showing all algorithms is available at
* http://csrc.nist.gov/publications/fips/
* fips180-2/fips180-2withchangenotice.pdf
*
* The SHA-384 and SHA-512 algorithms produce 384-bit and 512-bit
* message digests for a given data stream. It should take about
* 2**n steps to find a message with the same digest as a given
* message and 2**(n/2) to find any two messages with the same
* digest, when n is the digest size in bits. Therefore, this
* algorithm can serve as a means of providing a
* "fingerprint" for a message.
*
* Portability Issues:
* SHA-384 and SHA-512 are defined in terms of 64-bit "words",
* but if USE_32BIT_ONLY is #defined, this code is implemented in
* terms of 32-bit "words". This code uses <stdint.h> (included
* via "sha.h") to define the 64, 32 and 8 bit unsigned integer
* types. If your C compiler does not support 64 bit unsigned
* integers, and you do not #define USE_32BIT_ONLY, this code is
* not appropriate.
*
* Caveats:
* SHA-384 and SHA-512 are designed to work with messages less
* than 2^128 bits long. This implementation uses
* SHA384/512Input() to hash the bits that are a multiple of the
* size of an 8-bit character, and then uses SHA384/256FinalBits()
* to hash the final few bits of the input.
*
*/
#include "sha.h"
#include "sha-private.h"
#ifdef USE_32BIT_ONLY
/*
* Define 64-bit arithmetic in terms of 32-bit arithmetic.
* Each 64-bit number is represented in a 2-word array.
* All macros are defined such that the result is the last parameter.
*/
/*
* Define shift, rotate left and rotate right functions
*/
#define SHA512_SHR(bits, word, ret) ( \
/* (((uint64_t)((word))) >> (bits)) */ \
(ret)[0] = (((bits) < 32) && ((bits) >= 0)) ? \
((word)[0] >> (bits)) : 0, \
(ret)[1] = ((bits) > 32) ? ((word)[0] >> ((bits) - 32)) : \
((bits) == 32) ? (word)[0] : \
((bits) >= 0) ? \
(((word)[0] << (32 - (bits))) | \
((word)[1] >> (bits))) : 0 )
#define SHA512_SHL(bits, word, ret) ( \
/* (((uint64_t)(word)) << (bits)) */ \
(ret)[0] = ((bits) > 32) ? ((word)[1] << ((bits) - 32)) : \
((bits) == 32) ? (word)[1] : \
((bits) >= 0) ? \
(((word)[0] << (bits)) | \
((word)[1] >> (32 - (bits)))) : \
0, \
(ret)[1] = (((bits) < 32) && ((bits) >= 0)) ? \
((word)[1] << (bits)) : 0 )
/*
* Define 64-bit OR
*/
#define SHA512_OR(word1, word2, ret) ( \
(ret)[0] = (word1)[0] | (word2)[0], \
(ret)[1] = (word1)[1] | (word2)[1] )
/*
* Define 64-bit XOR
*/
#define SHA512_XOR(word1, word2, ret) ( \
(ret)[0] = (word1)[0] ^ (word2)[0], \
(ret)[1] = (word1)[1] ^ (word2)[1] )
/*
* Define 64-bit AND
*/
#define SHA512_AND(word1, word2, ret) ( \
(ret)[0] = (word1)[0] & (word2)[0], \
(ret)[1] = (word1)[1] & (word2)[1] )
/*
* Define 64-bit TILDA
*/
#define SHA512_TILDA(word, ret) \
( (ret)[0] = ~(word)[0], (ret)[1] = ~(word)[1] )
/*
* Define 64-bit ADD
*/
#define SHA512_ADD(word1, word2, ret) ( \
(ret)[1] = (word1)[1], (ret)[1] += (word2)[1], \
(ret)[0] = (word1)[0] + (word2)[0] + ((ret)[1] < (word1)[1]) )
/*
* Add the 4word value in word2 to word1.
*/
static uint32_t ADDTO4_temp, ADDTO4_temp2;
#define SHA512_ADDTO4(word1, word2) ( \
ADDTO4_temp = (word1)[3], \
(word1)[3] += (word2)[3], \
ADDTO4_temp2 = (word1)[2], \
(word1)[2] += (word2)[2] + ((word1)[3] < ADDTO4_temp), \
ADDTO4_temp = (word1)[1], \
(word1)[1] += (word2)[1] + ((word1)[2] < ADDTO4_temp2), \
(word1)[0] += (word2)[0] + ((word1)[1] < ADDTO4_temp) )
/*
* Add the 2word value in word2 to word1.
*/
static uint32_t ADDTO2_temp;
#define SHA512_ADDTO2(word1, word2) ( \
ADDTO2_temp = (word1)[1], \
(word1)[1] += (word2)[1], \
(word1)[0] += (word2)[0] + ((word1)[1] < ADDTO2_temp) )
/*
* SHA rotate ((word >> bits) | (word << (64-bits)))
*/
static uint32_t ROTR_temp1[2], ROTR_temp2[2];
#define SHA512_ROTR(bits, word, ret) ( \
SHA512_SHR((bits), (word), ROTR_temp1), \
SHA512_SHL(64-(bits), (word), ROTR_temp2), \
SHA512_OR(ROTR_temp1, ROTR_temp2, (ret)) )
/*
* Define the SHA SIGMA and sigma macros
* SHA512_ROTR(28,word) ^ SHA512_ROTR(34,word) ^ SHA512_ROTR(39,word)
*/
static uint32_t SIGMA0_temp1[2], SIGMA0_temp2[2],
SIGMA0_temp3[2], SIGMA0_temp4[2];
#define SHA512_SIGMA0(word, ret) ( \
SHA512_ROTR(28, (word), SIGMA0_temp1), \
SHA512_ROTR(34, (word), SIGMA0_temp2), \
SHA512_ROTR(39, (word), SIGMA0_temp3), \
SHA512_XOR(SIGMA0_temp2, SIGMA0_temp3, SIGMA0_temp4), \
SHA512_XOR(SIGMA0_temp1, SIGMA0_temp4, (ret)) )
/*
* SHA512_ROTR(14,word) ^ SHA512_ROTR(18,word) ^ SHA512_ROTR(41,word)
*/
static uint32_t SIGMA1_temp1[2], SIGMA1_temp2[2],
SIGMA1_temp3[2], SIGMA1_temp4[2];
#define SHA512_SIGMA1(word, ret) ( \
SHA512_ROTR(14, (word), SIGMA1_temp1), \
SHA512_ROTR(18, (word), SIGMA1_temp2), \
SHA512_ROTR(41, (word), SIGMA1_temp3), \
SHA512_XOR(SIGMA1_temp2, SIGMA1_temp3, SIGMA1_temp4), \
SHA512_XOR(SIGMA1_temp1, SIGMA1_temp4, (ret)) )
/*
* (SHA512_ROTR( 1,word) ^ SHA512_ROTR( 8,word) ^ SHA512_SHR( 7,word))
*/
static uint32_t sigma0_temp1[2], sigma0_temp2[2],
sigma0_temp3[2], sigma0_temp4[2];
#define SHA512_sigma0(word, ret) ( \
SHA512_ROTR( 1, (word), sigma0_temp1), \
SHA512_ROTR( 8, (word), sigma0_temp2), \
SHA512_SHR( 7, (word), sigma0_temp3), \
SHA512_XOR(sigma0_temp2, sigma0_temp3, sigma0_temp4), \
SHA512_XOR(sigma0_temp1, sigma0_temp4, (ret)) )
/*
* (SHA512_ROTR(19,word) ^ SHA512_ROTR(61,word) ^ SHA512_SHR( 6,word))
*/
static uint32_t sigma1_temp1[2], sigma1_temp2[2],
sigma1_temp3[2], sigma1_temp4[2];
#define SHA512_sigma1(word, ret) ( \
SHA512_ROTR(19, (word), sigma1_temp1), \
SHA512_ROTR(61, (word), sigma1_temp2), \
SHA512_SHR( 6, (word), sigma1_temp3), \
SHA512_XOR(sigma1_temp2, sigma1_temp3, sigma1_temp4), \
SHA512_XOR(sigma1_temp1, sigma1_temp4, (ret)) )
#undef SHA_Ch
#undef SHA_Maj
#ifndef USE_MODIFIED_MACROS
/*
* These definitions are the ones used in FIPS-180-2, section 4.1.3
* Ch(x,y,z) ((x & y) ^ (~x & z))
*/
static uint32_t Ch_temp1[2], Ch_temp2[2], Ch_temp3[2];
#define SHA_Ch(x, y, z, ret) ( \
SHA512_AND(x, y, Ch_temp1), \
SHA512_TILDA(x, Ch_temp2), \
SHA512_AND(Ch_temp2, z, Ch_temp3), \
SHA512_XOR(Ch_temp1, Ch_temp3, (ret)) )
/*
* Maj(x,y,z) (((x)&(y)) ^ ((x)&(z)) ^ ((y)&(z)))
*/
static uint32_t Maj_temp1[2], Maj_temp2[2],
Maj_temp3[2], Maj_temp4[2];
#define SHA_Maj(x, y, z, ret) ( \
SHA512_AND(x, y, Maj_temp1), \
SHA512_AND(x, z, Maj_temp2), \
SHA512_AND(y, z, Maj_temp3), \
SHA512_XOR(Maj_temp2, Maj_temp3, Maj_temp4), \
SHA512_XOR(Maj_temp1, Maj_temp4, (ret)) )
#else /* !USE_32BIT_ONLY */
/*
* These definitions are potentially faster equivalents for the ones
* used in FIPS-180-2, section 4.1.3.
* ((x & y) ^ (~x & z)) becomes
* ((x & (y ^ z)) ^ z)
*/
#define SHA_Ch(x, y, z, ret) ( \
(ret)[0] = (((x)[0] & ((y)[0] ^ (z)[0])) ^ (z)[0]), \
(ret)[1] = (((x)[1] & ((y)[1] ^ (z)[1])) ^ (z)[1]) )
/*
* ((x & y) ^ (x & z) ^ (y & z)) becomes
* ((x & (y | z)) | (y & z))
*/
#define SHA_Maj(x, y, z, ret) ( \
ret[0] = (((x)[0] & ((y)[0] | (z)[0])) | ((y)[0] & (z)[0])), \
ret[1] = (((x)[1] & ((y)[1] | (z)[1])) | ((y)[1] & (z)[1])) )
#endif /* USE_MODIFIED_MACROS */
/*
* add "length" to the length
*/
static uint32_t addTemp[4] = { 0, 0, 0, 0 };
#define SHA384_512AddLength(context, length) ( \
addTemp[3] = (length), SHA512_ADDTO4((context)->Length, addTemp), \
(context)->Corrupted = (((context)->Length[3] == 0) && \
((context)->Length[2] == 0) && ((context)->Length[1] == 0) && \
((context)->Length[0] < 8)) ? 1 : 0 )
/* Local Function Prototypes */
static void SHA384_512Finalize(SHA512Context *context,
uint8_t Pad_Byte);
static void SHA384_512PadMessage(SHA512Context *context,
uint8_t Pad_Byte);
static void SHA384_512ProcessMessageBlock(SHA512Context *context);
static int SHA384_512Reset(SHA512Context *context, uint32_t H0[]);
static int SHA384_512ResultN( SHA512Context *context,
uint8_t Message_Digest[], int HashSize);
/* Initial Hash Values: FIPS-180-2 sections 5.3.3 and 5.3.4 */
static uint32_t SHA384_H0[SHA512HashSize/4] = {
0xCBBB9D5D, 0xC1059ED8, 0x629A292A, 0x367CD507, 0x9159015A,
0x3070DD17, 0x152FECD8, 0xF70E5939, 0x67332667, 0xFFC00B31,
0x8EB44A87, 0x68581511, 0xDB0C2E0D, 0x64F98FA7, 0x47B5481D,
0xBEFA4FA4
};
static uint32_t SHA512_H0[SHA512HashSize/4] = {
0x6A09E667, 0xF3BCC908, 0xBB67AE85, 0x84CAA73B, 0x3C6EF372,
0xFE94F82B, 0xA54FF53A, 0x5F1D36F1, 0x510E527F, 0xADE682D1,
0x9B05688C, 0x2B3E6C1F, 0x1F83D9AB, 0xFB41BD6B, 0x5BE0CD19,
0x137E2179
};
#else /* !USE_32BIT_ONLY */
/* Define the SHA shift, rotate left and rotate right macro */
#define SHA512_SHR(bits,word) (((uint64_t)(word)) >> (bits))
#define SHA512_ROTR(bits,word) ((((uint64_t)(word)) >> (bits)) | \
(((uint64_t)(word)) << (64-(bits))))
/* Define the SHA SIGMA and sigma macros */
#define SHA512_SIGMA0(word) \
(SHA512_ROTR(28,word) ^ SHA512_ROTR(34,word) ^ SHA512_ROTR(39,word))
#define SHA512_SIGMA1(word) \
(SHA512_ROTR(14,word) ^ SHA512_ROTR(18,word) ^ SHA512_ROTR(41,word))
#define SHA512_sigma0(word) \
(SHA512_ROTR( 1,word) ^ SHA512_ROTR( 8,word) ^ SHA512_SHR( 7,word))
#define SHA512_sigma1(word) \
(SHA512_ROTR(19,word) ^ SHA512_ROTR(61,word) ^ SHA512_SHR( 6,word))
/*
* add "length" to the length
*/
static uint64_t addTemp;
#define SHA384_512AddLength(context, length) \
(addTemp = context->Length_Low, context->Corrupted = \
((context->Length_Low += length) < addTemp) && \
(++context->Length_High == 0) ? 1 : 0)
/* Local Function Prototypes */
static void SHA384_512Finalize(SHA512Context *context,
uint8_t Pad_Byte);
static void SHA384_512PadMessage(SHA512Context *context,
uint8_t Pad_Byte);
static void SHA384_512ProcessMessageBlock(SHA512Context *context);
static int SHA384_512Reset(SHA512Context *context, uint64_t H0[]);
static int SHA384_512ResultN(SHA512Context *context,
uint8_t Message_Digest[], int HashSize);
/* Initial Hash Values: FIPS-180-2 sections 5.3.3 and 5.3.4 */
static uint64_t SHA384_H0[] = {
0xCBBB9D5DC1059ED8ll, 0x629A292A367CD507ll, 0x9159015A3070DD17ll,
0x152FECD8F70E5939ll, 0x67332667FFC00B31ll, 0x8EB44A8768581511ll,
0xDB0C2E0D64F98FA7ll, 0x47B5481DBEFA4FA4ll
};
static uint64_t SHA512_H0[] = {
0x6A09E667F3BCC908ll, 0xBB67AE8584CAA73Bll, 0x3C6EF372FE94F82Bll,
0xA54FF53A5F1D36F1ll, 0x510E527FADE682D1ll, 0x9B05688C2B3E6C1Fll,
0x1F83D9ABFB41BD6Bll, 0x5BE0CD19137E2179ll
};
#endif /* USE_32BIT_ONLY */
/*
* SHA384Reset
*
* Description:
* This function will initialize the SHA384Context in preparation
* for computing a new SHA384 message digest.
*
* Parameters:
* context: [in/out]
* The context to reset.
*
* Returns:
* sha Error Code.
*
*/
int SHA384Reset(SHA384Context *context)
{
return SHA384_512Reset(context, SHA384_H0);
}
/*
* SHA384Input
*
* Description:
* This function accepts an array of octets as the next portion
* of the message.
*
* Parameters:
* context: [in/out]
* The SHA context to update
* message_array: [in]
* An array of characters representing the next portion of
* the message.
* length: [in]
* The length of the message in message_array
*
* Returns:
* sha Error Code.
*
*/
int SHA384Input(SHA384Context *context,
const uint8_t *message_array, unsigned int length)
{
return SHA512Input(context, message_array, length);
}
/*
* SHA384FinalBits
*
* Description:
* This function will add in any final bits of the message.
*
* Parameters:
* context: [in/out]
* The SHA context to update
* message_bits: [in]
* The final bits of the message, in the upper portion of the
* byte. (Use 0b###00000 instead of 0b00000### to input the
* three bits ###.)
* length: [in]
* The number of bits in message_bits, between 1 and 7.
*
* Returns:
* sha Error Code.
*
*/
int SHA384FinalBits(SHA384Context *context,
const uint8_t message_bits, unsigned int length)
{
return SHA512FinalBits(context, message_bits, length);
}
/*
* SHA384Result
*
* Description:
* This function will return the 384-bit message
* digest into the Message_Digest array provided by the caller.
* NOTE: The first octet of hash is stored in the 0th element,
* the last octet of hash in the 48th element.
*
* Parameters:
* context: [in/out]
* The context to use to calculate the SHA hash.
* Message_Digest: [out]
* Where the digest is returned.
*
* Returns:
* sha Error Code.
*
*/
int SHA384Result(SHA384Context *context,
uint8_t Message_Digest[SHA384HashSize])
{
return SHA384_512ResultN(context, Message_Digest, SHA384HashSize);
}
/*
* SHA512Reset
*
* Description:
* This function will initialize the SHA512Context in preparation
* for computing a new SHA512 message digest.
*
* Parameters:
* context: [in/out]
* The context to reset.
*
* Returns:
* sha Error Code.
*
*/
int SHA512Reset(SHA512Context *context)
{
return SHA384_512Reset(context, SHA512_H0);
}
/*
* SHA512Input
*
* Description:
* This function accepts an array of octets as the next portion
* of the message.
*
* Parameters:
* context: [in/out]
* The SHA context to update