mirror of
https://github.com/monero-project/monero.git
synced 2024-12-15 04:46:31 +02:00
Support building cncrypto lib with msvc
This commit is contained in:
parent
5f09d6c833
commit
7c4424531f
@ -34,7 +34,10 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef _MSC_VER
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
#include <byteswap.h>
|
#include <byteswap.h>
|
||||||
@ -206,6 +209,12 @@ static inline void memcpy_swap64(void *dst, const void *src, size_t n) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _MSC_VER
|
||||||
|
# define LITTLE_ENDIAN 1234
|
||||||
|
# define BIG_ENDIAN 4321
|
||||||
|
# define BYTE_ORDER LITTLE_ENDIAN
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN) || !defined(BIG_ENDIAN)
|
#if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN) || !defined(BIG_ENDIAN)
|
||||||
static_assert(false, "BYTE_ORDER is undefined. Perhaps, GNU extensions are not enabled");
|
static_assert(false, "BYTE_ORDER is undefined. Perhaps, GNU extensions are not enabled");
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,7 +6,9 @@ Public domain.
|
|||||||
|
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#ifndef _MSC_VER
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "chacha.h"
|
#include "chacha.h"
|
||||||
#include "common/int-util.h"
|
#include "common/int-util.h"
|
||||||
|
@ -53,6 +53,12 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define GETPID() _getpid()
|
||||||
|
#else
|
||||||
|
#define GETPID() getpid()
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "oaes_config.h"
|
#include "oaes_config.h"
|
||||||
#include "oaes_lib.h"
|
#include "oaes_lib.h"
|
||||||
|
|
||||||
@ -478,7 +484,7 @@ static void oaes_get_seed( char buf[RANDSIZ + 1] )
|
|||||||
sprintf( buf, "%04d%02d%02d%02d%02d%02d%03d%p%d",
|
sprintf( buf, "%04d%02d%02d%02d%02d%02d%03d%p%d",
|
||||||
gmTimer->tm_year + 1900, gmTimer->tm_mon + 1, gmTimer->tm_mday,
|
gmTimer->tm_year + 1900, gmTimer->tm_mon + 1, gmTimer->tm_mday,
|
||||||
gmTimer->tm_hour, gmTimer->tm_min, gmTimer->tm_sec, timer.millitm,
|
gmTimer->tm_hour, gmTimer->tm_min, gmTimer->tm_sec, timer.millitm,
|
||||||
_test + timer.millitm, getpid() );
|
_test + timer.millitm, GETPID() );
|
||||||
#else
|
#else
|
||||||
struct timeval timer;
|
struct timeval timer;
|
||||||
struct tm *gmTimer;
|
struct tm *gmTimer;
|
||||||
@ -490,7 +496,7 @@ static void oaes_get_seed( char buf[RANDSIZ + 1] )
|
|||||||
sprintf( buf, "%04d%02d%02d%02d%02d%02d%03d%p%d",
|
sprintf( buf, "%04d%02d%02d%02d%02d%02d%03d%p%d",
|
||||||
gmTimer->tm_year + 1900, gmTimer->tm_mon + 1, gmTimer->tm_mday,
|
gmTimer->tm_year + 1900, gmTimer->tm_mon + 1, gmTimer->tm_mday,
|
||||||
gmTimer->tm_hour, gmTimer->tm_min, gmTimer->tm_sec, timer.tv_usec/1000,
|
gmTimer->tm_hour, gmTimer->tm_min, gmTimer->tm_sec, timer.tv_usec/1000,
|
||||||
_test + timer.tv_usec/1000, getpid() );
|
_test + timer.tv_usec/1000, GETPID() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( _test )
|
if( _test )
|
||||||
@ -510,7 +516,7 @@ static uint32_t oaes_get_seed(void)
|
|||||||
_test = (char *) calloc( sizeof( char ), timer.millitm );
|
_test = (char *) calloc( sizeof( char ), timer.millitm );
|
||||||
_ret = gmTimer->tm_year + 1900 + gmTimer->tm_mon + 1 + gmTimer->tm_mday +
|
_ret = gmTimer->tm_year + 1900 + gmTimer->tm_mon + 1 + gmTimer->tm_mday +
|
||||||
gmTimer->tm_hour + gmTimer->tm_min + gmTimer->tm_sec + timer.millitm +
|
gmTimer->tm_hour + gmTimer->tm_min + gmTimer->tm_sec + timer.millitm +
|
||||||
(uintptr_t) ( _test + timer.millitm ) + getpid();
|
(uintptr_t) ( _test + timer.millitm ) + GETPID();
|
||||||
#else
|
#else
|
||||||
struct timeval timer;
|
struct timeval timer;
|
||||||
struct tm *gmTimer;
|
struct tm *gmTimer;
|
||||||
@ -522,7 +528,7 @@ static uint32_t oaes_get_seed(void)
|
|||||||
_test = (char *) calloc( sizeof( char ), timer.tv_usec/1000 );
|
_test = (char *) calloc( sizeof( char ), timer.tv_usec/1000 );
|
||||||
_ret = gmTimer->tm_year + 1900 + gmTimer->tm_mon + 1 + gmTimer->tm_mday +
|
_ret = gmTimer->tm_year + 1900 + gmTimer->tm_mon + 1 + gmTimer->tm_mday +
|
||||||
gmTimer->tm_hour + gmTimer->tm_min + gmTimer->tm_sec + timer.tv_usec/1000 +
|
gmTimer->tm_hour + gmTimer->tm_min + gmTimer->tm_sec + timer.tv_usec/1000 +
|
||||||
(uintptr_t) ( _test + timer.tv_usec/1000 ) + getpid();
|
(uintptr_t) ( _test + timer.tv_usec/1000 ) + GETPID();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( _test )
|
if( _test )
|
||||||
|
@ -34,7 +34,9 @@
|
|||||||
|
|
||||||
#include "hash-ops.h"
|
#include "hash-ops.h"
|
||||||
|
|
||||||
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
|
#ifdef _MSC_VER
|
||||||
|
#include <malloc.h>
|
||||||
|
#elif !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__)
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
#else
|
#else
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user