mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-08-01 11:26:52 +03:00
chacha: Create common file to avoid code duplication
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
#include "torture.h"
|
||||
#include "libssh/crypto.h"
|
||||
#include "libssh/chacha20-poly1305-common.h"
|
||||
|
||||
uint8_t key[32] =
|
||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e"
|
||||
@ -110,16 +111,15 @@ static void torture_crypto_aes256_cbc(void **state)
|
||||
ssh_cipher_clear(&cipher);
|
||||
}
|
||||
|
||||
#define POLY1305_TAGLEN 16
|
||||
|
||||
uint8_t chacha20poly1305_key[64] =
|
||||
uint8_t chacha20poly1305_key[CHACHA20_KEYLEN*2] =
|
||||
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e"
|
||||
"\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d"
|
||||
"\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c"
|
||||
"\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b"
|
||||
"\x3c\x3d\x3e\x3f";
|
||||
|
||||
uint8_t chacha20poly1305_cleartext[144] =
|
||||
#define CLEARTEXT_LENGTH 144
|
||||
uint8_t chacha20poly1305_cleartext[CLEARTEXT_LENGTH] =
|
||||
"\xb4\xfc\x5d\xc2\x49\x8d\x2c\x29\x4a\xc9\x9a\xb0\x1b\xf8\x29"
|
||||
"\xee\x85\x6d\x8c\x04\x34\x7c\x65\xf4\x89\x97\xc5\x71\x70\x41"
|
||||
"\x91\x40\x19\x60\xe1\xf1\x8f\x4d\x8c\x17\x51\xd6\xbc\x69\x6e"
|
||||
@ -133,7 +133,7 @@ uint8_t chacha20poly1305_cleartext[144] =
|
||||
|
||||
uint64_t chacha20poly1305_seq = (uint64_t)1234567890 * 98765431;
|
||||
|
||||
uint8_t chacha20poly1305_encrypted[sizeof(uint32_t) + 144 + POLY1305_TAGLEN] =
|
||||
uint8_t chacha20poly1305_encrypted[sizeof(uint32_t) + CLEARTEXT_LENGTH + POLY1305_TAGLEN] =
|
||||
"\xac\x2e\x4c\x54\xf6\x97\x75\xb4\x3b\x8f\xb0\x8e\xb0\x0a\x8e"
|
||||
"\xb3\x90\x21\x0d\x7a\xb6\xd3\x03\xf6\xbc\x6e\x3a\x32\x67\xe1"
|
||||
"\x13\x65\x43\x3b\x34\x9d\xcb\x62\x7e\x0a\x80\xb0\x45\x87\x07"
|
||||
|
Reference in New Issue
Block a user