Browse Source

Merge pull request #545 from libtom/pattop/fixes

Minor fix & cleanup
Steffen Jaeckel 5 years ago
parent
commit
cfbd7f8d36
2 changed files with 2 additions and 4 deletions
  1. 1 3
      src/hashes/sha2/sha256.c
  2. 1 1
      src/headers/tomcrypt_private.h

+ 1 - 3
src/hashes/sha2/sha256.c

@@ -168,10 +168,8 @@ static int s_sha256_compress(hash_state * md, const unsigned char *buf)
     RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],61,0xa4506ceb);
     RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],62,0xbef9a3f7);
     RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],63,0xc67178f2);
-
-#undef RND
-
 #endif
+#undef RND
 
     /* feedback */
     for (i = 0; i < 8; i++) {

+ 1 - 1
src/headers/tomcrypt_private.h

@@ -90,7 +90,7 @@ int func_name (hash_state * md, const unsigned char *in, unsigned long inlen)
     if (md-> state_var .curlen > sizeof(md-> state_var .buf)) {                             \
        return CRYPT_INVALID_ARG;                                                            \
     }                                                                                       \
-    if ((md-> state_var .length + inlen) < md-> state_var .length) {                        \
+    if ((md-> state_var .length + inlen * 8) < md-> state_var .length) {                        \
       return CRYPT_HASH_OVERFLOW;                                                           \
     }                                                                                       \
     while (inlen > 0) {                                                                     \