Mercurial > dropbear
annotate fuzz-harness.c @ 1672:3a97f14c0235
Add Chacha20-Poly1305, AES128-GCM and AES256-GCM support (#93)
* Add Chacha20-Poly1305 authenticated encryption
* Add general AEAD approach.
* Add [email protected] algo using LibTomCrypt chacha and
poly1305 routines.
Chacha20-Poly1305 is generally faster than AES256 on CPU w/o dedicated
AES instructions, having the same key size.
Compiling in will add ~5,5kB to binary size on x86-64.
function old new delta
chacha_crypt - 1397 +1397
_poly1305_block - 608 +608
poly1305_done - 595 +595
dropbear_chachapoly_crypt - 457 +457
.rodata 26976 27392 +416
poly1305_process - 290 +290
poly1305_init - 221 +221
chacha_setup - 218 +218
encrypt_packet 1068 1270 +202
dropbear_chachapoly_getlength - 147 +147
decrypt_packet 756 897 +141
chacha_ivctr64 - 137 +137
read_packet 543 637 +94
dropbear_chachapoly_start - 94 +94
read_kex_algos 792 880 +88
chacha_keystream - 69 +69
dropbear_mode_chachapoly - 48 +48
sshciphers 280 320 +40
dropbear_mode_none 24 48 +24
dropbear_mode_ctr 24 48 +24
dropbear_mode_cbc 24 48 +24
dropbear_chachapoly_mac - 24 +24
dropbear_chachapoly - 24 +24
gen_new_keys 848 854 +6
------------------------------------------------------------------------------
(add/remove: 14/0 grow/shrink: 10/0 up/down: 5388/0) Total: 5388 bytes
* Add AES128-GCM and AES256-GCM authenticated encryption
* Add general AES-GCM mode.
* Add [email protected] and [email protected] algo using
LibTomCrypt gcm routines.
AES-GCM is combination of AES CTR mode and GHASH, slower than AES-CTR on
CPU w/o dedicated AES/GHASH instructions therefore disabled by default.
Compiling in will add ~6kB to binary size on x86-64.
function old new delta
gcm_process - 1060 +1060
.rodata 26976 27808 +832
gcm_gf_mult - 820 +820
gcm_add_aad - 660 +660
gcm_shift_table - 512 +512
gcm_done - 471 +471
gcm_add_iv - 384 +384
gcm_init - 347 +347
dropbear_gcm_crypt - 309 +309
encrypt_packet 1068 1270 +202
decrypt_packet 756 897 +141
gcm_reset - 118 +118
read_packet 543 637 +94
read_kex_algos 792 880 +88
sshciphers 280 360 +80
gcm_mult_h - 80 +80
dropbear_gcm_start - 62 +62
dropbear_mode_gcm - 48 +48
dropbear_mode_none 24 48 +24
dropbear_mode_ctr 24 48 +24
dropbear_mode_cbc 24 48 +24
dropbear_ghash - 24 +24
dropbear_gcm_getlength - 24 +24
gen_new_keys 848 854 +6
------------------------------------------------------------------------------
(add/remove: 14/0 grow/shrink: 10/0 up/down: 6434/0) Total: 6434 bytes
author | Vladislav Grishenko <themiron@users.noreply.github.com> |
---|---|
date | Mon, 25 May 2020 20:50:25 +0500 |
parents | bff41a61a1b6 |
children | dfbe947bdf0d |
rev | line source |
---|---|
1348 | 1 #include "includes.h" |
1354 | 2 #include "buffer.h" |
3 #include "dbutil.h" | |
1348 | 4 |
5 extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size); | |
6 | |
7 int main(int argc, char ** argv) { | |
1354 | 8 int i; |
9 buffer *input = buf_new(100000); | |
10 | |
1363 | 11 for (i = 1; i < argc; i++) { |
1589
35af85194268
Add kexdh and kexecdh fuzzers
Matt Johnston <matt@ucc.asn.au>
parents:
1559
diff
changeset
|
12 printf("arg %s\n", argv[i]); |
1363 | 13 #if DEBUG_TRACE |
14 if (strcmp(argv[i], "-v") == 0) { | |
15 debug_trace = 1; | |
1373
9891bc31a1b3
fuzzers disable logging by default
Matt Johnston <matt@ucc.asn.au>
parents:
1363
diff
changeset
|
16 TRACE(("debug printing on")) |
1363 | 17 } |
1357 | 18 #endif |
1363 | 19 } |
1357 | 20 |
1605
bff41a61a1b6
Disable wrapfds outside of fuzzed code
Matt Johnston <matt@ucc.asn.au>
parents:
1589
diff
changeset
|
21 int old_fuzz_wrapfds = 0; |
1354 | 22 for (i = 1; i < argc; i++) { |
1363 | 23 if (argv[i][0] == '-') { |
1559
92c93b4a3646
Fix to be able to compile normal(ish) binaries with --enable-fuzz
Matt Johnston <matt@ucc.asn.au>
parents:
1373
diff
changeset
|
24 /* ignore arguments */ |
1363 | 25 continue; |
26 } | |
27 | |
1354 | 28 char* fn = argv[i]; |
29 buf_setlen(input, 0); | |
30 buf_readfile(input, fn); | |
31 buf_setpos(input, 0); | |
32 | |
1605
bff41a61a1b6
Disable wrapfds outside of fuzzed code
Matt Johnston <matt@ucc.asn.au>
parents:
1589
diff
changeset
|
33 fuzz.wrapfds = old_fuzz_wrapfds; |
1358
6b89eb92f872
glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents:
1357
diff
changeset
|
34 printf("Running %s once \n", fn); |
6b89eb92f872
glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents:
1357
diff
changeset
|
35 LLVMFuzzerTestOneInput(input->data, input->len); |
6b89eb92f872
glaring wrapfd problems fixed
Matt Johnston <matt@ucc.asn.au>
parents:
1357
diff
changeset
|
36 printf("Running %s twice \n", fn); |
1354 | 37 LLVMFuzzerTestOneInput(input->data, input->len); |
38 printf("Done %s\n", fn); | |
1605
bff41a61a1b6
Disable wrapfds outside of fuzzed code
Matt Johnston <matt@ucc.asn.au>
parents:
1589
diff
changeset
|
39 |
bff41a61a1b6
Disable wrapfds outside of fuzzed code
Matt Johnston <matt@ucc.asn.au>
parents:
1589
diff
changeset
|
40 /* Disable wrapfd so it won't interfere with buf_readfile() above */ |
bff41a61a1b6
Disable wrapfds outside of fuzzed code
Matt Johnston <matt@ucc.asn.au>
parents:
1589
diff
changeset
|
41 old_fuzz_wrapfds = fuzz.wrapfds; |
bff41a61a1b6
Disable wrapfds outside of fuzzed code
Matt Johnston <matt@ucc.asn.au>
parents:
1589
diff
changeset
|
42 fuzz.wrapfds = 0; |
1354 | 43 } |
44 | |
45 printf("Finished\n"); | |
46 | |
1348 | 47 return 0; |
48 } |