Skip to content

Commit 64d7ebe

Browse files
Tom St Denissjaeckel
authored andcommitted
added libtomcrypt-1.11
1 parent 99b6d03 commit 64d7ebe

281 files changed

Lines changed: 1434 additions & 479 deletions

File tree

Some content is hidden

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

Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PROJECT_NAME = LibTomCrypt
2323
# This could be handy for archiving the generated documentation or
2424
# if some version control system is used.
2525

26-
PROJECT_NUMBER = 1.10
26+
PROJECT_NUMBER = 1.11
2727

2828
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
2929
# base path where the generated documentation will be put.

TODO

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- ECC fixed point accelerator
2+
- look into X9.63 support [in addition to the LTC style ecc_encrypt_key() not replacing]
3+

build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
echo "$1 ($2, $3)..."
33
make clean 1>/dev/null 2>/dev/null
44
echo -n "building..."
5-
CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" make -j3 -f $3 test tv_gen 1>gcc_1.txt 2>gcc_2.txt || (echo "build $1 failed see gcc_2.txt for more information" && cat gcc_2.txt && exit 1)
5+
CFLAGS="$2 $CFLAGS $4" EXTRALIBS="$5" make -j4 -f $3 test tv_gen 1>gcc_1.txt 2>gcc_2.txt || (echo "build $1 failed see gcc_2.txt for more information" && cat gcc_2.txt && exit 1)
66
echo -n "testing..."
77
if [ -a test ] && [ -f test ] && [ -x test ]; then
88
((./test >test_std.txt 2>test_err.txt && ./tv_gen > tv.txt) && echo "$1 test passed." && echo "y" > testok.txt) || (echo "$1 test failed" && cat test_err.txt && exit 1)
99
if find *_tv.txt -type f 1>/dev/null 2>/dev/null ; then
10-
for f in *_tv.txt; do if (diff $f notes/$f) then true; else (echo "tv_gen $f failed" && rm -f testok.txt && exit 1); fi; done
10+
for f in *_tv.txt; do if (diff --ignore-case $f notes/$f) then true; else (echo "tv_gen $f failed" && rm -f testok.txt && exit 1); fi; done
1111
fi
1212
fi
1313
if [ -a testok.txt ] && [ -f testok.txt ]; then
@@ -16,5 +16,5 @@ fi
1616
exit 1
1717
1818
# $Source: /cvs/libtom/libtomcrypt/build.sh,v $
19-
# $Revision: 1.7 $
20-
# $Date: 2005/07/23 14:18:31 $
19+
# $Revision: 1.9 $
20+
# $Date: 2006/03/18 14:10:55 $

changes

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
April 4th, 2006
2+
v1.11 -- Removed printf's from lrw_test ... whoops
3+
-- lrw_process now checks the return of the cipher ecb encrypt/decrypt calls
4+
-- lrw_start was not using num_rounds ...
5+
-- Adam Miller reported a bug in the flexi decoder with elements past the end of a sequence. Fixed.
6+
-- Bruce Guenter suggested I use --tag=CC for libtool builds where the compiler may think it's C++. (I applied this to LTM and TFM)
7+
-- Optimized the ECC for TFM a bit by removing the useless "if" statements (most TFM functions don't return error codes)
8+
Actually shaved a good chunk of time off and made the code smaller. By default with TFM the stock LTC point add/dbl functions
9+
will be totally omitted (ECC-256 make key times on a Prescott for old vs. new are 11.03M vs. 9.59M cycles)
10+
-- added missing CVS tags to ltc_ecc_mulmod.c
11+
-- corrected typo in tomcrypt_cfg.h about what the file has been called
12+
-- corrected my address in the user manual. A "bit" out of date.
13+
-- added lrw_gen to tv_gen
14+
-- added GMP plugin, only tested on a AMD64 and x86_32 Gentoo Linux box so be aware
15+
-- made testme.sh runs diff case insensitivityly [whatever...] cuz GMP outputs lowercase satan text
16+
-- added LDFLAGS to the makefile to allow cross porting linking options
17+
-- added lrw_test() to the header file ... whoops
18+
-- changed libtomcrypt.org to libtomcrypt.com .... mumble mumble
19+
-- Updates to detect __STRICT_ANSI__ which is defined in --std=c99 modes (note -ansi is not supported as it lacks long long) so you can
20+
build LTC out of the box with c99 (note: it'll be slower as there is no asm in this case)
21+
-- Updated pelican.c and aes_tab.c to undef tables not-required. The tables are static so both AES and Pelican MAC would have copies. Save a few KB in the final binary.
22+
-- Added LTC_NO_FAST to the makefile.icc to compensate for the fact ICC v9 can't handle it (Pelican MAC fails for instance)
23+
124
February 11th, 2006
225
v1.10 -- Free ecb/cbc/ctr/lrw structures in timing code by calling the "done" function
326
-- fixed bug in lrw_process() which would always use the slow update ...
@@ -1413,6 +1436,6 @@ v0.02 -- Changed RC5 to only allow 12 to 24 rounds
14131436
v0.01 -- We will call this the first version.
14141437

14151438
/* $Source: /cvs/libtom/libtomcrypt/changes,v $ */
1416-
/* $Revision: 1.173 $ */
1417-
/* $Date: 2006/02/11 09:18:11 $ */
1439+
/* $Revision: 1.194 $ */
1440+
/* $Date: 2006/04/05 02:51:41 $ */
14181441

crypt.tex

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@
4747
\def\gap{\vspace{0.5ex}}
4848
\makeindex
4949
\begin{document}
50-
\title{LibTomCrypt \\ Version 1.10}
50+
\title{LibTomCrypt \\ Version 1.11}
5151
\author{Tom St Denis \\
5252
\\
5353
tomstdenis@gmail.com \\
54-
http://libtomcrypt.org
54+
http://libtomcrypt.com
5555
}
5656
\maketitle
5757
This text and source code library are both hereby placed in the public domain. This book has been
@@ -65,15 +65,15 @@
6565

6666
Tom St Denis,
6767

68-
Phone: 1-613-836-3160
68+
Phone: (647)401-8220
6969

70-
111 Banning Rd
70+
3330 South Millway, Unit 20
7171

72-
Kanata, Ontario
72+
Mississauga, Ontario
7373

74-
K2L 1C3
74+
L5L 3H4
7575

76-
Canada
76+
Canada
7777
\end{flushright}
7878
\newpage
7979
\tableofcontents
@@ -5056,6 +5056,15 @@ \section{BigNum Math Descriptors}
50565056
*/
50575057
int (*ecc_ptadd)(ecc_point *P, ecc_point *Q, ecc_point *R, void *modulus, void *mp);
50585058
5059+
/** ECC GF(p) point double
5060+
@param P The first point
5061+
@param R The destination of 2P
5062+
@param modulus The modulus
5063+
@param mp The "b" value from montgomery_setup()
5064+
@return CRYPT_OK on success
5065+
*/
5066+
int (*ecc_ptdbl)(ecc_point *P, ecc_point *R, void *modulus, void *mp);
5067+
50595068
/** ECC mapping from projective to affine, currently uses (x,y,z) => (x/z^2, y/z^3, 1)
50605069
@param P The point to map
50615070
@param modulus The modulus
@@ -5181,5 +5190,5 @@ \subsection{RSA Functions}
51815190
\end{document}
51825191
51835192
% $Source: /cvs/libtom/libtomcrypt/crypt.tex,v $
5184-
% $Revision: 1.63 $
5185-
% $Date: 2006/01/26 19:20:46 $
5193+
% $Revision: 1.67 $
5194+
% $Date: 2006/03/31 14:16:09 $

demos/test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ int main(void)
99
ltc_mp = ltm_desc;
1010
#elif defined(USE_TFM)
1111
ltc_mp = tfm_desc;
12+
#elif defined(USE_GMP)
13+
ltc_mp = gmp_desc;
1214
#else
1315
extern ltc_math_descriptor EXT_MATH_LIB;
1416
ltc_mp = EXT_MATH_LIB;

demos/timing.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ reg_algs();
1010
ltc_mp = ltm_desc;
1111
#elif defined(USE_TFM)
1212
ltc_mp = tfm_desc;
13+
#elif defined(USE_GMP)
14+
ltc_mp = gmp_desc;
1315
#else
1416
extern ltc_math_descriptor EXT_MATH_LIB;
1517
ltc_mp = EXT_MATH_LIB;

demos/tv_gen.c

Lines changed: 72 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ void reg_algs(void)
102102
ltc_mp = ltm_desc;
103103
#elif defined(USE_TFM)
104104
ltc_mp = tfm_desc;
105+
#elif defined(USE_GMP)
106+
ltc_mp = gmp_desc;
105107
#else
106108
extern ltc_math_descriptor EXT_MATH_LIB;
107109
ltc_mp = EXT_MATH_LIB;
@@ -675,10 +677,10 @@ void ecc_gen(void)
675677
fprintf(out, "ECC-%d\n", ltc_ecc_sets[x].size*8);
676678
mp_set(k, 1);
677679

678-
mp_read_radix(order, (char *)ltc_ecc_sets[x].order, 64);
679-
mp_read_radix(modulus, (char *)ltc_ecc_sets[x].prime, 64);
680-
mp_read_radix(G->x, (char *)ltc_ecc_sets[x].Gx, 64);
681-
mp_read_radix(G->y, (char *)ltc_ecc_sets[x].Gy, 64);
680+
mp_read_radix(order, (char *)ltc_ecc_sets[x].order, 16);
681+
mp_read_radix(modulus, (char *)ltc_ecc_sets[x].prime, 16);
682+
mp_read_radix(G->x, (char *)ltc_ecc_sets[x].Gx, 16);
683+
mp_read_radix(G->y, (char *)ltc_ecc_sets[x].Gy, 16);
682684
mp_set(G->z, 1);
683685

684686
while (mp_cmp(k, order) == LTC_MP_LT) {
@@ -695,6 +697,71 @@ void ecc_gen(void)
695697
fclose(out);
696698
}
697699

700+
void lrw_gen(void)
701+
{
702+
FILE *out;
703+
unsigned char tweak[16], key[16], iv[16], buf[1024];
704+
int x, y, err;
705+
symmetric_LRW lrw;
706+
707+
/* initialize default key and tweak */
708+
for (x = 0; x < 16; x++) {
709+
tweak[x] = key[x] = iv[x] = x;
710+
}
711+
712+
out = fopen("lrw_tv.txt", "w");
713+
for (x = 16; x < (int)(sizeof(buf)); x += 16) {
714+
if ((err = lrw_start(find_cipher("aes"), iv, key, 16, tweak, 0, &lrw)) != CRYPT_OK) {
715+
fprintf(stderr, "Error starting LRW-AES: %s\n", error_to_string(err));
716+
exit(EXIT_FAILURE);
717+
}
718+
719+
/* encrypt incremental */
720+
for (y = 0; y < x; y++) {
721+
buf[y] = y & 255;
722+
}
723+
724+
if ((err = lrw_encrypt(buf, buf, x, &lrw)) != CRYPT_OK) {
725+
fprintf(stderr, "Error encrypting with LRW-AES: %s\n", error_to_string(err));
726+
exit(EXIT_FAILURE);
727+
}
728+
729+
/* display it */
730+
fprintf(out, "%d:", x);
731+
for (y = 0; y < x; y++) {
732+
fprintf(out, "%02x", buf[y]);
733+
}
734+
fprintf(out, "\n");
735+
736+
/* reset IV */
737+
if ((err = lrw_setiv(iv, 16, &lrw)) != CRYPT_OK) {
738+
fprintf(stderr, "Error setting IV: %s\n", error_to_string(err));
739+
exit(EXIT_FAILURE);
740+
}
741+
742+
/* copy new tweak, iv and key */
743+
for (y = 0; y < 16; y++) {
744+
key[y] = buf[y];
745+
iv[y] = buf[(y+16)%x];
746+
tweak[y] = buf[(y+32)%x];
747+
}
748+
749+
if ((err = lrw_decrypt(buf, buf, x, &lrw)) != CRYPT_OK) {
750+
fprintf(stderr, "Error decrypting with LRW-AES: %s\n", error_to_string(err));
751+
exit(EXIT_FAILURE);
752+
}
753+
754+
/* display it */
755+
fprintf(out, "%d:", x);
756+
for (y = 0; y < x; y++) {
757+
fprintf(out, "%02x", buf[y]);
758+
}
759+
fprintf(out, "\n");
760+
lrw_done(&lrw);
761+
}
762+
fclose(out);
763+
}
764+
698765
int main(void)
699766
{
700767
reg_algs();
@@ -710,6 +777,7 @@ int main(void)
710777
printf("Generating BASE64 vectors..."); fflush(stdout); base64_gen(); printf("done\n");
711778
printf("Generating MATH vectors..."); fflush(stdout); math_gen(); printf("done\n");
712779
printf("Generating ECC vectors..."); fflush(stdout); ecc_gen(); printf("done\n");
780+
printf("Generating LRW vectors..."); fflush(stdout); lrw_gen(); printf("done\n");
713781
return 0;
714782
}
715783

doc/crypt.pdf

139 Bytes
Binary file not shown.

doc/footer.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<hr width="80%">
2-
Code by <a href="http://www.libtomcrypt.org/">Tom</a><br>
2+
Code by <a href="http://www.libtomcrypt.com/">Tom</a><br>
33
Docs using <img src="doxygen.png" alt="doxygen" align="middle" border=0>
44
<a href="http://jlcooke.ca/tom/hidden_image.png">
55

66
<!--
77
/* $Source: /cvs/libtom/libtomcrypt/doc/footer.html,v $ */
8-
/* $Revision: 1.3 $ */
9-
/* $Date: 2005/05/07 10:09:20 $ */
8+
/* $Revision: 1.4 $ */
9+
/* $Date: 2006/03/31 14:15:34 $ */
1010
-->

0 commit comments

Comments
 (0)