mirror of https://github.com/wolfSSL/wolfssl.git
commit
5d8a2a7702
|
@ -1499,10 +1499,10 @@ int wc_ecc_set_curve(ecc_key* key, int keysize, int curve_id)
|
|||
|
||||
|
||||
#ifdef ALT_ECC_SIZE
|
||||
static void alt_fp_init(fp_int* a)
|
||||
static void alt_fp_init(mp_int* a)
|
||||
{
|
||||
a->size = FP_SIZE_ECC;
|
||||
fp_zero(a);
|
||||
mp_zero(a);
|
||||
}
|
||||
#endif /* ALT_ECC_SIZE */
|
||||
|
||||
|
|
|
@ -6966,7 +6966,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 64 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -7050,7 +7050,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -7108,7 +7108,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
t = (sp_digit*)XMALLOC(sizeof(sp_digit) * 32 * 11, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (t == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -7168,7 +7168,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (t != NULL) {
|
||||
XMEMSET(t, 0, sizeof(sp_digit) * 32 * 11);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
#else
|
||||
XMEMSET(tmpad, 0, sizeof(tmpad));
|
||||
|
@ -16369,7 +16369,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 96 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -16453,7 +16453,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -16511,7 +16511,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
t = (sp_digit*)XMALLOC(sizeof(sp_digit) * 48 * 11, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (t == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -16571,7 +16571,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (t != NULL) {
|
||||
XMEMSET(t, 0, sizeof(sp_digit) * 48 * 11);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
#else
|
||||
XMEMSET(tmpad, 0, sizeof(tmpad));
|
||||
|
|
|
@ -4696,7 +4696,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 32 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -4780,7 +4780,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -4838,7 +4838,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
t = (sp_digit*)XMALLOC(sizeof(sp_digit) * 16 * 11, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (t == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -4898,7 +4898,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (t != NULL) {
|
||||
XMEMSET(t, 0, sizeof(sp_digit) * 16 * 11);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
#else
|
||||
XMEMSET(tmpad, 0, sizeof(tmpad));
|
||||
|
@ -11676,7 +11676,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 48 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -11760,7 +11760,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -11818,7 +11818,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
t = (sp_digit*)XMALLOC(sizeof(sp_digit) * 24 * 11, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (t == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -11878,7 +11878,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (t != NULL) {
|
||||
XMEMSET(t, 0, sizeof(sp_digit) * 24 * 11);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
#else
|
||||
XMEMSET(tmpad, 0, sizeof(tmpad));
|
||||
|
|
|
@ -3126,7 +3126,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 90 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -3180,7 +3180,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
}
|
||||
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
|
||||
return err;
|
||||
#else
|
||||
|
@ -3204,7 +3204,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 90 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -3284,7 +3284,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -3334,7 +3334,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 90 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -3355,7 +3355,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (d != NULL) {
|
||||
XMEMSET(d, 0, sizeof(sp_digit) * 90);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -3417,7 +3417,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (err == MP_OKAY) {
|
||||
t = (sp_digit*)XMALLOC(sizeof(sp_digit) * 45 * 11, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (t == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -3463,7 +3463,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (t != NULL) {
|
||||
XMEMSET(t, 0, sizeof(sp_digit) * 45 * 11);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -3611,8 +3611,7 @@ int sp_ModExp_2048(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
}
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 90 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 90 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -3636,7 +3635,7 @@ int sp_ModExp_2048(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
|
||||
if (d != NULL) {
|
||||
XMEMSET(e, 0, sizeof(sp_digit) * 90);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
}
|
||||
return err;
|
||||
#else
|
||||
|
@ -3659,8 +3658,7 @@ int sp_ModExp_2048(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 90 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 90 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -3693,7 +3691,7 @@ int sp_ModExp_2048(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -3730,8 +3728,7 @@ int sp_DhExp_2048(mp_int* base, const byte* exp, word32 expLen,
|
|||
}
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 90 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 90 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -3760,7 +3757,7 @@ int sp_DhExp_2048(mp_int* base, const byte* exp, word32 expLen,
|
|||
|
||||
if (d != NULL) {
|
||||
XMEMSET(e, 0, sizeof(sp_digit) * 90);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
}
|
||||
return err;
|
||||
#else
|
||||
|
@ -3783,8 +3780,7 @@ int sp_DhExp_2048(mp_int* base, const byte* exp, word32 expLen,
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 90 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 90 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -3822,7 +3818,7 @@ int sp_DhExp_2048(mp_int* base, const byte* exp, word32 expLen,
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -6496,7 +6492,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 136 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -6550,7 +6546,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
}
|
||||
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
|
||||
return err;
|
||||
#else
|
||||
|
@ -6574,7 +6570,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 136 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -6654,7 +6650,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -6704,7 +6700,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 136 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -6725,7 +6721,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (d != NULL) {
|
||||
XMEMSET(d, 0, sizeof(sp_digit) * 136);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -6787,7 +6783,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (err == MP_OKAY) {
|
||||
t = (sp_digit*)XMALLOC(sizeof(sp_digit) * 68 * 11, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (t == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -6833,7 +6829,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (t != NULL) {
|
||||
XMEMSET(t, 0, sizeof(sp_digit) * 68 * 11);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -6981,8 +6977,7 @@ int sp_ModExp_3072(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
}
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 136 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 136 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -7006,7 +7001,7 @@ int sp_ModExp_3072(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
|
||||
if (d != NULL) {
|
||||
XMEMSET(e, 0, sizeof(sp_digit) * 136);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
}
|
||||
return err;
|
||||
#else
|
||||
|
@ -7029,8 +7024,7 @@ int sp_ModExp_3072(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 136 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 136 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -7063,7 +7057,7 @@ int sp_ModExp_3072(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -7100,8 +7094,7 @@ int sp_DhExp_3072(mp_int* base, const byte* exp, word32 expLen,
|
|||
}
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 136 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 136 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -7130,7 +7123,7 @@ int sp_DhExp_3072(mp_int* base, const byte* exp, word32 expLen,
|
|||
|
||||
if (d != NULL) {
|
||||
XMEMSET(e, 0, sizeof(sp_digit) * 136);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
}
|
||||
return err;
|
||||
#else
|
||||
|
@ -7153,8 +7146,7 @@ int sp_DhExp_3072(mp_int* base, const byte* exp, word32 expLen,
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 136 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 136 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -7192,7 +7184,7 @@ int sp_DhExp_3072(mp_int* base, const byte* exp, word32 expLen,
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
|
|
@ -2549,7 +2549,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 36 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -2603,7 +2603,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
}
|
||||
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
|
||||
return err;
|
||||
#else
|
||||
|
@ -2627,7 +2627,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 36 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -2707,7 +2707,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -2757,7 +2757,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 36 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -2778,7 +2778,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (d != NULL) {
|
||||
XMEMSET(d, 0, sizeof(sp_digit) * 36);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -2840,7 +2840,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (err == MP_OKAY) {
|
||||
t = (sp_digit*)XMALLOC(sizeof(sp_digit) * 18 * 11, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (t == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -2886,7 +2886,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (t != NULL) {
|
||||
XMEMSET(t, 0, sizeof(sp_digit) * 18 * 11);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -3034,8 +3034,7 @@ int sp_ModExp_2048(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
}
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 36 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 36 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -3059,7 +3058,7 @@ int sp_ModExp_2048(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
|
||||
if (d != NULL) {
|
||||
XMEMSET(e, 0, sizeof(sp_digit) * 36);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
}
|
||||
return err;
|
||||
#else
|
||||
|
@ -3082,8 +3081,7 @@ int sp_ModExp_2048(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 36 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 36 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -3116,7 +3114,7 @@ int sp_ModExp_2048(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -3153,8 +3151,7 @@ int sp_DhExp_2048(mp_int* base, const byte* exp, word32 expLen,
|
|||
}
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 36 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 36 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -3183,7 +3180,7 @@ int sp_DhExp_2048(mp_int* base, const byte* exp, word32 expLen,
|
|||
|
||||
if (d != NULL) {
|
||||
XMEMSET(e, 0, sizeof(sp_digit) * 36);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
}
|
||||
return err;
|
||||
#else
|
||||
|
@ -3206,8 +3203,7 @@ int sp_DhExp_2048(mp_int* base, const byte* exp, word32 expLen,
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 36 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 36 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -3245,7 +3241,7 @@ int sp_DhExp_2048(mp_int* base, const byte* exp, word32 expLen,
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -5932,7 +5928,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 54 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -5986,7 +5982,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
}
|
||||
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
|
||||
return err;
|
||||
#else
|
||||
|
@ -6010,7 +6006,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 54 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -6090,7 +6086,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -6140,7 +6136,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 54 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -6161,7 +6157,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (d != NULL) {
|
||||
XMEMSET(d, 0, sizeof(sp_digit) * 54);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -6223,7 +6219,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (err == MP_OKAY) {
|
||||
t = (sp_digit*)XMALLOC(sizeof(sp_digit) * 27 * 11, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (t == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -6269,7 +6265,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
|
||||
if (t != NULL) {
|
||||
XMEMSET(t, 0, sizeof(sp_digit) * 27 * 11);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
|
||||
return err;
|
||||
|
@ -6417,8 +6413,7 @@ int sp_ModExp_3072(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
}
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 54 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 54 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -6442,7 +6437,7 @@ int sp_ModExp_3072(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
|
||||
if (d != NULL) {
|
||||
XMEMSET(e, 0, sizeof(sp_digit) * 54);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
}
|
||||
return err;
|
||||
#else
|
||||
|
@ -6465,8 +6460,7 @@ int sp_ModExp_3072(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 54 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 54 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -6499,7 +6493,7 @@ int sp_ModExp_3072(mp_int* base, mp_int* exp, mp_int* mod, mp_int* res)
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -6536,8 +6530,7 @@ int sp_DhExp_3072(mp_int* base, const byte* exp, word32 expLen,
|
|||
}
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 54 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 54 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -6566,7 +6559,7 @@ int sp_DhExp_3072(mp_int* base, const byte* exp, word32 expLen,
|
|||
|
||||
if (d != NULL) {
|
||||
XMEMSET(e, 0, sizeof(sp_digit) * 54);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
}
|
||||
return err;
|
||||
#else
|
||||
|
@ -6589,8 +6582,7 @@ int sp_DhExp_3072(mp_int* base, const byte* exp, word32 expLen,
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 54 * 4, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
d = (sp_digit*)XMALLOC(sizeof(*d) * 54 * 4, NULL, DYNAMIC_TYPE_DH);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -6628,7 +6620,7 @@ int sp_DhExp_3072(mp_int* base, const byte* exp, word32 expLen,
|
|||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_DH);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
|
|
@ -541,7 +541,7 @@ int sp_mod(sp_int* a, sp_int* m, sp_int* r)
|
|||
*/
|
||||
void sp_zero(sp_int* a)
|
||||
{
|
||||
XMEMSET(a->dp, 0, a->size);
|
||||
XMEMSET(a->dp, 0, a->size * sizeof(*a->dp));
|
||||
a->used = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -9597,7 +9597,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 32 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -9710,7 +9710,7 @@ int sp_RsaPublic_2048(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -9771,7 +9771,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
t = (sp_digit*)XMALLOC(sizeof(sp_digit) * 16 * 11, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (t == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -9851,7 +9851,7 @@ int sp_RsaPrivate_2048(const byte* in, word32 inLen, mp_int* dm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (t != NULL) {
|
||||
XMEMSET(t, 0, sizeof(sp_digit) * 16 * 11);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
#else
|
||||
XMEMSET(tmpad, 0, sizeof(tmpad));
|
||||
|
@ -26924,7 +26924,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
d = (sp_digit*)XMALLOC(sizeof(sp_digit) * 48 * 5, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (d == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -27037,7 +27037,7 @@ int sp_RsaPublic_3072(const byte* in, word32 inLen, mp_int* em, mp_int* mm,
|
|||
|
||||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (d != NULL)
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(d, NULL, DYNAMIC_TYPE_RSA);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
|
@ -27098,7 +27098,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (err == MP_OKAY) {
|
||||
t = (sp_digit*)XMALLOC(sizeof(sp_digit) * 24 * 11, NULL,
|
||||
DYNAMIC_TYPE_TMP_BUFFER);
|
||||
DYNAMIC_TYPE_RSA);
|
||||
if (t == NULL)
|
||||
err = MEMORY_E;
|
||||
}
|
||||
|
@ -27178,7 +27178,7 @@ int sp_RsaPrivate_3072(const byte* in, word32 inLen, mp_int* dm,
|
|||
#if defined(WOLFSSL_SP_SMALL) || defined(WOLFSSL_SMALL_STACK)
|
||||
if (t != NULL) {
|
||||
XMEMSET(t, 0, sizeof(sp_digit) * 24 * 11);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(t, NULL, DYNAMIC_TYPE_RSA);
|
||||
}
|
||||
#else
|
||||
XMEMSET(tmpad, 0, sizeof(tmpad));
|
||||
|
|
|
@ -296,7 +296,7 @@ typedef struct ecc_set_type {
|
|||
* fp_digit array will be shorter. */
|
||||
typedef struct alt_fp_int {
|
||||
int used, sign, size;
|
||||
fp_digit dp[FP_SIZE_ECC];
|
||||
mp_digit dp[FP_SIZE_ECC];
|
||||
} alt_fp_int;
|
||||
#endif /* ALT_ECC_SIZE */
|
||||
|
||||
|
|
|
@ -103,9 +103,9 @@
|
|||
#define sp_isodd(a) (a->used != 0 && (a->dp[0] & 1))
|
||||
|
||||
typedef struct sp_int {
|
||||
sp_int_digit dp[SP_INT_DIGITS];
|
||||
int size;
|
||||
int used;
|
||||
int size;
|
||||
sp_int_digit dp[SP_INT_DIGITS];
|
||||
} sp_int;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue