Skip to content

Commit

Permalink
Fuzzing update-style MD4
Browse files Browse the repository at this point in the history
  • Loading branch information
plusun committed Jul 29, 2018
1 parent 9617b48 commit af63ca0
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/fuzz/checksum/md4/update/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# $NetBSD: Makefile,v 1.15 2007/05/28 12:06:25 tls Exp $
# @(#)Makefile 8.2 (Berkeley) 4/2/94

.include <bsd.own.mk>

PROG= fuzz_md4
SRCS= fuzz_md4.c
.PATH: ${NETBSDSRCDIR}/lib/libc/md/
SRCS+= md4hl.c
.PATH: ${NETBSDSRCDIR}/common/lib/libc/md/
SRCS+= md4c.c

CPPFLAGS+=-I${NETBSDSRCDIR}/lib/libc/include

fuzz: fuzz_md4
./fuzz_md4 ./input > /dev/null

.include <bsd.prog.mk>
13 changes: 13 additions & 0 deletions tests/fuzz/checksum/md4/update/fuzz_md4.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <stdint.h>
#include <stddef.h>
#include <sys/types.h>
#include "md4.h"

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
MD4_CTX context;
MD4Init(&context);
MD4Update(&context, (const char *)data, size);
char digest[16];
MD4Final(digest, &context);
return 0;
}

0 comments on commit af63ca0

Please sign in to comment.