Implemented ksdk_port fixes to handle mp_ response codes. Added KSDK support for normal math. Regression testing against K82 hardware (MMCAU/LTC) and software with normal and fast math.
This commit is contained in:
@@ -239,6 +239,7 @@ void mp_clear (mp_int * a);
|
||||
void mp_forcezero(mp_int * a);
|
||||
int mp_unsigned_bin_size(mp_int * a);
|
||||
int mp_read_unsigned_bin (mp_int * a, const unsigned char *b, int c);
|
||||
int mp_to_unsigned_bin_at_pos(int x, mp_int *t, unsigned char *b);
|
||||
int mp_to_unsigned_bin (mp_int * a, unsigned char *b);
|
||||
int mp_exptmod (mp_int * G, mp_int * X, mp_int * P, mp_int * Y);
|
||||
/* end functions needed by Rsa */
|
||||
|
||||
@@ -23,7 +23,11 @@
|
||||
#define _KSDK_PORT_H_
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
#include <wolfssl/wolfcrypt/tfm.h>
|
||||
#ifdef USE_FAST_MATH
|
||||
#include <wolfssl/wolfcrypt/tfm.h>
|
||||
#else
|
||||
#include <wolfssl/wolfcrypt/integer.h>
|
||||
#endif
|
||||
#include <wolfssl/wolfcrypt/ecc.h>
|
||||
#include <wolfssl/wolfcrypt/curve25519.h>
|
||||
#include <wolfssl/wolfcrypt/ed25519.h>
|
||||
@@ -34,13 +38,12 @@ int ksdk_port_init(void);
|
||||
|
||||
/* software algorithm, by wolfcrypt */
|
||||
#if defined(FREESCALE_LTC_TFM)
|
||||
void wolfcrypt_fp_mul(fp_int *A, fp_int *B, fp_int *C);
|
||||
int wolfcrypt_fp_mod(fp_int *a, fp_int *b, fp_int *c);
|
||||
int wolfcrypt_fp_mulmod(fp_int *a, fp_int *b, fp_int *c, fp_int *d);
|
||||
int wolfcrypt_fp_mod(fp_int *a, fp_int *b, fp_int *c);
|
||||
int wolfcrypt_fp_invmod(fp_int *a, fp_int *b, fp_int *c);
|
||||
int _wolfcrypt_fp_exptmod(fp_int *G, fp_int *X, fp_int *P, fp_int *Y);
|
||||
int _fp_exptmod(fp_int *G, fp_int *X, fp_int *P, fp_int *Y);
|
||||
int wolfcrypt_mp_mul(mp_int *A, mp_int *B, mp_int *C);
|
||||
int wolfcrypt_mp_mod(mp_int *a, mp_int *b, mp_int *c);
|
||||
int wolfcrypt_mp_mulmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d);
|
||||
int wolfcrypt_mp_mod(mp_int *a, mp_int *b, mp_int *c);
|
||||
int wolfcrypt_mp_invmod(mp_int *a, mp_int *b, mp_int *c);
|
||||
int wolfcrypt_mp_exptmod(mp_int *G, mp_int *X, mp_int *P, mp_int *Y);
|
||||
#endif /* FREESCALE_LTC_TFM */
|
||||
|
||||
#if defined(FREESCALE_LTC_ECC)
|
||||
|
||||
@@ -914,8 +914,9 @@ static char *fgets(char *buff, int sz, FILE *fp)
|
||||
#endif /* FREESCALE_USE_LTC */
|
||||
|
||||
#ifdef FREESCALE_LTC_TFM_RSA_4096_ENABLE
|
||||
#undef USE_CERT_BUFFERS_2048
|
||||
#undef USE_CERT_BUFFERS_4096
|
||||
#define USE_CERT_BUFFERS_4096
|
||||
#undef FP_MAX_BITS
|
||||
#define FP_MAX_BITS (8192)
|
||||
|
||||
#undef NO_DH
|
||||
|
||||
@@ -606,6 +606,8 @@ typedef fp_int mp_int;
|
||||
#define MP_OKAY FP_OKAY /* ok result */
|
||||
#define MP_NO FP_NO /* yes/no result */
|
||||
#define MP_YES FP_YES /* yes/no result */
|
||||
#define MP_ZPOS FP_ZPOS
|
||||
#define MP_NEG FP_NEG
|
||||
|
||||
/* Prototypes */
|
||||
#define mp_zero(a) fp_zero(a)
|
||||
|
||||
Reference in New Issue
Block a user