C++ compat

This commit is contained in:
Frank Denis 2019-01-03 09:49:33 +01:00
parent e614671fc8
commit 7ac557498f
3 changed files with 16 additions and 14 deletions

View File

@ -35,7 +35,7 @@
int xmain(void);
static void *guard_page;
static unsigned char *guard_page;
#ifdef BENCHMARKS
@ -167,9 +167,9 @@ static FILE *fp_res;
int main(void)
{
FILE *fp_out;
void *_guard_page;
int c;
FILE *fp_out;
unsigned char *_guard_page;
int c;
if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {
perror("fopen(" TEST_NAME_RES ")");
@ -178,11 +178,11 @@ int main(void)
if (sodium_init() != 0) {
return 99;
}
if ((_guard_page = sodium_malloc(0)) == NULL) {
if ((_guard_page = (unsigned char *) sodium_malloc(0)) == NULL) {
perror("sodium_malloc()");
return 99;
}
guard_page = (void *) (((unsigned char *) _guard_page) + 1);
guard_page = _guard_page + 1;
if (xmain() != 0) {
return 99;
}

View File

@ -45,7 +45,8 @@ sigabrt_handler_12(int sig)
# else
signal(SIGABRT, sigabrt_handler_13);
# endif
assert(crypto_pwhash_str_alg(guard_page, "", 0U, 1U, 1U, -1) == -1);
assert(crypto_pwhash_str_alg((char *) guard_page,
"", 0U, 1U, 1U, -1) == -1);
exit(1);
}
@ -76,7 +77,7 @@ sigabrt_handler_9(int sig)
{
(void) sig;
signal(SIGABRT, sigabrt_handler_10);
assert(sodium_base642bin(guard_page, 1, guard_page, 1,
assert(sodium_base642bin(guard_page, 1, (const char *) guard_page, 1,
NULL, NULL, NULL, -1) == -1);
exit(1);
}
@ -86,7 +87,7 @@ sigabrt_handler_8(int sig)
{
(void) sig;
signal(SIGABRT, sigabrt_handler_9);
assert(sodium_bin2base64(guard_page, 1, guard_page, 1,
assert(sodium_bin2base64((char *) guard_page, 1, guard_page, 1,
sodium_base64_VARIANT_ORIGINAL) == NULL);
exit(1);
}
@ -96,7 +97,8 @@ sigabrt_handler_7(int sig)
{
(void) sig;
signal(SIGABRT, sigabrt_handler_8);
assert(sodium_bin2base64(guard_page, 1, guard_page, 1, -1) == NULL);
assert(sodium_bin2base64((char *) guard_page, 1,
guard_page, 1, -1) == NULL);
exit(1);
}

View File

@ -480,19 +480,19 @@ main(void)
assert(crypto_pwhash_alg_argon2id13() != crypto_pwhash_alg_argon2i13());
assert(crypto_pwhash_alg_argon2id13() == crypto_pwhash_alg_default());
assert(crypto_pwhash_argon2id(guard_page, 0, guard_page, 0, guard_page,
assert(crypto_pwhash_argon2id(guard_page, 0, (const char *) guard_page, 0, guard_page,
crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
0) == -1);
assert(crypto_pwhash_argon2id(guard_page, 0, guard_page, 0, guard_page,
assert(crypto_pwhash_argon2id(guard_page, 0, (const char *) guard_page, 0, guard_page,
crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
crypto_pwhash_ALG_ARGON2I13) == -1);
assert(crypto_pwhash_argon2i(guard_page, 0, guard_page, 0, guard_page,
assert(crypto_pwhash_argon2i(guard_page, 0, (const char *) guard_page, 0, guard_page,
crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
0) == -1);
assert(crypto_pwhash_argon2i(guard_page, 0, guard_page, 0, guard_page,
assert(crypto_pwhash_argon2i(guard_page, 0, (const char *) guard_page, 0, guard_page,
crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
crypto_pwhash_ALG_ARGON2ID13) == -1);