mirror of https://github.com/wolfSSL/wolfssl
progress on suite
This commit is contained in:
parent
6c366a1863
commit
53c63dd257
|
@ -1042,10 +1042,10 @@ enum BulkCipherAlgorithm {
|
||||||
cyassl_aes,
|
cyassl_aes,
|
||||||
cyassl_aes_gcm,
|
cyassl_aes_gcm,
|
||||||
cyassl_aes_ccm,
|
cyassl_aes_ccm,
|
||||||
|
cyassl_chacha,
|
||||||
cyassl_camellia,
|
cyassl_camellia,
|
||||||
cyassl_hc128, /* CyaSSL extensions */
|
cyassl_hc128, /* CyaSSL extensions */
|
||||||
cyassl_rabbit,
|
cyassl_rabbit
|
||||||
cyassl_chacha
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@ git stash -q --keep-index
|
||||||
|
|
||||||
# do the commit tests
|
# do the commit tests
|
||||||
echo "\n\nRunning commit tests...\n\n"
|
echo "\n\nRunning commit tests...\n\n"
|
||||||
#./commit-tests.sh
|
./commit-tests.sh
|
||||||
#RESULT=$?
|
RESULT=$?
|
||||||
|
|
||||||
# restore modified files not part of this commit
|
# restore modified files not part of this commit
|
||||||
echo "\n\nPopping any stashed modified files not part of commit\n"
|
echo "\n\nPopping any stashed modified files not part of commit\n"
|
||||||
|
|
|
@ -2419,7 +2419,6 @@ static int HashOutput(CYASSL* ssl, const byte* output, int sz, int ivSz)
|
||||||
#ifndef NO_MD5
|
#ifndef NO_MD5
|
||||||
Md5Update(&ssl->hashMd5, adj, sz);
|
Md5Update(&ssl->hashMd5, adj, sz);
|
||||||
#endif
|
#endif
|
||||||
// Poly1305Update(&ssl->hashPoly1395, adj, sz);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (IsAtLeastTLSv1_2(ssl)) {
|
if (IsAtLeastTLSv1_2(ssl)) {
|
||||||
|
@ -4313,7 +4312,7 @@ static INLINE int Encrypt(CYASSL* ssl, byte* out, const byte* input, word16 sz)
|
||||||
return Hc128_Process(ssl->encrypt.hc128, out, input, sz);
|
return Hc128_Process(ssl->encrypt.hc128, out, input, sz);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BILD_RABBIT
|
#ifdef BUILD_RABBIT
|
||||||
case cyassl_rabbit:
|
case cyassl_rabbit:
|
||||||
return RabbitProcess(ssl->encrypt.rabbit, out, input, sz);
|
return RabbitProcess(ssl->encrypt.rabbit, out, input, sz);
|
||||||
#endif
|
#endif
|
||||||
|
@ -4381,8 +4380,19 @@ static INLINE int Encrypt(CYASSL* ssl, byte* out, const byte* input, word16 sz)
|
||||||
/* add size of AD and size of cipher to poly input */
|
/* add size of AD and size of cipher to poly input */
|
||||||
(p + CHACHA20_BLOCK_SIZE + padding2)[0] =
|
(p + CHACHA20_BLOCK_SIZE + padding2)[0] =
|
||||||
(CHACHA20_BLOCK_SIZE);
|
(CHACHA20_BLOCK_SIZE);
|
||||||
|
|
||||||
|
/* 32 bit size of cipher to 64 bit endian */
|
||||||
((p + CHACHA20_BLOCK_SIZE + padding2))[8] =
|
((p + CHACHA20_BLOCK_SIZE + padding2))[8] =
|
||||||
(byte)(sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size);
|
(sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size) & 0xff;
|
||||||
|
|
||||||
|
((p + CHACHA20_BLOCK_SIZE + padding2))[9] =
|
||||||
|
((sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size) >> 8) & 0xff;
|
||||||
|
|
||||||
|
((p + CHACHA20_BLOCK_SIZE + padding2))[10] =
|
||||||
|
((sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size) >>16) & 0xff;
|
||||||
|
|
||||||
|
((p + CHACHA20_BLOCK_SIZE + padding2))[11] =
|
||||||
|
((sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size) >>24) & 0xff;
|
||||||
|
|
||||||
/* generate tag */
|
/* generate tag */
|
||||||
Poly1305SetKey(ssl->encrypt.poly1305,
|
Poly1305SetKey(ssl->encrypt.poly1305,
|
||||||
|
@ -4556,8 +4566,7 @@ static INLINE int Decrypt(CYASSL* ssl, byte* plain, const byte* input,
|
||||||
+ (sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size) % 16;
|
+ (sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size) % 16;
|
||||||
|
|
||||||
byte p[CHACHA20_BLOCK_SIZE + padding2 + 16];
|
byte p[CHACHA20_BLOCK_SIZE + padding2 + 16];
|
||||||
int i;
|
int i, ret;
|
||||||
int ret;
|
|
||||||
|
|
||||||
XMEMSET(tag, 0, 16);
|
XMEMSET(tag, 0, 16);
|
||||||
XMEMSET(cipher, 0, sizeof(cipher));
|
XMEMSET(cipher, 0, sizeof(cipher));
|
||||||
|
@ -4594,17 +4603,30 @@ static INLINE int Decrypt(CYASSL* ssl, byte* plain, const byte* input,
|
||||||
Chacha_SetIV(ssl->decrypt.chacha, nonce, 0);
|
Chacha_SetIV(ssl->decrypt.chacha, nonce, 0);
|
||||||
Chacha_Process(ssl->decrypt.chacha, cipher, cipher, 32);
|
Chacha_Process(ssl->decrypt.chacha, cipher, cipher, 32);
|
||||||
|
|
||||||
/* create Poly1305 tag */
|
/* create input for Poly1305 */
|
||||||
XMEMCPY(ssl->keys.server_write_MAC_secret, cipher, 32);
|
XMEMCPY(ssl->keys.server_write_MAC_secret, cipher, 32);
|
||||||
XMEMCPY(p, additional, CHACHA20_BLOCK_SIZE);
|
XMEMCPY(p, additional, CHACHA20_BLOCK_SIZE);
|
||||||
XMEMCPY((p + (CHACHA20_BLOCK_SIZE)), input + AEAD_EXP_IV_SZ,
|
XMEMCPY((p + (CHACHA20_BLOCK_SIZE)), input + AEAD_EXP_IV_SZ,
|
||||||
sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size);
|
sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size);
|
||||||
|
|
||||||
|
/* add size of AD and of cipher */
|
||||||
(p + CHACHA20_BLOCK_SIZE + padding2)[0] =
|
(p + CHACHA20_BLOCK_SIZE + padding2)[0] =
|
||||||
(CHACHA20_BLOCK_SIZE);
|
(CHACHA20_BLOCK_SIZE);
|
||||||
|
|
||||||
|
/* 32 bit size of cipher to 64 bit endian */
|
||||||
((p + CHACHA20_BLOCK_SIZE + padding2))[8] =
|
((p + CHACHA20_BLOCK_SIZE + padding2))[8] =
|
||||||
(byte)(sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size);
|
(sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size) & 0xff;
|
||||||
|
|
||||||
|
((p + CHACHA20_BLOCK_SIZE + padding2))[9] =
|
||||||
|
((sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size) >> 8) & 0xff;
|
||||||
|
|
||||||
|
((p + CHACHA20_BLOCK_SIZE + padding2))[10] =
|
||||||
|
((sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size) >>16) & 0xff;
|
||||||
|
|
||||||
|
((p + CHACHA20_BLOCK_SIZE + padding2))[11] =
|
||||||
|
((sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size) >>24) & 0xff;
|
||||||
|
|
||||||
|
/* create Poly1305 tag */
|
||||||
Poly1305SetKey(ssl->decrypt.poly1305,
|
Poly1305SetKey(ssl->decrypt.poly1305,
|
||||||
ssl->keys.server_write_MAC_secret,
|
ssl->keys.server_write_MAC_secret,
|
||||||
sizeof(ssl->keys.server_write_MAC_secret));
|
sizeof(ssl->keys.server_write_MAC_secret));
|
||||||
|
|
Loading…
Reference in New Issue