Commit 3a77a8a1 by Robert Dubner

### Update SHA and MSCHAP for IPR and formatting

parent 7e72085a
Pipeline #3659 passed with stage
in 40 minutes and 58 seconds
 ... ... @@ -60,10 +60,12 @@ A million repetitions of "a" ^block->l[(i+2)&15]^block->l[i&15],1)) /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ #define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); #define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5); \ w=rol(w,30); #define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); #define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); #define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); #define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5); \ w=rol(w,30); #define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); ... ... @@ -281,7 +283,8 @@ SHA1Final( #else for (i = 0; i < 8; i++) { finalcount[i] = (unsigned char) ((context->count[(i >= 4 ? 0 : 1)] >> ((3 - (i & 3)) * 8)) & 255); /* Endian independent */ finalcount[i] = (unsigned char) ((context->count[(i >= 4 ? 0 : 1)] >> ((3 - (i & 3)) * 8)) & 255); /* Endian independent */ } #endif c = 0200; ... ...
 ... ... @@ -35,27 +35,23 @@ typedef struct void SHA1Transform( uint32_t state[5], const unsigned char buffer[64] ); const unsigned char buffer[64]); void SHA1Init( SHA1_CTX * context ); SHA1_CTX * context); void SHA1Update( SHA1_CTX * context, const unsigned char *data, uint32_t len ); uint32_t len); void SHA1Final( unsigned char digest[20], SHA1_CTX * context ); SHA1_CTX * context); void SHA1( void SHA1_hash( char *hash_out, const char *str, int len); #endif /* SHA1_H */ \ No newline at end of file #endif /* _h_SHA1_H */
 ... ... @@ -15,16 +15,11 @@ * */ #include "radiusov.h" #include "lber-int.h" #define HAVE_SYS_TYPES_H 1 #define HAVE_STDINT_H 1 #include "md4.h" /** Calculate the MD4 hash of the contents of a buffer * * @param[out] out Where to write the MD4 digest. Must be a minimum of MD4_DIGEST_LENGTH. * @param[in] in Data to hash. * @param[in] inlen Length of the data. */ void md4_calc(uint8_t out[MD4_DIGEST_LENGTH], uint8_t const *in, size_t inlen) { ... ... @@ -169,14 +164,6 @@ md4_update(MD4_CTX *ctx, uint8_t const *in, size_t inlen) memcpy(ctx->buffer, in, inlen); } /** Finalise the MD4 context and write out the hash * * Final wrapup - pad to 64-byte boundary with the bit pattern 1 0* * (64-bit count of bits processed, MSB-first). * * @param[out] out Where to write the MD4 digest. Minimum length of MD4_DIGEST_LENGTH. * @param[in,out] ctx to finalise. */ void md4_final(uint8_t out[MD4_DIGEST_LENGTH], MD4_CTX *ctx) { ... ... @@ -230,7 +217,8 @@ md4_final(uint8_t out[MD4_DIGEST_LENGTH], MD4_CTX *ctx) #define F3(x, y, z) (x ^ y ^ z) /* This is the central step in the MD4 algorithm. */ #define MD4STEP(f, w, x, y, z, data, s) (w += f(x, y, z) + data, w = w << s | w >> (32 - s)) #define MD4STEP(f, w, x, y, z, data, s) (w += f(x, y, z) + data, \ w = w << s | w >> (32 - s)) /** The core of the MD4 algorithm * ... ...