4747\def\gap {\vspace {0.5ex}}
4848\makeindex
4949\begin {document }
50- \title {A Tiny Crypto Library, \\ LibTomCrypt \\ Version 0.89 }
50+ \title {A Tiny Crypto Library, \\ LibTomCrypt \\ Version 0.90 }
5151\author {Tom St Denis \\
5252Algonquin College \\
5353\\
@@ -158,25 +158,20 @@ \subsection{Modular}
158158\section {License }
159159
160160All of the source code except for the following files have been written by the author or donated to the project
161- under the TDCAL license:
161+ under a public domain license:
162162
163163\begin {enumerate }
164164 \item rc2.c
165165 \item safer.c
166166\end {enumerate }
167167
168- `mpi.c'' was originally written
169- by Michael Fromberger (sting@linguist.dartmouth.edu) but has since been replaced with my LibTomMath library.
170- `` rc2.c'' is based on publicly available code that is not attributed to a person from the given source. `` safer.c''
168+ `mpi.c'' was originally written by Michael Fromberger (sting@linguist.dartmouth.edu) but has since been replaced with my LibTomMath
169+ library.
170+
171+ `` rc2.c'' is based on publicly available code that is not attributed to a person from the given source. `` safer.c''
171172was written by Richard De Moliner (demoliner@isi.ee.ethz.ch) and is public domain.
172173
173- The rest of the code was written either by Tom St Denis or contributed to the project under the `` Tom Doesn't Care
174- About Licenses'' (TDCAL) license. Essentially this license grants the user unlimited distribution and usage (including
175- commercial usage). This means that you can use the package, you can re-distribute the package and even branch it. I
176- still retain ownership over the name of the package. If you want to branch the project you can use the code as a base
177- but you must change the name. The package is also royalty free which means you can use it in commercial products
178- without compensation towards the author. I assume no risk from usage of the code nor do I guarantee it works as
179- desired or stated.
174+ The project is hereby released as public domain.
180175
181176\section {Patent Disclosure }
182177
@@ -364,7 +359,7 @@ \section{Core Functions}
364359are (given that XXX is the name of the cipher):
365360\index {Cipher Setup}
366361\begin {verbatim }
367- int XXX_setup(const unsigned char *key, int keylen, int rounds,
362+ int XXX_setup(const unsigned char *key, int keylen, int rounds,
368363 symmetric_key *skey);
369364\end {verbatim }
370365
@@ -973,6 +968,8 @@ \section{Hash Descriptors}
973968 \hline SHA-256 & sha256\_ desc & 32 \\
974969 \hline TIGER-192 & tiger\_ desc & 24 \\
975970 \hline SHA-1 & sha1\_ desc & 20 \\
971+ \hline RIPEMD-160 & rmd160\_ desc & 20 \\
972+ \hline RIPEMD-128 & rmd128\_ desc & 16 \\
976973 \hline MD5 & md5\_ desc & 16 \\
977974 \hline MD4 & md4\_ desc & 16 \\
978975 \hline MD2 & md2\_ desc & 16 \\
@@ -1019,10 +1016,12 @@ \section{Hash based Message Authenication Codes}
10191016number of octets to process. Like the hash process routines you can send the data in arbitrarly sized chunks. When you
10201017are finished with the HMAC process you must call the following function to get the HMAC code:
10211018\begin {verbatim }
1022- int hmac_done(hmac_state *hmac, unsigned char *hash);
1019+ int hmac_done(hmac_state *hmac, unsigned char *hashOut,
1020+ unsigned long *outlen);
10231021\end {verbatim }
1024- `` hmac'' is the HMAC state you are working with. `` hash'' is the array of octets where the HMAC code should be stored. You
1025- must ensure that your destination array is the right size (or just make it of size MAXBLOCKSIZE to be sure).
1022+ `` hmac'' is the HMAC state you are working with. `` hashOut'' is the array of octets where the HMAC code should be stored. You must
1023+ set `` outlen'' to the size of the destination buffer before calling this function. It is updated with the length of the HMAC code
1024+ produced (depending on which hash was picked)
10261025
10271026There are two utility functions provided to make using HMACs easier todo. They accept the key and information about the
10281027message (file pointer, address in memory) and produce the HMAC result in one shot. These are useful if you want to avoid
@@ -1061,6 +1060,7 @@ \section{Hash based Message Authenication Codes}
10611060 int idx, errno;
10621061 hmac_state hmac;
10631062 unsigned char key[16], dst[MAXBLOCKSIZE];
1063+ unsigned long dstlen;
10641064
10651065 /* register SHA-1 */
10661066 if (register_hash(&sha1_desc) == -1) {
@@ -1086,10 +1086,12 @@ \section{Hash based Message Authenication Codes}
10861086 }
10871087
10881088 /* get result (presumably to use it somehow...) */
1089- if ((errno = hmac_done(&hmac, dst)) != CRYPT_OK) {
1089+ dstlen = sizeof(dst);
1090+ if ((errno = hmac_done(&hmac, dst, &dstlen)) != CRYPT_OK) {
10901091 printf("Error finishing hmac: %s\n", error_to_string(errno));
10911092 return -1;
10921093 }
1094+ printf("The hmac is %lu bytes long\n", dstlen);
10931095
10941096 /* return */
10951097 return 0;
0 commit comments