143
|
1 # MAKEFILE for linux GCC
|
|
2 #
|
|
3 # Tom St Denis
|
|
4 # Modified by Clay Culver
|
|
5
|
|
6 # The version
|
|
7 VERSION=0:99
|
|
8
|
|
9 # Compiler and Linker Names
|
|
10 CC=libtool --mode=compile gcc
|
|
11
|
|
12 # Archiver [makes .a files]
|
|
13 AR=libtool --mode=link
|
|
14
|
|
15 # Compilation flags. Note the += does not write over the user's CFLAGS!
|
|
16 CFLAGS += -c -I./ -Wall -Wsign-compare -W -Wshadow
|
|
17 # -Werror
|
|
18
|
|
19 # optimize for SPEED
|
|
20 CFLAGS += -O3 -funroll-all-loops
|
|
21
|
|
22 #add -fomit-frame-pointer. hinders debugging!
|
|
23 CFLAGS += -fomit-frame-pointer
|
|
24
|
|
25 # optimize for SIZE
|
|
26 #CFLAGS += -Os
|
|
27
|
|
28 # compile for DEBUGING (required for ccmalloc checking!!!)
|
|
29 #CFLAGS += -g3
|
|
30
|
|
31 #These flags control how the library gets built.
|
|
32
|
|
33 #Output filenames for various targets.
|
|
34 LIBNAME=libtomcrypt.la
|
|
35 HASH=hashsum
|
|
36 CRYPT=encrypt
|
|
37 SMALL=small
|
|
38 PROF=x86_prof
|
|
39 TV=tv_gen
|
|
40
|
|
41 #LIBPATH-The directory for libtomcrypt to be installed to.
|
|
42 #INCPATH-The directory to install the header files for libtomcrypt.
|
|
43 #DATAPATH-The directory to install the pdf docs.
|
|
44 DESTDIR=
|
|
45 LIBPATH=/usr/lib
|
|
46 INCPATH=/usr/include
|
|
47 DATAPATH=/usr/share/doc/libtomcrypt/pdf
|
|
48
|
|
49 #List of objects to compile.
|
|
50
|
|
51 #Leave MPI built-in or force developer to link against libtommath?
|
|
52 MPIOBJECT=mpi.o
|
|
53
|
|
54 #If you don't want mpi.o then add this
|
|
55 #MPISHARED=$(LIBPATH)/libtommath.la
|
|
56
|
|
57 OBJECTS=error_to_string.o mpi_to_ltc_error.o base64_encode.o base64_decode.o \
|
|
58 \
|
|
59 crypt.o crypt_find_cipher.o crypt_find_hash_any.o \
|
|
60 crypt_hash_is_valid.o crypt_register_hash.o crypt_unregister_prng.o \
|
|
61 crypt_argchk.o crypt_find_cipher_any.o crypt_find_hash_id.o \
|
|
62 crypt_prng_descriptor.o crypt_register_prng.o crypt_cipher_descriptor.o \
|
|
63 crypt_find_cipher_id.o crypt_find_prng.o crypt_prng_is_valid.o \
|
|
64 crypt_unregister_cipher.o crypt_cipher_is_valid.o crypt_find_hash.o \
|
|
65 crypt_hash_descriptor.o crypt_register_cipher.o crypt_unregister_hash.o \
|
|
66 \
|
|
67 sober128.o fortuna.o sprng.o yarrow.o rc4.o rng_get_bytes.o rng_make_prng.o \
|
|
68 \
|
|
69 rand_prime.o is_prime.o \
|
|
70 \
|
|
71 ecc.o dh.o \
|
|
72 \
|
|
73 rsa_decrypt_key.o rsa_encrypt_key.o rsa_exptmod.o rsa_free.o rsa_make_key.o \
|
|
74 rsa_sign_hash.o rsa_verify_hash.o rsa_export.o rsa_import.o tim_exptmod.o \
|
|
75 rsa_v15_encrypt_key.o rsa_v15_decrypt_key.o rsa_v15_sign_hash.o rsa_v15_verify_hash.o \
|
|
76 \
|
|
77 dsa_export.o dsa_free.o dsa_import.o dsa_make_key.o dsa_sign_hash.o \
|
|
78 dsa_verify_hash.o dsa_verify_key.o \
|
|
79 \
|
|
80 aes.o aes_enc.o \
|
|
81 \
|
|
82 blowfish.o des.o safer_tab.o safer.o saferp.o rc2.o xtea.o \
|
|
83 rc6.o rc5.o cast5.o noekeon.o twofish.o skipjack.o \
|
|
84 \
|
|
85 md2.o md4.o md5.o sha1.o sha256.o sha512.o tiger.o whirl.o \
|
|
86 rmd128.o rmd160.o chc.o \
|
|
87 \
|
|
88 packet_store_header.o packet_valid_header.o \
|
|
89 \
|
|
90 eax_addheader.o eax_decrypt.o eax_decrypt_verify_memory.o eax_done.o eax_encrypt.o \
|
|
91 eax_encrypt_authenticate_memory.o eax_init.o eax_test.o \
|
|
92 \
|
|
93 ocb_decrypt.o ocb_decrypt_verify_memory.o ocb_done_decrypt.o ocb_done_encrypt.o \
|
|
94 ocb_encrypt.o ocb_encrypt_authenticate_memory.o ocb_init.o ocb_ntz.o \
|
|
95 ocb_shift_xor.o ocb_test.o s_ocb_done.o \
|
|
96 \
|
|
97 omac_done.o omac_file.o omac_init.o omac_memory.o omac_process.o omac_test.o \
|
|
98 \
|
|
99 pmac_done.o pmac_file.o pmac_init.o pmac_memory.o pmac_ntz.o pmac_process.o \
|
|
100 pmac_shift_xor.o pmac_test.o \
|
|
101 \
|
|
102 cbc_start.o cbc_encrypt.o cbc_decrypt.o cbc_getiv.o cbc_setiv.o \
|
|
103 cfb_start.o cfb_encrypt.o cfb_decrypt.o cfb_getiv.o cfb_setiv.o \
|
|
104 ofb_start.o ofb_encrypt.o ofb_decrypt.o ofb_getiv.o ofb_setiv.o \
|
|
105 ctr_start.o ctr_encrypt.o ctr_decrypt.o ctr_getiv.o ctr_setiv.o \
|
|
106 ecb_start.o ecb_encrypt.o ecb_decrypt.o \
|
|
107 \
|
|
108 hash_file.o hash_filehandle.o hash_memory.o \
|
|
109 \
|
|
110 hmac_done.o hmac_file.o hmac_init.o hmac_memory.o hmac_process.o hmac_test.o \
|
|
111 \
|
|
112 pkcs_1_mgf1.o pkcs_1_oaep_encode.o pkcs_1_oaep_decode.o \
|
|
113 pkcs_1_pss_encode.o pkcs_1_pss_decode.o pkcs_1_i2osp.o pkcs_1_os2ip.o \
|
|
114 pkcs_1_v15_es_encode.o pkcs_1_v15_es_decode.o pkcs_1_v15_sa_encode.o pkcs_1_v15_sa_decode.o \
|
|
115 \
|
|
116 pkcs_5_1.o pkcs_5_2.o \
|
|
117 \
|
|
118 der_encode_integer.o der_decode_integer.o der_length_integer.o \
|
|
119 der_put_multi_integer.o der_get_multi_integer.o \
|
|
120 \
|
|
121 burn_stack.o zeromem.o \
|
|
122 \
|
|
123 $(MPIOBJECT)
|
|
124
|
|
125 TESTOBJECTS=demos/test.o
|
|
126 HASHOBJECTS=demos/hashsum.o
|
|
127 CRYPTOBJECTS=demos/encrypt.o
|
|
128 SMALLOBJECTS=demos/small.o
|
|
129 PROFS=demos/x86_prof.o
|
|
130 TVS=demos/tv_gen.o
|
|
131
|
|
132 #Files left over from making the crypt.pdf.
|
|
133 LEFTOVERS=*.dvi *.log *.aux *.toc *.idx *.ilg *.ind *.out
|
|
134
|
|
135 #Compressed filenames
|
|
136 COMPRESSED=crypt-$(VERSION).tar.bz2 crypt-$(VERSION).zip
|
|
137
|
|
138 #Header files used by libtomcrypt.
|
|
139 HEADERS=ltc_tommath.h mycrypt_cfg.h \
|
|
140 mycrypt_misc.h mycrypt_prng.h mycrypt_cipher.h mycrypt_hash.h \
|
|
141 mycrypt_macros.h mycrypt_pk.h mycrypt.h mycrypt_argchk.h \
|
|
142 mycrypt_custom.h mycrypt_pkcs.h tommath_class.h tommath_superclass.h
|
|
143
|
|
144 #The default rule for make builds the libtomcrypt library.
|
|
145 default:library
|
|
146
|
|
147 #ciphers come in two flavours... enc+dec and enc
|
|
148 aes_enc.o: aes.c aes_tab.c
|
|
149 $(CC) $(CFLAGS) -DENCRYPT_ONLY -c aes.c -o aes_enc.o
|
|
150
|
|
151 #These are the rules to make certain object files.
|
|
152 aes.o: aes.c aes_tab.c
|
|
153 twofish.o: twofish.c twofish_tab.c
|
|
154 whirl.o: whirl.c whirltab.c
|
|
155 ecc.o: ecc.c ecc_sys.c
|
|
156 dh.o: dh.c dh_sys.c
|
|
157 sha512.o: sha512.c sha384.c
|
|
158 sha256.o: sha256.c sha224.c
|
|
159
|
|
160 #This rule makes the libtomcrypt library.
|
|
161 library: $(LIBNAME)
|
|
162
|
|
163 $(LIBNAME): $(OBJECTS)
|
|
164 libtool --mode=link gcc $(CFLAGS) *.lo -o libtomcrypt.la -rpath $(LIBPATH) -version-info $(VERSION)
|
|
165 libtool --mode=link gcc $(CFLAGS) *.o -o libtomcrypt.a
|
|
166 libtool --mode=install install -c libtomcrypt.la $(LIBPATH)/libtomcrypt.la
|
|
167 install -d -g root -o root $(DESTDIR)$(INCPATH)
|
|
168 install -g root -o root $(HEADERS) $(DESTDIR)$(INCPATH)
|
|
169
|
|
170 #This rule makes the hash program included with libtomcrypt
|
|
171 hashsum: library
|
|
172 gcc $(CFLAGS) demos/hashsum.c -o hashsum.o
|
|
173 libtool --mode=link gcc -o hashsum hashsum.o -ltomcrypt $(MPISHARED)
|
|
174
|
|
175 #makes the crypt program
|
|
176 crypt: library
|
|
177 gcc $(CFLAGS) demos/encrypt.c -o encrypt.o
|
|
178 libtool --mode=link gcc -o crypt encrypt.o -ltomcrypt $(MPISHARED)
|
|
179
|
|
180 x86_prof: library
|
|
181 gcc $(CFLAGS) demos/x86_prof.c -o x86_prof.o
|
|
182 libtool --mode=link gcc -o x86_prof x86_prof.o -ltomcrypt $(MPISHARED) $(EXTRALIBS)
|
|
183
|
|
184 tv_gen: library $(TVS)
|
|
185 gcc $(CFLAGS) demos/tv_gen.c -o tv_gen.o
|
|
186 libtool --mode=link gcc -o tv_gen tv_gen.o -ltomcrypt $(MPISHARED)
|