Merge pull request #395 from libtom/feature/private_header

Add a new header file for private functions
This commit is contained in:
Steffen Jaeckel 2018-06-03 17:48:30 +02:00 committed by GitHub
commit 55fbe256ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
463 changed files with 900 additions and 773 deletions

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include <tomcrypt.h>
#include "tomcrypt_private.h"
#if defined(_WIN32)
#define PRI64 "I64d"

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include <tomcrypt.h>
#include "tomcrypt_private.h"
void hash_gen(void)
{

View File

@ -2037,8 +2037,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = LTC_SOURCE \
LTM_DESC \
PREDEFINED = LTM_DESC \
GMP_DESC \
TFM_DESC

View File

@ -291,7 +291,7 @@ sub process_makefiles {
my @c = ();
find({ no_chdir => 1, wanted => sub { push @c, $_ if -f $_ && $_ =~ /\.c$/ && $_ !~ /tab.c$/ } }, 'src');
my @h = ();
find({ no_chdir => 1, wanted => sub { push @h, $_ if -f $_ && $_ =~ /\.h$/ && $_ !~ /dh_static.h$/ } }, 'src');
find({ no_chdir => 1, wanted => sub { push @h, $_ if -f $_ && $_ =~ /\.h$/ && $_ !~ /dh_static.h$/ && $_ !~ /tomcrypt_private.h$/ } }, 'src');
my @all = ();
find({ no_chdir => 1, wanted => sub { push @all, $_ if -f $_ && $_ =~ /\.(c|h)$/ } }, 'src');
my @t = qw();
@ -299,7 +299,7 @@ sub process_makefiles {
my @o = sort ('src/ciphers/aes/aes_enc.o', map { my $x = $_; $x =~ s/\.c$/.o/; $x } @c);
my $var_o = prepare_variable("OBJECTS", @o);
my $var_h = prepare_variable("HEADERS", (sort @h));
my $var_h = prepare_variable("HEADERS_PUB", (sort @h));
(my $var_obj = $var_o) =~ s/\.o\b/.obj/sg;
my $var_to = prepare_variable("TOBJECTS", sort map { my $x = $_; $x =~ s/\.c$/.o/; $x } @t);

View File

@ -1035,6 +1035,10 @@
RelativePath="src\headers\tomcrypt_pkcs.h"
>
</File>
<File
RelativePath="src\headers\tomcrypt_private.h"
>
</File>
<File
RelativePath="src\headers\tomcrypt_prng.h"
>

View File

@ -217,12 +217,14 @@ tests/pkcs_1_oaep_test.o tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_
tests/rotate_test.o tests/rsa_test.o tests/store_test.o tests/test.o
#The following headers will be installed by "make install"
HEADERS=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h
HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h
#The default rule for make builds the libtomcrypt.a library (static)
default: $(LIBMAIN_S)

View File

@ -210,12 +210,14 @@ tests/pkcs_1_oaep_test.obj tests/pkcs_1_pss_test.obj tests/pkcs_1_test.obj tests
tests/rotate_test.obj tests/rsa_test.obj tests/store_test.obj tests/test.obj
#The following headers will be installed by "make install"
HEADERS=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h
HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h
#The default rule for make builds the tomcrypt.lib library (static)
default: $(LIBMAIN_S)

View File

@ -227,12 +227,14 @@ tests/pkcs_1_oaep_test.o tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_
tests/rotate_test.o tests/rsa_test.o tests/store_test.o tests/test.o
#The following headers will be installed by "make install"
HEADERS=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h
HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h
#The default rule for make builds the libtomcrypt.a library (static)
default: $(LIBMAIN_S)
@ -295,10 +297,10 @@ clean:
-@rm -f test.exe constants.exe sizes.exe tv_gen.exe hashsum.exe ltcrypt.exe small.exe timing.exe
#Install the library + headers
install: $(LIBMAIN_S) $(HEADERS)
install: $(LIBMAIN_S)
@mkdir -p $(DESTDIR)$(INCPATH) $(DESTDIR)$(LIBPATH)/pkgconfig
@cp $(LIBMAIN_S) $(DESTDIR)$(LIBPATH)/
@cp $(HEADERS) $(DESTDIR)$(INCPATH)/
@cp $(HEADERS_PUB) $(DESTDIR)$(INCPATH)/
@sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION),' libtomcrypt.pc.in > $(DESTDIR)$(LIBPATH)/pkgconfig/libtomcrypt.pc
#Install useful tools

View File

@ -387,12 +387,14 @@ tests/pkcs_1_oaep_test.o tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_
tests/rotate_test.o tests/rsa_test.o tests/store_test.o tests/test.o
# The following headers will be installed by "make install"
HEADERS=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
src/headers/tomcrypt_prng.h
HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h
#These are the rules to make certain object files.
src/ciphers/aes/aes.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
src/ciphers/twofish/twofish.o: src/ciphers/twofish/twofish.c src/ciphers/twofish/twofish_tab.c
@ -436,7 +438,7 @@ INSTALL_OPTS ?= -m 644
install -p -d $(DESTDIR)$(INCPATH)
install -p -d $(DESTDIR)$(LIBPATH)
$(INSTALL_CMD) -p $(INSTALL_OPTS) $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
install -p -m 644 $(HEADERS) $(DESTDIR)$(INCPATH)
install -p -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
$(DESTDIR)$(BINPATH):
install -p -d $(DESTDIR)$(BINPATH)
@ -454,7 +456,7 @@ install_test: $(call print-help,install_test,Installs the self-test binary) test
install_hooks: $(call print-help,install_hooks,Installs the git hooks)
for s in `ls hooks/`; do ln -s ../../hooks/$$s .git/hooks/$$s; done
HEADER_FILES=$(notdir $(HEADERS))
HEADER_FILES=$(notdir $(HEADERS_PUB))
.common_uninstall:
$(UNINSTALL_CMD) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
rm $(HEADER_FILES:%=$(DESTDIR)$(INCPATH)/%)

View File

@ -28,7 +28,7 @@
Implementation of AES
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_RIJNDAEL

View File

@ -13,7 +13,7 @@
Authors: Paulo S.L.M. Barreto and Vincent Rijmen.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_ANUBIS

View File

@ -10,7 +10,7 @@
@file blowfish.c
Implementation of the Blowfish block cipher, Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_BLOWFISH

View File

@ -12,7 +12,7 @@
Implementation by Tom St Denis of Elliptic Semiconductor
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CAMELLIA

View File

@ -11,7 +11,7 @@
@file cast5.c
Implementation of LTC_CAST5 (RFC 2144) by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CAST5

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
/**
@file des.c

View File

@ -22,7 +22,7 @@
and Japan (JP 3225440) (expired May 16, 2011).
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_IDEA

View File

@ -13,7 +13,7 @@
Derived from the 3GPP standard source code
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_KASUMI

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
/**
@file khazad.c

View File

@ -13,7 +13,7 @@
Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_KSEED

View File

@ -11,7 +11,7 @@
@file multi2.c
Multi-2 implementation (not public domain, hence the default disable)
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_MULTI2

View File

@ -10,7 +10,7 @@
@file noekeon.c
Implementation of the Noekeon block cipher by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_NOEKEON

View File

@ -16,7 +16,7 @@
* Thanks to CodeView, SoftIce, and D86 for helping bring this code to *
* the public. *
\**********************************************************************/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
/**
@file rc2.c

View File

@ -12,7 +12,7 @@
LTC_RC5 code by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_RC5

View File

@ -11,7 +11,7 @@
@file rc6.c
LTC_RC6 code by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_RC6

View File

@ -26,7 +26,7 @@
*
*******************************************************************************/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_SAFER

View File

@ -11,7 +11,7 @@
@file saferp.c
LTC_SAFER+ Implementation by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_SAFERP

View File

@ -15,7 +15,7 @@
https://en.wikipedia.org/wiki/Serpent_(cipher)
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_SERPENT

View File

@ -11,7 +11,7 @@
@file skipjack.c
Skipjack Implementation by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_SKIPJACK

View File

@ -11,7 +11,7 @@
@file twofish.c
Implementation of Twofish by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_TWOFISH

View File

@ -11,7 +11,7 @@
@file xtea.c
Implementation of LTC_XTEA, Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_XTEA

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CCM_MODE

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CCM_MODE

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CCM_MODE

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CCM_MODE

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
/**
@file ccm_memory.c

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CCM_MODE

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CCM_MODE

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
/**
@file ccm_test.c

View File

@ -7,7 +7,7 @@
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CHACHA20POLY1305_MODE

View File

@ -7,7 +7,7 @@
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CHACHA20POLY1305_MODE

View File

@ -7,7 +7,7 @@
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CHACHA20POLY1305_MODE

View File

@ -7,7 +7,7 @@
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CHACHA20POLY1305_MODE

View File

@ -7,7 +7,7 @@
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CHACHA20POLY1305_MODE

View File

@ -7,7 +7,7 @@
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CHACHA20POLY1305_MODE

View File

@ -7,7 +7,7 @@
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CHACHA20POLY1305_MODE

View File

@ -7,7 +7,7 @@
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CHACHA20POLY1305_MODE

View File

@ -7,7 +7,7 @@
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_CHACHA20POLY1305_MODE

View File

@ -10,7 +10,7 @@
@file eax_addheader.c
EAX implementation, add meta-data, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_EAX_MODE

View File

@ -11,7 +11,7 @@
@file eax_decrypt.c
EAX implementation, decrypt block, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_EAX_MODE

View File

@ -11,7 +11,7 @@
@file eax_decrypt_verify_memory.c
EAX implementation, decrypt block of memory, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_EAX_MODE

View File

@ -11,7 +11,7 @@
@file eax_done.c
EAX implementation, terminate session, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_EAX_MODE

View File

@ -11,7 +11,7 @@
@file eax_encrypt.c
EAX implementation, encrypt block by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_EAX_MODE

View File

@ -11,7 +11,7 @@
@file eax_encrypt_authenticate_memory.c
EAX implementation, encrypt a block of memory, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_EAX_MODE

View File

@ -11,7 +11,7 @@
@file eax_init.c
EAX implementation, initialized EAX state, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_EAX_MODE

View File

@ -11,7 +11,7 @@
@file eax_test.c
EAX implementation, self-test, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_EAX_MODE

View File

@ -11,7 +11,7 @@
@file gcm_add_aad.c
GCM implementation, Add AAD data to the stream, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_GCM_MODE

View File

@ -11,7 +11,7 @@
@file gcm_add_iv.c
GCM implementation, add IV data to the state, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_GCM_MODE

View File

@ -11,7 +11,7 @@
@file gcm_done.c
GCM implementation, Terminate the stream, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_GCM_MODE

View File

@ -11,7 +11,7 @@
@file gcm_gf_mult.c
GCM implementation, do the GF mult, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#if defined(LTC_GCM_TABLES) || defined(LTC_LRW_TABLES) || ((defined(LTC_GCM_MODE) || defined(LTC_GCM_MODE)) && defined(LTC_FAST))

View File

@ -11,7 +11,7 @@
@file gcm_init.c
GCM implementation, initialize state, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_GCM_MODE

View File

@ -11,7 +11,7 @@
@file gcm_memory.c
GCM implementation, process a packet, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_GCM_MODE

View File

@ -11,7 +11,7 @@
@file gcm_mult_h.c
GCM implementation, do the GF mult, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#if defined(LTC_GCM_MODE)
/**

View File

@ -11,7 +11,7 @@
@file gcm_process.c
GCM implementation, process message data, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_GCM_MODE

View File

@ -11,7 +11,7 @@
@file gcm_reset.c
GCM implementation, reset a used state so it can accept IV data, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_GCM_MODE

View File

@ -11,7 +11,7 @@
@file gcm_test.c
GCM implementation, testing, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_GCM_MODE

View File

@ -11,7 +11,7 @@
@file ocb_decrypt.c
OCB implementation, decrypt data, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB_MODE

View File

@ -11,7 +11,7 @@
@file ocb_decrypt_verify_memory.c
OCB implementation, helper to decrypt block of memory, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB_MODE

View File

@ -11,7 +11,7 @@
@file ocb_done_decrypt.c
OCB implementation, terminate decryption, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB_MODE

View File

@ -11,7 +11,7 @@
@file ocb_done_encrypt.c
OCB implementation, terminate encryption, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB_MODE

View File

@ -11,7 +11,7 @@
@file ocb_encrypt.c
OCB implementation, encrypt data, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB_MODE

View File

@ -11,7 +11,7 @@
@file ocb_encrypt_authenticate_memory.c
OCB implementation, encrypt block of memory, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB_MODE

View File

@ -11,7 +11,7 @@
@file ocb_init.c
OCB implementation, initialize state, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB_MODE

View File

@ -12,7 +12,7 @@
OCB implementation, internal function, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB_MODE

View File

@ -11,7 +11,7 @@
@file ocb_shift_xor.c
OCB implementation, internal function, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB_MODE

View File

@ -11,7 +11,7 @@
@file ocb_test.c
OCB implementation, self-test by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB_MODE

View File

@ -11,7 +11,7 @@
@file s_ocb_done.c
OCB implementation, internal helper, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB_MODE

View File

@ -11,7 +11,7 @@
@file ocb3_add_aad.c
OCB implementation, add AAD data, by Karel Miko
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB3_MODE

View File

@ -11,7 +11,7 @@
@file ocb3_decrypt.c
OCB implementation, decrypt data, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB3_MODE

View File

@ -11,7 +11,7 @@
@file ocb3_decrypt_last.c
OCB implementation, internal helper, by Karel Miko
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB3_MODE

View File

@ -11,7 +11,7 @@
@file ocb3_decrypt_verify_memory.c
OCB implementation, helper to decrypt block of memory, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB3_MODE

View File

@ -11,7 +11,7 @@
@file ocb3_done.c
OCB implementation, INTERNAL ONLY helper, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB3_MODE

View File

@ -11,7 +11,7 @@
@file ocb3_encrypt.c
OCB implementation, encrypt data, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB3_MODE

View File

@ -11,7 +11,7 @@
@file ocb3_encrypt_authenticate_memory.c
OCB implementation, encrypt block of memory, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB3_MODE

View File

@ -11,7 +11,7 @@
@file ocb3_encrypt_last.c
OCB implementation, internal helper, by Karel Miko
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB3_MODE

View File

@ -11,7 +11,7 @@
@file ocb3_init.c
OCB implementation, initialize state, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB3_MODE

View File

@ -11,7 +11,7 @@
@file ocb3_int_ntz.c
OCB implementation, INTERNAL ONLY helper, by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB3_MODE

View File

@ -11,7 +11,7 @@
@file ocb3_int_xor_blocks.c
OCB implementation, INTERNAL ONLY helper, by Karel Miko
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB3_MODE

View File

@ -11,7 +11,7 @@
@file ocb3_test.c
OCB implementation, self-test by Tom St Denis
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_OCB3_MODE

View File

@ -23,7 +23,7 @@
*/
/* see also https://www.ietf.org/rfc/rfc7693.txt */
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_BLAKE2B
@ -199,6 +199,19 @@ static int blake2b_init_param(hash_state *md, const unsigned char *P)
return CRYPT_OK;
}
/**
Initialize the hash/MAC state
Use this function to init for arbitrary sizes.
Give a key and keylen to init for MAC mode.
@param md The hash state you wish to initialize
@param outlen The desired output-length
@param key The key of the MAC
@param keylen The length of the key
@return CRYPT_OK if successful
*/
int blake2b_init(hash_state *md, unsigned long outlen, const unsigned char *key, unsigned long keylen)
{
unsigned char P[BLAKE2B_PARAM_SIZE];
@ -237,12 +250,32 @@ int blake2b_init(hash_state *md, unsigned long outlen, const unsigned char *key,
return CRYPT_OK;
}
/**
Initialize the hash state
@param md The hash state you wish to initialize
@return CRYPT_OK if successful
*/
int blake2b_160_init(hash_state *md) { return blake2b_init(md, 20, NULL, 0); }
/**
Initialize the hash state
@param md The hash state you wish to initialize
@return CRYPT_OK if successful
*/
int blake2b_256_init(hash_state *md) { return blake2b_init(md, 32, NULL, 0); }
/**
Initialize the hash state
@param md The hash state you wish to initialize
@return CRYPT_OK if successful
*/
int blake2b_384_init(hash_state *md) { return blake2b_init(md, 48, NULL, 0); }
/**
Initialize the hash state
@param md The hash state you wish to initialize
@return CRYPT_OK if successful
*/
int blake2b_512_init(hash_state *md) { return blake2b_init(md, 64, NULL, 0); }
#define G(r, i, a, b, c, d) \
@ -328,6 +361,13 @@ static int blake2b_compress(hash_state *md, const unsigned char *buf)
}
#endif
/**
Process a block of memory through the hash
@param md The hash state
@param in The data to hash
@param inlen The length of the data (octets)
@return CRYPT_OK if successful
*/
int blake2b_process(hash_state *md, const unsigned char *in, unsigned long inlen)
{
LTC_ARGCHK(md != NULL);
@ -360,6 +400,12 @@ int blake2b_process(hash_state *md, const unsigned char *in, unsigned long inlen
return CRYPT_OK;
}
/**
Terminate the hash to get the digest
@param md The hash state
@param out [out] The destination of the hash (size depending on the length used on init)
@return CRYPT_OK if successful
*/
int blake2b_done(hash_state *md, unsigned char *out)
{
unsigned char buffer[BLAKE2B_OUTBYTES] = { 0 };

View File

@ -23,7 +23,7 @@
*/
/* see also https://www.ietf.org/rfc/rfc7693.txt */
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_BLAKE2S
@ -193,6 +193,19 @@ static int blake2s_init_param(hash_state *md, const unsigned char *P)
return CRYPT_OK;
}
/**
Initialize the hash/MAC state
Use this function to init for arbitrary sizes.
Give a key and keylen to init for MAC mode.
@param md The hash state you wish to initialize
@param outlen The desired output-length
@param key The key of the MAC
@param keylen The length of the key
@return CRYPT_OK if successful
*/
int blake2s_init(hash_state *md, unsigned long outlen, const unsigned char *key, unsigned long keylen)
{
unsigned char P[BLAKE2S_PARAM_SIZE];
@ -230,12 +243,32 @@ int blake2s_init(hash_state *md, unsigned long outlen, const unsigned char *key,
return CRYPT_OK;
}
/**
Initialize the hash state
@param md The hash state you wish to initialize
@return CRYPT_OK if successful
*/
int blake2s_128_init(hash_state *md) { return blake2s_init(md, 16, NULL, 0); }
/**
Initialize the hash state
@param md The hash state you wish to initialize
@return CRYPT_OK if successful
*/
int blake2s_160_init(hash_state *md) { return blake2s_init(md, 20, NULL, 0); }
/**
Initialize the hash state
@param md The hash state you wish to initialize
@return CRYPT_OK if successful
*/
int blake2s_224_init(hash_state *md) { return blake2s_init(md, 28, NULL, 0); }
/**
Initialize the hash state
@param md The hash state you wish to initialize
@return CRYPT_OK if successful
*/
int blake2s_256_init(hash_state *md) { return blake2s_init(md, 32, NULL, 0); }
#define G(r, i, a, b, c, d) \
@ -316,6 +349,13 @@ static int blake2s_compress(hash_state *md, const unsigned char *buf)
}
#endif
/**
Process a block of memory through the hash
@param md The hash state
@param in The data to hash
@param inlen The length of the data (octets)
@return CRYPT_OK if successful
*/
int blake2s_process(hash_state *md, const unsigned char *in, unsigned long inlen)
{
LTC_ARGCHK(md != NULL);
@ -348,6 +388,12 @@ int blake2s_process(hash_state *md, const unsigned char *in, unsigned long inlen
return CRYPT_OK;
}
/**
Terminate the hash to get the digest
@param md The hash state
@param out [out] The destination of the hash (size depending on the length used on init)
@return CRYPT_OK if successful
*/
int blake2s_done(hash_state *md, unsigned char *out)
{
unsigned char buffer[BLAKE2S_OUTBYTES] = { 0 };

View File

@ -7,7 +7,7 @@
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
/**
@file chc.c

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifndef LTC_NO_FILE
/**

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifndef LTC_NO_FILE
/**

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#ifdef LTC_HASH_HELPERS
/**

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
#include <stdarg.h>
#ifdef LTC_HASH_HELPERS

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
/**
@param md2.c

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
/**
@param md4.c

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
/**

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
/**
@param rmd128.c

View File

@ -6,7 +6,7 @@
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt.h"
#include "tomcrypt_private.h"
/**
@file rmd160.c

Some files were not shown because too many files have changed in this diff Show More