diff src/headers/tomcrypt_hash.h @ 210:4768b55c5240 libtomcrypt

propagate from branch 'au.asn.ucc.matt.ltc-orig' (head 33c416b902f1a44913d825bae7ad9a160f703ed3) to branch 'au.asn.ucc.matt.dropbear.ltc' (head 4d6aec6e6121e13f68c11c149b6579c41cb63e74)
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Jul 2005 12:10:23 +0000
parents 39d5d58461d6
children
line wrap: on
line diff
--- a/src/headers/tomcrypt_hash.h	Tue May 10 17:02:59 2005 +0000
+++ b/src/headers/tomcrypt_hash.h	Wed Jul 06 12:10:23 2005 +0000
@@ -132,10 +132,11 @@
     unsigned long hashsize;
     /** Input block size in octets */
     unsigned long blocksize;
-    /** ASN.1 DER identifier */
-    unsigned char DER[64];
+    /** ASN.1 OID */
+    unsigned long OID[16];
     /** Length of DER encoding */
-    unsigned long DERlen;
+    unsigned long OIDlen;
+
     /** Init a hash state
       @param hash   The hash to initialize
       @return CRYPT_OK if successful
@@ -278,6 +279,8 @@
 int unregister_hash(const struct ltc_hash_descriptor *hash);
 int hash_is_valid(int idx);
 
+LTC_MUTEX_PROTO(ltc_hash_mutex);
+
 int hash_memory(int hash, 
                 const unsigned char *in,  unsigned long inlen, 
                       unsigned char *out, unsigned long *outlen);
@@ -292,29 +295,29 @@
 {                                                                                           \
     unsigned long n;                                                                        \
     int           err;                                                                      \
-    LTC_ARGCHK(md != NULL);                                                                    \
-    LTC_ARGCHK(in != NULL);                                                                   \
+    LTC_ARGCHK(md != NULL);                                                                 \
+    LTC_ARGCHK(in != NULL);                                                                 \
     if (md-> state_var .curlen > sizeof(md-> state_var .buf)) {                             \
        return CRYPT_INVALID_ARG;                                                            \
     }                                                                                       \
-    while (inlen > 0) {                                                                       \
-        if (md-> state_var .curlen == 0 && inlen >= block_size) {                             \
-           if ((err = compress_name (md, (unsigned char *)in)) != CRYPT_OK) { \
-              return err;         \
-           }                                        \
+    while (inlen > 0) {                                                                     \
+        if (md-> state_var .curlen == 0 && inlen >= block_size) {                           \
+           if ((err = compress_name (md, (unsigned char *)in)) != CRYPT_OK) {               \
+              return err;                                                                   \
+           }                                                                                \
            md-> state_var .length += block_size * 8;                                        \
-           in             += block_size;                                                   \
-           inlen          -= block_size;                                                   \
+           in             += block_size;                                                    \
+           inlen          -= block_size;                                                    \
         } else {                                                                            \
-           n = MIN(inlen, (block_size - md-> state_var .curlen));                             \
-           memcpy(md-> state_var .buf + md-> state_var.curlen, in, (size_t)n);             \
+           n = MIN(inlen, (block_size - md-> state_var .curlen));                           \
+           memcpy(md-> state_var .buf + md-> state_var.curlen, in, (size_t)n);              \
            md-> state_var .curlen += n;                                                     \
-           in             += n;                                                            \
-           inlen          -= n;                                                            \
+           in             += n;                                                             \
+           inlen          -= n;                                                             \
            if (md-> state_var .curlen == block_size) {                                      \
-              if ((err = compress_name (md, md-> state_var .buf)) != CRYPT_OK) {\
-                 return err;                                      \
-              } \
+              if ((err = compress_name (md, md-> state_var .buf)) != CRYPT_OK) {            \
+                 return err;                                                                \
+              }                                                                             \
               md-> state_var .length += 8*block_size;                                       \
               md-> state_var .curlen = 0;                                                   \
            }                                                                                \
@@ -322,3 +325,7 @@
     }                                                                                       \
     return CRYPT_OK;                                                                        \
 }
+
+/* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_hash.h,v $ */
+/* $Revision: 1.12 $ */
+/* $Date: 2005/06/19 18:00:28 $ */