X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=cubehash%2Fcubehash.c;h=4b3b466a24f2dbdb5e7af31709191029946a8505;hb=HEAD;hp=72c0d7521e4d4bdfb549b9e03f9691329fc8ac64;hpb=5f46191d2615ebe2caa6e111b478031a34f20b9e;p=arm-crypto-lib.git diff --git a/cubehash/cubehash.c b/cubehash/cubehash.c index 72c0d75..4b3b466 100644 --- a/cubehash/cubehash.c +++ b/cubehash/cubehash.c @@ -31,16 +31,17 @@ #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){