From 06b1582de6d676e8e9cda2a6a19bf2db0081115c Mon Sep 17 00:00:00 2001 From: Karel Miko Date: Thu, 30 Mar 2017 21:23:20 +0200 Subject: [PATCH] new #define FILE_READ_BUFSIZE --- src/headers/tomcrypt_custom.h | 5 ++++- src/mac/poly1305/poly1305_file.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/headers/tomcrypt_custom.h b/src/headers/tomcrypt_custom.h index 5039113..61eafd2 100644 --- a/src/headers/tomcrypt_custom.h +++ b/src/headers/tomcrypt_custom.h @@ -550,7 +550,10 @@ #endif - +#ifndef LTC_NO_FILE + /* buffer size for reading from a file via fread(..) */ + #define FILE_READ_BUFSIZE 8192 +#endif /* $Source$ */ /* $Revision$ */ diff --git a/src/mac/poly1305/poly1305_file.c b/src/mac/poly1305/poly1305_file.c index 92ff2aa..bca5ceb 100644 --- a/src/mac/poly1305/poly1305_file.c +++ b/src/mac/poly1305/poly1305_file.c @@ -42,7 +42,7 @@ int poly1305_file(const char *fname, const unsigned char *key, unsigned long key LTC_ARGCHK(maclen != NULL); if ((in = fopen(fname, "rb")) == NULL) { return CRYPT_FILE_NOTFOUND; } - if ((buf = XMALLOC(8196)) == NULL) { return CRYPT_MEM; } + if ((buf = XMALLOC(FILE_READ_BUFSIZE)) == NULL) { return CRYPT_MEM; } if ((err = poly1305_init(&st, key, keylen)) != CRYPT_OK) { goto LBL_ERR; } do {