Improve Visual C++ compat.

This commit is contained in:
Frank Denis
2013-04-22 12:35:59 -07:00
parent c21c7eb3f7
commit b146c5150a
14 changed files with 34 additions and 16 deletions
@@ -3,7 +3,7 @@
#include "crypto_scalarmult_curve25519.h"
static const unsigned char sigma[16] = {
'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', 'k'
'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
};
static const unsigned char n[16] = {0};
@@ -9,7 +9,7 @@ Preconditions:
|f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc.
*/
static const unsigned char zero[32];
static unsigned char zero[32];
int fe_isnonzero(const fe f)
{
@@ -9,7 +9,9 @@ Public domain.
typedef unsigned int uint32;
static const unsigned char sigma[16] = "expand 32-byte k";
static const unsigned char sigma[16] = {
'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
};
int crypto_stream(
unsigned char *c,unsigned long long clen,
@@ -9,7 +9,9 @@ Public domain.
typedef unsigned int uint32;
static const unsigned char sigma[16] = "expand 32-byte k";
static const unsigned char sigma[16] = {
'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
};
int crypto_stream_xor(
unsigned char *c,
@@ -9,7 +9,9 @@ Public domain.
typedef unsigned int uint32;
static const unsigned char sigma[16] = "expand 32-byte k";
static const unsigned char sigma[16] = {
'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
};
int crypto_stream(
unsigned char *c,unsigned long long clen,
@@ -9,7 +9,9 @@ Public domain.
typedef unsigned int uint32;
static const unsigned char sigma[16] = "expand 32-byte k";
static const unsigned char sigma[16] = {
'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
};
int crypto_stream_xor(
unsigned char *c,
@@ -9,7 +9,9 @@ Public domain.
typedef unsigned int uint32;
static const unsigned char sigma[16] = "expand 32-byte k";
static const unsigned char sigma[16] = {
'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
};
int crypto_stream(
unsigned char *c,unsigned long long clen,
@@ -9,7 +9,9 @@ Public domain.
typedef unsigned int uint32;
static const unsigned char sigma[16] = "expand 32-byte k";
static const unsigned char sigma[16] = {
'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
};
int crypto_stream_xor(
unsigned char *c,
@@ -8,7 +8,9 @@ Public domain.
#include "crypto_core_hsalsa20.h"
#include "crypto_stream_salsa20.h"
static const unsigned char sigma[16] = "expand 32-byte k";
static const unsigned char sigma[16] = {
'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
};
int crypto_stream(
unsigned char *c,unsigned long long clen,
@@ -8,7 +8,9 @@ Public domain.
#include "crypto_core_hsalsa20.h"
#include "crypto_stream_salsa20.h"
static const unsigned char sigma[16] = "expand 32-byte k";
static const unsigned char sigma[16] = {
'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k'
};
int crypto_stream_xor(
unsigned char *c,
+2 -2
View File
@@ -10,8 +10,8 @@
extern "C" {
#endif
void *_sodium_alignedcalloc(unsigned char ** const unaligned_p,
const size_t len);
unsigned char *_sodium_alignedcalloc(unsigned char ** const unaligned_p,
const size_t len);
SODIUM_EXPORT
void sodium_memzero(void * const pnt, const size_t len);
@@ -262,7 +262,7 @@ randombytes_salsa20_random_buf(void * const buf, const size_t size)
#ifdef ULONG_LONG_MAX
assert(size <= ULONG_LONG_MAX);
#endif
ret = crypto_stream_salsa20(buf, (unsigned long long) size,
ret = crypto_stream_salsa20((unsigned char *) buf, (unsigned long long) size,
(unsigned char *) &stream.nonce,
stream.key);
assert(ret == 0);
+3 -1
View File
@@ -1,8 +1,10 @@
#include <stdbool.h>
#include "core.h"
#include "crypto_onetimeauth.h"
static _Bool initialized;
static bool initialized;
int
sodium_init(void)
+2 -2
View File
@@ -27,7 +27,7 @@ sodium_memzero(void * const pnt, const size_t len)
#endif
}
void *
unsigned char *
_sodium_alignedcalloc(unsigned char ** const unaligned_p, const size_t len)
{
unsigned char *aligned;
@@ -35,7 +35,7 @@ _sodium_alignedcalloc(unsigned char ** const unaligned_p, const size_t len)
size_t i;
if (SIZE_MAX - (size_t) 256U < len ||
(unaligned = malloc(len + (size_t) 256U)) == NULL) {
(unaligned = (unsigned char *) malloc(len + (size_t) 256U)) == NULL) {
*unaligned_p = NULL;
return NULL;
}