mirror of https://github.com/wolfSSL/wolfssl.git
fixup some chacah-poly suite things including a valgrind error
parent
48e3ef1c31
commit
3bfd0bbf3b
|
@ -464,7 +464,7 @@ void bench_poly1305()
|
||||||
persec = persec / 1024;
|
persec = persec / 1024;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
printf("POLY1305 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
|
printf("POLY1305 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
|
||||||
blockType, total, persec);
|
blockType, total, persec);
|
||||||
}
|
}
|
||||||
#endif /* HAVE_POLY1305 */
|
#endif /* HAVE_POLY1305 */
|
||||||
|
|
|
@ -474,9 +474,7 @@ void c32to24(word32 in, word24 out);
|
||||||
#if !defined(NO_RSA)
|
#if !defined(NO_RSA)
|
||||||
#define BUILD_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
|
#define BUILD_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
|
||||||
#endif
|
#endif
|
||||||
#if !defined(NO_DSA)
|
#define BUILD_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
|
||||||
#define BUILD_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#if !defined(NO_DH) && !defined(NO_RSA)
|
#if !defined(NO_DH) && !defined(NO_RSA)
|
||||||
#define BUILD_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256
|
#define BUILD_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256
|
||||||
|
|
|
@ -625,7 +625,7 @@ THREAD_RETURN CYASSL_THREAD client_test(void* args)
|
||||||
|
|
||||||
#ifdef HAVE_POLY1305
|
#ifdef HAVE_POLY1305
|
||||||
/* use old poly to connect with google server */
|
/* use old poly to connect with google server */
|
||||||
if (!XMEMCMP(domain, "www.google.com", 15)) {
|
if (!XSTRNCMP(domain, "www.google.com", 14)) {
|
||||||
if (CyaSSL_use_old_poly(ssl, 1) != 0)
|
if (CyaSSL_use_old_poly(ssl, 1) != 0)
|
||||||
err_sys("unable to set to old poly");
|
err_sys("unable to set to old poly");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1672,6 +1672,9 @@ int InitSSL(CYASSL* ssl, CYASSL_CTX* ctx)
|
||||||
ssl->options.groupMessages = ctx->groupMessages;
|
ssl->options.groupMessages = ctx->groupMessages;
|
||||||
ssl->options.usingNonblock = 0;
|
ssl->options.usingNonblock = 0;
|
||||||
ssl->options.saveArrays = 0;
|
ssl->options.saveArrays = 0;
|
||||||
|
#ifdef HAVE_POLY1305
|
||||||
|
ssl->options.oldPoly = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef NO_CERTS
|
#ifndef NO_CERTS
|
||||||
/* ctx still owns certificate, certChain, key, dh, and cm */
|
/* ctx still owns certificate, certChain, key, dh, and cm */
|
||||||
|
@ -4876,13 +4879,12 @@ static int Poly1305TagOld(CYASSL* ssl, byte* additional, const byte* out,
|
||||||
static int ChachaAEADEncrypt(CYASSL* ssl, byte* out, const byte* input,
|
static int ChachaAEADEncrypt(CYASSL* ssl, byte* out, const byte* input,
|
||||||
word16 sz)
|
word16 sz)
|
||||||
{
|
{
|
||||||
int offset = 5; /*where to find type,version in record header */
|
const byte* additionalSrc = input - RECORD_HEADER_SZ;
|
||||||
const byte* additionalSrc = input - offset;
|
int ret = 0;
|
||||||
int ret = 0;
|
byte tag[POLY1305_AUTH_SZ];
|
||||||
byte tag[ssl->specs.aead_mac_size];
|
|
||||||
byte additional[CHACHA20_BLOCK_SIZE];
|
byte additional[CHACHA20_BLOCK_SIZE];
|
||||||
byte nonce[AEAD_NONCE_SZ];
|
byte nonce[AEAD_NONCE_SZ];
|
||||||
byte cipher[32]; /* generated key for poly1305 */
|
byte cipher[CHACHA20_256_KEY_SIZE]; /* generated key for poly1305 */
|
||||||
|
|
||||||
XMEMSET(tag, 0, sizeof(tag));
|
XMEMSET(tag, 0, sizeof(tag));
|
||||||
XMEMSET(nonce, 0, AEAD_NONCE_SZ);
|
XMEMSET(nonce, 0, AEAD_NONCE_SZ);
|
||||||
|
@ -4928,7 +4930,7 @@ static int ChachaAEADEncrypt(CYASSL* ssl, byte* out, const byte* input,
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if ((ret = Chacha_Process(ssl->encrypt.chacha, cipher,
|
if ((ret = Chacha_Process(ssl->encrypt.chacha, cipher,
|
||||||
cipher, 32)) != 0)
|
cipher, sizeof(cipher))) != 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* encrypt the plain text */
|
/* encrypt the plain text */
|
||||||
|
@ -4981,8 +4983,8 @@ static int ChachaAEADDecrypt(CYASSL* ssl, byte* plain, const byte* input,
|
||||||
{
|
{
|
||||||
byte additional[CHACHA20_BLOCK_SIZE];
|
byte additional[CHACHA20_BLOCK_SIZE];
|
||||||
byte nonce[AEAD_NONCE_SZ];
|
byte nonce[AEAD_NONCE_SZ];
|
||||||
byte tag[ssl->specs.aead_mac_size];
|
byte tag[POLY1305_AUTH_SZ];
|
||||||
byte cipher[32]; /* generated key for mac */
|
byte cipher[CHACHA20_256_KEY_SIZE]; /* generated key for mac */
|
||||||
int i;
|
int i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue