From 4afa7c7e22298c19218f8829c23b04ed9972f44c Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 17 Oct 2017 14:42:13 -0700 Subject: [PATCH] RSA Update Added mp wrappers for fp_abs() and fp_2expt(). --- wolfcrypt/src/tfm.c | 13 +++++++++++++ wolfssl/wolfcrypt/tfm.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/wolfcrypt/src/tfm.c b/wolfcrypt/src/tfm.c index 81edccd0b..5057b42ff 100644 --- a/wolfcrypt/src/tfm.c +++ b/wolfcrypt/src/tfm.c @@ -2455,6 +2455,12 @@ int mp_mul_2d(fp_int *a, int b, fp_int *c) return MP_OKAY; } +int mp_2expt(fp_int* a, int b) +{ + fp_2expt(a, b); + return MP_OKAY; +} + int mp_div(fp_int * a, fp_int * b, fp_int * c, fp_int * d) { return fp_div(a, b, c, d); @@ -3389,6 +3395,13 @@ void mp_dump(const char* desc, mp_int* a, byte verbose) #endif /* defined(WOLFSSL_KEY_GEN) || defined(HAVE_COMP_KEY) || defined(WOLFSSL_DEBUG_MATH) */ +int mp_abs(mp_int* a, mp_int* b) +{ + fp_abs(a, b); + return FP_OKAY; +} + + int mp_lshd (mp_int * a, int b) { fp_lshd(a, b); diff --git a/wolfssl/wolfcrypt/tfm.h b/wolfssl/wolfcrypt/tfm.h index e0432311b..43d546307 100644 --- a/wolfssl/wolfcrypt/tfm.h +++ b/wolfssl/wolfcrypt/tfm.h @@ -672,6 +672,7 @@ MP_API int mp_mod(mp_int *a, mp_int *b, mp_int *c); MP_API int mp_invmod(mp_int *a, mp_int *b, mp_int *c); MP_API int mp_exptmod (mp_int * g, mp_int * x, mp_int * p, mp_int * y); MP_API int mp_mul_2d(mp_int *a, int b, mp_int *c); +MP_API int mp_2expt(mp_int* a, int b); MP_API int mp_div(mp_int * a, mp_int * b, mp_int * c, mp_int * d); @@ -733,6 +734,7 @@ MP_API int mp_cnt_lsb(fp_int *a); MP_API int mp_div_2d(fp_int *a, int b, fp_int *c, fp_int *d); MP_API int mp_mod_d(fp_int* a, fp_digit b, fp_digit* c); MP_API int mp_lshd (mp_int * a, int b); +MP_API int mp_abs(mp_int* a, mp_int* b); WOLFSSL_API word32 CheckRunTimeFastMath(void);