diff libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c @ 435:337c45621e81

merge of 'a9b0496634cdd25647b65e585cc3240f3fa699ee' and 'c22be8b8f570b48e9662dac32c7b3e7148a42206'
author Matt Johnston <matt@ucc.asn.au>
date Thu, 22 Feb 2007 14:53:49 +0000
parents 0cbe8f6dbf9e
children f849a5ca2efc
line wrap: on
line diff
--- a/libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c	Thu Feb 22 14:52:46 2007 +0000
+++ b/libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c	Thu Feb 22 14:53:49 2007 +0000
@@ -6,7 +6,7 @@
  * The library is free for all purposes without any express
  * guarantee it works.
  *
- * Tom St Denis, [email protected], http://libtomcrypt.org
+ * Tom St Denis, [email protected], http://libtomcrypt.com
  */
 #include "tomcrypt.h"
 
@@ -67,14 +67,8 @@
       return CRYPT_INVALID_PACKET;
    }
 
-   /* decode word1 and word2 */
-   --len;
-   t = in[x++];
-   words[0] = t/40;
-   words[1] = t%40;
-
-   /* decode rest */
-   y = 2;
+   /* decode words */
+   y = 0;
    t = 0;
    while (len--) {
        t = (t << 7) | (in[x] & 0x7F);
@@ -83,7 +77,13 @@
            if (y >= *outlen) {
               return CRYPT_BUFFER_OVERFLOW;
            }
-           words[y++] = t;
+      if (y == 0) {
+         words[0] = t / 40;
+         words[1] = t % 40;
+         y = 2;
+      } else {
+              words[y++] = t;
+      }
            t          = 0;
        }
    }
@@ -95,5 +95,5 @@
 #endif
 
 /* $Source: /cvs/libtom/libtomcrypt/src/pk/asn1/der/object_identifier/der_decode_object_identifier.c,v $ */
-/* $Revision: 1.1 $ */
-/* $Date: 2005/05/16 15:08:11 $ */
+/* $Revision: 1.5 $ */
+/* $Date: 2006/11/21 00:18:23 $ */