some updates for the blinding code; summary:
[openssl.git] / crypto / ripemd / rmd_dgst.c
index be3eb2204a1e751065b53c0c94f20affa4de20fe..03a286dfccfa32d1eb60879cc77320599ff4eb56 100644 (file)
 const char *RMD160_version="RIPE-MD160" OPENSSL_VERSION_PTEXT;
 
 #  ifdef RMD160_ASM
-     void ripemd160_block_x86(RIPEMD160_CTX *c, unsigned long *p,int num);
+     void ripemd160_block_x86(RIPEMD160_CTX *c, unsigned long *p,size_t num);
 #    define ripemd160_block ripemd160_block_x86
 #  else
-     void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,int num);
+     void ripemd160_block(RIPEMD160_CTX *c, unsigned long *p,size_t num);
 #  endif
 
-void RIPEMD160_Init(RIPEMD160_CTX *c)
+int RIPEMD160_Init(RIPEMD160_CTX *c)
        {
        c->A=RIPEMD160_A;
        c->B=RIPEMD160_B;
@@ -79,20 +79,21 @@ void RIPEMD160_Init(RIPEMD160_CTX *c)
        c->Nl=0;
        c->Nh=0;
        c->num=0;
+       return 1;
        }
 
 #ifndef ripemd160_block_host_order
 #ifdef X
 #undef X
 #endif
-#define X(i)   X[(i)]
-void ripemd160_block_host_order (RIPEMD160_CTX *ctx, const void *p, int num)
+#define X(i)   XX[i]
+void ripemd160_block_host_order (RIPEMD160_CTX *ctx, const void *p, size_t num)
        {
-       const RIPEMD160_LONG *X=p;
-       register unsigned long A,B,C,D,E;
-       register unsigned long a,b,c,d,e;
+       const RIPEMD160_LONG *XX=p;
+       register unsigned MD32_REG_T A,B,C,D,E;
+       register unsigned MD32_REG_T a,b,c,d,e;
 
-       for (;num--;X+=HASH_LBLOCK)
+       for (;num--;XX+=HASH_LBLOCK)
                {
 
        A=ctx->A; B=ctx->B; C=ctx->C; D=ctx->D; E=ctx->E;
@@ -286,21 +287,20 @@ void ripemd160_block_host_order (RIPEMD160_CTX *ctx, const void *p, int num)
 #ifdef X
 #undef X
 #endif
-#define X(i)   X##i
-void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, int num)
+void ripemd160_block_data_order (RIPEMD160_CTX *ctx, const void *p, size_t num)
        {
        const unsigned char *data=p;
-       register unsigned long A,B,C,D,E;
-       unsigned long a,b,c,d,e,l;
-       RIPEMD160_LONG   X0, X1, X2, X3, X4, X5, X6, X7,
-                        X8, X9,X10,X11,X12,X13,X14,X15;
-       /*
-        * Originally the above was declared as RIPEMD160_LONG X[16];
-        * The idea was to make RISC compilers to accomodate at
-        * least part of X in the register bank. Unfortunately not
-        * all compilers get this idea:-(
-        *                                      <appro@fy.chalmers.se>
-        */
+       register unsigned MD32_REG_T A,B,C,D,E;
+       unsigned MD32_REG_T a,b,c,d,e,l;
+#ifndef MD32_XARRAY
+       /* See comment in crypto/sha/sha_locl.h for details. */
+       unsigned MD32_REG_T     XX0, XX1, XX2, XX3, XX4, XX5, XX6, XX7,
+                               XX8, XX9,XX10,XX11,XX12,XX13,XX14,XX15;
+# define X(i)  XX##i
+#else
+       RIPEMD160_LONG  XX[16];
+# define X(i)  XX[i]
+#endif
 
        for (;num--;)
                {