mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-25 17:25:37 +01:00
- Fixed MS Visual C++ name clash with int64 in sha4.h
This commit is contained in:
parent
c0a1a319df
commit
4f5ae803fa
@ -52,6 +52,7 @@ Bugfix
|
|||||||
* If certificate serial is longer than 32 octets, serial number is now
|
* If certificate serial is longer than 32 octets, serial number is now
|
||||||
appended with '....' after first 28 octets
|
appended with '....' after first 28 octets
|
||||||
* Improved build support for s390x and sparc64 in bignum.h
|
* Improved build support for s390x and sparc64 in bignum.h
|
||||||
|
* Fixed MS Visual C++ name clash with int64 in sha4.h
|
||||||
|
|
||||||
= Version 1.0.0 released on 2011-07-27
|
= Version 1.0.0 released on 2011-07-27
|
||||||
Features
|
Features
|
||||||
|
@ -31,10 +31,10 @@
|
|||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
#if defined(_MSC_VER) || defined(__WATCOMC__)
|
||||||
#define UL64(x) x##ui64
|
#define UL64(x) x##ui64
|
||||||
#define int64 __int64
|
#define long64 __int64
|
||||||
#else
|
#else
|
||||||
#define UL64(x) x##ULL
|
#define UL64(x) x##ULL
|
||||||
#define int64 long long
|
#define long64 long long
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,8 +42,8 @@
|
|||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned int64 total[2]; /*!< number of bytes processed */
|
unsigned long64 total[2]; /*!< number of bytes processed */
|
||||||
unsigned int64 state[8]; /*!< intermediate digest state */
|
unsigned long64 state[8]; /*!< intermediate digest state */
|
||||||
unsigned char buffer[128]; /*!< data block being processed */
|
unsigned char buffer[128]; /*!< data block being processed */
|
||||||
|
|
||||||
unsigned char ipad[128]; /*!< HMAC: inner padding */
|
unsigned char ipad[128]; /*!< HMAC: inner padding */
|
||||||
|
@ -44,14 +44,14 @@
|
|||||||
#ifndef GET_UINT64_BE
|
#ifndef GET_UINT64_BE
|
||||||
#define GET_UINT64_BE(n,b,i) \
|
#define GET_UINT64_BE(n,b,i) \
|
||||||
{ \
|
{ \
|
||||||
(n) = ( (unsigned int64) (b)[(i) ] << 56 ) \
|
(n) = ( (unsigned long64) (b)[(i) ] << 56 ) \
|
||||||
| ( (unsigned int64) (b)[(i) + 1] << 48 ) \
|
| ( (unsigned long64) (b)[(i) + 1] << 48 ) \
|
||||||
| ( (unsigned int64) (b)[(i) + 2] << 40 ) \
|
| ( (unsigned long64) (b)[(i) + 2] << 40 ) \
|
||||||
| ( (unsigned int64) (b)[(i) + 3] << 32 ) \
|
| ( (unsigned long64) (b)[(i) + 3] << 32 ) \
|
||||||
| ( (unsigned int64) (b)[(i) + 4] << 24 ) \
|
| ( (unsigned long64) (b)[(i) + 4] << 24 ) \
|
||||||
| ( (unsigned int64) (b)[(i) + 5] << 16 ) \
|
| ( (unsigned long64) (b)[(i) + 5] << 16 ) \
|
||||||
| ( (unsigned int64) (b)[(i) + 6] << 8 ) \
|
| ( (unsigned long64) (b)[(i) + 6] << 8 ) \
|
||||||
| ( (unsigned int64) (b)[(i) + 7] ); \
|
| ( (unsigned long64) (b)[(i) + 7] ); \
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -72,7 +72,7 @@
|
|||||||
/*
|
/*
|
||||||
* Round constants
|
* Round constants
|
||||||
*/
|
*/
|
||||||
static const unsigned int64 K[80] =
|
static const unsigned long64 K[80] =
|
||||||
{
|
{
|
||||||
UL64(0x428A2F98D728AE22), UL64(0x7137449123EF65CD),
|
UL64(0x428A2F98D728AE22), UL64(0x7137449123EF65CD),
|
||||||
UL64(0xB5C0FBCFEC4D3B2F), UL64(0xE9B5DBA58189DBBC),
|
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] )
|
static void sha4_process( sha4_context *ctx, const unsigned char data[128] )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned int64 temp1, temp2, W[80];
|
unsigned long64 temp1, temp2, W[80];
|
||||||
unsigned int64 A, B, C, D, E, F, G, H;
|
unsigned long64 A, B, C, D, E, F, G, H;
|
||||||
|
|
||||||
#define SHR(x,n) (x >> n)
|
#define SHR(x,n) (x >> n)
|
||||||
#define ROTR(x,n) (SHR(x,n) | (x << (64 - 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);
|
left = (unsigned int) (ctx->total[0] & 0x7F);
|
||||||
fill = 128 - left;
|
fill = 128 - left;
|
||||||
|
|
||||||
ctx->total[0] += (unsigned int64) ilen;
|
ctx->total[0] += (unsigned long64) ilen;
|
||||||
|
|
||||||
if( ctx->total[0] < (unsigned int64) ilen )
|
if( ctx->total[0] < (unsigned long64) ilen )
|
||||||
ctx->total[1]++;
|
ctx->total[1]++;
|
||||||
|
|
||||||
if( left && ilen >= fill )
|
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] )
|
void sha4_finish( sha4_context *ctx, unsigned char output[64] )
|
||||||
{
|
{
|
||||||
size_t last, padn;
|
size_t last, padn;
|
||||||
unsigned int64 high, low;
|
unsigned long64 high, low;
|
||||||
unsigned char msglen[16];
|
unsigned char msglen[16];
|
||||||
|
|
||||||
high = ( ctx->total[0] >> 61 )
|
high = ( ctx->total[0] >> 61 )
|
||||||
|
Loading…
Reference in New Issue
Block a user