"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libcanlock/src/sha224-256.c" between
tin-2.4.2.tar.xz and tin-2.4.3.tar.xz

About: TIN is a threaded NNTP and spool based UseNet newsreader.

sha224-256.c  (tin-2.4.2.tar.xz):sha224-256.c  (tin-2.4.3.tar.xz)
skipping to change at line 43 skipping to change at line 43
* appropriate. * appropriate.
* *
* Caveats: * Caveats:
* SHA-224 and SHA-256 are designed to work with messages less * SHA-224 and SHA-256 are designed to work with messages less
* than 2^64 bits long. This implementation uses SHA224/256Input() * than 2^64 bits long. This implementation uses SHA224/256Input()
* to hash the bits that are a multiple of the size of an 8-bit * to hash the bits that are a multiple of the size of an 8-bit
* octet, and then optionally uses SHA224/256FinalBits() * octet, and then optionally uses SHA224/256FinalBits()
* to hash the final few bits of the input. * to hash the final few bits of the input.
*/ */
#include "canlock-private.h"
#include "sha.h" #include "sha.h"
#include "sha-private.h" #include "sha-private.h"
/* Define the SHA shift, rotate left, and rotate right macros */ /* Define the SHA shift, rotate left, and rotate right macros */
#define SHA256_SHR(bits,word) ((word) >> (bits)) #define SHA256_SHR(bits,word) ((word) >> (bits))
#if 0 /* not used */ #if 0 /* not used */
#define SHA256_ROTL(bits,word) \ #define SHA256_ROTL(bits,word) \
(((word) << (bits)) | ((word) >> (32-(bits)))) (((word) << (bits)) | ((word) >> (32-(bits))))
#endif /* 0 */ #endif /* 0 */
#define SHA256_ROTR(bits,word) \ #define SHA256_ROTR(bits,word) \
skipping to change at line 403 skipping to change at line 404
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152,
0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147,
0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc,
0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,
0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08,
0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f,
0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
}; };
int t, t4; /* Loop counter */ int t, t4; /* Loop counter */
uint32_t temp1, temp2; /* Temporary word value */ uint32_t temp1, temp2; /* Temporary word value */
uint32_t W[64]; /* Word sequence */ uint32_t W[64]; /* Word sequence. Security review: Location L5 */
uint32_t A, B, C, D, E, F, G, H; /* Word buffers */ uint32_t A, B, C, D, E, F, G, H; /* Word buffers */
/* /*
* Initialize the first 16 words in the array W * Initialize the first 16 words in the array W
*/ */
for (t = t4 = 0; t < 16; t++, t4 += 4) for (t = t4 = 0; t < 16; t++, t4 += 4)
W[t] = (((uint32_t)context->Message_Block[t4]) << 24) | W[t] = (((uint32_t)context->Message_Block[t4]) << 24) |
(((uint32_t)context->Message_Block[t4 + 1]) << 16) | (((uint32_t)context->Message_Block[t4 + 1]) << 16) |
(((uint32_t)context->Message_Block[t4 + 2]) << 8) | (((uint32_t)context->Message_Block[t4 + 2]) << 8) |
(((uint32_t)context->Message_Block[t4 + 3])); (((uint32_t)context->Message_Block[t4 + 3]));
skipping to change at line 443 skipping to change at line 444
H = G; H = G;
G = F; G = F;
F = E; F = E;
E = D + temp1; E = D + temp1;
D = C; D = C;
C = B; C = B;
B = A; B = A;
A = temp1 + temp2; A = temp1 + temp2;
} }
cl_clear_secret((void *) W, sizeof(W), sizeof(W));
context->Intermediate_Hash[0] += A; context->Intermediate_Hash[0] += A;
context->Intermediate_Hash[1] += B; context->Intermediate_Hash[1] += B;
context->Intermediate_Hash[2] += C; context->Intermediate_Hash[2] += C;
context->Intermediate_Hash[3] += D; context->Intermediate_Hash[3] += D;
context->Intermediate_Hash[4] += E; context->Intermediate_Hash[4] += E;
context->Intermediate_Hash[5] += F; context->Intermediate_Hash[5] += F;
context->Intermediate_Hash[6] += G; context->Intermediate_Hash[6] += G;
context->Intermediate_Hash[7] += H; context->Intermediate_Hash[7] += H;
context->Message_Block_Index = 0; context->Message_Block_Index = 0;
 End of changes. 3 change blocks. 
3 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)