aboutsummaryrefslogtreecommitdiffstats
path: root/engines/ccgost
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2014-07-08 22:24:44 +0200
committerAndy Polyakov <appro@openssl.org>2014-07-09 22:45:38 +0200
commit2064e2db08eb90da711999445680d45c44483e82 (patch)
treeff1c8a72aa142e58a73b0380e16e03c2324250b7 /engines/ccgost
parentde222838fe17a04b9694ad0e9c4604193c976fa7 (diff)
downloadopenssl-2064e2db08eb90da711999445680d45c44483e82.tar.gz
Please Clang's sanitizer.
PR: #3424,#3423,#3422 (cherry picked from commit 021e5043e524b1cb28a929ef902548a987c16e65)
Diffstat (limited to 'engines/ccgost')
-rw-r--r--engines/ccgost/gost89.c16
-rw-r--r--engines/ccgost/gost_crypt.c4
2 files changed, 10 insertions, 10 deletions
diff --git a/engines/ccgost/gost89.c b/engines/ccgost/gost89.c
index b0568c6b3c..c1474cb652 100644
--- a/engines/ccgost/gost89.c
+++ b/engines/ccgost/gost89.c
@@ -120,7 +120,7 @@ static void kboxinit(gost_ctx *c, const gost_subst_block *b)
for (i = 0; i < 256; i++)
{
- c->k87[i] = (b->k8[i>>4] <<4 | b->k7 [i &15])<<24;
+ c->k87[i] = (word32)(b->k8[i>>4] <<4 | b->k7 [i &15])<<24;
c->k65[i] = (b->k6[i>>4] << 4 | b->k5 [i &15])<<16;
c->k43[i] = (b->k4[i>>4] <<4 | b->k3 [i &15])<<8;
c->k21[i] = b->k2[i>>4] <<4 | b->k1 [i &15];
@@ -140,8 +140,8 @@ static word32 f(gost_ctx *c,word32 x)
void gostcrypt(gost_ctx *c, const byte *in, byte *out)
{
register word32 n1, n2; /* As named in the GOST */
- n1 = in[0]|(in[1]<<8)|(in[2]<<16)|(in[3]<<24);
- n2 = in[4]|(in[5]<<8)|(in[6]<<16)|(in[7]<<24);
+ n1 = in[0]|(in[1]<<8)|(in[2]<<16)|((word32)in[3]<<24);
+ n2 = in[4]|(in[5]<<8)|(in[6]<<16)|((word32)in[7]<<24);
/* Instead of swapping halves, swap names each round */
n2 ^= f(c,n1+c->k[0]); n1 ^= f(c,n2+c->k[1]);
@@ -173,8 +173,8 @@ void gostcrypt(gost_ctx *c, const byte *in, byte *out)
void gostdecrypt(gost_ctx *c, const byte *in,byte *out)
{
register word32 n1, n2; /* As named in the GOST */
- n1 = in[0]|(in[1]<<8)|(in[2]<<16)|(in[3]<<24);
- n2 = in[4]|(in[5]<<8)|(in[6]<<16)|(in[7]<<24);
+ n1 = in[0]|(in[1]<<8)|(in[2]<<16)|((word32)in[3]<<24);
+ n2 = in[4]|(in[5]<<8)|(in[6]<<16)|((word32)in[7]<<24);
n2 ^= f(c,n1+c->k[0]); n1 ^= f(c,n2+c->k[1]);
n2 ^= f(c,n1+c->k[2]); n1 ^= f(c,n2+c->k[3]);
@@ -275,7 +275,7 @@ void gost_key(gost_ctx *c, const byte *k)
int i,j;
for(i=0,j=0;i<8;i++,j+=4)
{
- c->k[i]=k[j]|(k[j+1]<<8)|(k[j+2]<<16)|(k[j+3]<<24);
+ c->k[i]=k[j]|(k[j+1]<<8)|(k[j+2]<<16)|((word32)k[j+3]<<24);
}
}
@@ -323,8 +323,8 @@ void mac_block(gost_ctx *c,byte *buffer,const byte *block)
{
buffer[i]^=block[i];
}
- n1 = buffer[0]|(buffer[1]<<8)|(buffer[2]<<16)|(buffer[3]<<24);
- n2 = buffer[4]|(buffer[5]<<8)|(buffer[6]<<16)|(buffer[7]<<24);
+ n1 = buffer[0]|(buffer[1]<<8)|(buffer[2]<<16)|((word32)buffer[3]<<24);
+ n2 = buffer[4]|(buffer[5]<<8)|(buffer[6]<<16)|((word32)buffer[7]<<24);
/* Instead of swapping halves, swap names each round */
n2 ^= f(c,n1+c->k[0]); n1 ^= f(c,n2+c->k[1]);
diff --git a/engines/ccgost/gost_crypt.c b/engines/ccgost/gost_crypt.c
index 52aef15acf..15ab02aabb 100644
--- a/engines/ccgost/gost_crypt.c
+++ b/engines/ccgost/gost_crypt.c
@@ -241,13 +241,13 @@ static void gost_cnt_next (void *ctx, unsigned char *iv, unsigned char *buf)
{
memcpy(buf1,iv,8);
}
- g = buf1[0]|(buf1[1]<<8)|(buf1[2]<<16)|(buf1[3]<<24);
+ g = buf1[0]|(buf1[1]<<8)|(buf1[2]<<16)|((word32)buf1[3]<<24);
g += 0x01010101;
buf1[0]=(unsigned char)(g&0xff);
buf1[1]=(unsigned char)((g>>8)&0xff);
buf1[2]=(unsigned char)((g>>16)&0xff);
buf1[3]=(unsigned char)((g>>24)&0xff);
- g = buf1[4]|(buf1[5]<<8)|(buf1[6]<<16)|(buf1[7]<<24);
+ g = buf1[4]|(buf1[5]<<8)|(buf1[6]<<16)|((word32)buf1[7]<<24);
go = g;
g += 0x01010104;
if (go > g) /* overflow*/