added libtomcrypt-1.02

This commit is contained in:
Tom St Denis 2005-04-19 11:30:30 +00:00 committed by Steffen Jaeckel
parent 6ac9952498
commit 65c1317eee
14 changed files with 38 additions and 34 deletions

View File

@ -23,7 +23,7 @@ PROJECT_NAME = LibTomCrypt
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 1.00rc1
PROJECT_NUMBER = 1.02
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.

10
changes
View File

@ -1,3 +1,11 @@
April 19th, 2005
v1.02
-- Added LTC_TEST support to gcm_test()
-- "pt/ct" can now be NULL in gcm_process() if you are processing zero bytes
-- Optimized GCM by removing the "double copy" handling of the plaintext/aad
-- Richard Outerbridge pointed out that x86_prof won't build on MACOS and that the manual
erroneously refers to "mycrypt" all over the place. Fixed.
April 17th, 2005
v1.01
** Secure Science Corporation has supported this release cycle by sponsoring the development time taken. Their
@ -54,7 +62,7 @@ v1.01
-- Added "stest" build to intel CC to test static linked from within the dir (so you don't have to install to test)
-- Moved testing/benchmark into testprof directory and build it as part of the build. Now you can link against libtomcrypt_prof.a to get
testing info (hint: hardware developers ;-) )
-- Added CCM to tv_gen
-- Added CCM to tv_gen
-- Added demos to MSVC makefile
-- Removed -funroll-all-loops from GCC makefile and replaced with -funroll-loops which is a bit more sane (P4 ain't got much cache for the IDATA)
-- Fixed GCM prior to release and re-enabled it. It has not been optimized but it does conform when compiled with optimizations.

View File

@ -47,7 +47,7 @@
\def\gap{\vspace{0.5ex}}
\makeindex
\begin{document}
\title{LibTomCrypt \\ Version 1.01}
\title{LibTomCrypt \\ Version 1.02}
\author{Tom St Denis \\
\\
tomstdenis@gmail.com \\
@ -167,7 +167,7 @@ The project is hereby released as public domain.
The author (Tom St Denis) is not a patent lawyer so this section is not to be treated as legal advice. To the best
of the authors knowledge the only patent related issues within the library are the RC5 and RC6 symmetric block ciphers.
They can be removed from a build by simply commenting out the two appropriate lines in ``mycrypt\_custom.h''. The rest
They can be removed from a build by simply commenting out the two appropriate lines in ``tomcrypt\_custom.h''. The rest
of the ciphers and hashes are patent free or under patents that have since expired.
The RC2 and RC4 symmetric ciphers are not under patents but are under trademark regulations. This means you can use
@ -593,7 +593,7 @@ byte string from the real 7/21 byte key.
\item
Note that ``Twofish'' has additional configuration options that take place at build time. These options are found in
the file ``mycrypt\_cfg.h''. The first option is ``TWOFISH\_SMALL'' which when defined will force the Twofish code
the file ``tomcrypt\_cfg.h''. The first option is ``TWOFISH\_SMALL'' which when defined will force the Twofish code
to not pre-compute the Twofish ``$g(X)$'' function as a set of four $8 \times 32$ s-boxes. This means that a scheduled
key will require less ram but the resulting cipher will be slower. The second option is ``TWOFISH\_TABLES'' which when
defined will force the Twofish code to use pre-computed tables for the two s-boxes $q_0, q_1$ as well as the multiplication
@ -3728,8 +3728,8 @@ This will use libtool and gcc to build a shared library ``libtomcrypt.la'' as we
and install them into /usr/lib (and the headers into /usr/include). To link your application you should use the
libtool program in ``--mode=link''.
\section{mycrypt\_cfg.h}
The file ``mycrypt\_cfg.h'' is what lets you control various high level macros which control the behaviour
\section{tomcrypt\_cfg.h}
The file ``tomcrypt\_cfg.h'' is what lets you control various high level macros which control the behaviour
of the library.
\subsubsection{ARGTYPE}
@ -3748,10 +3748,10 @@ which will work on all platforms.
Currently LibTomCrypt will detect x86-32 and x86-64 running GCC as well as x86-32 running MSVC.
\section{The Configure Script}
There are also options you can specify from the configure script or ``mycrypt\_custom.h''.
There are also options you can specify from the configure script or ``tomcrypt\_custom.h''.
\subsection{X memory routines}
At the top of mycrypt\_custom.h are four macros denoted as XMALLOC, XCALLOC, XREALLOC and XFREE which resolve to
At the top of tomcrypt\_custom.h are four macros denoted as XMALLOC, XCALLOC, XREALLOC and XFREE which resolve to
the name of the respective functions. This lets you substitute in your own memory routines. If you substitute in
your own functions they must behave like the standard C library functions in terms of what they expect as input and
output. By default the library uses the standard C routines.
@ -3830,7 +3830,7 @@ If you plan on only using RSA with moduli in the range of 1024 to 2560 bits you
to reduce the library size. Follow these steps
\begin{enumerate}
\item Undefine MDSA, MECC and MDH from mycrypt\_custom.h
\item Undefine MDSA, MECC and MDH from tomcrypt\_custom.h
\item Undefine LTM\_ALL from tommath\_superclass.h
\item Define SC\_RSA\_1 from tommath\_superclass.h
\item Rebuild the library.

Binary file not shown.

View File

@ -4,7 +4,7 @@
# Modified by Clay Culver
# The version
VERSION=1.01
VERSION=1.02
# Compiler and Linker Names
#CC=gcc

View File

@ -6,7 +6,7 @@
# Tom St Denis
# The version
VERSION=0:101
VERSION=0:102
# Compiler and Linker Names
CC=libtool --mode=compile gcc

View File

@ -101,13 +101,10 @@ int gcm_add_aad(gcm_state *gcm,
/* start adding AAD data to the state */
for (; x < adatalen; x++) {
gcm->buf[gcm->buflen++] = *adata++;
gcm->X[gcm->buflen++] ^= *adata++;
if (gcm->buflen == 16) {
/* GF mult it */
for (y = 0; y < 16; y++) {
gcm->X[y] ^= gcm->buf[y];
}
gcm_mult_h(gcm, gcm->X);
gcm->buflen = 0;
gcm->totlen += 128;

View File

@ -49,9 +49,6 @@ int gcm_done(gcm_state *gcm,
/* handle remaining ciphertext */
if (gcm->buflen) {
for (x = 0; x < (unsigned long)gcm->buflen; x++) {
gcm->X[x] ^= gcm->buf[x];
}
gcm->pttotlen += gcm->buflen * CONST64(8);
gcm_mult_h(gcm, gcm->X);
}

View File

@ -36,8 +36,10 @@ int gcm_process(gcm_state *gcm,
int err;
LTC_ARGCHK(gcm != NULL);
LTC_ARGCHK(pt != NULL);
LTC_ARGCHK(ct != NULL);
if (ptlen > 0) {
LTC_ARGCHK(pt != NULL);
LTC_ARGCHK(ct != NULL);
}
if (gcm->buflen > 16 || gcm->buflen < 0) {
return CRYPT_INVALID_ARG;
@ -51,9 +53,6 @@ int gcm_process(gcm_state *gcm,
if (gcm->mode == GCM_MODE_AAD) {
/* let's process the AAD */
if (gcm->buflen) {
for (x = 0; x < (unsigned long)gcm->buflen; x++) {
gcm->X[x] ^= gcm->buf[x];
}
gcm->totlen += gcm->buflen * CONST64(8);
gcm_mult_h(gcm, gcm->X);
}
@ -115,9 +114,6 @@ int gcm_process(gcm_state *gcm,
/* process text */
for (; x < ptlen; x++) {
if (gcm->buflen == 16) {
for (y = 0; y < 16; y++) {
gcm->X[y] ^= gcm->buf[y];
}
gcm->pttotlen += 128;
gcm_mult_h(gcm, gcm->X);
@ -135,7 +131,7 @@ int gcm_process(gcm_state *gcm,
b = ct[x];
pt[x] = ct[x] ^ gcm->buf[gcm->buflen];
}
gcm->buf[gcm->buflen++] = b;
gcm->X[gcm->buflen++] ^= b;
}
return CRYPT_OK;

View File

@ -23,6 +23,9 @@
*/
int gcm_test(void)
{
#ifndef LTC_TEST
return CRYPT_NOP;
#else
static const struct {
unsigned char K[32];
int keylen;
@ -355,6 +358,7 @@ int gcm_test(void)
}
return CRYPT_OK;
#endif
}
#endif

View File

@ -16,8 +16,8 @@ extern "C" {
#endif
/* version */
#define CRYPT 0x0101
#define SCRYPT "1.01"
#define CRYPT 0x0102
#define SCRYPT "1.02"
/* max size of either a cipher/hash block or symmetric key [largest of the two] */
#define MAXBLOCKSIZE 128

View File

@ -142,7 +142,7 @@ int pelican_done(pelican_state *pelmac, unsigned char *out)
}
pelmac->state[pelmac->buflen++] ^= 0x80;
aes_ecb_encrypt(pelmac->state, out, &pelmac->K);
aes_done(&pelmac->K);
aes_done(&pelmac->K);
return CRYPT_OK;
}

View File

@ -51,7 +51,7 @@ int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key)
/* ok all the ASN.1 params are fine so far, let's move up */
x = ((unsigned long)in[2]);
y = 0;
if ((in[1] & 0x0f) == 2) {
if ((in[1] & ~0x80) == 2) {
x = (x << 8) + ((unsigned long)in[3]) + 1;
in += 1;
y = 1;

View File

@ -51,12 +51,14 @@ ulong64 rdtsc (void)
ulong64 a;
asm __volatile__ ("rdtsc\nmovl %%eax,(%0)\nmovl %%edx,4(%0)\n"::"r"(&a):"%eax","%edx");
return a;
#else /* gcc-IA64 version */
#elif defined(__ia64__) /* gcc-IA64 version */
unsigned long result;
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");
while (__builtin_expect ((int) result == -1, 0))
__asm__ __volatile__("mov %0=ar.itc" : "=r"(result) :: "memory");
return result;
#else
return XCLOCK();
#endif
// Microsoft and Intel Windows compilers
@ -70,7 +72,7 @@ ulong64 rdtsc (void)
#endif
return __getReg (3116);
#else
#error need rdtsc function for this build
return XCLOCK();
#endif
}