diff libtomcrypt/src/headers/tomcrypt_hash.h @ 382:0cbe8f6dbf9e

propagate from branch 'au.asn.ucc.matt.ltc.dropbear' (head 2af22fb4e878750b88f80f90d439b316d229796f) to branch 'au.asn.ucc.matt.dropbear' (head 02c413252c90e9de8e03d91e9939dde3029f5c0a)
author Matt Johnston <matt@ucc.asn.au>
date Thu, 11 Jan 2007 02:41:05 +0000
parents 1b9e69c058d2
children f849a5ca2efc
line wrap: on
line diff
--- a/libtomcrypt/src/headers/tomcrypt_hash.h	Thu Jan 04 02:01:09 2007 +0000
+++ b/libtomcrypt/src/headers/tomcrypt_hash.h	Thu Jan 11 02:41:05 2007 +0000
@@ -70,6 +70,22 @@
 };
 #endif
 
+#ifdef RIPEMD256
+struct rmd256_state {
+    ulong64 length;
+    unsigned char buf[64];
+    ulong32 curlen, state[8];
+};
+#endif
+
+#ifdef RIPEMD320
+struct rmd320_state {
+    ulong64 length;
+    unsigned char buf[64];
+    ulong32 curlen, state[10];
+};
+#endif
+
 #ifdef WHIRLPOOL
 struct whirlpool_state {
     ulong64 length, state[8];
@@ -87,6 +103,7 @@
 #endif
 
 typedef union Hash_state {
+    char dummy[1];
 #ifdef CHC_HASH
     struct chc_state chc;
 #endif
@@ -120,9 +137,16 @@
 #ifdef RIPEMD160
     struct rmd160_state rmd160;
 #endif
+#ifdef RIPEMD256
+    struct rmd256_state rmd256;
+#endif
+#ifdef RIPEMD320
+    struct rmd320_state rmd320;
+#endif
     void *data;
 } hash_state;
 
+/** hash descriptor */
 extern  struct ltc_hash_descriptor {
     /** name of hash */
     char *name;
@@ -159,6 +183,12 @@
       @return CRYPT_OK if successful, CRYPT_NOP if self-tests have been disabled
     */
     int (*test)(void);
+
+    /* accelerated hmac callback: if you need to-do multiple packets just use the generic hmac_memory and provide a hash callback */
+    int  (*hmac_block)(const unsigned char *key, unsigned long  keylen,
+                       const unsigned char *in,  unsigned long  inlen, 
+                             unsigned char *out, unsigned long *outlen);
+
 } hash_descriptor[];
 
 #ifdef CHC_HASH
@@ -272,14 +302,32 @@
 extern const struct ltc_hash_descriptor rmd160_desc;
 #endif
 
+#ifdef RIPEMD256
+int rmd256_init(hash_state * md);
+int rmd256_process(hash_state * md, const unsigned char *in, unsigned long inlen);
+int rmd256_done(hash_state * md, unsigned char *hash);
+int rmd256_test(void);
+extern const struct ltc_hash_descriptor rmd256_desc;
+#endif
+
+#ifdef RIPEMD320
+int rmd320_init(hash_state * md);
+int rmd320_process(hash_state * md, const unsigned char *in, unsigned long inlen);
+int rmd320_done(hash_state * md, unsigned char *hash);
+int rmd320_test(void);
+extern const struct ltc_hash_descriptor rmd320_desc;
+#endif
+
+
 int find_hash(const char *name);
 int find_hash_id(unsigned char ID);
+int find_hash_oid(const unsigned long *ID, unsigned long IDlen);
 int find_hash_any(const char *name, int digestlen);
 int register_hash(const struct ltc_hash_descriptor *hash);
 int unregister_hash(const struct ltc_hash_descriptor *hash);
 int hash_is_valid(int idx);
 
-LTC_MUTEX_PROTO(ltc_hash_mutex);
+LTC_MUTEX_PROTO(ltc_hash_mutex)
 
 int hash_memory(int hash, 
                 const unsigned char *in,  unsigned long inlen, 
@@ -327,5 +375,5 @@
 }
 
 /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_hash.h,v $ */
-/* $Revision: 1.12 $ */
-/* $Date: 2005/06/19 18:00:28 $ */
+/* $Revision: 1.19 $ */
+/* $Date: 2006/11/05 01:36:43 $ */