fix PRQA-C level 6 warnings
This commit is contained in:
parent
34633617f7
commit
c300d77c55
@ -203,7 +203,7 @@ static int RsaUnPad(const byte *pkcsBlock, unsigned int pkcsBlockLen,
|
||||
static int RsaFunction(const byte* in, word32 inLen, byte* out, word32* outLen,
|
||||
int type, RsaKey* key)
|
||||
{
|
||||
#define ERROR_OUT(x) { ret = x; goto done;}
|
||||
#define ERROR_OUT(x) { ret = (x); goto done;}
|
||||
|
||||
mp_int tmp;
|
||||
int ret = 0;
|
||||
@ -220,7 +220,7 @@ static int RsaFunction(const byte* in, word32 inLen, byte* out, word32* outLen,
|
||||
if (mp_exptmod(&tmp, &key->d, &key->n, &tmp) != MP_OKAY)
|
||||
ERROR_OUT(MP_EXPTMOD_E);
|
||||
#else
|
||||
#define INNER_ERROR_OUT(x) { ret = x; goto inner_done; }
|
||||
#define INNER_ERROR_OUT(x) { ret = (x); goto inner_done; }
|
||||
|
||||
mp_int tmpa, tmpb;
|
||||
|
||||
|
@ -209,26 +209,25 @@ int InitSha(Sha* sha)
|
||||
#ifndef FREESCALE_MMCAU
|
||||
|
||||
#define blk0(i) (W[i] = sha->buffer[i])
|
||||
#define blk1(i) (W[i&15] = \
|
||||
rotlFixed(W[(i+13)&15]^W[(i+8)&15]^W[(i+2)&15]^W[i&15],1))
|
||||
#define blk1(i) (W[(i)&15] = \
|
||||
rotlFixed(W[((i)+13)&15]^W[((i)+8)&15]^W[((i)+2)&15]^W[(i)&15],1))
|
||||
|
||||
#define f1(x,y,z) (z^(x &(y^z)))
|
||||
#define f2(x,y,z) (x^y^z)
|
||||
#define f3(x,y,z) ((x&y)|(z&(x|y)))
|
||||
#define f4(x,y,z) (x^y^z)
|
||||
#define f1(x,y,z) ((z)^((x) &((y)^(z))))
|
||||
#define f2(x,y,z) ((x)^(y)^(z))
|
||||
#define f3(x,y,z) (((x)&(y))|((z)&((x)|(y))))
|
||||
#define f4(x,y,z) ((x)^(y)^(z))
|
||||
|
||||
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
|
||||
#define R0(v,w,x,y,z,i) z+= f1(w,x,y) + blk0(i) + 0x5A827999+ \
|
||||
rotlFixed(v,5); w = rotlFixed(w,30);
|
||||
#define R1(v,w,x,y,z,i) z+= f1(w,x,y) + blk1(i) + 0x5A827999+ \
|
||||
rotlFixed(v,5); w = rotlFixed(w,30);
|
||||
#define R2(v,w,x,y,z,i) z+= f2(w,x,y) + blk1(i) + 0x6ED9EBA1+ \
|
||||
rotlFixed(v,5); w = rotlFixed(w,30);
|
||||
#define R3(v,w,x,y,z,i) z+= f3(w,x,y) + blk1(i) + 0x8F1BBCDC+ \
|
||||
rotlFixed(v,5); w = rotlFixed(w,30);
|
||||
#define R4(v,w,x,y,z,i) z+= f4(w,x,y) + blk1(i) + 0xCA62C1D6+ \
|
||||
rotlFixed(v,5); w = rotlFixed(w,30);
|
||||
|
||||
#define R0(v,w,x,y,z,i) (z)+= f1((w),(x),(y)) + blk0((i)) + 0x5A827999+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
#define R1(v,w,x,y,z,i) (z)+= f1((w),(x),(y)) + blk1((i)) + 0x5A827999+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
#define R2(v,w,x,y,z,i) (z)+= f2((w),(x),(y)) + blk1((i)) + 0x6ED9EBA1+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
#define R3(v,w,x,y,z,i) (z)+= f3((w),(x),(y)) + blk1((i)) + 0x8F1BBCDC+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
#define R4(v,w,x,y,z,i) (z)+= f4((w),(x),(y)) + blk1((i)) + 0xCA62C1D6+ \
|
||||
rotlFixed((v),5); (w) = rotlFixed((w),30);
|
||||
|
||||
static void Transform(Sha* sha)
|
||||
{
|
||||
|
@ -116,8 +116,8 @@ static const word32 K[64] = {
|
||||
0x90BEFFFAL, 0xA4506CEBL, 0xBEF9A3F7L, 0xC67178F2L
|
||||
};
|
||||
|
||||
#define Ch(x,y,z) (z ^ (x & (y ^ z)))
|
||||
#define Maj(x,y,z) (((x | y) & z) | (x & y))
|
||||
#define Ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z))))
|
||||
#define Maj(x,y,z) ((((x) | (y)) & (z)) | ((x) & (y)))
|
||||
#define S(x, n) rotrFixed(x, n)
|
||||
#define R(x, n) (((x)&0xFFFFFFFFU)>>(n))
|
||||
#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22))
|
||||
@ -126,10 +126,10 @@ static const word32 K[64] = {
|
||||
#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10))
|
||||
|
||||
#define RND(a,b,c,d,e,f,g,h,i) \
|
||||
t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \
|
||||
t1 = Sigma0(a) + Maj(a, b, c); \
|
||||
d += t0; \
|
||||
h = t0 + t1;
|
||||
t0 = (h) + Sigma1((e)) + Ch((e), (f), (g)) + K[(i)] + W[(i)]; \
|
||||
t1 = Sigma0((a)) + Maj((a), (b), (c)); \
|
||||
(d) += t0; \
|
||||
(h) = t0 + t1;
|
||||
|
||||
|
||||
static int Transform(Sha256* sha256)
|
||||
|
Loading…
x
Reference in New Issue
Block a user