diff src/headers/tomcrypt_hash.h @ 209:39d5d58461d6 libtomcrypt-orig LTC_1.05

Import of libtomcrypt 1.05
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Jul 2005 03:53:40 +0000
parents 1c15b283127b
children
line wrap: on
line diff
--- a/src/headers/tomcrypt_hash.h	Fri May 06 13:23:02 2005 +0000
+++ b/src/headers/tomcrypt_hash.h	Wed Jul 06 03:53:40 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 $ */