diff options
Diffstat (limited to 'src/lib/libcrypto/ec')
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp224.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp256.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_nistp521.c | 6 |
3 files changed, 6 insertions, 12 deletions
diff --git a/src/lib/libcrypto/ec/ecp_nistp224.c b/src/lib/libcrypto/ec/ecp_nistp224.c index bd8f65b097..53aced54d5 100644 --- a/src/lib/libcrypto/ec/ecp_nistp224.c +++ b/src/lib/libcrypto/ec/ecp_nistp224.c | |||
| @@ -1435,8 +1435,8 @@ ec_GFp_nistp224_points_mul(const EC_GROUP * group, EC_POINT * r, | |||
| 1435 | */ | 1435 | */ |
| 1436 | mixed = 1; | 1436 | mixed = 1; |
| 1437 | } | 1437 | } |
| 1438 | secrets = malloc(num_points * sizeof(felem_bytearray)); | 1438 | secrets = calloc(num_points, sizeof(felem_bytearray)); |
| 1439 | pre_comp = malloc(num_points * 17 * 3 * sizeof(felem)); | 1439 | pre_comp = calloc(num_points, 17 * 3 * sizeof(felem)); |
| 1440 | if (mixed) | 1440 | if (mixed) |
| 1441 | tmp_felems = malloc((num_points * 17 + 1) * sizeof(felem)); | 1441 | tmp_felems = malloc((num_points * 17 + 1) * sizeof(felem)); |
| 1442 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL))) { | 1442 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL))) { |
| @@ -1448,8 +1448,6 @@ ec_GFp_nistp224_points_mul(const EC_GROUP * group, EC_POINT * r, | |||
| 1448 | * infinity, i.e., they contribute nothing to the linear | 1448 | * infinity, i.e., they contribute nothing to the linear |
| 1449 | * combination | 1449 | * combination |
| 1450 | */ | 1450 | */ |
| 1451 | memset(secrets, 0, num_points * sizeof(felem_bytearray)); | ||
| 1452 | memset(pre_comp, 0, num_points * 17 * 3 * sizeof(felem)); | ||
| 1453 | for (i = 0; i < num_points; ++i) { | 1451 | for (i = 0; i < num_points; ++i) { |
| 1454 | if (i == num) | 1452 | if (i == num) |
| 1455 | /* the generator */ | 1453 | /* the generator */ |
diff --git a/src/lib/libcrypto/ec/ecp_nistp256.c b/src/lib/libcrypto/ec/ecp_nistp256.c index 558c29c5ba..df80cc2b8a 100644 --- a/src/lib/libcrypto/ec/ecp_nistp256.c +++ b/src/lib/libcrypto/ec/ecp_nistp256.c | |||
| @@ -1985,8 +1985,8 @@ ec_GFp_nistp256_points_mul(const EC_GROUP * group, EC_POINT * r, | |||
| 1985 | */ | 1985 | */ |
| 1986 | mixed = 1; | 1986 | mixed = 1; |
| 1987 | } | 1987 | } |
| 1988 | secrets = malloc(num_points * sizeof(felem_bytearray)); | 1988 | secrets = calloc(num_points, sizeof(felem_bytearray)); |
| 1989 | pre_comp = malloc(num_points * 17 * 3 * sizeof(smallfelem)); | 1989 | pre_comp = calloc(num_points, 17 * 3 * sizeof(smallfelem)); |
| 1990 | if (mixed) | 1990 | if (mixed) |
| 1991 | tmp_smallfelems = malloc((num_points * 17 + 1) * sizeof(smallfelem)); | 1991 | tmp_smallfelems = malloc((num_points * 17 + 1) * sizeof(smallfelem)); |
| 1992 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_smallfelems == NULL))) { | 1992 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_smallfelems == NULL))) { |
| @@ -1998,8 +1998,6 @@ ec_GFp_nistp256_points_mul(const EC_GROUP * group, EC_POINT * r, | |||
| 1998 | * infinity, i.e., they contribute nothing to the linear | 1998 | * infinity, i.e., they contribute nothing to the linear |
| 1999 | * combination | 1999 | * combination |
| 2000 | */ | 2000 | */ |
| 2001 | memset(secrets, 0, num_points * sizeof(felem_bytearray)); | ||
| 2002 | memset(pre_comp, 0, num_points * 17 * 3 * sizeof(smallfelem)); | ||
| 2003 | for (i = 0; i < num_points; ++i) { | 2001 | for (i = 0; i < num_points; ++i) { |
| 2004 | if (i == num) | 2002 | if (i == num) |
| 2005 | /* | 2003 | /* |
diff --git a/src/lib/libcrypto/ec/ecp_nistp521.c b/src/lib/libcrypto/ec/ecp_nistp521.c index 0c40f08346..6792c5b71d 100644 --- a/src/lib/libcrypto/ec/ecp_nistp521.c +++ b/src/lib/libcrypto/ec/ecp_nistp521.c | |||
| @@ -1872,8 +1872,8 @@ ec_GFp_nistp521_points_mul(const EC_GROUP * group, EC_POINT * r, | |||
| 1872 | */ | 1872 | */ |
| 1873 | mixed = 1; | 1873 | mixed = 1; |
| 1874 | } | 1874 | } |
| 1875 | secrets = malloc(num_points * sizeof(felem_bytearray)); | 1875 | secrets = calloc(num_points, sizeof(felem_bytearray)); |
| 1876 | pre_comp = malloc(num_points * 17 * 3 * sizeof(felem)); | 1876 | pre_comp = calloc(num_points, 17 * 3 * sizeof(felem)); |
| 1877 | if (mixed) | 1877 | if (mixed) |
| 1878 | tmp_felems = malloc((num_points * 17 + 1) * sizeof(felem)); | 1878 | tmp_felems = malloc((num_points * 17 + 1) * sizeof(felem)); |
| 1879 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL))) { | 1879 | if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_felems == NULL))) { |
| @@ -1885,8 +1885,6 @@ ec_GFp_nistp521_points_mul(const EC_GROUP * group, EC_POINT * r, | |||
| 1885 | * infinity, i.e., they contribute nothing to the linear | 1885 | * infinity, i.e., they contribute nothing to the linear |
| 1886 | * combination | 1886 | * combination |
| 1887 | */ | 1887 | */ |
| 1888 | memset(secrets, 0, num_points * sizeof(felem_bytearray)); | ||
| 1889 | memset(pre_comp, 0, num_points * 17 * 3 * sizeof(felem)); | ||
| 1890 | for (i = 0; i < num_points; ++i) { | 1888 | for (i = 0; i < num_points; ++i) { |
| 1891 | if (i == num) | 1889 | if (i == num) |
| 1892 | /* | 1890 | /* |
