Skip to content

Commit 55fbe25

Browse files
authored
Merge pull request #395 from libtom/feature/private_header
Add a new header file for private functions
2 parents 5d8f35e + c725be2 commit 55fbe25

File tree

463 files changed

+900
-773
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

463 files changed

+900
-773
lines changed

demos/timing.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* The library is free for all purposes without any express
77
* guarantee it works.
88
*/
9-
#include <tomcrypt.h>
9+
#include "tomcrypt_private.h"
1010

1111
#if defined(_WIN32)
1212
#define PRI64 "I64d"

demos/tv_gen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* The library is free for all purposes without any express
77
* guarantee it works.
88
*/
9-
#include <tomcrypt.h>
9+
#include "tomcrypt_private.h"
1010

1111
void hash_gen(void)
1212
{

doc/Doxyfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,8 +2037,7 @@ INCLUDE_FILE_PATTERNS =
20372037
# recursively expanded use the := operator instead of the = operator.
20382038
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
20392039

2040-
PREDEFINED = LTC_SOURCE \
2041-
LTM_DESC \
2040+
PREDEFINED = LTM_DESC \
20422041
GMP_DESC \
20432042
TFM_DESC
20442043

helper.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,15 @@ sub process_makefiles {
291291
my @c = ();
292292
find({ no_chdir => 1, wanted => sub { push @c, $_ if -f $_ && $_ =~ /\.c$/ && $_ !~ /tab.c$/ } }, 'src');
293293
my @h = ();
294-
find({ no_chdir => 1, wanted => sub { push @h, $_ if -f $_ && $_ =~ /\.h$/ && $_ !~ /dh_static.h$/ } }, 'src');
294+
find({ no_chdir => 1, wanted => sub { push @h, $_ if -f $_ && $_ =~ /\.h$/ && $_ !~ /dh_static.h$/ && $_ !~ /tomcrypt_private.h$/ } }, 'src');
295295
my @all = ();
296296
find({ no_chdir => 1, wanted => sub { push @all, $_ if -f $_ && $_ =~ /\.(c|h)$/ } }, 'src');
297297
my @t = qw();
298298
find({ no_chdir => 1, wanted => sub { push @t, $_ if $_ =~ /(common|no_prng|_tests?|test).c$/ } }, 'tests');
299299

300300
my @o = sort ('src/ciphers/aes/aes_enc.o', map { my $x = $_; $x =~ s/\.c$/.o/; $x } @c);
301301
my $var_o = prepare_variable("OBJECTS", @o);
302-
my $var_h = prepare_variable("HEADERS", (sort @h));
302+
my $var_h = prepare_variable("HEADERS_PUB", (sort @h));
303303
(my $var_obj = $var_o) =~ s/\.o\b/.obj/sg;
304304

305305
my $var_to = prepare_variable("TOBJECTS", sort map { my $x = $_; $x =~ s/\.c$/.o/; $x } @t);

libtomcrypt_VS2008.vcproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,10 @@
10351035
RelativePath="src\headers\tomcrypt_pkcs.h"
10361036
>
10371037
</File>
1038+
<File
1039+
RelativePath="src\headers\tomcrypt_private.h"
1040+
>
1041+
</File>
10381042
<File
10391043
RelativePath="src\headers\tomcrypt_prng.h"
10401044
>

makefile.mingw

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,12 +217,14 @@ tests/pkcs_1_oaep_test.o tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_
217217
tests/rotate_test.o tests/rsa_test.o tests/store_test.o tests/test.o
218218

219219
#The following headers will be installed by "make install"
220-
HEADERS=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
220+
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
221221
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
222222
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
223223
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
224224
src/headers/tomcrypt_prng.h
225225

226+
HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h
227+
226228
#The default rule for make builds the libtomcrypt.a library (static)
227229
default: $(LIBMAIN_S)
228230

makefile.msvc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,14 @@ tests/pkcs_1_oaep_test.obj tests/pkcs_1_pss_test.obj tests/pkcs_1_test.obj tests
210210
tests/rotate_test.obj tests/rsa_test.obj tests/store_test.obj tests/test.obj
211211

212212
#The following headers will be installed by "make install"
213-
HEADERS=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
213+
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
214214
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
215215
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
216216
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
217217
src/headers/tomcrypt_prng.h
218218

219+
HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h
220+
219221
#The default rule for make builds the tomcrypt.lib library (static)
220222
default: $(LIBMAIN_S)
221223

makefile.unix

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,12 +227,14 @@ tests/pkcs_1_oaep_test.o tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_
227227
tests/rotate_test.o tests/rsa_test.o tests/store_test.o tests/test.o
228228

229229
#The following headers will be installed by "make install"
230-
HEADERS=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
230+
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
231231
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
232232
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
233233
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
234234
src/headers/tomcrypt_prng.h
235235

236+
HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h
237+
236238
#The default rule for make builds the libtomcrypt.a library (static)
237239
default: $(LIBMAIN_S)
238240

@@ -295,10 +297,10 @@ clean:
295297
-@rm -f test.exe constants.exe sizes.exe tv_gen.exe hashsum.exe ltcrypt.exe small.exe timing.exe
296298

297299
#Install the library + headers
298-
install: $(LIBMAIN_S) $(HEADERS)
300+
install: $(LIBMAIN_S)
299301
@mkdir -p $(DESTDIR)$(INCPATH) $(DESTDIR)$(LIBPATH)/pkgconfig
300302
@cp $(LIBMAIN_S) $(DESTDIR)$(LIBPATH)/
301-
@cp $(HEADERS) $(DESTDIR)$(INCPATH)/
303+
@cp $(HEADERS_PUB) $(DESTDIR)$(INCPATH)/
302304
@sed -e 's,^prefix=.*,prefix=$(PREFIX),' -e 's,^Version:.*,Version: $(VERSION),' libtomcrypt.pc.in > $(DESTDIR)$(LIBPATH)/pkgconfig/libtomcrypt.pc
303305

304306
#Install useful tools

makefile_include.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,14 @@ tests/pkcs_1_oaep_test.o tests/pkcs_1_pss_test.o tests/pkcs_1_test.o tests/prng_
387387
tests/rotate_test.o tests/rsa_test.o tests/store_test.o tests/test.o
388388

389389
# The following headers will be installed by "make install"
390-
HEADERS=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
390+
HEADERS_PUB=src/headers/tomcrypt.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cfg.h \
391391
src/headers/tomcrypt_cipher.h src/headers/tomcrypt_custom.h src/headers/tomcrypt_hash.h \
392392
src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h src/headers/tomcrypt_math.h \
393393
src/headers/tomcrypt_misc.h src/headers/tomcrypt_pk.h src/headers/tomcrypt_pkcs.h \
394394
src/headers/tomcrypt_prng.h
395395

396+
HEADERS=$(HEADERS_PUB) src/headers/tomcrypt_private.h
397+
396398
#These are the rules to make certain object files.
397399
src/ciphers/aes/aes.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
398400
src/ciphers/twofish/twofish.o: src/ciphers/twofish/twofish.c src/ciphers/twofish/twofish_tab.c
@@ -436,7 +438,7 @@ INSTALL_OPTS ?= -m 644
436438
install -p -d $(DESTDIR)$(INCPATH)
437439
install -p -d $(DESTDIR)$(LIBPATH)
438440
$(INSTALL_CMD) -p $(INSTALL_OPTS) $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
439-
install -p -m 644 $(HEADERS) $(DESTDIR)$(INCPATH)
441+
install -p -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
440442

441443
$(DESTDIR)$(BINPATH):
442444
install -p -d $(DESTDIR)$(BINPATH)
@@ -454,7 +456,7 @@ install_test: $(call print-help,install_test,Installs the self-test binary) test
454456
install_hooks: $(call print-help,install_hooks,Installs the git hooks)
455457
for s in `ls hooks/`; do ln -s ../../hooks/$$s .git/hooks/$$s; done
456458

457-
HEADER_FILES=$(notdir $(HEADERS))
459+
HEADER_FILES=$(notdir $(HEADERS_PUB))
458460
.common_uninstall:
459461
$(UNINSTALL_CMD) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
460462
rm $(HEADER_FILES:%=$(DESTDIR)$(INCPATH)/%)

src/ciphers/aes/aes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
Implementation of AES
2929
*/
3030

31-
#include "tomcrypt.h"
31+
#include "tomcrypt_private.h"
3232

3333
#ifdef LTC_RIJNDAEL
3434

0 commit comments

Comments
 (0)