totp

Simple cli tool for storing TOTP secrets and generating tokens
git clone https://git.inz.fi/totp/
Log | Files | Refs | Submodules

commit 53120e371609ab266df16ad6aad1049751d5d974
parent 1195b89de4248d5c0a1d79148c499ba7011b894b
Author: Santtu Lakkala <santtu.lakkala@digital14.com>
Date:   Tue, 26 Sep 2023 12:51:31 +0300

Add non-encrypted DB fuzz target

Diffstat:
MMakefile | 6++++++
Mfuzzdb.c | 6+-----
2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile @@ -43,12 +43,18 @@ test: algotest ${NAME} fuzzdb: fuzzdb.c ${AFLCC} fuzzdb.c -o fuzzdb -fsanitize=undefined,address +fuzzdbraw: fuzzdb.c + ${AFLCC} fuzzdb.c -o fuzzdbraw -fsanitize=undefined,address -DRAW_DB + test/fuzz-crashes: mkdir tests/fuzz-crashes db-fuzz: fuzzdb tests/fuzz-crashes ${AFLFUZZ} -i tests/dbs -o tests/fuzz-crashes ./fuzzdb +dbraw-fuzz: fuzzdbraw tests/fuzz-crashes + ${AFLFUZZ} -i tests/rawdbs -o tests/fuzz-crashes ./fuzzdbraw + fuzzuri: fuzzuri.c ${AFLCC} fuzzuri.c -o fuzzuri -fsanitize=undefined,address diff --git a/fuzzdb.c b/fuzzdb.c @@ -3,8 +3,8 @@ #include <unistd.h> #include <stdint.h> #include <fcntl.h> -#ifndef RAW_DB #define AES256 1 +#ifndef RAW_DB #include "tiny-AES-c/aes.c" #endif #include "tiny-AES-c/aes.h" @@ -20,11 +20,9 @@ ssize_t my_read(int fd, void *buf, size_t count); #undef read #undef open -#ifndef RAW_DB uint8_t keybuf[AES_BLOCKLEN + AES_KEYLEN] = { 0xc7, 0x14, 0x90, 0xfc, 0x24, 0xaa, 0x3d, 0x19, 0xe1, 0x12, 0x82, 0xda, 0x77, 0x03, 0x2d, 0xd9, 0xcd, 0xb3, 0x31, 0x03, 0xc8, 0xd3, 0xda, 0x46, 0x29, 0xc7, 0x1c, 0x1b, 0xe7, 0xf8, 0x06, 0xa7, 0x0b, 0x3c, 0x1c, 0x17, 0x74, 0xf0, 0xd5, 0x34, 0x1b, 0xe3, 0x24, 0xef, 0xde, 0xac, 0x9d, 0x9e }; -#endif ssize_t len; ssize_t buf_pos; @@ -59,9 +57,7 @@ int main(void) __AFL_INIT(); unsigned char *buf = __AFL_FUZZ_TESTCASE_BUF; while (__AFL_LOOP(10000)) { -#ifndef RAW_DB struct AES_ctx aes; -#endif len = __AFL_FUZZ_TESTCASE_LEN; src = realloc(src, len + 1); buf_pos = 0;