Commit 66f571bd authored by Davide Galassi's avatar Davide Galassi

Fix in the MPI init size with zero

parent e6d584a0
......@@ -46,10 +46,13 @@ int cry_mpi_init(cry_mpi *a)
*/
int cry_mpi_init_size(cry_mpi *a, size_t size)
{
a->data = malloc(sizeof(cry_mpi_digit) * size);
if (a->data == NULL)
return -1;
if (size != 0) {
a->data = malloc(sizeof(cry_mpi_digit) * size);
if (a->data == NULL)
return -1;
} else {
a->data = NULL;
}
a->used = 0;
a->alloc = size;
a->sign = 0;
......
......@@ -3,10 +3,18 @@
# p0 : input size
################################################################################
Initialize with given size
Initialize with given size (0)
mpi_init_size
0
Initialize with given size (1)
mpi_init_size
1
Initialize with given size (100)
mpi_init_size
100
################################################################################
# Set primitive integer value
# p0 : input value (primitive base 10)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment