mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-24 00:06:32 +01:00
- Moved from unsigned long to uint32_t throughout code
This commit is contained in:
parent
6adff7497a
commit
5c2364c2ba
34 changed files with 539 additions and 454 deletions
|
|
@ -44,14 +44,14 @@
|
|||
#ifndef GET_UINT64_BE
|
||||
#define GET_UINT64_BE(n,b,i) \
|
||||
{ \
|
||||
(n) = ( (unsigned long64) (b)[(i) ] << 56 ) \
|
||||
| ( (unsigned long64) (b)[(i) + 1] << 48 ) \
|
||||
| ( (unsigned long64) (b)[(i) + 2] << 40 ) \
|
||||
| ( (unsigned long64) (b)[(i) + 3] << 32 ) \
|
||||
| ( (unsigned long64) (b)[(i) + 4] << 24 ) \
|
||||
| ( (unsigned long64) (b)[(i) + 5] << 16 ) \
|
||||
| ( (unsigned long64) (b)[(i) + 6] << 8 ) \
|
||||
| ( (unsigned long64) (b)[(i) + 7] ); \
|
||||
(n) = ( (uint64_t) (b)[(i) ] << 56 ) \
|
||||
| ( (uint64_t) (b)[(i) + 1] << 48 ) \
|
||||
| ( (uint64_t) (b)[(i) + 2] << 40 ) \
|
||||
| ( (uint64_t) (b)[(i) + 3] << 32 ) \
|
||||
| ( (uint64_t) (b)[(i) + 4] << 24 ) \
|
||||
| ( (uint64_t) (b)[(i) + 5] << 16 ) \
|
||||
| ( (uint64_t) (b)[(i) + 6] << 8 ) \
|
||||
| ( (uint64_t) (b)[(i) + 7] ); \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
/*
|
||||
* Round constants
|
||||
*/
|
||||
static const unsigned long64 K[80] =
|
||||
static const uint64_t K[80] =
|
||||
{
|
||||
UL64(0x428A2F98D728AE22), UL64(0x7137449123EF65CD),
|
||||
UL64(0xB5C0FBCFEC4D3B2F), UL64(0xE9B5DBA58189DBBC),
|
||||
|
|
@ -155,8 +155,8 @@ void sha4_starts( sha4_context *ctx, int is384 )
|
|||
static void sha4_process( sha4_context *ctx, const unsigned char data[128] )
|
||||
{
|
||||
int i;
|
||||
unsigned long64 temp1, temp2, W[80];
|
||||
unsigned long64 A, B, C, D, E, F, G, H;
|
||||
uint64_t temp1, temp2, W[80];
|
||||
uint64_t A, B, C, D, E, F, G, H;
|
||||
|
||||
#define SHR(x,n) (x >> n)
|
||||
#define ROTR(x,n) (SHR(x,n) | (x << (64 - n)))
|
||||
|
|
@ -235,9 +235,9 @@ void sha4_update( sha4_context *ctx, const unsigned char *input, size_t ilen )
|
|||
left = (unsigned int) (ctx->total[0] & 0x7F);
|
||||
fill = 128 - left;
|
||||
|
||||
ctx->total[0] += (unsigned long64) ilen;
|
||||
ctx->total[0] += (uint64_t) ilen;
|
||||
|
||||
if( ctx->total[0] < (unsigned long64) ilen )
|
||||
if( ctx->total[0] < (uint64_t) ilen )
|
||||
ctx->total[1]++;
|
||||
|
||||
if( left && ilen >= fill )
|
||||
|
|
@ -282,7 +282,7 @@ static const unsigned char sha4_padding[128] =
|
|||
void sha4_finish( sha4_context *ctx, unsigned char output[64] )
|
||||
{
|
||||
size_t last, padn;
|
||||
unsigned long64 high, low;
|
||||
uint64_t high, low;
|
||||
unsigned char msglen[16];
|
||||
|
||||
high = ( ctx->total[0] >> 61 )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue