Skip to content

Commit

Permalink
Fuzzing update-style md2(3)
Browse files Browse the repository at this point in the history
  • Loading branch information
plusun committed Jul 27, 2018
1 parent cf8bb22 commit f98643e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/fuzz/checksum/md2/update/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# $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_md2
SRCS= fuzz_md2.c
.PATH: ${NETBSDSRCDIR}/lib/libc/hash/md2/
SRCS+= md2.c md2hl.c

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

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

.include <bsd.prog.mk>
13 changes: 13 additions & 0 deletions tests/fuzz/checksum/md2/update/fuzz_md2.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 "md2.h"

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
MD2_CTX context;
MD2Init(&context);
MD2Update(&context, (const char *)data, size);
char digest[16];
MD2Final(digest, &context);
return 0;
}

0 comments on commit f98643e

Please sign in to comment.