fix compilation for 32 bits OS

This commit is contained in:
Ludovic FLAMENT
2015-07-24 11:17:06 +02:00
parent 78a936a4fd
commit 9c2a85d9f6

View File

@@ -4290,7 +4290,7 @@ int mp_rand_prime(mp_int* N, int len, RNG* rng, void* heap)
byte* buf; byte* buf;
if (N == NULL || rng == NULL) if (N == NULL || rng == NULL)
return BAD_FUNC_ARG; return MP_VAL;
/* get type */ /* get type */
if (len < 0) { if (len < 0) {
@@ -4302,13 +4302,13 @@ int mp_rand_prime(mp_int* N, int len, RNG* rng, void* heap)
/* allow sizes between 2 and 512 bytes for a prime size */ /* allow sizes between 2 and 512 bytes for a prime size */
if (len < 2 || len > 512) { if (len < 2 || len > 512) {
return BAD_FUNC_ARG; return MP_VAL;
} }
/* allocate buffer to work with */ /* allocate buffer to work with */
buf = (byte*)XMALLOC(len, heap, DYNAMIC_TYPE_RSA); buf = (byte*)XMALLOC(len, heap, DYNAMIC_TYPE_RSA);
if (buf == NULL) { if (buf == NULL) {
return MEMORY_E; return MP_MEM;
} }
XMEMSET(buf, 0, len); XMEMSET(buf, 0, len);
@@ -4341,7 +4341,7 @@ int mp_rand_prime(mp_int* N, int len, RNG* rng, void* heap)
} }
} while (res == MP_NO); } while (res == MP_NO);
ForceZero(buf, len); XMEMSET(buf, 0, len);
XFREE(buf, heap, DYNAMIC_TYPE_RSA); XFREE(buf, heap, DYNAMIC_TYPE_RSA);
return MP_OKAY; return MP_OKAY;