giorgiozoppi opened a new issue #21: SHA hash might be not initialized correctly
URL: https://github.com/apache/incubator-milagro-crypto-c/issues/21
 
 
   in the function 
   void ehashit(int sha,octet *p,int n,octet *x,octet *w,int pad)
   You need a default in the switch since without any default all the flow will 
skip the hashing. I suggest that due to the current standards the default is 
SHA_256 for the parameters sha.
   Just replace the code :
   switch(sha)
               {
               case SHA256:
                   HASH256_process(&sha256,x->val[i]);
                   break;
               case SHA384:
                   HASH384_process(&sha512,x->val[i]);
                   break;
               case SHA512:
                   HASH512_process(&sha512,x->val[i]);
                   break;
               }
   
   with:
   switch(sha)
               {
               case SHA256:
                   HASH256_process(&sha256,x->val[i]);
                   break;
               case SHA384:
                   HASH384_process(&sha512,x->val[i]);
                   break;
               case SHA512:
                   HASH512_process(&sha512,x->val[i]);
                   break;
              default: 
                    HASH256_process(&sha256,x->val[i]);
                   break;
               }
   
   In every case where it makes sense in that function. Suppose that put a not 
valid value, it will produce an hash. The other option is to check input value 
sha. 
   It is not a problem just a code smell.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to