X-Git-Url: https://git.cryptolib.org/?p=arm-crypto-lib.git;a=blobdiff_plain;f=cubehash%2Fcubehash.c;h=76040b0010d11d7026276f4a5be5d31dde1fcbae;hp=72c0d7521e4d4bdfb549b9e03f9691329fc8ac64;hb=d70d1d77bab1a5f5278227d674bc59da0378fe15;hpb=d00ed9a275c69fa3512007452e479abd98dbe745 diff --git a/cubehash/cubehash.c b/cubehash/cubehash.c index 72c0d75..76040b0 100644 --- a/cubehash/cubehash.c +++ b/cubehash/cubehash.c @@ -26,21 +26,22 @@ */ -#include "memxor.h" +#include "memxor/memxor.h" #include "cubehash.h" #include #include +inline static uint32_t rol32(uint32_t a, uint8_t r){ return (a<>(32-r)); } /* -• Add x_0jklm into x_1jklm modulo 232 , for each (j, k, l, m). +• Add x_0jklm into x_1jklm modulo 2**32 , for each (j, k, l, m). • Rotate x_0jklm upwards by 7 bits, for each (j, k, l, m). • Swap x_00klm with x_01klm , for each (k, l, m). • Xor x_1jklm into x_0jklm , for each (j, k, l, m). • Swap x_1jk0m with x_1jk1m , for each (j, k, m). -• Add x_0jklm into x_1jklm modulo 232 , for each (j, k, l, m). +• Add x_0jklm into x_1jklm modulo 2**32 , for each (j, k, l, m). • Rotate x_0jklm upwards by 11 bits, for each (j, k, l, m). • Swap x_0j0lm with x_0j1lm , for each (j, l, m). • Xor x_1jklm into x_0jklm , for each (j, k, l, m). @@ -52,8 +53,6 @@ static void cubehash_round(cubehash_ctx_t* ctx){ uint32_t t; for(i=0; i<16; ++i){ ctx->a[i+16] += ctx->a[i]; - } - for(i=0; i<16; ++i){ ctx->a[i] = rol32(ctx->a[i], 7); } for(i=0; i<8; ++i){ @@ -74,8 +73,6 @@ static void cubehash_round(cubehash_ctx_t* ctx){ } for(i=0; i<16; ++i){ ctx->a[i+16] += ctx->a[i]; - } - for(i=0; i<16; ++i){ ctx->a[i] = rol32(ctx->a[i], 11); } for(i=0; i<4; ++i){