diff options
Diffstat (limited to 'FreeRTOS-Plus/Source/WolfSSL/wolfcrypt/src/fp_mul_comba_17.i')
-rw-r--r-- | FreeRTOS-Plus/Source/WolfSSL/wolfcrypt/src/fp_mul_comba_17.i | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/FreeRTOS-Plus/Source/WolfSSL/wolfcrypt/src/fp_mul_comba_17.i b/FreeRTOS-Plus/Source/WolfSSL/wolfcrypt/src/fp_mul_comba_17.i index fe12f0602..fb3205515 100644 --- a/FreeRTOS-Plus/Source/WolfSSL/wolfcrypt/src/fp_mul_comba_17.i +++ b/FreeRTOS-Plus/Source/WolfSSL/wolfcrypt/src/fp_mul_comba_17.i @@ -1,8 +1,8 @@ /* fp_mul_comba_17.i * - * Copyright (C) 2006-2015 wolfSSL Inc. + * Copyright (C) 2006-2020 wolfSSL Inc. * - * This file is part of wolfSSL. (formerly known as CyaSSL) + * This file is part of wolfSSL. * * wolfSSL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,17 +16,29 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ + #ifdef TFM_MUL17 -void fp_mul_comba17(fp_int *A, fp_int *B, fp_int *C) +int fp_mul_comba17(fp_int *A, fp_int *B, fp_int *C) { - fp_digit c0, c1, c2, at[34]; + fp_digit c0, c1, c2; +#ifndef WOLFSSL_SMALL_STACK + fp_digit at[34]; +#else + fp_digit *at; +#endif + +#ifdef WOLFSSL_SMALL_STACK + at = (fp_digit*)XMALLOC(sizeof(fp_digit) * 34, NULL, DYNAMIC_TYPE_TMP_BUFFER); + if (at == NULL) + return FP_MEM; +#endif - memcpy(at, A->dp, 17 * sizeof(fp_digit)); - memcpy(at+17, B->dp, 17 * sizeof(fp_digit)); + XMEMCPY(at, A->dp, 17 * sizeof(fp_digit)); + XMEMCPY(at+17, B->dp, 17 * sizeof(fp_digit)); COMBA_START; COMBA_CLEAR; @@ -166,5 +178,10 @@ void fp_mul_comba17(fp_int *A, fp_int *B, fp_int *C) C->sign = A->sign ^ B->sign; fp_clamp(C); COMBA_FINI; + +#ifdef WOLFSSL_SMALL_STACK + XFREE(at, NULL, DYNAMIC_TYPE_TMP_BUFFER); +#endif + return FP_OKAY; } #endif |