Use properly local variables for thread-safety.
[openssl.git] / engines / ccgost / gosthash.c
index de55e0c3aa9dcf55fc3d7ff3a52bf1a5efe42b16..a5c0662ffc32f35ff7d3f8d812d3b8d8fa98b302 100644 (file)
@@ -86,7 +86,7 @@ static void xor_blocks (byte *result,const byte *a,const byte *b,size_t len)
  */
 static int hash_step(gost_ctx *c,byte *H,const byte *M) 
        {
-       static byte U[32],W[32],V[32],S[32],Key[32];
+       byte U[32],W[32],V[32],S[32],Key[32];
        int i;
        /* Compute first key */
        xor_blocks(W,H,M,32);
@@ -228,7 +228,7 @@ int finish_hash(gost_hash_ctx *ctx,byte *hashval)
        byte buf[32];
        byte H[32];
        byte S[32];
-       long long fin_len=ctx->len;
+       ghosthash_len fin_len=ctx->len;
        byte *bptr;
        memcpy(H,ctx->H,32);
        memcpy(S,ctx->S,32);
@@ -245,7 +245,7 @@ int finish_hash(gost_hash_ctx *ctx,byte *hashval)
        fin_len<<=3; /* Hash length in BITS!!*/
        while(fin_len>0)
                {
-               *(bptr++)=fin_len&0xFF;
+               *(bptr++)=(byte)(fin_len&0xFF);
                fin_len>>=8;
                };
        hash_step(ctx->cipher_ctx,H,buf);
@@ -253,4 +253,3 @@ int finish_hash(gost_hash_ctx *ctx,byte *hashval)
        memcpy(hashval,H,32);
        return 1;
        }
-