forked from wolfSSL/wolfssl
Add additional checks to sp_ecc_point_new
This commit is contained in:
@ -117,7 +117,6 @@ static const sp_point p256_base __attribute__((aligned(128))) = {
|
|||||||
static int sp_ecc_point_new_ex(void* heap, sp_point* sp, sp_point** p)
|
static int sp_ecc_point_new_ex(void* heap, sp_point* sp, sp_point** p)
|
||||||
{
|
{
|
||||||
int ret = MP_OKAY;
|
int ret = MP_OKAY;
|
||||||
(void)heap;
|
|
||||||
|
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
ret = MEMORY_E;
|
ret = MEMORY_E;
|
||||||
@ -125,8 +124,16 @@ static int sp_ecc_point_new_ex(void* heap, sp_point* sp, sp_point** p)
|
|||||||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||||
(void)sp;
|
(void)sp;
|
||||||
*p = (sp_point*)XMALLOC(sizeof(sp_point), heap, DYNAMIC_TYPE_ECC);
|
*p = (sp_point*)XMALLOC(sizeof(sp_point), heap, DYNAMIC_TYPE_ECC);
|
||||||
|
if (*p == NULL) {
|
||||||
|
ret = MEMORY_E;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
*p = sp;
|
(void)heap;
|
||||||
|
if (sp == NULL) {
|
||||||
|
ret = MEMORY_E;
|
||||||
|
} else {
|
||||||
|
*p = sp;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user