Browse Source

It should be `static inline`

Signed-off-by: Steffen Jaeckel <[email protected]>
Steffen Jaeckel 3 weeks ago
parent
commit
ef1453d5ba
3 changed files with 24 additions and 24 deletions
  1. 3 3
      src/ciphers/cast5.c
  2. 12 12
      src/ciphers/sm4.c
  3. 9 9
      src/hashes/tiger.c

+ 3 - 3
src/ciphers/cast5.c

@@ -492,7 +492,7 @@ int cast5_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_
 #endif
 #endif
 
 
 #define FI cast5_FI
 #define FI cast5_FI
-LTC_INLINE static ulong32 FI(ulong32 R, ulong32 Km, ulong32 Kr)
+static LTC_INLINE ulong32 FI(ulong32 R, ulong32 Km, ulong32 Kr)
 {
 {
    ulong32 I;
    ulong32 I;
    I = (Km + R);
    I = (Km + R);
@@ -500,7 +500,7 @@ LTC_INLINE static ulong32 FI(ulong32 R, ulong32 Km, ulong32 Kr)
    return ((S1[LTC_BYTE(I, 3)] ^ S2[LTC_BYTE(I,2)]) - S3[LTC_BYTE(I,1)]) + S4[LTC_BYTE(I,0)];
    return ((S1[LTC_BYTE(I, 3)] ^ S2[LTC_BYTE(I,2)]) - S3[LTC_BYTE(I,1)]) + S4[LTC_BYTE(I,0)];
 }
 }
 
 
-LTC_INLINE static ulong32 FII(ulong32 R, ulong32 Km, ulong32 Kr)
+static LTC_INLINE ulong32 FII(ulong32 R, ulong32 Km, ulong32 Kr)
 {
 {
    ulong32 I;
    ulong32 I;
    I = (Km ^ R);
    I = (Km ^ R);
@@ -508,7 +508,7 @@ LTC_INLINE static ulong32 FII(ulong32 R, ulong32 Km, ulong32 Kr)
    return ((S1[LTC_BYTE(I, 3)] - S2[LTC_BYTE(I,2)]) + S3[LTC_BYTE(I,1)]) ^ S4[LTC_BYTE(I,0)];
    return ((S1[LTC_BYTE(I, 3)] - S2[LTC_BYTE(I,2)]) + S3[LTC_BYTE(I,1)]) ^ S4[LTC_BYTE(I,0)];
 }
 }
 
 
-LTC_INLINE static ulong32 FIII(ulong32 R, ulong32 Km, ulong32 Kr)
+static LTC_INLINE ulong32 FIII(ulong32 R, ulong32 Km, ulong32 Kr)
 {
 {
    ulong32 I;
    ulong32 I;
    I = (Km - R);
    I = (Km - R);

+ 12 - 12
src/ciphers/sm4.c

@@ -67,7 +67,7 @@ static const sm4_u8_t sm4_sbox_table[16][16] = {
  * S-box
  * S-box
  * defined in section 2.6 S-box
  * defined in section 2.6 S-box
  */
  */
-LTC_INLINE static sm4_u8_t s_sm4_sbox(sm4_u8_t a)
+static LTC_INLINE sm4_u8_t s_sm4_sbox(sm4_u8_t a)
 {
 {
     return sm4_sbox_table[(a >> 4) & 0x0f][a & 0x0f];
     return sm4_sbox_table[(a >> 4) & 0x0f][a & 0x0f];
 }
 }
@@ -80,7 +80,7 @@ LTC_INLINE static sm4_u8_t s_sm4_sbox(sm4_u8_t a)
  * But we just convert a 32bit word byte by byte.
  * But we just convert a 32bit word byte by byte.
  * So it's OK if we don't convert the endian order
  * So it's OK if we don't convert the endian order
  */
  */
-LTC_INLINE static sm4_u32_t s_sm4_t(sm4_u32_t A)
+static LTC_INLINE sm4_u32_t s_sm4_t(sm4_u32_t A)
 {
 {
     sm4_u8_t  a[4];
     sm4_u8_t  a[4];
     sm4_u8_t  b[4];
     sm4_u8_t  b[4];
@@ -98,7 +98,7 @@ LTC_INLINE static sm4_u32_t s_sm4_t(sm4_u32_t A)
 /*
 /*
  * defined in section 6.2 (2) Linear transformation L
  * defined in section 6.2 (2) Linear transformation L
  */
  */
-LTC_INLINE static sm4_u32_t s_sm4_L62(sm4_u32_t B)
+static LTC_INLINE sm4_u32_t s_sm4_L62(sm4_u32_t B)
 {
 {
     return B ^ ROLc(B, 2) ^ ROLc(B, 10) ^ ROLc(B, 18) ^ ROLc(B, 24);
     return B ^ ROLc(B, 2) ^ ROLc(B, 10) ^ ROLc(B, 18) ^ ROLc(B, 24);
 }
 }
@@ -106,7 +106,7 @@ LTC_INLINE static sm4_u32_t s_sm4_L62(sm4_u32_t B)
 /*
 /*
  * defined in section 6.2 Permutation T
  * defined in section 6.2 Permutation T
  */
  */
-LTC_INLINE static sm4_u32_t s_sm4_T62(sm4_u32_t Z)
+static LTC_INLINE sm4_u32_t s_sm4_T62(sm4_u32_t Z)
 {
 {
     return s_sm4_L62(s_sm4_t(Z));
     return s_sm4_L62(s_sm4_t(Z));
 }
 }
@@ -137,7 +137,7 @@ static const sm4_u32_t sm4_CK[32] =
 /*
 /*
  * defined in section 7.3 (1) L'
  * defined in section 7.3 (1) L'
  */
  */
-LTC_INLINE static sm4_u32_t s_sm4_L73(sm4_u32_t B)
+static LTC_INLINE sm4_u32_t s_sm4_L73(sm4_u32_t B)
 {
 {
     return B ^ ROLc(B, 13) ^ ROLc(B, 23);
     return B ^ ROLc(B, 13) ^ ROLc(B, 23);
 }
 }
@@ -145,7 +145,7 @@ LTC_INLINE static sm4_u32_t s_sm4_L73(sm4_u32_t B)
 /*
 /*
  * defined in section 7.3 (1) T'
  * defined in section 7.3 (1) T'
  */
  */
-LTC_INLINE static sm4_u32_t s_sm4_T73(sm4_u32_t Z)
+static LTC_INLINE sm4_u32_t s_sm4_T73(sm4_u32_t Z)
 {
 {
     return s_sm4_L73(s_sm4_t(Z));
     return s_sm4_L73(s_sm4_t(Z));
 }
 }
@@ -153,7 +153,7 @@ LTC_INLINE static sm4_u32_t s_sm4_T73(sm4_u32_t Z)
 /*
 /*
  * defined in section 7.3 Key Expansion
  * defined in section 7.3 Key Expansion
  */
  */
-LTC_INLINE static void s_sm4_mk2rk(sm4_u32_t rk[32], sm4_u8_t mk[16])
+static LTC_INLINE void s_sm4_mk2rk(sm4_u32_t rk[32], sm4_u8_t mk[16])
 {
 {
     sm4_u32_t MK[4] = { 0 };
     sm4_u32_t MK[4] = { 0 };
     sm4_u32_t K[4+32] = { 0 };
     sm4_u32_t K[4+32] = { 0 };
@@ -175,7 +175,7 @@ LTC_INLINE static void s_sm4_mk2rk(sm4_u32_t rk[32], sm4_u8_t mk[16])
 /*
 /*
  * defined in section 6 Round Function F
  * defined in section 6 Round Function F
  */
  */
-LTC_INLINE static sm4_u32_t s_sm4_F(sm4_u32_t X[4], sm4_u32_t rk)
+static LTC_INLINE sm4_u32_t s_sm4_F(sm4_u32_t X[4], sm4_u32_t rk)
 {
 {
     return X[0] ^ s_sm4_T62(X[1] ^ X[2] ^ X[3] ^ rk);
     return X[0] ^ s_sm4_T62(X[1] ^ X[2] ^ X[3] ^ rk);
 }
 }
@@ -183,7 +183,7 @@ LTC_INLINE static sm4_u32_t s_sm4_F(sm4_u32_t X[4], sm4_u32_t rk)
 /*
 /*
  * defined in section 7.1 (2) The reverse transformation
  * defined in section 7.1 (2) The reverse transformation
  */
  */
-LTC_INLINE static void s_sm4_R(sm4_u32_t Y[4], sm4_u32_t X[32+4])
+static LTC_INLINE void s_sm4_R(sm4_u32_t Y[4], sm4_u32_t X[32+4])
 {
 {
     Y[0] = X[35];
     Y[0] = X[35];
     Y[1] = X[34];
     Y[1] = X[34];
@@ -194,7 +194,7 @@ LTC_INLINE static void s_sm4_R(sm4_u32_t Y[4], sm4_u32_t X[32+4])
 /*
 /*
  * defined in section 7.1 (En)cryption
  * defined in section 7.1 (En)cryption
  */
  */
-LTC_INLINE static void s_sm4_crypt(sm4_u32_t Y[4], sm4_u32_t X[4+32], const sm4_u32_t rk[32])
+static LTC_INLINE void s_sm4_crypt(sm4_u32_t Y[4], sm4_u32_t X[4+32], const sm4_u32_t rk[32])
 {
 {
     int i;
     int i;
 
 
@@ -203,7 +203,7 @@ LTC_INLINE static void s_sm4_crypt(sm4_u32_t Y[4], sm4_u32_t X[4+32], const sm4_
     s_sm4_R(Y, X);
     s_sm4_R(Y, X);
 }
 }
 
 
-LTC_INLINE static void s_sm4_setkey(struct sm4_key *sm4, const unsigned char *key)
+static LTC_INLINE void s_sm4_setkey(struct sm4_key *sm4, const unsigned char *key)
 {
 {
     int i;
     int i;
 
 
@@ -229,7 +229,7 @@ int sm4_setup(const unsigned char *key, int keylen,
 /*
 /*
  * SM4 encryption.
  * SM4 encryption.
  */
  */
-LTC_INLINE static void s_sm4_do(void *output, const void *input, const sm4_u32_t rk[32])
+static LTC_INLINE void s_sm4_do(void *output, const void *input, const sm4_u32_t rk[32])
 {
 {
     sm4_u32_t Y[4];
     sm4_u32_t Y[4];
     sm4_u32_t X[32+4];
     sm4_u32_t X[32+4];

+ 9 - 9
src/hashes/tiger.c

@@ -566,7 +566,7 @@ static const ulong64 table[4*256] = {
     CONST64(0xC83223F1720AEF96) /* 1022 */, CONST64(0xC3A0396F7363A51F) /* 1023 */};
     CONST64(0xC83223F1720AEF96) /* 1022 */, CONST64(0xC3A0396F7363A51F) /* 1023 */};
 
 
 /* one round of the hash function */
 /* one round of the hash function */
-LTC_INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x, int mul)
+static LTC_INLINE void s_tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x, int mul)
 {
 {
     ulong64 tmp;
     ulong64 tmp;
     tmp = (*c ^= x);
     tmp = (*c ^= x);
@@ -582,14 +582,14 @@ LTC_INLINE static void tiger_round(ulong64 *a, ulong64 *b, ulong64 *c, ulong64 x
 /* one complete pass */
 /* one complete pass */
 static void s_pass(ulong64 *a, ulong64 *b, ulong64 *c, const ulong64 *x, int mul)
 static void s_pass(ulong64 *a, ulong64 *b, ulong64 *c, const ulong64 *x, int mul)
 {
 {
-   tiger_round(a,b,c,x[0],mul);
-   tiger_round(b,c,a,x[1],mul);
-   tiger_round(c,a,b,x[2],mul);
-   tiger_round(a,b,c,x[3],mul);
-   tiger_round(b,c,a,x[4],mul);
-   tiger_round(c,a,b,x[5],mul);
-   tiger_round(a,b,c,x[6],mul);
-   tiger_round(b,c,a,x[7],mul);
+   s_tiger_round(a,b,c,x[0],mul);
+   s_tiger_round(b,c,a,x[1],mul);
+   s_tiger_round(c,a,b,x[2],mul);
+   s_tiger_round(a,b,c,x[3],mul);
+   s_tiger_round(b,c,a,x[4],mul);
+   s_tiger_round(c,a,b,x[5],mul);
+   s_tiger_round(a,b,c,x[6],mul);
+   s_tiger_round(b,c,a,x[7],mul);
 }
 }
 
 
 /* The key mixing schedule */
 /* The key mixing schedule */