forked from wolfSSL/wolfssl
Merge pull request #1 from wolfSSL/master
update to current wolfssl version
This commit is contained in:
@@ -173,6 +173,36 @@ static int OpenNitroxDevice(int dma_mode,int dev_id)
|
||||
static RNG rng;
|
||||
#endif
|
||||
|
||||
/* use kB instead of mB for embedded benchmarking */
|
||||
#ifdef BENCH_EMBEDDED
|
||||
static byte plain [1024];
|
||||
#else
|
||||
static byte plain [1024*1024];
|
||||
#endif
|
||||
|
||||
|
||||
/* use kB instead of mB for embedded benchmarking */
|
||||
#ifdef BENCH_EMBEDDED
|
||||
static byte cipher[1024];
|
||||
#else
|
||||
static byte cipher[1024*1024];
|
||||
#endif
|
||||
|
||||
|
||||
static const byte key[] =
|
||||
{
|
||||
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
|
||||
0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
|
||||
0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67
|
||||
};
|
||||
|
||||
static const byte iv[] =
|
||||
{
|
||||
0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef,
|
||||
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
|
||||
0x11,0x21,0x31,0x41,0x51,0x61,0x71,0x81
|
||||
};
|
||||
|
||||
|
||||
/* so embedded projects can pull in tests on their own */
|
||||
#if !defined(NO_MAIN_DRIVER)
|
||||
@@ -191,6 +221,11 @@ int benchmark_test(void *args)
|
||||
wolfSSL_Debugging_ON();
|
||||
#endif
|
||||
|
||||
(void)plain;
|
||||
(void)cipher;
|
||||
(void)key;
|
||||
(void)iv;
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
|
||||
if (ret != 0) {
|
||||
@@ -327,37 +362,6 @@ static const char blockType[] = "megs"; /* used in printf output */
|
||||
#endif
|
||||
|
||||
|
||||
/* use kB instead of mB for embedded benchmarking */
|
||||
#ifdef BENCH_EMBEDDED
|
||||
static byte plain [1024];
|
||||
#else
|
||||
static byte plain [1024*1024];
|
||||
#endif
|
||||
|
||||
|
||||
static const byte key[] =
|
||||
{
|
||||
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
|
||||
0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
|
||||
0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67
|
||||
};
|
||||
|
||||
static const byte iv[] =
|
||||
{
|
||||
0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef,
|
||||
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
|
||||
0x11,0x21,0x31,0x41,0x51,0x61,0x71,0x81
|
||||
|
||||
};
|
||||
|
||||
/* use kB instead of mB for embedded benchmarking */
|
||||
#ifdef BENCH_EMBEDDED
|
||||
static byte cipher[1024];
|
||||
#else
|
||||
static byte cipher[1024*1024];
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef NO_AES
|
||||
|
||||
void bench_aes(int show)
|
||||
|
||||
@@ -3887,10 +3887,4 @@ static int AesCaviumCbcDecrypt(Aes* aes, byte* out, const byte* in,
|
||||
|
||||
#endif /* HAVE_FIPS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* NO_AES */
|
||||
|
||||
|
||||
@@ -5827,7 +5827,7 @@ int wc_MakeCert(Cert* cert, byte* derBuffer, word32 derSz, RsaKey* rsaKey,
|
||||
|
||||
#ifdef HAVE_NTRU
|
||||
|
||||
int MakeNtruCert(Cert* cert, byte* derBuffer, word32 derSz,
|
||||
int wc_MakeNtruCert(Cert* cert, byte* derBuffer, word32 derSz,
|
||||
const byte* ntruKey, word16 keySz, RNG* rng)
|
||||
{
|
||||
return MakeAnyCert(cert, derBuffer, derSz, NULL, NULL, rng, ntruKey, keySz);
|
||||
|
||||
@@ -2088,8 +2088,8 @@ int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
|
||||
* If either of those don't allocate correctly, none of
|
||||
* the rest of this function will execute, and everything
|
||||
* gets cleaned up at the end. */
|
||||
XMEMSET(&r, 0, sizeof(r));
|
||||
XMEMSET(&s, 0, sizeof(s));
|
||||
mp_init(&r);
|
||||
mp_init(&s);
|
||||
if (err == MP_OKAY)
|
||||
err = DecodeECC_DSA_Sig(sig, siglen, &r, &s);
|
||||
|
||||
@@ -2401,10 +2401,10 @@ int wc_ecc_import_x963(const byte* in, word32 inLen, ecc_key* key)
|
||||
if (err == MP_OKAY) {
|
||||
if ((mp_isodd(&t2) && in[0] == 0x03) ||
|
||||
(!mp_isodd(&t2) && in[0] == 0x02)) {
|
||||
err = mp_mod(&t2, &prime, &key->pubkey.y);
|
||||
err = mp_mod(&t2, &prime, key->pubkey.y);
|
||||
}
|
||||
else {
|
||||
err = mp_submod(&prime, &t2, &prime, &key->pubkey.y);
|
||||
err = mp_submod(&prime, &t2, &prime, key->pubkey.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1829,6 +1829,7 @@ void fp_reverse (unsigned char *s, int len)
|
||||
void fp_sub_d(fp_int *a, fp_digit b, fp_int *c)
|
||||
{
|
||||
fp_int tmp;
|
||||
fp_init(&tmp);
|
||||
fp_set(&tmp, b);
|
||||
fp_sub(a, &tmp, c);
|
||||
}
|
||||
@@ -1983,6 +1984,14 @@ void fp_copy(fp_int *a, fp_int* b)
|
||||
XMEMCPY(b->dp, a->dp, a->used * sizeof(fp_digit));
|
||||
}
|
||||
}
|
||||
|
||||
void fp_init_copy(fp_int *a, fp_int* b)
|
||||
{
|
||||
if (a != b) {
|
||||
fp_init(a);
|
||||
fp_copy(b, a);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* fast math conversion */
|
||||
|
||||
@@ -3814,7 +3814,7 @@ int rsa_test(void)
|
||||
free(pem);
|
||||
return -453;
|
||||
}
|
||||
ret = RsaPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes);
|
||||
ret = wc_RsaPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes);
|
||||
if (ret != 0) {
|
||||
free(derCert);
|
||||
free(pem);
|
||||
@@ -3839,7 +3839,7 @@ int rsa_test(void)
|
||||
return -455;
|
||||
}
|
||||
|
||||
certSz = MakeNtruCert(&myCert, derCert, FOURK_BUF, public_key,
|
||||
certSz = wc_MakeNtruCert(&myCert, derCert, FOURK_BUF, public_key,
|
||||
public_key_len, &rng);
|
||||
if (certSz < 0) {
|
||||
free(derCert);
|
||||
|
||||
Reference in New Issue
Block a user