summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ecp_nistp256.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ec/ecp_nistp256.c')
-rw-r--r--src/lib/libcrypto/ec/ecp_nistp256.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libcrypto/ec/ecp_nistp256.c b/src/lib/libcrypto/ec/ecp_nistp256.c
index 4bc0f5dce0..947fb7eee0 100644
--- a/src/lib/libcrypto/ec/ecp_nistp256.c
+++ b/src/lib/libcrypto/ec/ecp_nistp256.c
@@ -1666,7 +1666,7 @@ const EC_METHOD *EC_GFp_nistp256_method(void)
1666static NISTP256_PRE_COMP *nistp256_pre_comp_new() 1666static NISTP256_PRE_COMP *nistp256_pre_comp_new()
1667 { 1667 {
1668 NISTP256_PRE_COMP *ret = NULL; 1668 NISTP256_PRE_COMP *ret = NULL;
1669 ret = (NISTP256_PRE_COMP *) OPENSSL_malloc(sizeof *ret); 1669 ret = (NISTP256_PRE_COMP *) malloc(sizeof *ret);
1670 if (!ret) 1670 if (!ret)
1671 { 1671 {
1672 ECerr(EC_F_NISTP256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); 1672 ECerr(EC_F_NISTP256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
@@ -1699,7 +1699,7 @@ static void nistp256_pre_comp_free(void *pre_)
1699 if (i > 0) 1699 if (i > 0)
1700 return; 1700 return;
1701 1701
1702 OPENSSL_free(pre); 1702 free(pre);
1703 } 1703 }
1704 1704
1705static void nistp256_pre_comp_clear_free(void *pre_) 1705static void nistp256_pre_comp_clear_free(void *pre_)
@@ -1715,7 +1715,7 @@ static void nistp256_pre_comp_clear_free(void *pre_)
1715 return; 1715 return;
1716 1716
1717 OPENSSL_cleanse(pre, sizeof *pre); 1717 OPENSSL_cleanse(pre, sizeof *pre);
1718 OPENSSL_free(pre); 1718 free(pre);
1719 } 1719 }
1720 1720
1721/******************************************************************************/ 1721/******************************************************************************/
@@ -1901,10 +1901,10 @@ int ec_GFp_nistp256_points_mul(const EC_GROUP *group, EC_POINT *r,
1901 * converting those into affine form is time well spent */ 1901 * converting those into affine form is time well spent */
1902 mixed = 1; 1902 mixed = 1;
1903 } 1903 }
1904 secrets = OPENSSL_malloc(num_points * sizeof(felem_bytearray)); 1904 secrets = malloc(num_points * sizeof(felem_bytearray));
1905 pre_comp = OPENSSL_malloc(num_points * 17 * 3 * sizeof(smallfelem)); 1905 pre_comp = malloc(num_points * 17 * 3 * sizeof(smallfelem));
1906 if (mixed) 1906 if (mixed)
1907 tmp_smallfelems = OPENSSL_malloc((num_points * 17 + 1) * sizeof(smallfelem)); 1907 tmp_smallfelems = malloc((num_points * 17 + 1) * sizeof(smallfelem));
1908 if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_smallfelems == NULL))) 1908 if ((secrets == NULL) || (pre_comp == NULL) || (mixed && (tmp_smallfelems == NULL)))
1909 { 1909 {
1910 ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_MALLOC_FAILURE); 1910 ECerr(EC_F_EC_GFP_NISTP256_POINTS_MUL, ERR_R_MALLOC_FAILURE);
@@ -2026,11 +2026,11 @@ err:
2026 if (new_ctx != NULL) 2026 if (new_ctx != NULL)
2027 BN_CTX_free(new_ctx); 2027 BN_CTX_free(new_ctx);
2028 if (secrets != NULL) 2028 if (secrets != NULL)
2029 OPENSSL_free(secrets); 2029 free(secrets);
2030 if (pre_comp != NULL) 2030 if (pre_comp != NULL)
2031 OPENSSL_free(pre_comp); 2031 free(pre_comp);
2032 if (tmp_smallfelems != NULL) 2032 if (tmp_smallfelems != NULL)
2033 OPENSSL_free(tmp_smallfelems); 2033 free(tmp_smallfelems);
2034 return ret; 2034 return ret;
2035 } 2035 }
2036 2036