"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libcanlock/src/sha384-512.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.

sha384-512.c  (tin-2.4.2.tar.xz):sha384-512.c  (tin-2.4.3.tar.xz)
skipping to change at line 46 skipping to change at line 46
* *
* Caveats: * Caveats:
* SHA-384 and SHA-512 are designed to work with messages less * SHA-384 and SHA-512 are designed to work with messages less
* than 2^128 bits long. This implementation uses SHA384/512Input() * than 2^128 bits long. This implementation uses SHA384/512Input()
* 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 SHA384/256FinalBits() * octet, and then optionally uses SHA384/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"
#ifdef USE_32BIT_ONLY #ifdef USE_32BIT_ONLY
/* /*
* Define 64-bit arithmetic in terms of 32-bit arithmetic. * Define 64-bit arithmetic in terms of 32-bit arithmetic.
* Each 64-bit number is represented in a 2-word array. * Each 64-bit number is represented in a 2-word array.
* All macros are defined such that the result is the last parameter. * All macros are defined such that the result is the last parameter.
*/ */
/* /*
skipping to change at line 681 skipping to change at line 682
0xD186B8C7, 0x21C0C207, 0xEADA7DD6, 0xCDE0EB1E, 0xF57D4F7F, 0xD186B8C7, 0x21C0C207, 0xEADA7DD6, 0xCDE0EB1E, 0xF57D4F7F,
0xEE6ED178, 0x06F067AA, 0x72176FBA, 0x0A637DC5, 0xA2C898A6, 0xEE6ED178, 0x06F067AA, 0x72176FBA, 0x0A637DC5, 0xA2C898A6,
0x113F9804, 0xBEF90DAE, 0x1B710B35, 0x131C471B, 0x28DB77F5, 0x113F9804, 0xBEF90DAE, 0x1B710B35, 0x131C471B, 0x28DB77F5,
0x23047D84, 0x32CAAB7B, 0x40C72493, 0x3C9EBE0A, 0x15C9BEBC, 0x23047D84, 0x32CAAB7B, 0x40C72493, 0x3C9EBE0A, 0x15C9BEBC,
0x431D67C4, 0x9C100D4C, 0x4CC5D4BE, 0xCB3E42B6, 0x597F299C, 0x431D67C4, 0x9C100D4C, 0x4CC5D4BE, 0xCB3E42B6, 0x597F299C,
0xFC657E2A, 0x5FCB6FAB, 0x3AD6FAEC, 0x6C44198C, 0x4A475817 0xFC657E2A, 0x5FCB6FAB, 0x3AD6FAEC, 0x6C44198C, 0x4A475817
}; };
int t, t2, t8; /* Loop counter */ int t, t2, t8; /* Loop counter */
uint32_t temp1[2], temp2[2], /* Temporary word values */ uint32_t temp1[2], temp2[2], /* Temporary word values */
temp3[2], temp4[2], temp5[2]; temp3[2], temp4[2], temp5[2];
uint32_t W[2*80]; /* Word sequence */ uint32_t W[2*80]; /* Word sequence. Security review: Location L6a */
uint32_t A[2], B[2], C[2], D[2], /* Word buffers */ uint32_t A[2], B[2], C[2], D[2], /* Word buffers */
E[2], F[2], G[2], H[2]; E[2], F[2], G[2], H[2];
/* Initialize the first 16 words in the array W */ /* Initialize the first 16 words in the array W */
for (t = t2 = t8 = 0; t < 16; t++, t8 += 8) { for (t = t2 = t8 = 0; t < 16; t++, t8 += 8) {
W[t2++] = ((((uint32_t)context->Message_Block[t8 ])) << 24) | W[t2++] = ((((uint32_t)context->Message_Block[t8 ])) << 24) |
((((uint32_t)context->Message_Block[t8 + 1])) << 16) | ((((uint32_t)context->Message_Block[t8 + 1])) << 16) |
((((uint32_t)context->Message_Block[t8 + 2])) << 8) | ((((uint32_t)context->Message_Block[t8 + 2])) << 8) |
((((uint32_t)context->Message_Block[t8 + 3]))); ((((uint32_t)context->Message_Block[t8 + 3])));
W[t2++] = ((((uint32_t)context->Message_Block[t8 + 4])) << 24) | W[t2++] = ((((uint32_t)context->Message_Block[t8 + 4])) << 24) |
skipping to change at line 754 skipping to change at line 755
H[0] = G[0]; H[1] = G[1]; H[0] = G[0]; H[1] = G[1];
G[0] = F[0]; G[1] = F[1]; G[0] = F[0]; G[1] = F[1];
F[0] = E[0]; F[1] = E[1]; F[0] = E[0]; F[1] = E[1];
SHA512_ADD(D, temp1, E); SHA512_ADD(D, temp1, E);
D[0] = C[0]; D[1] = C[1]; D[0] = C[0]; D[1] = C[1];
C[0] = B[0]; C[1] = B[1]; C[0] = B[0]; C[1] = B[1];
B[0] = A[0]; B[1] = A[1]; B[0] = A[0]; B[1] = A[1];
SHA512_ADD(temp1, temp2, A); SHA512_ADD(temp1, temp2, A);
} }
cl_clear_secret((void *) W, sizeof(W), sizeof(W));
SHA512_ADDTO2(&context->Intermediate_Hash[0], A); SHA512_ADDTO2(&context->Intermediate_Hash[0], A);
SHA512_ADDTO2(&context->Intermediate_Hash[2], B); SHA512_ADDTO2(&context->Intermediate_Hash[2], B);
SHA512_ADDTO2(&context->Intermediate_Hash[4], C); SHA512_ADDTO2(&context->Intermediate_Hash[4], C);
SHA512_ADDTO2(&context->Intermediate_Hash[6], D); SHA512_ADDTO2(&context->Intermediate_Hash[6], D);
SHA512_ADDTO2(&context->Intermediate_Hash[8], E); SHA512_ADDTO2(&context->Intermediate_Hash[8], E);
SHA512_ADDTO2(&context->Intermediate_Hash[10], F); SHA512_ADDTO2(&context->Intermediate_Hash[10], F);
SHA512_ADDTO2(&context->Intermediate_Hash[12], G); SHA512_ADDTO2(&context->Intermediate_Hash[12], G);
SHA512_ADDTO2(&context->Intermediate_Hash[14], H); SHA512_ADDTO2(&context->Intermediate_Hash[14], H);
#else /* !USE_32BIT_ONLY */ #else /* !USE_32BIT_ONLY */
skipping to change at line 794 skipping to change at line 797
0x5B9CCA4F7763E373ll, 0x682E6FF3D6B2B8A3ll, 0x748F82EE5DEFB2FCll, 0x5B9CCA4F7763E373ll, 0x682E6FF3D6B2B8A3ll, 0x748F82EE5DEFB2FCll,
0x78A5636F43172F60ll, 0x84C87814A1F0AB72ll, 0x8CC702081A6439ECll, 0x78A5636F43172F60ll, 0x84C87814A1F0AB72ll, 0x8CC702081A6439ECll,
0x90BEFFFA23631E28ll, 0xA4506CEBDE82BDE9ll, 0xBEF9A3F7B2C67915ll, 0x90BEFFFA23631E28ll, 0xA4506CEBDE82BDE9ll, 0xBEF9A3F7B2C67915ll,
0xC67178F2E372532Bll, 0xCA273ECEEA26619Cll, 0xD186B8C721C0C207ll, 0xC67178F2E372532Bll, 0xCA273ECEEA26619Cll, 0xD186B8C721C0C207ll,
0xEADA7DD6CDE0EB1Ell, 0xF57D4F7FEE6ED178ll, 0x06F067AA72176FBAll, 0xEADA7DD6CDE0EB1Ell, 0xF57D4F7FEE6ED178ll, 0x06F067AA72176FBAll,
0x0A637DC5A2C898A6ll, 0x113F9804BEF90DAEll, 0x1B710B35131C471Bll, 0x0A637DC5A2C898A6ll, 0x113F9804BEF90DAEll, 0x1B710B35131C471Bll,
0x28DB77F523047D84ll, 0x32CAAB7B40C72493ll, 0x3C9EBE0A15C9BEBCll, 0x28DB77F523047D84ll, 0x32CAAB7B40C72493ll, 0x3C9EBE0A15C9BEBCll,
0x431D67C49C100D4Cll, 0x4CC5D4BECB3E42B6ll, 0x597F299CFC657E2All, 0x431D67C49C100D4Cll, 0x4CC5D4BECB3E42B6ll, 0x597F299CFC657E2All,
0x5FCB6FAB3AD6FAECll, 0x6C44198C4A475817ll 0x5FCB6FAB3AD6FAECll, 0x6C44198C4A475817ll
}; };
int t, t8; /* Loop counter */ int t, t8; /* Loop counter */
uint64_t temp1, temp2; /* Temporary word value */ uint64_t temp1, temp2; /* Temporary word value */
uint64_t W[80]; /* Word sequence */ uint64_t W[80]; /* Word sequence. Security review: Location L6b */
uint64_t A, B, C, D, E, F, G, H; /* Word buffers */ uint64_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 = t8 = 0; t < 16; t++, t8 += 8) for (t = t8 = 0; t < 16; t++, t8 += 8)
W[t] = ((uint64_t)(context->Message_Block[t8 ]) << 56) | W[t] = ((uint64_t)(context->Message_Block[t8 ]) << 56) |
((uint64_t)(context->Message_Block[t8 + 1]) << 48) | ((uint64_t)(context->Message_Block[t8 + 1]) << 48) |
((uint64_t)(context->Message_Block[t8 + 2]) << 40) | ((uint64_t)(context->Message_Block[t8 + 2]) << 40) |
((uint64_t)(context->Message_Block[t8 + 3]) << 32) | ((uint64_t)(context->Message_Block[t8 + 3]) << 32) |
skipping to change at line 837 skipping to change at line 840
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;
#endif /* USE_32BIT_ONLY */ #endif /* USE_32BIT_ONLY */
 End of changes. 5 change blocks. 
4 lines changed or deleted 9 lines changed or added

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