Upgrade libtomcrypt

This commit is contained in:
2025-10-24 19:33:21 +03:00
parent d770dd8df3
commit acc69bb8ad
157 changed files with 922 additions and 761 deletions

View File

@@ -277,7 +277,7 @@ int chc_test(void)
oldhashidx = cipher_idx;
chc_register(idx);
for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
for (i = 0; i < (int)LTC_ARRAY_SIZE(tests); i++) {
if ((err = chc_init(&md)) != CRYPT_OK) {
return err;
}

View File

@@ -380,7 +380,7 @@ int rmd128_test(void)
unsigned char tmp[16];
hash_state md;
for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
for (i = 0; i < (int)LTC_ARRAY_SIZE(tests); i++) {
rmd128_init(&md);
rmd128_process(&md, (unsigned char *)tests[i].msg, XSTRLEN(tests[i].msg));
rmd128_done(&md, tmp);

View File

@@ -439,7 +439,7 @@ int rmd160_test(void)
unsigned char tmp[20];
hash_state md;
for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
for (i = 0; i < (int)LTC_ARRAY_SIZE(tests); i++) {
rmd160_init(&md);
rmd160_process(&md, (unsigned char *)tests[i].msg, XSTRLEN(tests[i].msg));
rmd160_done(&md, tmp);

View File

@@ -405,7 +405,7 @@ int rmd256_test(void)
unsigned char tmp[32];
hash_state md;
for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
for (i = 0; i < (int)LTC_ARRAY_SIZE(tests); i++) {
rmd256_init(&md);
rmd256_process(&md, (unsigned char *)tests[i].msg, XSTRLEN(tests[i].msg));
rmd256_done(&md, tmp);

View File

@@ -470,7 +470,7 @@ int rmd320_test(void)
unsigned char tmp[40];
hash_state md;
for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
for (i = 0; i < (int)LTC_ARRAY_SIZE(tests); i++) {
rmd320_init(&md);
rmd320_process(&md, (unsigned char *)tests[i].msg, XSTRLEN(tests[i].msg));
rmd320_done(&md, tmp);

View File

@@ -566,7 +566,7 @@ static const ulong64 table[4*256] = {
CONST64(0xC83223F1720AEF96) /* 1022 */, CONST64(0xC3A0396F7363A51F) /* 1023 */};
/* one round of the hash function */
LTC_INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x, int mul)
static LTC_INLINE void s_tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x, int mul)
{
ulong64 tmp;
tmp = (*c ^= x);
@@ -582,14 +582,14 @@ LTC_INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x
/* one complete pass */
static void s_pass(ulong64 *a, ulong64 *b, ulong64 *c, const ulong64 *x, int mul)
{
tiger_round(a,b,c,x[0],mul);
tiger_round(b,c,a,x[1],mul);
tiger_round(c,a,b,x[2],mul);
tiger_round(a,b,c,x[3],mul);
tiger_round(b,c,a,x[4],mul);
tiger_round(c,a,b,x[5],mul);
tiger_round(a,b,c,x[6],mul);
tiger_round(b,c,a,x[7],mul);
s_tiger_round(a,b,c,x[0],mul);
s_tiger_round(b,c,a,x[1],mul);
s_tiger_round(c,a,b,x[2],mul);
s_tiger_round(a,b,c,x[3],mul);
s_tiger_round(b,c,a,x[4],mul);
s_tiger_round(c,a,b,x[5],mul);
s_tiger_round(a,b,c,x[6],mul);
s_tiger_round(b,c,a,x[7],mul);
}
/* The key mixing schedule */

View File

@@ -281,7 +281,7 @@ int whirlpool_test(void)
unsigned char tmp[64];
hash_state md;
for (i = 0; i < (int)(sizeof(tests)/sizeof(tests[0])); i++) {
for (i = 0; i < (int)LTC_ARRAY_SIZE(tests); i++) {
whirlpool_init(&md);
whirlpool_process(&md, (unsigned char *)tests[i].msg, tests[i].len);
whirlpool_done(&md, tmp);