Commit 1e6dbc7340 for openssl.org

commit 1e6dbc7340a8c406c32f6713768de363bdadfdf8
Author: Bob Beck <beck@openssl.org>
Date:   Wed May 20 07:54:06 2026 -0600

    Convert use of artisinally made hand crafted integer types
    to use the stdint.h ones.

    Reviewed-by: Richard Levitte <levitte@openssl.org>
    Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
    MergeDate: Wed May 27 09:09:41 2026
    (Merged from https://github.com/openssl/openssl/pull/31254)

diff --git a/crypto/aes/aes_core.c b/crypto/aes/aes_core.c
index 766c2aa48e..1781f45c69 100644
--- a/crypto/aes/aes_core.c
+++ b/crypto/aes/aes_core.c
@@ -62,17 +62,17 @@

 typedef union {
     unsigned char b[8];
-    u32 w[2];
-    u64 d;
+    uint32_t w[2];
+    uint64_t d;
 } uni;

 /*
  * Compute w := (w * x) mod (x^8 + x^4 + x^3 + x^1 + 1)
  * Therefore the name "xtime".
  */
-static void XtimeWord(u32 *w)
+static void XtimeWord(uint32_t *w)
 {
-    u32 a, b;
+    uint32_t a, b;

     a = *w;
     b = a & 0x80808080u;
@@ -83,9 +83,9 @@ static void XtimeWord(u32 *w)
     *w = b;
 }

-static void XtimeLong(u64 *w)
+static void XtimeLong(uint64_t *w)
 {
-    u64 a, b;
+    uint64_t a, b;

     a = *w;
     b = a & U64(0x8080808080808080);
@@ -142,9 +142,9 @@ static void XtimeLong(u64 *w)
  *   return [b0,b1];
  * The non-linear multiplies (*) can be done in parallel at no extra cost.
  */
-static void SubWord(u32 *w)
+static void SubWord(uint32_t *w)
 {
-    u32 x, y, a1, a2, a3, a4, a5, a6;
+    uint32_t x, y, a1, a2, a3, a4, a5, a6;

     x = *w;
     y = ((x & 0xFEFEFEFEu) >> 1) | ((x & 0x01010101u) << 7);
@@ -233,9 +233,9 @@ static void SubWord(u32 *w)
     *w = x;
 }

-static void SubLong(u64 *w)
+static void SubLong(uint64_t *w)
 {
-    u64 x, y, a1, a2, a3, a4, a5, a6;
+    uint64_t x, y, a1, a2, a3, a4, a5, a6;

     x = *w;
     y = ((x & U64(0xFEFEFEFEFEFEFEFE)) >> 1) | ((x & U64(0x0101010101010101)) << 7);
@@ -327,9 +327,9 @@ static void SubLong(u64 *w)
 /*
  * This computes w := (S^-1 * (w + c))^-1
  */
-static void InvSubLong(u64 *w)
+static void InvSubLong(uint64_t *w)
 {
-    u64 x, y, a1, a2, a3, a4, a5, a6;
+    uint64_t x, y, a1, a2, a3, a4, a5, a6;

     x = *w;
     x ^= U64(0x6363636363636363);
@@ -422,7 +422,7 @@ static void InvSubLong(u64 *w)
     *w = x;
 }

-static void ShiftRows(u64 *state)
+static void ShiftRows(uint64_t *state)
 {
     unsigned char s[4];
     unsigned char *s0;
@@ -441,7 +441,7 @@ static void ShiftRows(u64 *state)
     }
 }

-static void InvShiftRows(u64 *state)
+static void InvShiftRows(uint64_t *state)
 {
     unsigned char s[4];
     unsigned char *s0;
@@ -460,7 +460,7 @@ static void InvShiftRows(u64 *state)
     }
 }

-static void MixColumns(u64 *state)
+static void MixColumns(uint64_t *state)
 {
     uni s1;
     uni s;
@@ -488,7 +488,7 @@ static void MixColumns(u64 *state)
     }
 }

-static void InvMixColumns(u64 *state)
+static void InvMixColumns(uint64_t *state)
 {
     uni s1;
     uni s;
@@ -524,16 +524,16 @@ static void InvMixColumns(u64 *state)
     }
 }

-static void AddRoundKey(u64 *state, const u64 *w)
+static void AddRoundKey(uint64_t *state, const uint64_t *w)
 {
     state[0] ^= w[0];
     state[1] ^= w[1];
 }

 static void Cipher(const unsigned char *in, unsigned char *out,
-    const u64 *w, int nr)
+    const uint64_t *w, int nr)
 {
-    u64 state[2];
+    uint64_t state[2];
     int i;

     memcpy(state, in, 16);
@@ -557,10 +557,10 @@ static void Cipher(const unsigned char *in, unsigned char *out,
 }

 static void InvCipher(const unsigned char *in, unsigned char *out,
-    const u64 *w, int nr)
+    const uint64_t *w, int nr)

 {
-    u64 state[2];
+    uint64_t state[2];
     int i;

     memcpy(state, in, 16);
@@ -583,7 +583,7 @@ static void InvCipher(const unsigned char *in, unsigned char *out,
     memcpy(out, state, 16);
 }

-static void RotWord(u32 *x)
+static void RotWord(uint32_t *x)
 {
     unsigned char *w0;
     unsigned char tmp;
@@ -596,12 +596,12 @@ static void RotWord(u32 *x)
     w0[3] = tmp;
 }

-static void KeyExpansion(const unsigned char *key, u64 *w,
+static void KeyExpansion(const unsigned char *key, uint64_t *w,
     int nr, int nk)
 {
-    u32 rcon;
+    uint32_t rcon;
     uni prev;
-    u32 temp;
+    uint32_t temp;
     int i, n;

     memcpy(w, key, nk * 4);
@@ -631,14 +631,14 @@ static void KeyExpansion(const unsigned char *key, u64 *w,
 int AES_set_encrypt_key(const unsigned char *userKey, int bits,
     AES_KEY *key)
 {
-    u64 *rk;
+    uint64_t *rk;

     if (!userKey || !key)
         return -1;
     if (bits != 128 && bits != 192 && bits != 256)
         return -2;

-    rk = (u64 *)key->rd_key;
+    rk = (uint64_t *)key->rd_key;

     if (bits == 128)
         key->rounds = 10;
@@ -667,10 +667,10 @@ int AES_set_decrypt_key(const unsigned char *userKey, int bits,
 void AES_encrypt(const unsigned char *in, unsigned char *out,
     const AES_KEY *key)
 {
-    const u64 *rk;
+    const uint64_t *rk;

     assert(in && out && key);
-    rk = (u64 *)key->rd_key;
+    rk = (uint64_t *)key->rd_key;

     Cipher(in, out, rk, key->rounds);
 }
@@ -682,10 +682,10 @@ void AES_encrypt(const unsigned char *in, unsigned char *out,
 void AES_decrypt(const unsigned char *in, unsigned char *out,
     const AES_KEY *key)
 {
-    const u64 *rk;
+    const uint64_t *rk;

     assert(in && out && key);
-    rk = (u64 *)key->rd_key;
+    rk = (uint64_t *)key->rd_key;

     InvCipher(in, out, rk, key->rounds);
 }
@@ -703,7 +703,7 @@ Td3[x] = Si[x].[09, 0d, 0b, 0e];
 Td4[x] = Si[x].[01];
 */

-static const u32 Te0[256] = {
+static const uint32_t Te0[256] = {
     0xc66363a5U,
     0xf87c7c84U,
     0xee777799U,
@@ -961,7 +961,7 @@ static const u32 Te0[256] = {
     0x6dbbbbd6U,
     0x2c16163aU,
 };
-static const u32 Te1[256] = {
+static const uint32_t Te1[256] = {
     0xa5c66363U,
     0x84f87c7cU,
     0x99ee7777U,
@@ -1219,7 +1219,7 @@ static const u32 Te1[256] = {
     0xd66dbbbbU,
     0x3a2c1616U,
 };
-static const u32 Te2[256] = {
+static const uint32_t Te2[256] = {
     0x63a5c663U,
     0x7c84f87cU,
     0x7799ee77U,
@@ -1477,7 +1477,7 @@ static const u32 Te2[256] = {
     0xbbd66dbbU,
     0x163a2c16U,
 };
-static const u32 Te3[256] = {
+static const uint32_t Te3[256] = {
     0x6363a5c6U,
     0x7c7c84f8U,
     0x777799eeU,
@@ -1736,7 +1736,7 @@ static const u32 Te3[256] = {
     0x16163a2cU,
 };

-static const u32 Td0[256] = {
+static const uint32_t Td0[256] = {
     0x51f4a750U,
     0x7e416553U,
     0x1a17a4c3U,
@@ -1994,7 +1994,7 @@ static const u32 Td0[256] = {
     0x486c5c74U,
     0xd0b85742U,
 };
-static const u32 Td1[256] = {
+static const uint32_t Td1[256] = {
     0x5051f4a7U,
     0x537e4165U,
     0xc31a17a4U,
@@ -2252,7 +2252,7 @@ static const u32 Td1[256] = {
     0x74486c5cU,
     0x42d0b857U,
 };
-static const u32 Td2[256] = {
+static const uint32_t Td2[256] = {
     0xa75051f4U,
     0x65537e41U,
     0xa4c31a17U,
@@ -2510,7 +2510,7 @@ static const u32 Td2[256] = {
     0x5c74486cU,
     0x5742d0b8U,
 };
-static const u32 Td3[256] = {
+static const uint32_t Td3[256] = {
     0xf4a75051U,
     0x4165537eU,
     0x17a4c31aU,
@@ -2768,7 +2768,7 @@ static const u32 Td3[256] = {
     0x6c5c7448U,
     0xb85742d0U,
 };
-static const u8 Td4[256] = {
+static const uint8_t Td4[256] = {
     0x52U,
     0x09U,
     0x6aU,
@@ -3026,7 +3026,7 @@ static const u8 Td4[256] = {
     0x0cU,
     0x7dU,
 };
-static const u32 rcon[] = {
+static const uint32_t rcon[] = {
     0x01000000,
     0x02000000,
     0x04000000,
@@ -3046,9 +3046,9 @@ int AES_set_encrypt_key(const unsigned char *userKey, int bits,
     AES_KEY *key)
 {

-    u32 *rk;
+    uint32_t *rk;
     int i = 0;
-    u32 temp;
+    uint32_t temp;

     if (!userKey || !key)
         return -1;
@@ -3129,9 +3129,9 @@ int AES_set_decrypt_key(const unsigned char *userKey, int bits,
     AES_KEY *key)
 {

-    u32 *rk;
+    uint32_t *rk;
     int i, j, status;
-    u32 temp;
+    uint32_t temp;

     /* first, start with an encryption schedule */
     status = AES_set_encrypt_key(userKey, bits, key);
@@ -3174,8 +3174,8 @@ void AES_encrypt(const unsigned char *in, unsigned char *out,
     const AES_KEY *key)
 {

-    const u32 *rk;
-    u32 s0, s1, s2, s3, t0, t1, t2, t3;
+    const uint32_t *rk;
+    uint32_t s0, s1, s2, s3, t0, t1, t2, t3;
 #ifndef FULL_UNROLL
     int r;
 #endif /* ?FULL_UNROLL */
@@ -3306,8 +3306,8 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
     const AES_KEY *key)
 {

-    const u32 *rk;
-    u32 s0, s1, s2, s3, t0, t1, t2, t3;
+    const uint32_t *rk;
+    uint32_t s0, s1, s2, s3, t0, t1, t2, t3;
 #ifndef FULL_UNROLL
     int r;
 #endif /* ?FULL_UNROLL */
@@ -3420,19 +3420,19 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
      * apply last round and
      * map cipher state to byte array block:
      */
-    s0 = ((u32)Td4[(t0 >> 24)] << 24) ^ ((u32)Td4[(t3 >> 16) & 0xff] << 16) ^ ((u32)Td4[(t2 >> 8) & 0xff] << 8) ^ ((u32)Td4[(t1) & 0xff]) ^ rk[0];
+    s0 = ((uint32_t)Td4[(t0 >> 24)] << 24) ^ ((uint32_t)Td4[(t3 >> 16) & 0xff] << 16) ^ ((uint32_t)Td4[(t2 >> 8) & 0xff] << 8) ^ ((uint32_t)Td4[(t1) & 0xff]) ^ rk[0];
     PUTU32(out, s0);
-    s1 = ((u32)Td4[(t1 >> 24)] << 24) ^ ((u32)Td4[(t0 >> 16) & 0xff] << 16) ^ ((u32)Td4[(t3 >> 8) & 0xff] << 8) ^ ((u32)Td4[(t2) & 0xff]) ^ rk[1];
+    s1 = ((uint32_t)Td4[(t1 >> 24)] << 24) ^ ((uint32_t)Td4[(t0 >> 16) & 0xff] << 16) ^ ((uint32_t)Td4[(t3 >> 8) & 0xff] << 8) ^ ((uint32_t)Td4[(t2) & 0xff]) ^ rk[1];
     PUTU32(out + 4, s1);
-    s2 = ((u32)Td4[(t2 >> 24)] << 24) ^ ((u32)Td4[(t1 >> 16) & 0xff] << 16) ^ ((u32)Td4[(t0 >> 8) & 0xff] << 8) ^ ((u32)Td4[(t3) & 0xff]) ^ rk[2];
+    s2 = ((uint32_t)Td4[(t2 >> 24)] << 24) ^ ((uint32_t)Td4[(t1 >> 16) & 0xff] << 16) ^ ((uint32_t)Td4[(t0 >> 8) & 0xff] << 8) ^ ((uint32_t)Td4[(t3) & 0xff]) ^ rk[2];
     PUTU32(out + 8, s2);
-    s3 = ((u32)Td4[(t3 >> 24)] << 24) ^ ((u32)Td4[(t2 >> 16) & 0xff] << 16) ^ ((u32)Td4[(t1 >> 8) & 0xff] << 8) ^ ((u32)Td4[(t0) & 0xff]) ^ rk[3];
+    s3 = ((uint32_t)Td4[(t3 >> 24)] << 24) ^ ((uint32_t)Td4[(t2 >> 16) & 0xff] << 16) ^ ((uint32_t)Td4[(t1 >> 8) & 0xff] << 8) ^ ((uint32_t)Td4[(t0) & 0xff]) ^ rk[3];
     PUTU32(out + 12, s3);
 }

 #else /* AES_ASM */

-static const u8 Te4[256] = {
+static const uint8_t Te4[256] = {
     0x63U, 0x7cU, 0x77U, 0x7bU, 0xf2U, 0x6bU, 0x6fU, 0xc5U,
     0x30U, 0x01U, 0x67U, 0x2bU, 0xfeU, 0xd7U, 0xabU, 0x76U,
     0xcaU, 0x82U, 0xc9U, 0x7dU, 0xfaU, 0x59U, 0x47U, 0xf0U,
@@ -3466,7 +3466,7 @@ static const u8 Te4[256] = {
     0x8cU, 0xa1U, 0x89U, 0x0dU, 0xbfU, 0xe6U, 0x42U, 0x68U,
     0x41U, 0x99U, 0x2dU, 0x0fU, 0xb0U, 0x54U, 0xbbU, 0x16U
 };
-static const u32 rcon[] = {
+static const uint32_t rcon[] = {
     0x01000000,
     0x02000000,
     0x04000000,
@@ -3485,9 +3485,9 @@ static const u32 rcon[] = {
 int AES_set_encrypt_key(const unsigned char *userKey, int bits,
     AES_KEY *key)
 {
-    u32 *rk;
+    uint32_t *rk;
     int i = 0;
-    u32 temp;
+    uint32_t temp;

     if (!userKey || !key)
         return -1;
@@ -3510,7 +3510,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, int bits,
     if (bits == 128) {
         while (1) {
             temp = rk[3];
-            rk[4] = rk[0] ^ ((u32)Te4[(temp >> 16) & 0xff] << 24) ^ ((u32)Te4[(temp >> 8) & 0xff] << 16) ^ ((u32)Te4[(temp) & 0xff] << 8) ^ ((u32)Te4[(temp >> 24)]) ^ rcon[i];
+            rk[4] = rk[0] ^ ((uint32_t)Te4[(temp >> 16) & 0xff] << 24) ^ ((uint32_t)Te4[(temp >> 8) & 0xff] << 16) ^ ((uint32_t)Te4[(temp) & 0xff] << 8) ^ ((uint32_t)Te4[(temp >> 24)]) ^ rcon[i];
             rk[5] = rk[1] ^ rk[4];
             rk[6] = rk[2] ^ rk[5];
             rk[7] = rk[3] ^ rk[6];
@@ -3525,7 +3525,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, int bits,
     if (bits == 192) {
         while (1) {
             temp = rk[5];
-            rk[6] = rk[0] ^ ((u32)Te4[(temp >> 16) & 0xff] << 24) ^ ((u32)Te4[(temp >> 8) & 0xff] << 16) ^ ((u32)Te4[(temp) & 0xff] << 8) ^ ((u32)Te4[(temp >> 24)]) ^ rcon[i];
+            rk[6] = rk[0] ^ ((uint32_t)Te4[(temp >> 16) & 0xff] << 24) ^ ((uint32_t)Te4[(temp >> 8) & 0xff] << 16) ^ ((uint32_t)Te4[(temp) & 0xff] << 8) ^ ((uint32_t)Te4[(temp >> 24)]) ^ rcon[i];
             rk[7] = rk[1] ^ rk[6];
             rk[8] = rk[2] ^ rk[7];
             rk[9] = rk[3] ^ rk[8];
@@ -3542,7 +3542,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, int bits,
     if (bits == 256) {
         while (1) {
             temp = rk[7];
-            rk[8] = rk[0] ^ ((u32)Te4[(temp >> 16) & 0xff] << 24) ^ ((u32)Te4[(temp >> 8) & 0xff] << 16) ^ ((u32)Te4[(temp) & 0xff] << 8) ^ ((u32)Te4[(temp >> 24)]) ^ rcon[i];
+            rk[8] = rk[0] ^ ((uint32_t)Te4[(temp >> 16) & 0xff] << 24) ^ ((uint32_t)Te4[(temp >> 8) & 0xff] << 16) ^ ((uint32_t)Te4[(temp) & 0xff] << 8) ^ ((uint32_t)Te4[(temp >> 24)]) ^ rcon[i];
             rk[9] = rk[1] ^ rk[8];
             rk[10] = rk[2] ^ rk[9];
             rk[11] = rk[3] ^ rk[10];
@@ -3550,7 +3550,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, int bits,
                 return 0;
             }
             temp = rk[11];
-            rk[12] = rk[4] ^ ((u32)Te4[(temp >> 24)] << 24) ^ ((u32)Te4[(temp >> 16) & 0xff] << 16) ^ ((u32)Te4[(temp >> 8) & 0xff] << 8) ^ ((u32)Te4[(temp) & 0xff]);
+            rk[12] = rk[4] ^ ((uint32_t)Te4[(temp >> 24)] << 24) ^ ((uint32_t)Te4[(temp >> 16) & 0xff] << 16) ^ ((uint32_t)Te4[(temp >> 8) & 0xff] << 8) ^ ((uint32_t)Te4[(temp) & 0xff]);
             rk[13] = rk[5] ^ rk[12];
             rk[14] = rk[6] ^ rk[13];
             rk[15] = rk[7] ^ rk[14];
@@ -3568,9 +3568,9 @@ int AES_set_decrypt_key(const unsigned char *userKey, int bits,
     AES_KEY *key)
 {

-    u32 *rk;
+    uint32_t *rk;
     int i, j, status;
-    u32 temp;
+    uint32_t temp;

     /* first, start with an encryption schedule */
     status = AES_set_encrypt_key(userKey, bits, key);
@@ -3598,7 +3598,7 @@ int AES_set_decrypt_key(const unsigned char *userKey, int bits,
     for (i = 1; i < (key->rounds); i++) {
         rk += 4;
         for (j = 0; j < 4; j++) {
-            u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;
+            uint32_t tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;

             tp1 = rk[j];
             m = tp1 & 0x80808080;
diff --git a/crypto/aes/aes_local.h b/crypto/aes/aes_local.h
index 71f9f5c648..38c37537fc 100644
--- a/crypto/aes/aes_local.h
+++ b/crypto/aes/aes_local.h
@@ -17,31 +17,22 @@

 #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64))
 #define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)
-#define GETU32(p) SWAP(*((u32 *)(p)))
-#define PUTU32(ct, st)               \
-    {                                \
-        *((u32 *)(ct)) = SWAP((st)); \
+#define GETU32(p) SWAP(*((uint32_t *)(p)))
+#define PUTU32(ct, st)                    \
+    {                                     \
+        *((uint32_t *)(ct)) = SWAP((st)); \
     }
 #else
-#define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3]))
-#define PUTU32(ct, st)              \
-    {                               \
-        (ct)[0] = (u8)((st) >> 24); \
-        (ct)[1] = (u8)((st) >> 16); \
-        (ct)[2] = (u8)((st) >> 8);  \
-        (ct)[3] = (u8)(st);         \
+#define GETU32(pt) (((uint32_t)(pt)[0] << 24) ^ ((uint32_t)(pt)[1] << 16) ^ ((uint32_t)(pt)[2] << 8) ^ ((uint32_t)(pt)[3]))
+#define PUTU32(ct, st)                   \
+    {                                    \
+        (ct)[0] = (uint8_t)((st) >> 24); \
+        (ct)[1] = (uint8_t)((st) >> 16); \
+        (ct)[2] = (uint8_t)((st) >> 8);  \
+        (ct)[3] = (uint8_t)(st);         \
     }
 #endif

-typedef uint64_t u64;
-#ifdef AES_LONG
-typedef unsigned long u32;
-#else
-typedef unsigned int u32;
-#endif
-typedef unsigned short u16;
-typedef unsigned char u8;
-
 #define MAXKC (256 / 32)
 #define MAXKB (256 / 8)
 #define MAXNR 14
diff --git a/crypto/aes/aes_x86core.c b/crypto/aes/aes_x86core.c
index 2361d9d0c6..3fa8cb2188 100644
--- a/crypto/aes/aes_x86core.c
+++ b/crypto/aes/aes_x86core.c
@@ -77,7 +77,7 @@ static void prefetch256(const void *table)
 #endif

 #undef GETU32
-#define GETU32(p) (*((u32 *)(p)))
+#define GETU32(p) (*((uint32_t *)(p)))

 #if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
 #define U64(C) C##UI64
@@ -112,10 +112,10 @@ Te1[x] = S [x].[03, 02, 01, 01];
 Te2[x] = S [x].[01, 03, 02, 01];
 Te3[x] = S [x].[01, 01, 03, 02];
 */
-#define Te0 (u32)((u64 *)((u8 *)Te + 0))
-#define Te1 (u32)((u64 *)((u8 *)Te + 3))
-#define Te2 (u32)((u64 *)((u8 *)Te + 2))
-#define Te3 (u32)((u64 *)((u8 *)Te + 1))
+#define Te0 (uint32_t)((uint64_t *)((uint8_t *)Te + 0))
+#define Te1 (uint32_t)((uint64_t *)((uint8_t *)Te + 3))
+#define Te2 (uint32_t)((uint64_t *)((uint8_t *)Te + 2))
+#define Te3 (uint32_t)((uint64_t *)((uint8_t *)Te + 1))
 /*-
 Td [x] = Si[x].[0e, 09, 0d, 0b, 0e, 09, 0d, 0b];
 Td0[x] = Si[x].[0e, 09, 0d, 0b];
@@ -124,12 +124,12 @@ Td2[x] = Si[x].[0d, 0b, 0e, 09];
 Td3[x] = Si[x].[09, 0d, 0b, 0e];
 Td4[x] = Si[x].[01];
 */
-#define Td0 (u32)((u64 *)((u8 *)Td + 0))
-#define Td1 (u32)((u64 *)((u8 *)Td + 3))
-#define Td2 (u32)((u64 *)((u8 *)Td + 2))
-#define Td3 (u32)((u64 *)((u8 *)Td + 1))
+#define Td0 (uint32_t)((uint64_t *)((uint8_t *)Td + 0))
+#define Td1 (uint32_t)((uint64_t *)((uint8_t *)Td + 3))
+#define Td2 (uint32_t)((uint64_t *)((uint8_t *)Td + 2))
+#define Td3 (uint32_t)((uint64_t *)((uint8_t *)Td + 1))

-static const u64 Te[256] = {
+static const uint64_t Te[256] = {
     U64(0xa56363c6a56363c6), U64(0x847c7cf8847c7cf8),
     U64(0x997777ee997777ee), U64(0x8d7b7bf68d7b7bf6),
     U64(0x0df2f2ff0df2f2ff), U64(0xbd6b6bd6bd6b6bd6),
@@ -260,7 +260,7 @@ static const u64 Te[256] = {
     U64(0xd6bbbb6dd6bbbb6d), U64(0x3a16162c3a16162c)
 };

-static const u8 Te4[256] = {
+static const uint8_t Te4[256] = {
     0x63U, 0x7cU, 0x77U, 0x7bU, 0xf2U, 0x6bU, 0x6fU, 0xc5U,
     0x30U, 0x01U, 0x67U, 0x2bU, 0xfeU, 0xd7U, 0xabU, 0x76U,
     0xcaU, 0x82U, 0xc9U, 0x7dU, 0xfaU, 0x59U, 0x47U, 0xf0U,
@@ -295,7 +295,7 @@ static const u8 Te4[256] = {
     0x41U, 0x99U, 0x2dU, 0x0fU, 0xb0U, 0x54U, 0xbbU, 0x16U
 };

-static const u64 Td[256] = {
+static const uint64_t Td[256] = {
     U64(0x50a7f45150a7f451), U64(0x5365417e5365417e),
     U64(0xc3a4171ac3a4171a), U64(0x965e273a965e273a),
     U64(0xcb6bab3bcb6bab3b), U64(0xf1459d1ff1459d1f),
@@ -425,7 +425,7 @@ static const u64 Td[256] = {
     U64(0x6184cb7b6184cb7b), U64(0x70b632d570b632d5),
     U64(0x745c6c48745c6c48), U64(0x4257b8d04257b8d0)
 };
-static const u8 Td4[256] = {
+static const uint8_t Td4[256] = {
     0x52U, 0x09U, 0x6aU, 0xd5U, 0x30U, 0x36U, 0xa5U, 0x38U,
     0xbfU, 0x40U, 0xa3U, 0x9eU, 0x81U, 0xf3U, 0xd7U, 0xfbU,
     0x7cU, 0xe3U, 0x39U, 0x82U, 0x9bU, 0x2fU, 0xffU, 0x87U,
@@ -460,7 +460,7 @@ static const u8 Td4[256] = {
     0xe1U, 0x69U, 0x14U, 0x63U, 0x55U, 0x21U, 0x0cU, 0x7dU
 };

-static const u32 rcon[] = {
+static const uint32_t rcon[] = {
     0x00000001U,
     0x00000002U,
     0x00000004U,
@@ -480,9 +480,9 @@ int AES_set_encrypt_key(const unsigned char *userKey, int bits,
     AES_KEY *key)
 {

-    u32 *rk;
+    uint32_t *rk;
     int i = 0;
-    u32 temp;
+    uint32_t temp;

     if (!userKey || !key)
         return -1;
@@ -505,7 +505,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, int bits,
     if (bits == 128) {
         while (1) {
             temp = rk[3];
-            rk[4] = rk[0] ^ ((u32)Te4[(temp >> 8) & 0xff]) ^ ((u32)Te4[(temp >> 16) & 0xff] << 8) ^ ((u32)Te4[(temp >> 24)] << 16) ^ ((u32)Te4[(temp) & 0xff] << 24) ^ rcon[i];
+            rk[4] = rk[0] ^ ((uint32_t)Te4[(temp >> 8) & 0xff]) ^ ((uint32_t)Te4[(temp >> 16) & 0xff] << 8) ^ ((uint32_t)Te4[(temp >> 24)] << 16) ^ ((uint32_t)Te4[(temp) & 0xff] << 24) ^ rcon[i];
             rk[5] = rk[1] ^ rk[4];
             rk[6] = rk[2] ^ rk[5];
             rk[7] = rk[3] ^ rk[6];
@@ -520,7 +520,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, int bits,
     if (bits == 192) {
         while (1) {
             temp = rk[5];
-            rk[6] = rk[0] ^ ((u32)Te4[(temp >> 8) & 0xff]) ^ ((u32)Te4[(temp >> 16) & 0xff] << 8) ^ ((u32)Te4[(temp >> 24)] << 16) ^ ((u32)Te4[(temp) & 0xff] << 24) ^ rcon[i];
+            rk[6] = rk[0] ^ ((uint32_t)Te4[(temp >> 8) & 0xff]) ^ ((uint32_t)Te4[(temp >> 16) & 0xff] << 8) ^ ((uint32_t)Te4[(temp >> 24)] << 16) ^ ((uint32_t)Te4[(temp) & 0xff] << 24) ^ rcon[i];
             rk[7] = rk[1] ^ rk[6];
             rk[8] = rk[2] ^ rk[7];
             rk[9] = rk[3] ^ rk[8];
@@ -537,7 +537,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, int bits,
     if (bits == 256) {
         while (1) {
             temp = rk[7];
-            rk[8] = rk[0] ^ ((u32)Te4[(temp >> 8) & 0xff]) ^ ((u32)Te4[(temp >> 16) & 0xff] << 8) ^ ((u32)Te4[(temp >> 24)] << 16) ^ ((u32)Te4[(temp) & 0xff] << 24) ^ rcon[i];
+            rk[8] = rk[0] ^ ((uint32_t)Te4[(temp >> 8) & 0xff]) ^ ((uint32_t)Te4[(temp >> 16) & 0xff] << 8) ^ ((uint32_t)Te4[(temp >> 24)] << 16) ^ ((uint32_t)Te4[(temp) & 0xff] << 24) ^ rcon[i];
             rk[9] = rk[1] ^ rk[8];
             rk[10] = rk[2] ^ rk[9];
             rk[11] = rk[3] ^ rk[10];
@@ -545,7 +545,7 @@ int AES_set_encrypt_key(const unsigned char *userKey, int bits,
                 return 0;
             }
             temp = rk[11];
-            rk[12] = rk[4] ^ ((u32)Te4[(temp) & 0xff]) ^ ((u32)Te4[(temp >> 8) & 0xff] << 8) ^ ((u32)Te4[(temp >> 16) & 0xff] << 16) ^ ((u32)Te4[(temp >> 24)] << 24);
+            rk[12] = rk[4] ^ ((uint32_t)Te4[(temp) & 0xff]) ^ ((uint32_t)Te4[(temp >> 8) & 0xff] << 8) ^ ((uint32_t)Te4[(temp >> 16) & 0xff] << 16) ^ ((uint32_t)Te4[(temp >> 24)] << 24);
             rk[13] = rk[5] ^ rk[12];
             rk[14] = rk[6] ^ rk[13];
             rk[15] = rk[7] ^ rk[14];
@@ -563,9 +563,9 @@ int AES_set_decrypt_key(const unsigned char *userKey, int bits,
     AES_KEY *key)
 {

-    u32 *rk;
+    uint32_t *rk;
     int i, j, status;
-    u32 temp;
+    uint32_t temp;

     /* first, start with an encryption schedule */
     status = AES_set_encrypt_key(userKey, bits, key);
@@ -594,7 +594,7 @@ int AES_set_decrypt_key(const unsigned char *userKey, int bits,
         rk += 4;
 #if 1
         for (j = 0; j < 4; j++) {
-            u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;
+            uint32_t tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;

             tp1 = rk[j];
             m = tp1 & 0x80808080;
@@ -631,8 +631,8 @@ void AES_encrypt(const unsigned char *in, unsigned char *out,
     const AES_KEY *key)
 {

-    const u32 *rk;
-    u32 s0, s1, s2, s3, t[4];
+    const uint32_t *rk;
+    uint32_t s0, s1, s2, s3, t[4];
     int r;

     assert(in && out && key);
@@ -650,15 +650,15 @@ void AES_encrypt(const unsigned char *in, unsigned char *out,
 #if defined(AES_COMPACT_IN_OUTER_ROUNDS)
     prefetch256(Te4);

-    t[0] = (u32)Te4[(s0) & 0xff] ^ (u32)Te4[(s1 >> 8) & 0xff] << 8 ^ (u32)Te4[(s2 >> 16) & 0xff] << 16 ^ (u32)Te4[(s3 >> 24)] << 24;
-    t[1] = (u32)Te4[(s1) & 0xff] ^ (u32)Te4[(s2 >> 8) & 0xff] << 8 ^ (u32)Te4[(s3 >> 16) & 0xff] << 16 ^ (u32)Te4[(s0 >> 24)] << 24;
-    t[2] = (u32)Te4[(s2) & 0xff] ^ (u32)Te4[(s3 >> 8) & 0xff] << 8 ^ (u32)Te4[(s0 >> 16) & 0xff] << 16 ^ (u32)Te4[(s1 >> 24)] << 24;
-    t[3] = (u32)Te4[(s3) & 0xff] ^ (u32)Te4[(s0 >> 8) & 0xff] << 8 ^ (u32)Te4[(s1 >> 16) & 0xff] << 16 ^ (u32)Te4[(s2 >> 24)] << 24;
+    t[0] = (uint32_t)Te4[(s0) & 0xff] ^ (uint32_t)Te4[(s1 >> 8) & 0xff] << 8 ^ (uint32_t)Te4[(s2 >> 16) & 0xff] << 16 ^ (uint32_t)Te4[(s3 >> 24)] << 24;
+    t[1] = (uint32_t)Te4[(s1) & 0xff] ^ (uint32_t)Te4[(s2 >> 8) & 0xff] << 8 ^ (uint32_t)Te4[(s3 >> 16) & 0xff] << 16 ^ (uint32_t)Te4[(s0 >> 24)] << 24;
+    t[2] = (uint32_t)Te4[(s2) & 0xff] ^ (uint32_t)Te4[(s3 >> 8) & 0xff] << 8 ^ (uint32_t)Te4[(s0 >> 16) & 0xff] << 16 ^ (uint32_t)Te4[(s1 >> 24)] << 24;
+    t[3] = (uint32_t)Te4[(s3) & 0xff] ^ (uint32_t)Te4[(s0 >> 8) & 0xff] << 8 ^ (uint32_t)Te4[(s1 >> 16) & 0xff] << 16 ^ (uint32_t)Te4[(s2 >> 24)] << 24;

     /* now do the linear transform using words */
     {
         int i;
-        u32 r0, r1, r2;
+        uint32_t r0, r1, r2;

         for (i = 0; i < 4; i++) {
             r0 = t[i];
@@ -688,15 +688,15 @@ void AES_encrypt(const unsigned char *in, unsigned char *out,
      */
     for (rk += 8, r = key->rounds - 2; r > 0; rk += 4, r--) {
 #if defined(AES_COMPACT_IN_INNER_ROUNDS)
-        t[0] = (u32)Te4[(s0) & 0xff] ^ (u32)Te4[(s1 >> 8) & 0xff] << 8 ^ (u32)Te4[(s2 >> 16) & 0xff] << 16 ^ (u32)Te4[(s3 >> 24)] << 24;
-        t[1] = (u32)Te4[(s1) & 0xff] ^ (u32)Te4[(s2 >> 8) & 0xff] << 8 ^ (u32)Te4[(s3 >> 16) & 0xff] << 16 ^ (u32)Te4[(s0 >> 24)] << 24;
-        t[2] = (u32)Te4[(s2) & 0xff] ^ (u32)Te4[(s3 >> 8) & 0xff] << 8 ^ (u32)Te4[(s0 >> 16) & 0xff] << 16 ^ (u32)Te4[(s1 >> 24)] << 24;
-        t[3] = (u32)Te4[(s3) & 0xff] ^ (u32)Te4[(s0 >> 8) & 0xff] << 8 ^ (u32)Te4[(s1 >> 16) & 0xff] << 16 ^ (u32)Te4[(s2 >> 24)] << 24;
+        t[0] = (uint32_t)Te4[(s0) & 0xff] ^ (uint32_t)Te4[(s1 >> 8) & 0xff] << 8 ^ (uint32_t)Te4[(s2 >> 16) & 0xff] << 16 ^ (uint32_t)Te4[(s3 >> 24)] << 24;
+        t[1] = (uint32_t)Te4[(s1) & 0xff] ^ (uint32_t)Te4[(s2 >> 8) & 0xff] << 8 ^ (uint32_t)Te4[(s3 >> 16) & 0xff] << 16 ^ (uint32_t)Te4[(s0 >> 24)] << 24;
+        t[2] = (uint32_t)Te4[(s2) & 0xff] ^ (uint32_t)Te4[(s3 >> 8) & 0xff] << 8 ^ (uint32_t)Te4[(s0 >> 16) & 0xff] << 16 ^ (uint32_t)Te4[(s1 >> 24)] << 24;
+        t[3] = (uint32_t)Te4[(s3) & 0xff] ^ (uint32_t)Te4[(s0 >> 8) & 0xff] << 8 ^ (uint32_t)Te4[(s1 >> 16) & 0xff] << 16 ^ (uint32_t)Te4[(s2 >> 24)] << 24;

         /* now do the linear transform using words */
         {
             int i;
-            u32 r0, r1, r2;
+            uint32_t r0, r1, r2;

             for (i = 0; i < 4; i++) {
                 r0 = t[i];
@@ -728,15 +728,15 @@ void AES_encrypt(const unsigned char *in, unsigned char *out,
 #if defined(AES_COMPACT_IN_OUTER_ROUNDS)
     prefetch256(Te4);

-    *(u32 *)(out + 0) = (u32)Te4[(s0) & 0xff] ^ (u32)Te4[(s1 >> 8) & 0xff] << 8 ^ (u32)Te4[(s2 >> 16) & 0xff] << 16 ^ (u32)Te4[(s3 >> 24)] << 24 ^ rk[0];
-    *(u32 *)(out + 4) = (u32)Te4[(s1) & 0xff] ^ (u32)Te4[(s2 >> 8) & 0xff] << 8 ^ (u32)Te4[(s3 >> 16) & 0xff] << 16 ^ (u32)Te4[(s0 >> 24)] << 24 ^ rk[1];
-    *(u32 *)(out + 8) = (u32)Te4[(s2) & 0xff] ^ (u32)Te4[(s3 >> 8) & 0xff] << 8 ^ (u32)Te4[(s0 >> 16) & 0xff] << 16 ^ (u32)Te4[(s1 >> 24)] << 24 ^ rk[2];
-    *(u32 *)(out + 12) = (u32)Te4[(s3) & 0xff] ^ (u32)Te4[(s0 >> 8) & 0xff] << 8 ^ (u32)Te4[(s1 >> 16) & 0xff] << 16 ^ (u32)Te4[(s2 >> 24)] << 24 ^ rk[3];
+    *(uint32_t *)(out + 0) = (uint32_t)Te4[(s0) & 0xff] ^ (uint32_t)Te4[(s1 >> 8) & 0xff] << 8 ^ (uint32_t)Te4[(s2 >> 16) & 0xff] << 16 ^ (uint32_t)Te4[(s3 >> 24)] << 24 ^ rk[0];
+    *(uint32_t *)(out + 4) = (uint32_t)Te4[(s1) & 0xff] ^ (uint32_t)Te4[(s2 >> 8) & 0xff] << 8 ^ (uint32_t)Te4[(s3 >> 16) & 0xff] << 16 ^ (uint32_t)Te4[(s0 >> 24)] << 24 ^ rk[1];
+    *(uint32_t *)(out + 8) = (uint32_t)Te4[(s2) & 0xff] ^ (uint32_t)Te4[(s3 >> 8) & 0xff] << 8 ^ (uint32_t)Te4[(s0 >> 16) & 0xff] << 16 ^ (uint32_t)Te4[(s1 >> 24)] << 24 ^ rk[2];
+    *(uint32_t *)(out + 12) = (uint32_t)Te4[(s3) & 0xff] ^ (uint32_t)Te4[(s0 >> 8) & 0xff] << 8 ^ (uint32_t)Te4[(s1 >> 16) & 0xff] << 16 ^ (uint32_t)Te4[(s2 >> 24)] << 24 ^ rk[3];
 #else
-    *(u32 *)(out + 0) = (Te2[(s0) & 0xff] & 0x000000ffU) ^ (Te3[(s1 >> 8) & 0xff] & 0x0000ff00U) ^ (Te0[(s2 >> 16) & 0xff] & 0x00ff0000U) ^ (Te1[(s3 >> 24)] & 0xff000000U) ^ rk[0];
-    *(u32 *)(out + 4) = (Te2[(s1) & 0xff] & 0x000000ffU) ^ (Te3[(s2 >> 8) & 0xff] & 0x0000ff00U) ^ (Te0[(s3 >> 16) & 0xff] & 0x00ff0000U) ^ (Te1[(s0 >> 24)] & 0xff000000U) ^ rk[1];
-    *(u32 *)(out + 8) = (Te2[(s2) & 0xff] & 0x000000ffU) ^ (Te3[(s3 >> 8) & 0xff] & 0x0000ff00U) ^ (Te0[(s0 >> 16) & 0xff] & 0x00ff0000U) ^ (Te1[(s1 >> 24)] & 0xff000000U) ^ rk[2];
-    *(u32 *)(out + 12) = (Te2[(s3) & 0xff] & 0x000000ffU) ^ (Te3[(s0 >> 8) & 0xff] & 0x0000ff00U) ^ (Te0[(s1 >> 16) & 0xff] & 0x00ff0000U) ^ (Te1[(s2 >> 24)] & 0xff000000U) ^ rk[3];
+    *(uint32_t *)(out + 0) = (Te2[(s0) & 0xff] & 0x000000ffU) ^ (Te3[(s1 >> 8) & 0xff] & 0x0000ff00U) ^ (Te0[(s2 >> 16) & 0xff] & 0x00ff0000U) ^ (Te1[(s3 >> 24)] & 0xff000000U) ^ rk[0];
+    *(uint32_t *)(out + 4) = (Te2[(s1) & 0xff] & 0x000000ffU) ^ (Te3[(s2 >> 8) & 0xff] & 0x0000ff00U) ^ (Te0[(s3 >> 16) & 0xff] & 0x00ff0000U) ^ (Te1[(s0 >> 24)] & 0xff000000U) ^ rk[1];
+    *(uint32_t *)(out + 8) = (Te2[(s2) & 0xff] & 0x000000ffU) ^ (Te3[(s3 >> 8) & 0xff] & 0x0000ff00U) ^ (Te0[(s0 >> 16) & 0xff] & 0x00ff0000U) ^ (Te1[(s1 >> 24)] & 0xff000000U) ^ rk[2];
+    *(uint32_t *)(out + 12) = (Te2[(s3) & 0xff] & 0x000000ffU) ^ (Te3[(s0 >> 8) & 0xff] & 0x0000ff00U) ^ (Te0[(s1 >> 16) & 0xff] & 0x00ff0000U) ^ (Te1[(s2 >> 24)] & 0xff000000U) ^ rk[3];
 #endif
 }

@@ -748,8 +748,8 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
     const AES_KEY *key)
 {

-    const u32 *rk;
-    u32 s0, s1, s2, s3, t[4];
+    const uint32_t *rk;
+    uint32_t s0, s1, s2, s3, t[4];
     int r;

     assert(in && out && key);
@@ -767,15 +767,15 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
 #if defined(AES_COMPACT_IN_OUTER_ROUNDS)
     prefetch256(Td4);

-    t[0] = (u32)Td4[(s0) & 0xff] ^ (u32)Td4[(s3 >> 8) & 0xff] << 8 ^ (u32)Td4[(s2 >> 16) & 0xff] << 16 ^ (u32)Td4[(s1 >> 24)] << 24;
-    t[1] = (u32)Td4[(s1) & 0xff] ^ (u32)Td4[(s0 >> 8) & 0xff] << 8 ^ (u32)Td4[(s3 >> 16) & 0xff] << 16 ^ (u32)Td4[(s2 >> 24)] << 24;
-    t[2] = (u32)Td4[(s2) & 0xff] ^ (u32)Td4[(s1 >> 8) & 0xff] << 8 ^ (u32)Td4[(s0 >> 16) & 0xff] << 16 ^ (u32)Td4[(s3 >> 24)] << 24;
-    t[3] = (u32)Td4[(s3) & 0xff] ^ (u32)Td4[(s2 >> 8) & 0xff] << 8 ^ (u32)Td4[(s1 >> 16) & 0xff] << 16 ^ (u32)Td4[(s0 >> 24)] << 24;
+    t[0] = (uint32_t)Td4[(s0) & 0xff] ^ (uint32_t)Td4[(s3 >> 8) & 0xff] << 8 ^ (uint32_t)Td4[(s2 >> 16) & 0xff] << 16 ^ (uint32_t)Td4[(s1 >> 24)] << 24;
+    t[1] = (uint32_t)Td4[(s1) & 0xff] ^ (uint32_t)Td4[(s0 >> 8) & 0xff] << 8 ^ (uint32_t)Td4[(s3 >> 16) & 0xff] << 16 ^ (uint32_t)Td4[(s2 >> 24)] << 24;
+    t[2] = (uint32_t)Td4[(s2) & 0xff] ^ (uint32_t)Td4[(s1 >> 8) & 0xff] << 8 ^ (uint32_t)Td4[(s0 >> 16) & 0xff] << 16 ^ (uint32_t)Td4[(s3 >> 24)] << 24;
+    t[3] = (uint32_t)Td4[(s3) & 0xff] ^ (uint32_t)Td4[(s2 >> 8) & 0xff] << 8 ^ (uint32_t)Td4[(s1 >> 16) & 0xff] << 16 ^ (uint32_t)Td4[(s0 >> 24)] << 24;

     /* now do the linear transform using words */
     {
         int i;
-        u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;
+        uint32_t tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;

         for (i = 0; i < 4; i++) {
             tp1 = t[i];
@@ -813,15 +813,15 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
      */
     for (rk += 8, r = key->rounds - 2; r > 0; rk += 4, r--) {
 #if defined(AES_COMPACT_IN_INNER_ROUNDS)
-        t[0] = (u32)Td4[(s0) & 0xff] ^ (u32)Td4[(s3 >> 8) & 0xff] << 8 ^ (u32)Td4[(s2 >> 16) & 0xff] << 16 ^ (u32)Td4[(s1 >> 24)] << 24;
-        t[1] = (u32)Td4[(s1) & 0xff] ^ (u32)Td4[(s0 >> 8) & 0xff] << 8 ^ (u32)Td4[(s3 >> 16) & 0xff] << 16 ^ (u32)Td4[(s2 >> 24)] << 24;
-        t[2] = (u32)Td4[(s2) & 0xff] ^ (u32)Td4[(s1 >> 8) & 0xff] << 8 ^ (u32)Td4[(s0 >> 16) & 0xff] << 16 ^ (u32)Td4[(s3 >> 24)] << 24;
-        t[3] = (u32)Td4[(s3) & 0xff] ^ (u32)Td4[(s2 >> 8) & 0xff] << 8 ^ (u32)Td4[(s1 >> 16) & 0xff] << 16 ^ (u32)Td4[(s0 >> 24)] << 24;
+        t[0] = (uint32_t)Td4[(s0) & 0xff] ^ (uint32_t)Td4[(s3 >> 8) & 0xff] << 8 ^ (uint32_t)Td4[(s2 >> 16) & 0xff] << 16 ^ (uint32_t)Td4[(s1 >> 24)] << 24;
+        t[1] = (uint32_t)Td4[(s1) & 0xff] ^ (uint32_t)Td4[(s0 >> 8) & 0xff] << 8 ^ (uint32_t)Td4[(s3 >> 16) & 0xff] << 16 ^ (uint32_t)Td4[(s2 >> 24)] << 24;
+        t[2] = (uint32_t)Td4[(s2) & 0xff] ^ (uint32_t)Td4[(s1 >> 8) & 0xff] << 8 ^ (uint32_t)Td4[(s0 >> 16) & 0xff] << 16 ^ (uint32_t)Td4[(s3 >> 24)] << 24;
+        t[3] = (uint32_t)Td4[(s3) & 0xff] ^ (uint32_t)Td4[(s2 >> 8) & 0xff] << 8 ^ (uint32_t)Td4[(s1 >> 16) & 0xff] << 16 ^ (uint32_t)Td4[(s0 >> 24)] << 24;

         /* now do the linear transform using words */
         {
             int i;
-            u32 tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;
+            uint32_t tp1, tp2, tp4, tp8, tp9, tpb, tpd, tpe, m;

             for (i = 0; i < 4; i++) {
                 tp1 = t[i];
@@ -860,8 +860,8 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
      */
     prefetch256(Td4);

-    *(u32 *)(out + 0) = ((u32)Td4[(s0) & 0xff]) ^ ((u32)Td4[(s3 >> 8) & 0xff] << 8) ^ ((u32)Td4[(s2 >> 16) & 0xff] << 16) ^ ((u32)Td4[(s1 >> 24)] << 24) ^ rk[0];
-    *(u32 *)(out + 4) = ((u32)Td4[(s1) & 0xff]) ^ ((u32)Td4[(s0 >> 8) & 0xff] << 8) ^ ((u32)Td4[(s3 >> 16) & 0xff] << 16) ^ ((u32)Td4[(s2 >> 24)] << 24) ^ rk[1];
-    *(u32 *)(out + 8) = ((u32)Td4[(s2) & 0xff]) ^ ((u32)Td4[(s1 >> 8) & 0xff] << 8) ^ ((u32)Td4[(s0 >> 16) & 0xff] << 16) ^ ((u32)Td4[(s3 >> 24)] << 24) ^ rk[2];
-    *(u32 *)(out + 12) = ((u32)Td4[(s3) & 0xff]) ^ ((u32)Td4[(s2 >> 8) & 0xff] << 8) ^ ((u32)Td4[(s1 >> 16) & 0xff] << 16) ^ ((u32)Td4[(s0 >> 24)] << 24) ^ rk[3];
+    *(uint32_t *)(out + 0) = ((uint32_t)Td4[(s0) & 0xff]) ^ ((uint32_t)Td4[(s3 >> 8) & 0xff] << 8) ^ ((uint32_t)Td4[(s2 >> 16) & 0xff] << 16) ^ ((uint32_t)Td4[(s1 >> 24)] << 24) ^ rk[0];
+    *(uint32_t *)(out + 4) = ((uint32_t)Td4[(s1) & 0xff]) ^ ((uint32_t)Td4[(s0 >> 8) & 0xff] << 8) ^ ((uint32_t)Td4[(s3 >> 16) & 0xff] << 16) ^ ((uint32_t)Td4[(s2 >> 24)] << 24) ^ rk[1];
+    *(uint32_t *)(out + 8) = ((uint32_t)Td4[(s2) & 0xff]) ^ ((uint32_t)Td4[(s1 >> 8) & 0xff] << 8) ^ ((uint32_t)Td4[(s0 >> 16) & 0xff] << 16) ^ ((uint32_t)Td4[(s3 >> 24)] << 24) ^ rk[2];
+    *(uint32_t *)(out + 12) = ((uint32_t)Td4[(s3) & 0xff]) ^ ((uint32_t)Td4[(s2 >> 8) & 0xff] << 8) ^ ((uint32_t)Td4[(s1 >> 16) & 0xff] << 16) ^ ((uint32_t)Td4[(s0 >> 24)] << 24) ^ rk[3];
 }
diff --git a/crypto/camellia/camellia.c b/crypto/camellia/camellia.c
index cd9521a019..8841baa7a5 100644
--- a/crypto/camellia/camellia.c
+++ b/crypto/camellia/camellia.c
@@ -53,15 +53,15 @@
 #define RightRotate(x, s) (((x) >> (s)) + ((x) << (32 - s)))
 #define LeftRotate(x, s) (((x) << (s)) + ((x) >> (32 - s)))

-#define GETU32(p) (((u32)(p)[0] << 24) ^ ((u32)(p)[1] << 16) ^ ((u32)(p)[2] << 8) ^ ((u32)(p)[3]))
-#define PUTU32(p, v) ((p)[0] = (u8)((v) >> 24), (p)[1] = (u8)((v) >> 16), (p)[2] = (u8)((v) >> 8), (p)[3] = (u8)(v))
+#define GETU32(p) (((uint32_t)(p)[0] << 24) ^ ((uint32_t)(p)[1] << 16) ^ ((uint32_t)(p)[2] << 8) ^ ((uint32_t)(p)[3]))
+#define PUTU32(p, v) ((p)[0] = (uint8_t)((v) >> 24), (p)[1] = (uint8_t)((v) >> 16), (p)[2] = (uint8_t)((v) >> 8), (p)[3] = (uint8_t)(v))

 /* S-box data */
 #define SBOX1_1110 Camellia_SBOX[0]
 #define SBOX4_4404 Camellia_SBOX[1]
 #define SBOX2_0222 Camellia_SBOX[2]
 #define SBOX3_3033 Camellia_SBOX[3]
-static const u32 Camellia_SBOX[][256] = {
+static const uint32_t Camellia_SBOX[][256] = {
     { 0x70707000, 0x82828200, 0x2c2c2c00, 0xececec00, 0xb3b3b300, 0x27272700,
         0xc0c0c000, 0xe5e5e500, 0xe4e4e400, 0x85858500, 0x57575700, 0x35353500,
         0xeaeaea00, 0x0c0c0c00, 0xaeaeae00, 0x41414100, 0x23232300, 0xefefef00,
@@ -237,7 +237,7 @@ static const u32 Camellia_SBOX[][256] = {
 };

 /* Key generation constants */
-static const u32 SIGMA[] = {
+static const uint32_t SIGMA[] = {
     0xa09e667f, 0x3bcc908b, 0xb67ae858, 0x4caa73b2, 0xc6ef372f, 0xe94f82be,
     0x54ff53a5, 0xf1d36f1c, 0x10e527fa, 0xde682d1d, 0xb05688c2, 0xb3e6c1fd
 };
@@ -252,7 +252,7 @@ static const u32 SIGMA[] = {
  */
 #define Camellia_Feistel(_s0, _s1, _s2, _s3, _key) \
     do {                                           \
-        register u32 _t0, _t1, _t2, _t3;           \
+        register uint32_t _t0, _t1, _t2, _t3;      \
                                                    \
         _t0 = _s0 ^ (_key)[0];                     \
         _t3 = SBOX4_4404[_t0 & 0xff];              \
@@ -278,16 +278,16 @@ static const u32 SIGMA[] = {
  */
 #define RotLeft128(_s0, _s1, _s2, _s3, _n)      \
     do {                                        \
-        u32 _t0 = _s0 >> (32 - _n);             \
+        uint32_t _t0 = _s0 >> (32 - _n);        \
         _s0 = (_s0 << _n) | (_s1 >> (32 - _n)); \
         _s1 = (_s1 << _n) | (_s2 >> (32 - _n)); \
         _s2 = (_s2 << _n) | (_s3 >> (32 - _n)); \
         _s3 = (_s3 << _n) | _t0;                \
     } while (0)

-int Camellia_Ekeygen(int keyBitLength, const u8 *rawKey, KEY_TABLE_TYPE k)
+int Camellia_Ekeygen(int keyBitLength, const uint8_t *rawKey, KEY_TABLE_TYPE k)
 {
-    register u32 s0, s1, s2, s3;
+    register uint32_t s0, s1, s2, s3;

     k[0] = s0 = GETU32(rawKey);
     k[1] = s1 = GETU32(rawKey + 4);
@@ -402,12 +402,12 @@ int Camellia_Ekeygen(int keyBitLength, const u8 *rawKey, KEY_TABLE_TYPE k)
      */
 }

-void Camellia_EncryptBlock_Rounds(int grandRounds, const u8 plaintext[],
+void Camellia_EncryptBlock_Rounds(int grandRounds, const uint8_t plaintext[],
     const KEY_TABLE_TYPE keyTable,
-    u8 ciphertext[])
+    uint8_t ciphertext[])
 {
-    register u32 s0, s1, s2, s3;
-    const u32 *k = keyTable, *kend = keyTable + grandRounds * 16;
+    register uint32_t s0, s1, s2, s3;
+    const uint32_t *k = keyTable, *kend = keyTable + grandRounds * 16;

     s0 = GETU32(plaintext) ^ k[0];
     s1 = GETU32(plaintext + 4) ^ k[1];
@@ -448,19 +448,19 @@ void Camellia_EncryptBlock_Rounds(int grandRounds, const u8 plaintext[],
     PUTU32(ciphertext + 12, s1);
 }

-void Camellia_EncryptBlock(int keyBitLength, const u8 plaintext[],
-    const KEY_TABLE_TYPE keyTable, u8 ciphertext[])
+void Camellia_EncryptBlock(int keyBitLength, const uint8_t plaintext[],
+    const KEY_TABLE_TYPE keyTable, uint8_t ciphertext[])
 {
     Camellia_EncryptBlock_Rounds(keyBitLength == 128 ? 3 : 4,
         plaintext, keyTable, ciphertext);
 }

-void Camellia_DecryptBlock_Rounds(int grandRounds, const u8 ciphertext[],
+void Camellia_DecryptBlock_Rounds(int grandRounds, const uint8_t ciphertext[],
     const KEY_TABLE_TYPE keyTable,
-    u8 plaintext[])
+    uint8_t plaintext[])
 {
-    u32 s0, s1, s2, s3;
-    const u32 *k = keyTable + grandRounds * 16, *kend = keyTable + 4;
+    uint32_t s0, s1, s2, s3;
+    const uint32_t *k = keyTable + grandRounds * 16, *kend = keyTable + 4;

     s0 = GETU32(ciphertext) ^ k[0];
     s1 = GETU32(ciphertext + 4) ^ k[1];
@@ -501,8 +501,8 @@ void Camellia_DecryptBlock_Rounds(int grandRounds, const u8 ciphertext[],
     PUTU32(plaintext + 12, s1);
 }

-void Camellia_DecryptBlock(int keyBitLength, const u8 ciphertext[],
-    const KEY_TABLE_TYPE keyTable, u8 plaintext[])
+void Camellia_DecryptBlock(int keyBitLength, const uint8_t ciphertext[],
+    const KEY_TABLE_TYPE keyTable, uint8_t plaintext[])
 {
     Camellia_DecryptBlock_Rounds(keyBitLength == 128 ? 3 : 4,
         ciphertext, keyTable, plaintext);
diff --git a/crypto/camellia/cmll_local.h b/crypto/camellia/cmll_local.h
index 5740307385..45b8dc0e2d 100644
--- a/crypto/camellia/cmll_local.h
+++ b/crypto/camellia/cmll_local.h
@@ -25,21 +25,19 @@
 #ifndef OSSL_CRYPTO_CAMELLIA_CMLL_LOCAL_H
 #define OSSL_CRYPTO_CAMELLIA_CMLL_LOCAL_H

+#include <stdint.h>
 #include <openssl/camellia.h>

-typedef unsigned int u32;
-typedef unsigned char u8;
-
-int Camellia_Ekeygen(int keyBitLength, const u8 *rawKey,
+int Camellia_Ekeygen(int keyBitLength, const uint8_t *rawKey,
     KEY_TABLE_TYPE keyTable);
-void Camellia_EncryptBlock_Rounds(int grandRounds, const u8 plaintext[],
+void Camellia_EncryptBlock_Rounds(int grandRounds, const uint8_t plaintext[],
     const KEY_TABLE_TYPE keyTable,
-    u8 ciphertext[]);
-void Camellia_DecryptBlock_Rounds(int grandRounds, const u8 ciphertext[],
+    uint8_t ciphertext[]);
+void Camellia_DecryptBlock_Rounds(int grandRounds, const uint8_t ciphertext[],
     const KEY_TABLE_TYPE keyTable,
-    u8 plaintext[]);
-void Camellia_EncryptBlock(int keyBitLength, const u8 plaintext[],
-    const KEY_TABLE_TYPE keyTable, u8 ciphertext[]);
-void Camellia_DecryptBlock(int keyBitLength, const u8 ciphertext[],
-    const KEY_TABLE_TYPE keyTable, u8 plaintext[]);
+    uint8_t plaintext[]);
+void Camellia_EncryptBlock(int keyBitLength, const uint8_t plaintext[],
+    const KEY_TABLE_TYPE keyTable, uint8_t ciphertext[]);
+void Camellia_DecryptBlock(int keyBitLength, const uint8_t ciphertext[],
+    const KEY_TABLE_TYPE keyTable, uint8_t plaintext[]);
 #endif /* #ifndef OSSL_CRYPTO_CAMELLIA_CMLL_LOCAL_H */
diff --git a/crypto/chacha/chacha_enc.c b/crypto/chacha/chacha_enc.c
index 3cd4f0188d..e9a4d3263a 100644
--- a/crypto/chacha/chacha_enc.c
+++ b/crypto/chacha/chacha_enc.c
@@ -9,17 +9,16 @@

 /* Adapted from the public domain code by D. Bernstein from SUPERCOP. */

+#include <stdint.h>
 #include <string.h>

 #include "internal/endian.h"
 #include "crypto/chacha.h"
 #include "crypto/ctype.h"

-typedef unsigned int u32;
-typedef unsigned char u8;
 typedef union {
-    u32 u[16];
-    u8 c[64];
+    uint32_t u[16];
+    uint8_t c[64];
 } chacha_buf;

 #define ROTATE(v, n) (((v) << (n)) | ((v) >> (32 - (n))))
@@ -29,14 +28,14 @@ typedef union {
 #if defined(__riscv_zbb) || defined(__riscv_zbkb)
 #if __riscv_xlen == 64
 #undef ROTATE
-#define ROTATE(x, n) ({ u32 ret;                   \
+#define ROTATE(x, n) ({ uint32_t ret;                   \
                         asm ("roriw %0, %1, %2"        \
                         : "=r"(ret)                    \
                         : "r"(x), "i"(32 - (n))); ret; })
 #endif
 #if __riscv_xlen == 32
 #undef ROTATE
-#define ROTATE(x, n) ({ u32 ret;                   \
+#define ROTATE(x, n) ({ uint32_t ret;                   \
                         asm ("rori %0, %1, %2"         \
                         : "=r"(ret)                    \
                         : "r"(x), "i"(32 - (n))); ret; })
@@ -45,12 +44,12 @@ typedef union {
 #endif
 #endif

-#define U32TO8_LITTLE(p, v)     \
-    do {                        \
-        (p)[0] = (u8)(v >> 0);  \
-        (p)[1] = (u8)(v >> 8);  \
-        (p)[2] = (u8)(v >> 16); \
-        (p)[3] = (u8)(v >> 24); \
+#define U32TO8_LITTLE(p, v)          \
+    do {                             \
+        (p)[0] = (uint8_t)(v >> 0);  \
+        (p)[1] = (uint8_t)(v >> 8);  \
+        (p)[2] = (uint8_t)(v >> 16); \
+        (p)[3] = (uint8_t)(v >> 24); \
     } while (0)

 /* QUARTERROUND updates a, b, c, d with a ChaCha "quarter" round. */
@@ -62,9 +61,9 @@ typedef union {

 /* chacha_core performs 20 rounds of ChaCha on the input words in
  * |input| and writes the 64 output bytes to |output|. */
-static void chacha20_core(chacha_buf *output, const u32 input[16])
+static void chacha20_core(chacha_buf *output, const uint32_t input[16])
 {
-    u32 x[16];
+    uint32_t x[16];
     int i;
     DECLARE_IS_ENDIAN;

@@ -98,23 +97,23 @@ void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp, size_t len,
     const unsigned int key[8], const unsigned int counter[4])
 #endif
 {
-    u32 input[16];
+    uint32_t input[16];
     chacha_buf buf;
     size_t todo, i;

     /* sigma constant "expand 32-byte k" in little-endian encoding */
-    input[0] = ((u32)ossl_toascii('e')) | ((u32)ossl_toascii('x') << 8)
-        | ((u32)ossl_toascii('p') << 16)
-        | ((u32)ossl_toascii('a') << 24);
-    input[1] = ((u32)ossl_toascii('n')) | ((u32)ossl_toascii('d') << 8)
-        | ((u32)ossl_toascii(' ') << 16)
-        | ((u32)ossl_toascii('3') << 24);
-    input[2] = ((u32)ossl_toascii('2')) | ((u32)ossl_toascii('-') << 8)
-        | ((u32)ossl_toascii('b') << 16)
-        | ((u32)ossl_toascii('y') << 24);
-    input[3] = ((u32)ossl_toascii('t')) | ((u32)ossl_toascii('e') << 8)
-        | ((u32)ossl_toascii(' ') << 16)
-        | ((u32)ossl_toascii('k') << 24);
+    input[0] = ((uint32_t)ossl_toascii('e')) | ((uint32_t)ossl_toascii('x') << 8)
+        | ((uint32_t)ossl_toascii('p') << 16)
+        | ((uint32_t)ossl_toascii('a') << 24);
+    input[1] = ((uint32_t)ossl_toascii('n')) | ((uint32_t)ossl_toascii('d') << 8)
+        | ((uint32_t)ossl_toascii(' ') << 16)
+        | ((uint32_t)ossl_toascii('3') << 24);
+    input[2] = ((uint32_t)ossl_toascii('2')) | ((uint32_t)ossl_toascii('-') << 8)
+        | ((uint32_t)ossl_toascii('b') << 16)
+        | ((uint32_t)ossl_toascii('y') << 24);
+    input[3] = ((uint32_t)ossl_toascii('t')) | ((uint32_t)ossl_toascii('e') << 8)
+        | ((uint32_t)ossl_toascii(' ') << 16)
+        | ((uint32_t)ossl_toascii('k') << 24);

     input[4] = key[0];
     input[5] = key[1];
diff --git a/crypto/ec/ecp_nistp224.c b/crypto/ec/ecp_nistp224.c
index 449417414a..7183131622 100644
--- a/crypto/ec/ecp_nistp224.c
+++ b/crypto/ec/ecp_nistp224.c
@@ -49,9 +49,6 @@
 #error "Your compiler doesn't appear to support 128-bit integer types"
 #endif

-typedef uint8_t u8;
-typedef uint64_t u64;
-
 /******************************************************************************/
 /*-
  * INTERNAL REPRESENTATION OF FIELD ELEMENTS
@@ -84,7 +81,7 @@ typedef widelimb widefelem[7];
  * group order size for the elliptic curve, and we also use this type for
  * scalars for point multiplication.
  */
-typedef u8 felem_bytearray[28];
+typedef uint8_t felem_bytearray[28];

 static const felem_bytearray nistp224_curve_params[5] = {
     { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, /* p */
@@ -307,7 +304,7 @@ const EC_METHOD *EC_GFp_nistp224_method(void)
 /*
  * Helper functions to convert field elements to/from internal representation
  */
-static void bin28_to_felem(felem out, const u8 in[28])
+static void bin28_to_felem(felem out, const uint8_t in[28])
 {
     out[0] = *((const limb *)(in)) & 0x00ffffffffffffff;
     out[1] = (*((const limb_aX *)(in + 7))) & 0x00ffffffffffffff;
@@ -315,7 +312,7 @@ static void bin28_to_felem(felem out, const u8 in[28])
     out[3] = (*((const limb_aX *)(in + 20))) >> 8;
 }

-static void felem_to_bin28(u8 out[28], const felem in)
+static void felem_to_bin28(uint8_t out[28], const felem in)
 {
     unsigned i;
     for (i = 0; i < 7; ++i) {
@@ -1087,7 +1084,7 @@ static void point_add(felem x3, felem y3, felem z3,
  * copies it to out.
  * The pre_comp array argument should be size of |size| argument
  */
-static void select_point(const u64 idx, unsigned int size,
+static void select_point(const uint64_t idx, unsigned int size,
     const felem pre_comp[][3], felem out[3])
 {
     unsigned i, j;
@@ -1096,7 +1093,7 @@ static void select_point(const u64 idx, unsigned int size,
     memset(out, 0, sizeof(*out) * 3);
     for (i = 0; i < size; i++) {
         const limb *inlimbs = &pre_comp[i][0][0];
-        u64 mask = i ^ idx;
+        uint64_t mask = i ^ idx;
         mask |= mask >> 4;
         mask |= mask >> 2;
         mask |= mask >> 1;
@@ -1124,7 +1121,7 @@ static char get_bit(const felem_bytearray in, unsigned i)
  */
 static void batch_mul(felem x_out, felem y_out, felem z_out,
     const felem_bytearray scalars[],
-    const unsigned num_points, const u8 *g_scalar,
+    const unsigned num_points, const uint8_t *g_scalar,
     const int mixed, const felem pre_comp[][17][3],
     const felem g_pre_comp[2][16][3])
 {
@@ -1132,8 +1129,8 @@ static void batch_mul(felem x_out, felem y_out, felem z_out,
     unsigned num;
     unsigned gen_mul = (g_scalar != NULL);
     felem nq[3], tmp[4];
-    u64 bits;
-    u8 sign, digit;
+    uint64_t bits;
+    uint8_t sign, digit;

     /* set nq to the point at infinity */
     memset(nq, 0, sizeof(nq));
diff --git a/crypto/ec/ecp_nistp256.c b/crypto/ec/ecp_nistp256.c
index 136406bbc7..e247e51c9c 100644
--- a/crypto/ec/ecp_nistp256.c
+++ b/crypto/ec/ecp_nistp256.c
@@ -50,17 +50,13 @@
 #error "Your compiler doesn't appear to support 128-bit integer types"
 #endif

-typedef uint8_t u8;
-typedef uint32_t u32;
-typedef uint64_t u64;
-
 /*
  * The underlying field. P256 operates over GF(2^256-2^224+2^192+2^96-1). We
  * can serialize an element of this field into 32 bytes. We call this an
  * felem_bytearray.
  */

-typedef u8 felem_bytearray[32];
+typedef uint8_t felem_bytearray[32];

 /*
  * These are the parameters of P256, taken from FIPS 186-3, page 86. These
@@ -115,36 +111,36 @@ static const felem_bytearray nistp256_curve_params[5] = {
 typedef uint128_t limb;
 typedef limb felem[NLIMBS];
 typedef limb longfelem[NLIMBS * 2];
-typedef u64 smallfelem[NLIMBS];
+typedef uint64_t smallfelem[NLIMBS];

 /* This is the value of the prime as four 64-bit words, little-endian. */
-static const u64 kPrime[4] = {
+static const uint64_t kPrime[4] = {
     0xfffffffffffffffful, 0xffffffff, 0, 0xffffffff00000001ul
 };
-static const u64 bottom63bits = 0x7ffffffffffffffful;
+static const uint64_t bottom63bits = 0x7ffffffffffffffful;

 /*
  * bin32_to_felem takes a little-endian byte array and converts it into felem
  * form. This assumes that the CPU is little-endian.
  */
-static void bin32_to_felem(felem out, const u8 in[32])
+static void bin32_to_felem(felem out, const uint8_t in[32])
 {
-    out[0] = *((u64 *)&in[0]);
-    out[1] = *((u64 *)&in[8]);
-    out[2] = *((u64 *)&in[16]);
-    out[3] = *((u64 *)&in[24]);
+    out[0] = *((uint64_t *)&in[0]);
+    out[1] = *((uint64_t *)&in[8]);
+    out[2] = *((uint64_t *)&in[16]);
+    out[3] = *((uint64_t *)&in[24]);
 }

 /*
  * smallfelem_to_bin32 takes a smallfelem and serializes into a little
  * endian, 32 byte array. This assumes that the CPU is little-endian.
  */
-static void smallfelem_to_bin32(u8 out[32], const smallfelem in)
+static void smallfelem_to_bin32(uint8_t out[32], const smallfelem in)
 {
-    *((u64 *)&out[0]) = in[0];
-    *((u64 *)&out[8]) = in[1];
-    *((u64 *)&out[16]) = in[2];
-    *((u64 *)&out[24]) = in[3];
+    *((uint64_t *)&out[0]) = in[0];
+    *((uint64_t *)&out[8]) = in[1];
+    *((uint64_t *)&out[16]) = in[2];
+    *((uint64_t *)&out[24]) = in[3];
 }

 /* BN_to_felem converts an OpenSSL BIGNUM into an felem */
@@ -222,7 +218,7 @@ static void felem_small_sum(felem out, const smallfelem in)
 }

 /* felem_scalar sets out = out * scalar */
-static void felem_scalar(felem out, const u64 scalar)
+static void felem_scalar(felem out, const uint64_t scalar)
 {
     out[0] *= scalar;
     out[1] *= scalar;
@@ -231,7 +227,7 @@ static void felem_scalar(felem out, const u64 scalar)
 }

 /* longfelem_scalar sets out = out * scalar */
-static void longfelem_scalar(longfelem out, const u64 scalar)
+static void longfelem_scalar(longfelem out, const uint64_t scalar)
 {
     out[0] *= scalar;
     out[1] *= scalar;
@@ -376,15 +372,15 @@ static const felem zero110 = { two64m0, two110p32m0, two64m46, two64m32 };
 static void felem_shrink(smallfelem out, const felem in)
 {
     felem tmp;
-    u64 a, b, mask;
-    u64 high, low;
-    static const u64 kPrime3Test = 0x7fffffff00000001ul; /* 2^63 - 2^32 + 1 */
+    uint64_t a, b, mask;
+    uint64_t high, low;
+    static const uint64_t kPrime3Test = 0x7fffffff00000001ul; /* 2^63 - 2^32 + 1 */

     /* Carry 2->3 */
-    tmp[3] = zero110[3] + in[3] + ((u64)(in[2] >> 64));
+    tmp[3] = zero110[3] + in[3] + ((uint64_t)(in[2] >> 64));
     /* tmp[3] < 2^110 */

-    tmp[2] = zero110[2] + (u64)in[2];
+    tmp[2] = zero110[2] + (uint64_t)in[2];
     tmp[0] = zero110[0] + in[0];
     tmp[1] = zero110[1] + in[1];
     /* tmp[0] < 2**110, tmp[1] < 2^111, tmp[2] < 2**65 */
@@ -394,7 +390,7 @@ static void felem_shrink(smallfelem out, const felem in)
      * tmp[3]. We don't update the other words till the end.
      */
     a = tmp[3] >> 64; /* a < 2^46 */
-    tmp[3] = (u64)tmp[3];
+    tmp[3] = (uint64_t)tmp[3];
     tmp[3] -= a;
     tmp[3] += ((limb)a) << 32;
     /* tmp[3] < 2^79 */
@@ -402,7 +398,7 @@ static void felem_shrink(smallfelem out, const felem in)
     b = a;
     a = tmp[3] >> 64; /* a < 2^15 */
     b += a; /* b < 2^46 + 2^15 < 2^47 */
-    tmp[3] = (u64)tmp[3];
+    tmp[3] = (uint64_t)tmp[3];
     tmp[3] -= a;
     tmp[3] += ((limb)a) << 32;
     /* tmp[3] < 2^64 + 2^47 */
@@ -418,7 +414,7 @@ static void felem_shrink(smallfelem out, const felem in)
      * In order to make space in tmp[3] for the carry from 2 -> 3, we
      * conditionally subtract kPrime if tmp[3] is large enough.
      */
-    high = (u64)(tmp[3] >> 64);
+    high = (uint64_t)(tmp[3] >> 64);
     /* As tmp[3] < 2^65, high is either 1 or 0 */
     high = 0 - high;
     /*-
@@ -426,7 +422,7 @@ static void felem_shrink(smallfelem out, const felem in)
      *   all ones   if the high word of tmp[3] is 1
      *   all zeros  if the high word of tmp[3] if 0
      */
-    low = (u64)tmp[3];
+    low = (uint64_t)tmp[3];
     mask = 0 - (low >> 63);
     /*-
      * mask is:
@@ -450,12 +446,12 @@ static void felem_shrink(smallfelem out, const felem in)
     tmp[3] -= mask & kPrime[3];
     /* tmp[3] < 2**64 - 2**32 + 1 */

-    tmp[1] += ((u64)(tmp[0] >> 64));
-    tmp[0] = (u64)tmp[0];
-    tmp[2] += ((u64)(tmp[1] >> 64));
-    tmp[1] = (u64)tmp[1];
-    tmp[3] += ((u64)(tmp[2] >> 64));
-    tmp[2] = (u64)tmp[2];
+    tmp[1] += ((uint64_t)(tmp[0] >> 64));
+    tmp[0] = (uint64_t)tmp[0];
+    tmp[2] += ((uint64_t)(tmp[1] >> 64));
+    tmp[1] = (uint64_t)tmp[1];
+    tmp[3] += ((uint64_t)(tmp[2] >> 64));
+    tmp[2] = (uint64_t)tmp[2];
     /* tmp[i] < 2^64 */

     out[0] = tmp[0];
@@ -483,7 +479,7 @@ static void smallfelem_expand(felem out, const smallfelem in)
 static void smallfelem_square(longfelem out, const smallfelem small)
 {
     limb a;
-    u64 high, low;
+    uint64_t high, low;

     a = ((uint128_t)small[0]) * small[0];
     low = a;
@@ -561,7 +557,7 @@ static void smallfelem_square(longfelem out, const smallfelem small)
  */
 static void felem_square(longfelem out, const felem in)
 {
-    u64 small[4];
+    uint64_t small[4];
     felem_shrink(small, in);
     smallfelem_square(out, small);
 }
@@ -578,7 +574,7 @@ static void smallfelem_mul(longfelem out, const smallfelem small1,
     const smallfelem small2)
 {
     limb a;
-    u64 high, low;
+    uint64_t high, low;

     a = ((uint128_t)small1[0]) * small2[0];
     low = a;
@@ -827,12 +823,12 @@ static void felem_reduce_zero105(felem out, const longfelem in)
  * subtract_u64 sets *result = *result - v and *carry to one if the
  * subtraction underflowed.
  */
-static void subtract_u64(u64 *result, u64 *carry, u64 v)
+static void subtract_u64(uint64_t *result, uint64_t *carry, uint64_t v)
 {
     uint128_t r = *result;
     r -= v;
     *carry = (r >> 64) & 1;
-    *result = (u64)r;
+    *result = (uint64_t)r;
 }

 /*
@@ -842,7 +838,7 @@ static void subtract_u64(u64 *result, u64 *carry, u64 v)
 static void felem_contract(smallfelem out, const felem in)
 {
     unsigned i;
-    u64 all_equal_so_far = 0, result = 0, carry;
+    uint64_t all_equal_so_far = 0, result = 0, carry;

     felem_shrink(out, in);
     /* small is minimal except that the value might be > p */
@@ -850,18 +846,18 @@ static void felem_contract(smallfelem out, const felem in)
     all_equal_so_far--;
     /*
      * We are doing a constant time test if out >= kPrime. We need to compare
-     * each u64, from most-significant to least significant. For each one, if
+     * each uint64_t, from most-significant to least significant. For each one, if
      * all words so far have been equal (m is all ones) then a non-equal
      * result is the answer. Otherwise we continue.
      */
     for (i = 3; i < 4; i--) {
-        u64 equal;
+        uint64_t equal;
         uint128_t a = ((uint128_t)kPrime[i]) - out[i];
         /*
          * if out[i] > kPrime[i] then a will underflow and the high 64-bits
          * will all be set.
          */
-        result |= all_equal_so_far & ((u64)(a >> 64));
+        result |= all_equal_so_far & ((uint64_t)(a >> 64));

         /*
          * if kPrime[i] == out[i] then |equal| will be all zeros and the
@@ -932,9 +928,9 @@ static void smallfelem_mul_contract(smallfelem out, const smallfelem in1,
 static limb smallfelem_is_zero(const smallfelem small)
 {
     limb result;
-    u64 is_p;
+    uint64_t is_p;

-    u64 is_zero = small[0] | small[1] | small[2] | small[3];
+    uint64_t is_zero = small[0] | small[1] | small[2] | small[3];
     is_zero--;
     is_zero &= is_zero << 32;
     is_zero &= is_zero << 16;
@@ -1209,7 +1205,7 @@ static void copy_conditional(felem out, const felem in, limb mask)
 static void copy_small_conditional(felem out, const smallfelem in, limb mask)
 {
     unsigned i;
-    const u64 mask64 = mask;
+    const uint64_t mask64 = mask;
     for (i = 0; i < NLIMBS; ++i) {
         out[i] = ((limb)(in[i] & mask64)) | (out[i] & ~mask);
     }
@@ -1628,17 +1624,17 @@ static const smallfelem gmul[2][16][3] = {
  * select_point selects the |idx|th point from a precomputation table and
  * copies it to out.
  */
-static void select_point(const u64 idx, unsigned int size,
+static void select_point(const uint64_t idx, unsigned int size,
     const smallfelem pre_comp[16][3], smallfelem out[3])
 {
     unsigned i, j;
-    u64 *outlimbs = &out[0][0];
+    uint64_t *outlimbs = &out[0][0];

     memset(out, 0, sizeof(*out) * 3);

     for (i = 0; i < size; i++) {
-        const u64 *inlimbs = (u64 *)&pre_comp[i][0][0];
-        u64 mask = i ^ idx;
+        const uint64_t *inlimbs = (uint64_t *)&pre_comp[i][0][0];
+        uint64_t mask = i ^ idx;
         mask |= mask >> 4;
         mask |= mask >> 2;
         mask |= mask >> 1;
@@ -1666,7 +1662,7 @@ static char get_bit(const felem_bytearray in, int i)
  */
 static void batch_mul(felem x_out, felem y_out, felem z_out,
     const felem_bytearray scalars[],
-    const unsigned num_points, const u8 *g_scalar,
+    const unsigned num_points, const uint8_t *g_scalar,
     const int mixed, const smallfelem pre_comp[][17][3],
     const smallfelem g_pre_comp[2][16][3])
 {
@@ -1674,8 +1670,8 @@ static void batch_mul(felem x_out, felem y_out, felem z_out,
     unsigned num, gen_mul = (g_scalar != NULL);
     felem nq[3], ftmp;
     smallfelem tmp[3];
-    u64 bits;
-    u8 sign, digit;
+    uint64_t bits;
+    uint8_t sign, digit;

     /* set nq to the point at infinity */
     memset(nq, 0, sizeof(nq));
diff --git a/crypto/ec/ecp_nistp384.c b/crypto/ec/ecp_nistp384.c
index aedd052d98..e03bda2178 100644
--- a/crypto/ec/ecp_nistp384.c
+++ b/crypto/ec/ecp_nistp384.c
@@ -41,16 +41,13 @@
 #error "Your compiler doesn't appear to support 128-bit integer types"
 #endif

-typedef uint8_t u8;
-typedef uint64_t u64;
-
 /*
  * The underlying field. P384 operates over GF(2^384-2^128-2^96+2^32-1). We
  * can serialize an element of this field into 48 bytes. We call this an
  * felem_bytearray.
  */

-typedef u8 felem_bytearray[48];
+typedef uint8_t felem_bytearray[48];

 /*
  * These are the parameters of P384, taken from FIPS 186-3, section D.1.2.4.
@@ -113,7 +110,7 @@ typedef widelimb widefelem[2 * NLIMBS - 1];
 static const limb bottom56bits = 0xffffffffffffff;

 /* Helper functions (de)serialising reduced field elements in little endian */
-static void bin48_to_felem(felem out, const u8 in[48])
+static void bin48_to_felem(felem out, const uint8_t in[48])
 {
     memset(out, 0, 56);
     out[0] = (*((limb *)&in[0])) & bottom56bits;
@@ -125,7 +122,7 @@ static void bin48_to_felem(felem out, const u8 in[48])
     memmove(&out[6], &in[42], 6);
 }

-static void felem_to_bin48(u8 out[48], const felem in)
+static void felem_to_bin48(uint8_t out[48], const felem in)
 {
     memset(out, 0, 48);
     (*((limb *)&out[0])) |= (in[0] & bottom56bits);
@@ -1404,7 +1401,7 @@ static char get_bit(const felem_bytearray in, int i)
  */
 static void batch_mul(felem x_out, felem y_out, felem z_out,
     const felem_bytearray scalars[],
-    const unsigned int num_points, const u8 *g_scalar,
+    const unsigned int num_points, const uint8_t *g_scalar,
     const int mixed, const felem pre_comp[][17][3],
     const felem g_pre_comp[16][3])
 {
@@ -1412,7 +1409,7 @@ static void batch_mul(felem x_out, felem y_out, felem z_out,
     unsigned int num, gen_mul = (g_scalar != NULL);
     felem nq[3], tmp[4];
     limb bits;
-    u8 sign, digit;
+    uint8_t sign, digit;

     /* set nq to the point at infinity */
     memset(nq, 0, sizeof(nq));
diff --git a/crypto/ec/ecp_nistp521.c b/crypto/ec/ecp_nistp521.c
index 1fb747eba0..7ea8d00c14 100644
--- a/crypto/ec/ecp_nistp521.c
+++ b/crypto/ec/ecp_nistp521.c
@@ -49,16 +49,13 @@
 #error "Your compiler doesn't appear to support 128-bit integer types"
 #endif

-typedef uint8_t u8;
-typedef uint64_t u64;
-
 /*
  * The underlying field. P521 operates over GF(2^521-1). We can serialize an
  * element of this field into 66 bytes where the most significant byte
  * contains only a single bit. We call this an felem_bytearray.
  */

-typedef u8 felem_bytearray[66];
+typedef uint8_t felem_bytearray[66];

 /*
  * These are the parameters of P521, taken from FIPS 186-3, section D.1.2.5.
@@ -140,7 +137,7 @@ static const limb bottom58bits = 0x3ffffffffffffff;
  * bin66_to_felem takes a little-endian byte array and converts it into felem
  * form. This assumes that the CPU is little-endian.
  */
-static void bin66_to_felem(felem out, const u8 in[66])
+static void bin66_to_felem(felem out, const uint8_t in[66])
 {
     out[0] = (*((limb *)&in[0])) & bottom58bits;
     out[1] = (*((limb_aX *)&in[7]) >> 2) & bottom58bits;
@@ -157,7 +154,7 @@ static void bin66_to_felem(felem out, const u8 in[66])
  * felem_to_bin66 takes an felem and serializes into a little endian, 66 byte
  * array. This assumes that the CPU is little-endian.
  */
-static void felem_to_bin66(u8 out[66], const felem in)
+static void felem_to_bin66(uint8_t out[66], const felem in)
 {
     memset(out, 0, 66);
     (*((limb *)&out[0])) = in[0];
@@ -521,7 +518,7 @@ static const limb bottom52bits = 0xfffffffffffff;
  */
 static void felem_reduce(felem out, const largefelem in)
 {
-    u64 overflow1, overflow2;
+    uint64_t overflow1, overflow2;

     out[0] = ((limb)in[0]) & bottom58bits;
     out[1] = ((limb)in[1]) & bottom58bits;
@@ -1497,7 +1494,7 @@ static char get_bit(const felem_bytearray in, int i)
  */
 static void batch_mul(felem x_out, felem y_out, felem z_out,
     const felem_bytearray scalars[],
-    const unsigned num_points, const u8 *g_scalar,
+    const unsigned num_points, const uint8_t *g_scalar,
     const int mixed, const felem pre_comp[][17][3],
     const felem g_pre_comp[16][3])
 {
@@ -1505,7 +1502,7 @@ static void batch_mul(felem x_out, felem y_out, felem z_out,
     unsigned num, gen_mul = (g_scalar != NULL);
     felem nq[3], tmp[4];
     limb bits;
-    u8 sign, digit;
+    uint8_t sign, digit;

     /* set nq to the point at infinity */
     memset(nq, 0, sizeof(nq));
diff --git a/crypto/ec/ecp_nistz256.c b/crypto/ec/ecp_nistz256.c
index 766706c598..301f90188a 100644
--- a/crypto/ec/ecp_nistz256.c
+++ b/crypto/ec/ecp_nistz256.c
@@ -39,8 +39,6 @@

 #define P256_LIMBS (256 / BN_BITS2)

-typedef unsigned short u16;
-
 typedef struct {
     BN_ULONG X[P256_LIMBS];
     BN_ULONG Y[P256_LIMBS];
diff --git a/crypto/modes/ccm128.c b/crypto/modes/ccm128.c
index 02ab4f8831..ba73600f39 100644
--- a/crypto/modes/ccm128.c
+++ b/crypto/modes/ccm128.c
@@ -13,9 +13,9 @@

 #ifndef STRICT_ALIGNMENT
 #ifdef __GNUC__
-typedef u64 u64_a1 __attribute((__aligned__(1)));
+typedef uint64_t u64_a1 __attribute((__aligned__(1)));
 #else
-typedef u64 u64_a1;
+typedef uint64_t u64_a1;
 #endif
 #endif

@@ -28,7 +28,7 @@ void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx,
     block128_f block)
 {
     memset(ctx->nonce.c, 0, sizeof(ctx->nonce.c));
-    ctx->nonce.c[0] = ((u8)(L - 1) & 7) | (u8)(((M - 2) / 2) & 7) << 3;
+    ctx->nonce.c[0] = ((uint8_t)(L - 1) & 7) | (uint8_t)(((M - 2) / 2) & 7) << 3;
     ctx->blocks = 0;
     ctx->block = block;
     ctx->key = key;
@@ -46,17 +46,17 @@ int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx,
         return -1; /* nonce is too short */

     if (sizeof(mlen) == 8 && L >= 3) {
-        ctx->nonce.c[8] = (u8)(mlen >> (56 % (sizeof(mlen) * 8)));
-        ctx->nonce.c[9] = (u8)(mlen >> (48 % (sizeof(mlen) * 8)));
-        ctx->nonce.c[10] = (u8)(mlen >> (40 % (sizeof(mlen) * 8)));
-        ctx->nonce.c[11] = (u8)(mlen >> (32 % (sizeof(mlen) * 8)));
+        ctx->nonce.c[8] = (uint8_t)(mlen >> (56 % (sizeof(mlen) * 8)));
+        ctx->nonce.c[9] = (uint8_t)(mlen >> (48 % (sizeof(mlen) * 8)));
+        ctx->nonce.c[10] = (uint8_t)(mlen >> (40 % (sizeof(mlen) * 8)));
+        ctx->nonce.c[11] = (uint8_t)(mlen >> (32 % (sizeof(mlen) * 8)));
     } else
         ctx->nonce.u[1] = 0;

-    ctx->nonce.c[12] = (u8)(mlen >> 24);
-    ctx->nonce.c[13] = (u8)(mlen >> 16);
-    ctx->nonce.c[14] = (u8)(mlen >> 8);
-    ctx->nonce.c[15] = (u8)mlen;
+    ctx->nonce.c[12] = (uint8_t)(mlen >> 24);
+    ctx->nonce.c[13] = (uint8_t)(mlen >> 16);
+    ctx->nonce.c[14] = (uint8_t)(mlen >> 8);
+    ctx->nonce.c[15] = (uint8_t)mlen;

     ctx->nonce.c[0] &= ~0x40; /* clear Adata flag */
     memcpy(&ctx->nonce.c[1], nonce, 14 - L);
@@ -78,29 +78,29 @@ void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx,
     (*block)(ctx->nonce.c, ctx->cmac.c, ctx->key), ctx->blocks++;

     if (alen < (0x10000 - 0x100)) {
-        ctx->cmac.c[0] ^= (u8)(alen >> 8);
-        ctx->cmac.c[1] ^= (u8)alen;
+        ctx->cmac.c[0] ^= (uint8_t)(alen >> 8);
+        ctx->cmac.c[1] ^= (uint8_t)alen;
         i = 2;
     } else if (sizeof(alen) == 8
         && alen >= (size_t)1 << (32 % (sizeof(alen) * 8))) {
         ctx->cmac.c[0] ^= 0xFF;
         ctx->cmac.c[1] ^= 0xFF;
-        ctx->cmac.c[2] ^= (u8)(alen >> (56 % (sizeof(alen) * 8)));
-        ctx->cmac.c[3] ^= (u8)(alen >> (48 % (sizeof(alen) * 8)));
-        ctx->cmac.c[4] ^= (u8)(alen >> (40 % (sizeof(alen) * 8)));
-        ctx->cmac.c[5] ^= (u8)(alen >> (32 % (sizeof(alen) * 8)));
-        ctx->cmac.c[6] ^= (u8)(alen >> 24);
-        ctx->cmac.c[7] ^= (u8)(alen >> 16);
-        ctx->cmac.c[8] ^= (u8)(alen >> 8);
-        ctx->cmac.c[9] ^= (u8)alen;
+        ctx->cmac.c[2] ^= (uint8_t)(alen >> (56 % (sizeof(alen) * 8)));
+        ctx->cmac.c[3] ^= (uint8_t)(alen >> (48 % (sizeof(alen) * 8)));
+        ctx->cmac.c[4] ^= (uint8_t)(alen >> (40 % (sizeof(alen) * 8)));
+        ctx->cmac.c[5] ^= (uint8_t)(alen >> (32 % (sizeof(alen) * 8)));
+        ctx->cmac.c[6] ^= (uint8_t)(alen >> 24);
+        ctx->cmac.c[7] ^= (uint8_t)(alen >> 16);
+        ctx->cmac.c[8] ^= (uint8_t)(alen >> 8);
+        ctx->cmac.c[9] ^= (uint8_t)alen;
         i = 10;
     } else {
         ctx->cmac.c[0] ^= 0xFF;
         ctx->cmac.c[1] ^= 0xFE;
-        ctx->cmac.c[2] ^= (u8)(alen >> 24);
-        ctx->cmac.c[3] ^= (u8)(alen >> 16);
-        ctx->cmac.c[4] ^= (u8)(alen >> 8);
-        ctx->cmac.c[5] ^= (u8)alen;
+        ctx->cmac.c[2] ^= (uint8_t)(alen >> 24);
+        ctx->cmac.c[3] ^= (uint8_t)(alen >> 16);
+        ctx->cmac.c[4] ^= (uint8_t)(alen >> 8);
+        ctx->cmac.c[5] ^= (uint8_t)alen;
         i = 6;
     }

@@ -121,7 +121,7 @@ void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx,
 static void ctr64_inc(unsigned char *counter)
 {
     unsigned int n = 8;
-    u8 c;
+    uint8_t c;

     counter += 8;
     do {
@@ -144,8 +144,8 @@ int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx,
     block128_f block = ctx->block;
     void *key = ctx->key;
     union {
-        u64 u[2];
-        u8 c[16];
+        uint64_t u[2];
+        uint8_t c[16];
     } scratch;

     if (!(flags0 & 0x40))
@@ -170,8 +170,8 @@ int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx,
     while (len >= 16) {
 #if defined(STRICT_ALIGNMENT)
         union {
-            u64 u[2];
-            u8 c[16];
+            uint64_t u[2];
+            uint8_t c[16];
         } temp;

         memcpy(temp.c, inp, 16);
@@ -228,8 +228,8 @@ int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx,
     block128_f block = ctx->block;
     void *key = ctx->key;
     union {
-        u64 u[2];
-        u8 c[16];
+        uint64_t u[2];
+        uint8_t c[16];
     } scratch;

     if (!(flags0 & 0x40))
@@ -250,8 +250,8 @@ int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx,
     while (len >= 16) {
 #if defined(STRICT_ALIGNMENT)
         union {
-            u64 u[2];
-            u8 c[16];
+            uint64_t u[2];
+            uint8_t c[16];
         } temp;
 #endif
         (*block)(ctx->nonce.c, scratch.c, key);
@@ -317,8 +317,8 @@ int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx,
     block128_f block = ctx->block;
     void *key = ctx->key;
     union {
-        u64 u[2];
-        u8 c[16];
+        uint64_t u[2];
+        uint8_t c[16];
     } scratch;

     if (!(flags0 & 0x40))
@@ -381,8 +381,8 @@ int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx,
     block128_f block = ctx->block;
     void *key = ctx->key;
     union {
-        u64 u[2];
-        u8 c[16];
+        uint64_t u[2];
+        uint8_t c[16];
     } scratch;

     if (!(flags0 & 0x40))
diff --git a/crypto/modes/ctr128.c b/crypto/modes/ctr128.c
index 6013d6ee41..5954615e7d 100644
--- a/crypto/modes/ctr128.c
+++ b/crypto/modes/ctr128.c
@@ -26,12 +26,12 @@ typedef size_t size_t_aX;
 /* increment counter (128-bit int) by 1 */
 static void ctr128_inc(unsigned char *counter)
 {
-    u32 n = 16, c = 1;
+    uint32_t n = 16, c = 1;

     do {
         --n;
         c += counter[n];
-        counter[n] = (u8)c;
+        counter[n] = (uint8_t)c;
         c >>= 8;
     } while (n);
 }
@@ -137,12 +137,12 @@ void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
 /* increment upper 96 bits of 128-bit counter by 1 */
 static void ctr96_inc(unsigned char *counter)
 {
-    u32 n = 12, c = 1;
+    uint32_t n = 12, c = 1;

     do {
         --n;
         c += counter[n];
-        counter[n] = (u8)c;
+        counter[n] = (uint8_t)c;
         c >>= 8;
     } while (n);
 }
@@ -179,7 +179,7 @@ void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
          * overflow, which is then handled by limiting the
          * amount of blocks to the exact overflow point...
          */
-        ctr32 += (u32)blocks;
+        ctr32 += (uint32_t)blocks;
         if (ctr32 < blocks) {
             blocks -= ctr32;
             ctr32 = 0;
diff --git a/crypto/modes/gcm128.c b/crypto/modes/gcm128.c
index 0bef7440f8..1b77c2e27e 100644
--- a/crypto/modes/gcm128.c
+++ b/crypto/modes/gcm128.c
@@ -22,9 +22,9 @@ typedef size_t size_t_aX;
 #if defined(BSWAP4) && defined(STRICT_ALIGNMENT)
 /* redefine, because alignment is ensured */
 #undef GETU32
-#define GETU32(p) BSWAP4(*(const u32 *)(p))
+#define GETU32(p) BSWAP4(*(const uint32_t *)(p))
 #undef PUTU32
-#define PUTU32(p, v) *(u32 *)(p) = BSWAP4(v)
+#define PUTU32(p, v) *(uint32_t *)(p) = BSWAP4(v)
 #endif

 /* RISC-V uses C implementation as a fallback. */
@@ -34,17 +34,17 @@ typedef size_t size_t_aX;
 #endif

 #define PACK(s) ((size_t)(s) << (sizeof(size_t) * 8 - 16))
-#define REDUCE1BIT(V)                                           \
-    do {                                                        \
-        if (sizeof(size_t) == 8) {                              \
-            u64 T = U64(0xe100000000000000) & (0 - (V.lo & 1)); \
-            V.lo = (V.hi << 63) | (V.lo >> 1);                  \
-            V.hi = (V.hi >> 1) ^ T;                             \
-        } else {                                                \
-            u32 T = 0xe1000000U & (0 - (u32)(V.lo & 1));        \
-            V.lo = (V.hi << 63) | (V.lo >> 1);                  \
-            V.hi = (V.hi >> 1) ^ ((u64)T << 32);                \
-        }                                                       \
+#define REDUCE1BIT(V)                                                \
+    do {                                                             \
+        if (sizeof(size_t) == 8) {                                   \
+            uint64_t T = U64(0xe100000000000000) & (0 - (V.lo & 1)); \
+            V.lo = (V.hi << 63) | (V.lo >> 1);                       \
+            V.hi = (V.hi >> 1) ^ T;                                  \
+        } else {                                                     \
+            uint32_t T = 0xe1000000U & (0 - (uint32_t)(V.lo & 1));   \
+            V.lo = (V.hi << 63) | (V.lo >> 1);                       \
+            V.hi = (V.hi >> 1) ^ ((uint64_t)T << 32);                \
+        }                                                            \
     } while (0)

 /*-
@@ -85,7 +85,7 @@ typedef size_t size_t_aX;
  * Value of 1 is not appropriate for performance reasons.
  */

-static void gcm_init_4bit(u128 Htable[16], const u64 H[2])
+static void gcm_init_4bit(u128 Htable[16], const uint64_t H[2])
 {
     u128 V;
 #if defined(OPENSSL_SMALL_FOOTPRINT)
@@ -165,14 +165,14 @@ static const size_t rem_4bit[16] = {
     PACK(0x9180), PACK(0x8DA0), PACK(0xA9C0), PACK(0xB5E0)
 };

-static void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16])
+static void gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16])
 {
     u128 Z;
     int cnt = 15;
     size_t rem, nlo, nhi;
     DECLARE_IS_ENDIAN;

-    nlo = ((const u8 *)Xi)[15];
+    nlo = ((const uint8_t *)Xi)[15];
     nhi = nlo >> 4;
     nlo &= 0xf;

@@ -186,7 +186,7 @@ static void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16])
         if (sizeof(size_t) == 8)
             Z.hi ^= rem_4bit[rem];
         else
-            Z.hi ^= (u64)rem_4bit[rem] << 32;
+            Z.hi ^= (uint64_t)rem_4bit[rem] << 32;

         Z.hi ^= Htable[nhi].hi;
         Z.lo ^= Htable[nhi].lo;
@@ -194,7 +194,7 @@ static void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16])
         if (--cnt < 0)
             break;

-        nlo = ((const u8 *)Xi)[cnt];
+        nlo = ((const uint8_t *)Xi)[cnt];
         nhi = nlo >> 4;
         nlo &= 0xf;

@@ -204,7 +204,7 @@ static void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16])
         if (sizeof(size_t) == 8)
             Z.hi ^= rem_4bit[rem];
         else
-            Z.hi ^= (u64)rem_4bit[rem] << 32;
+            Z.hi ^= (uint64_t)rem_4bit[rem] << 32;

         Z.hi ^= Htable[nlo].hi;
         Z.lo ^= Htable[nlo].lo;
@@ -215,15 +215,15 @@ static void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16])
         Xi[0] = BSWAP8(Z.hi);
         Xi[1] = BSWAP8(Z.lo);
 #else
-        u8 *p = (u8 *)Xi;
-        u32 v;
-        v = (u32)(Z.hi >> 32);
+        uint8_t *p = (uint8_t *)Xi;
+        uint32_t v;
+        v = (uint32_t)(Z.hi >> 32);
         PUTU32(p, v);
-        v = (u32)(Z.hi);
+        v = (uint32_t)(Z.hi);
         PUTU32(p + 4, v);
-        v = (u32)(Z.lo >> 32);
+        v = (uint32_t)(Z.lo >> 32);
         PUTU32(p + 8, v);
-        v = (u32)(Z.lo);
+        v = (uint32_t)(Z.lo);
         PUTU32(p + 12, v);
 #endif
     } else {
@@ -243,8 +243,8 @@ static void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16])
  * mostly as reference and a placeholder for possible future
  * non-trivial optimization[s]...
  */
-static void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16],
-    const u8 *inp, size_t len)
+static void gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16],
+    const uint8_t *inp, size_t len)
 {
     u128 Z;
     int cnt;
@@ -253,7 +253,7 @@ static void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16],

     do {
         cnt = 15;
-        nlo = ((const u8 *)Xi)[15];
+        nlo = ((const uint8_t *)Xi)[15];
         nlo ^= inp[15];
         nhi = nlo >> 4;
         nlo &= 0xf;
@@ -268,7 +268,7 @@ static void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16],
             if (sizeof(size_t) == 8)
                 Z.hi ^= rem_4bit[rem];
             else
-                Z.hi ^= (u64)rem_4bit[rem] << 32;
+                Z.hi ^= (uint64_t)rem_4bit[rem] << 32;

             Z.hi ^= Htable[nhi].hi;
             Z.lo ^= Htable[nhi].lo;
@@ -276,7 +276,7 @@ static void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16],
             if (--cnt < 0)
                 break;

-            nlo = ((const u8 *)Xi)[cnt];
+            nlo = ((const uint8_t *)Xi)[cnt];
             nlo ^= inp[cnt];
             nhi = nlo >> 4;
             nlo &= 0xf;
@@ -287,7 +287,7 @@ static void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16],
             if (sizeof(size_t) == 8)
                 Z.hi ^= rem_4bit[rem];
             else
-                Z.hi ^= (u64)rem_4bit[rem] << 32;
+                Z.hi ^= (uint64_t)rem_4bit[rem] << 32;

             Z.hi ^= Htable[nlo].hi;
             Z.lo ^= Htable[nlo].lo;
@@ -298,15 +298,15 @@ static void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16],
             Xi[0] = BSWAP8(Z.hi);
             Xi[1] = BSWAP8(Z.lo);
 #else
-            u8 *p = (u8 *)Xi;
-            u32 v;
-            v = (u32)(Z.hi >> 32);
+            uint8_t *p = (uint8_t *)Xi;
+            uint32_t v;
+            v = (uint32_t)(Z.hi >> 32);
             PUTU32(p, v);
-            v = (u32)(Z.hi);
+            v = (uint32_t)(Z.hi);
             PUTU32(p + 4, v);
-            v = (u32)(Z.lo >> 32);
+            v = (uint32_t)(Z.lo >> 32);
             PUTU32(p + 8, v);
-            v = (u32)(Z.lo);
+            v = (uint32_t)(Z.lo);
             PUTU32(p + 12, v);
 #endif
         } else {
@@ -321,8 +321,8 @@ static void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16],
 }
 #endif
 #else
-void gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]);
-void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], const u8 *inp,
+void gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
     size_t len);
 #endif

@@ -341,9 +341,9 @@ void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], const u8 *inp,
 #if !defined(I386_ONLY) && (defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64))
 #define GHASH_ASM_X86_OR_64

-void gcm_init_clmul(u128 Htable[16], const u64 Xi[2]);
-void gcm_gmult_clmul(u64 Xi[2], const u128 Htable[16]);
-void gcm_ghash_clmul(u64 Xi[2], const u128 Htable[16], const u8 *inp,
+void gcm_init_clmul(u128 Htable[16], const uint64_t Xi[2]);
+void gcm_gmult_clmul(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_ghash_clmul(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
     size_t len);

 #if defined(__i386) || defined(__i386__) || defined(_M_IX86)
@@ -351,20 +351,20 @@ void gcm_ghash_clmul(u64 Xi[2], const u128 Htable[16], const u8 *inp,
 #define gcm_gmult_avx gcm_gmult_clmul
 #define gcm_ghash_avx gcm_ghash_clmul
 #else
-void gcm_init_avx(u128 Htable[16], const u64 Xi[2]);
-void gcm_gmult_avx(u64 Xi[2], const u128 Htable[16]);
-void gcm_ghash_avx(u64 Xi[2], const u128 Htable[16], const u8 *inp,
+void gcm_init_avx(u128 Htable[16], const uint64_t Xi[2]);
+void gcm_gmult_avx(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_ghash_avx(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
     size_t len);
 #endif

 #if defined(__i386) || defined(__i386__) || defined(_M_IX86)
 #define GHASH_ASM_X86
-void gcm_gmult_4bit_mmx(u64 Xi[2], const u128 Htable[16]);
-void gcm_ghash_4bit_mmx(u64 Xi[2], const u128 Htable[16], const u8 *inp,
+void gcm_gmult_4bit_mmx(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_ghash_4bit_mmx(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
     size_t len);

-void gcm_gmult_4bit_x86(u64 Xi[2], const u128 Htable[16]);
-void gcm_ghash_4bit_x86(u64 Xi[2], const u128 Htable[16], const u8 *inp,
+void gcm_gmult_4bit_x86(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_ghash_4bit_x86(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
     size_t len);
 #endif
 #elif defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(_M_ARM64)
@@ -375,53 +375,53 @@ void gcm_ghash_4bit_x86(u64 Xi[2], const u128 Htable[16], const u8 *inp,
 #if defined(__arm__) || defined(__arm)
 #define NEON_CAPABLE (OPENSSL_armcap_P & ARMV7_NEON)
 #endif
-void gcm_init_neon(u128 Htable[16], const u64 Xi[2]);
-void gcm_gmult_neon(u64 Xi[2], const u128 Htable[16]);
-void gcm_ghash_neon(u64 Xi[2], const u128 Htable[16], const u8 *inp,
+void gcm_init_neon(u128 Htable[16], const uint64_t Xi[2]);
+void gcm_gmult_neon(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_ghash_neon(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
     size_t len);
-void gcm_init_v8(u128 Htable[16], const u64 Xi[2]);
-void gcm_gmult_v8(u64 Xi[2], const u128 Htable[16]);
-void gcm_ghash_v8(u64 Xi[2], const u128 Htable[16], const u8 *inp,
+void gcm_init_v8(u128 Htable[16], const uint64_t Xi[2]);
+void gcm_gmult_v8(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_ghash_v8(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
     size_t len);
 #endif
 #elif defined(__sparc__) || defined(__sparc)
 #include "arch/sparc_arch.h"
 #define GHASH_ASM_SPARC
-void gcm_init_vis3(u128 Htable[16], const u64 Xi[2]);
-void gcm_gmult_vis3(u64 Xi[2], const u128 Htable[16]);
-void gcm_ghash_vis3(u64 Xi[2], const u128 Htable[16], const u8 *inp,
+void gcm_init_vis3(u128 Htable[16], const uint64_t Xi[2]);
+void gcm_gmult_vis3(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_ghash_vis3(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
     size_t len);
 #elif defined(OPENSSL_CPUID_OBJ) && (defined(__powerpc__) || defined(__POWERPC__) || defined(_ARCH_PPC))
 #include "arch/ppc_arch.h"
 #define GHASH_ASM_PPC
-void gcm_init_p8(u128 Htable[16], const u64 Xi[2]);
-void gcm_gmult_p8(u64 Xi[2], const u128 Htable[16]);
-void gcm_ghash_p8(u64 Xi[2], const u128 Htable[16], const u8 *inp,
+void gcm_init_p8(u128 Htable[16], const uint64_t Xi[2]);
+void gcm_gmult_p8(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_ghash_p8(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
     size_t len);
 #elif defined(OPENSSL_CPUID_OBJ) && defined(__riscv) && __riscv_xlen == 64
 #include "arch/riscv_arch.h"
 #define GHASH_ASM_RV64I
 /* Zbc/Zbkc (scalar crypto with clmul) based routines. */
-void gcm_init_rv64i_zbc(u128 Htable[16], const u64 Xi[2]);
-void gcm_init_rv64i_zbc__zbb(u128 Htable[16], const u64 Xi[2]);
-void gcm_init_rv64i_zbc__zbkb(u128 Htable[16], const u64 Xi[2]);
-void gcm_gmult_rv64i_zbc(u64 Xi[2], const u128 Htable[16]);
-void gcm_gmult_rv64i_zbc__zbkb(u64 Xi[2], const u128 Htable[16]);
-void gcm_ghash_rv64i_zbc(u64 Xi[2], const u128 Htable[16],
-    const u8 *inp, size_t len);
-void gcm_ghash_rv64i_zbc__zbkb(u64 Xi[2], const u128 Htable[16],
-    const u8 *inp, size_t len);
+void gcm_init_rv64i_zbc(u128 Htable[16], const uint64_t Xi[2]);
+void gcm_init_rv64i_zbc__zbb(u128 Htable[16], const uint64_t Xi[2]);
+void gcm_init_rv64i_zbc__zbkb(u128 Htable[16], const uint64_t Xi[2]);
+void gcm_gmult_rv64i_zbc(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_gmult_rv64i_zbc__zbkb(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_ghash_rv64i_zbc(uint64_t Xi[2], const u128 Htable[16],
+    const uint8_t *inp, size_t len);
+void gcm_ghash_rv64i_zbc__zbkb(uint64_t Xi[2], const u128 Htable[16],
+    const uint8_t *inp, size_t len);
 /* zvkb/Zvbc (vector crypto with vclmul) based routines. */
-void gcm_init_rv64i_zvkb_zvbc(u128 Htable[16], const u64 Xi[2]);
-void gcm_gmult_rv64i_zvkb_zvbc(u64 Xi[2], const u128 Htable[16]);
-void gcm_ghash_rv64i_zvkb_zvbc(u64 Xi[2], const u128 Htable[16],
-    const u8 *inp, size_t len);
+void gcm_init_rv64i_zvkb_zvbc(u128 Htable[16], const uint64_t Xi[2]);
+void gcm_gmult_rv64i_zvkb_zvbc(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_ghash_rv64i_zvkb_zvbc(uint64_t Xi[2], const u128 Htable[16],
+    const uint8_t *inp, size_t len);
 /* Zvkg (vector crypto with vgmul.vv and vghsh.vv). */
-void gcm_init_rv64i_zvkg(u128 Htable[16], const u64 Xi[2]);
-void gcm_init_rv64i_zvkg_zvkb(u128 Htable[16], const u64 Xi[2]);
-void gcm_gmult_rv64i_zvkg(u64 Xi[2], const u128 Htable[16]);
-void gcm_ghash_rv64i_zvkg(u64 Xi[2], const u128 Htable[16],
-    const u8 *inp, size_t len);
+void gcm_init_rv64i_zvkg(u128 Htable[16], const uint64_t Xi[2]);
+void gcm_init_rv64i_zvkg_zvkb(u128 Htable[16], const uint64_t Xi[2]);
+void gcm_gmult_rv64i_zvkg(uint64_t Xi[2], const u128 Htable[16]);
+void gcm_ghash_rv64i_zvkg(uint64_t Xi[2], const u128 Htable[16],
+    const uint8_t *inp, size_t len);
 #endif
 #endif

@@ -560,7 +560,7 @@ static void gcm_get_funcs(struct gcm_funcs_st *ctx)
 #endif
 }

-void ossl_gcm_init_4bit(u128 Htable[16], const u64 H[2])
+void ossl_gcm_init_4bit(u128 Htable[16], const uint64_t H[2])
 {
     struct gcm_funcs_st funcs;

@@ -568,7 +568,7 @@ void ossl_gcm_init_4bit(u128 Htable[16], const u64 H[2])
     funcs.ginit(Htable, H);
 }

-void ossl_gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16])
+void ossl_gcm_gmult_4bit(uint64_t Xi[2], const u128 Htable[16])
 {
     struct gcm_funcs_st funcs;

@@ -576,11 +576,11 @@ void ossl_gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16])
     funcs.gmult(Xi, Htable);
 }

-void ossl_gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16],
-    const u8 *inp, size_t len)
+void ossl_gcm_ghash_4bit(uint64_t Xi[2], const u128 Htable[16],
+    const uint8_t *inp, size_t len)
 {
     struct gcm_funcs_st funcs;
-    u64 tmp[2];
+    uint64_t tmp[2];
     size_t i;

     gcm_get_funcs(&funcs);
@@ -613,10 +613,10 @@ void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block)
         ctx->H.u[0] = BSWAP8(ctx->H.u[0]);
         ctx->H.u[1] = BSWAP8(ctx->H.u[1]);
 #else
-        u8 *p = ctx->H.c;
-        u64 hi, lo;
-        hi = (u64)GETU32(p) << 32 | GETU32(p + 4);
-        lo = (u64)GETU32(p + 8) << 32 | GETU32(p + 12);
+        uint8_t *p = ctx->H.c;
+        uint64_t hi, lo;
+        hi = (uint64_t)GETU32(p) << 32 | GETU32(p + 4);
+        lo = (uint64_t)GETU32(p + 8) << 32 | GETU32(p + 12);
         ctx->H.u[0] = hi;
         ctx->H.u[1] = lo;
 #endif
@@ -646,7 +646,7 @@ void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv,
         ctr = 1;
     } else {
         size_t i;
-        u64 len0 = len;
+        uint64_t len0 = len;

         /* Borrow ctx->Xi to calculate initial Yi */
         ctx->Xi.u[0] = 0;
@@ -669,14 +669,14 @@ void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv,
 #ifdef BSWAP8
             ctx->Xi.u[1] ^= BSWAP8(len0);
 #else
-            ctx->Xi.c[8] ^= (u8)(len0 >> 56);
-            ctx->Xi.c[9] ^= (u8)(len0 >> 48);
-            ctx->Xi.c[10] ^= (u8)(len0 >> 40);
-            ctx->Xi.c[11] ^= (u8)(len0 >> 32);
-            ctx->Xi.c[12] ^= (u8)(len0 >> 24);
-            ctx->Xi.c[13] ^= (u8)(len0 >> 16);
-            ctx->Xi.c[14] ^= (u8)(len0 >> 8);
-            ctx->Xi.c[15] ^= (u8)(len0);
+            ctx->Xi.c[8] ^= (uint8_t)(len0 >> 56);
+            ctx->Xi.c[9] ^= (uint8_t)(len0 >> 48);
+            ctx->Xi.c[10] ^= (uint8_t)(len0 >> 40);
+            ctx->Xi.c[11] ^= (uint8_t)(len0 >> 32);
+            ctx->Xi.c[12] ^= (uint8_t)(len0 >> 24);
+            ctx->Xi.c[13] ^= (uint8_t)(len0 >> 16);
+            ctx->Xi.c[14] ^= (uint8_t)(len0 >> 8);
+            ctx->Xi.c[15] ^= (uint8_t)(len0);
 #endif
         } else {
             ctx->Xi.u[1] ^= len0;
@@ -718,7 +718,7 @@ int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad,
 {
     size_t i;
     unsigned int n;
-    u64 alen = ctx->len.u[0];
+    uint64_t alen = ctx->len.u[0];

     if (ctx->len.u[1])
         return -2;
@@ -774,7 +774,7 @@ int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
     DECLARE_IS_ENDIAN;
     unsigned int n, ctr, mres;
     size_t i;
-    u64 mlen = ctx->len.u[1];
+    uint64_t mlen = ctx->len.u[1];
     block128_f block = ctx->block;
     void *key = ctx->key;

@@ -999,7 +999,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
     DECLARE_IS_ENDIAN;
     unsigned int n, ctr, mres;
     size_t i;
-    u64 mlen = ctx->len.u[1];
+    uint64_t mlen = ctx->len.u[1];
     block128_f block = ctx->block;
     void *key = ctx->key;

@@ -1057,7 +1057,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
                 }
 #else
                 while (n && len) {
-                    u8 c = *(in++);
+                    uint8_t c = *(in++);
                     *(out++) = c ^ ctx->EKi.c[n];
                     ctx->Xi.c[n] ^= c;
                     --len;
@@ -1176,7 +1176,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
                 }
 #else
                 while (len--) {
-                    u8 c = in[n];
+                    uint8_t c = in[n];
                     ctx->Xi.c[n] ^= c;
                     out[n] = c ^ ctx->EKi.c[n];
                     ++n;
@@ -1191,7 +1191,7 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
     }
 #endif
     for (i = 0; i < len; ++i) {
-        u8 c;
+        uint8_t c;
         if (n == 0) {
             (*block)(ctx->Yi.c, ctx->EKi.c, key);
             ++ctr;
@@ -1235,7 +1235,7 @@ int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx,
     DECLARE_IS_ENDIAN;
     unsigned int n, ctr, mres;
     size_t i;
-    u64 mlen = ctx->len.u[1];
+    uint64_t mlen = ctx->len.u[1];
     void *key = ctx->key;

     mlen += len;
@@ -1389,7 +1389,7 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
     DECLARE_IS_ENDIAN;
     unsigned int n, ctr, mres;
     size_t i;
-    u64 mlen = ctx->len.u[1];
+    uint64_t mlen = ctx->len.u[1];
     void *key = ctx->key;

     mlen += len;
@@ -1443,7 +1443,7 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
         }
 #else
         while (n && len) {
-            u8 c = *(in++);
+            uint8_t c = *(in++);
             *(out++) = c ^ ctx->EKi.c[n];
             ctx->Xi.c[n] ^= c;
             --len;
@@ -1527,7 +1527,7 @@ int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
 #if defined(GHASH)
             out[n] = (ctx->Xn[mres++] = in[n]) ^ ctx->EKi.c[n];
 #else
-            u8 c = in[n];
+            uint8_t c = in[n];
             ctx->Xi.c[mres++] ^= c;
             out[n] = c ^ ctx->EKi.c[n];
 #endif
@@ -1544,8 +1544,8 @@ int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag,
     size_t len)
 {
     DECLARE_IS_ENDIAN;
-    u64 alen = ctx->len.u[0] << 3;
-    u64 clen = ctx->len.u[1] << 3;
+    uint64_t alen = ctx->len.u[0] << 3;
+    uint64_t clen = ctx->len.u[1] << 3;

 #if defined(GHASH) && !defined(OPENSSL_SMALL_FOOTPRINT)
     u128 bitlen;
@@ -1573,13 +1573,13 @@ int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag,
         alen = BSWAP8(alen);
         clen = BSWAP8(clen);
 #else
-        u8 *p = ctx->len.c;
+        uint8_t *p = ctx->len.c;

         ctx->len.u[0] = alen;
         ctx->len.u[1] = clen;

-        alen = (u64)GETU32(p) << 32 | GETU32(p + 4);
-        clen = (u64)GETU32(p + 8) << 32 | GETU32(p + 12);
+        alen = (uint64_t)GETU32(p) << 32 | GETU32(p + 4);
+        clen = (uint64_t)GETU32(p + 8) << 32 | GETU32(p + 12);
 #endif
     }

diff --git a/crypto/modes/ocb128.c b/crypto/modes/ocb128.c
index 02a5fcca68..c6b906a56b 100644
--- a/crypto/modes/ocb128.c
+++ b/crypto/modes/ocb128.c
@@ -17,9 +17,9 @@
 /*
  * Calculate the number of binary trailing zero's in any given number
  */
-static u32 ocb_ntz(u64 n)
+static uint32_t ocb_ntz(uint64_t n)
 {
-    u32 cnt = 0;
+    uint32_t cnt = 0;

     /*
      * We do a right-to-left simple sequential search. This is surprisingly
@@ -263,7 +263,7 @@ int CRYPTO_ocb128_setiv(OCB128_CONTEXT *ctx, const unsigned char *iv,
 int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad,
     size_t len)
 {
-    u64 i, all_num_blocks;
+    uint64_t i, all_num_blocks;
     size_t num_blocks, last_len;
     OCB_BLOCK tmp;

@@ -325,7 +325,7 @@ int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx,
     const unsigned char *in, unsigned char *out,
     size_t len)
 {
-    u64 i, all_num_blocks;
+    uint64_t i, all_num_blocks;
     size_t num_blocks, last_len;

     /*
@@ -420,7 +420,7 @@ int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx,
     const unsigned char *in, unsigned char *out,
     size_t len)
 {
-    u64 i, all_num_blocks;
+    uint64_t i, all_num_blocks;
     size_t num_blocks, last_len;

     /*
diff --git a/crypto/modes/xts128.c b/crypto/modes/xts128.c
index 7b55d1e0b3..f4bc0eccbc 100644
--- a/crypto/modes/xts128.c
+++ b/crypto/modes/xts128.c
@@ -14,9 +14,9 @@

 #ifndef STRICT_ALIGNMENT
 #ifdef __GNUC__
-typedef u64 u64_a1 __attribute((__aligned__(1)));
+typedef uint64_t u64_a1 __attribute((__aligned__(1)));
 #else
-typedef u64 u64_a1;
+typedef uint64_t u64_a1;
 #endif
 #endif

@@ -27,9 +27,9 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx,
 {
     DECLARE_IS_ENDIAN;
     union {
-        u64 u[2];
-        u32 d[4];
-        u8 c[16];
+        uint64_t u[2];
+        uint32_t d[4];
+        uint8_t c[16];
     } tweak, scratch;
     unsigned int i;

@@ -83,15 +83,15 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx,
                  * + substitutes for |, because c is 1 bit
                  */
                 c += ((size_t)tweak.c[i]) << 1;
-                tweak.c[i] = (u8)c;
+                tweak.c[i] = (uint8_t)c;
                 c = c >> 8;
             }
-            tweak.c[0] ^= (u8)(0x87 & (0 - c));
+            tweak.c[0] ^= (uint8_t)(0x87 & (0 - c));
         }
     }
     if (enc) {
         for (i = 0; i < len; ++i) {
-            u8 c = inp[i];
+            uint8_t c = inp[i];
             out[i] = scratch.c[i];
             scratch.c[i] = c;
         }
@@ -103,8 +103,8 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx,
         memcpy(out - 16, scratch.c, 16);
     } else {
         union {
-            u64 u[2];
-            u8 c[16];
+            uint64_t u[2];
+            uint8_t c[16];
         } tweak1;

         if (IS_LITTLE_ENDIAN) {
@@ -122,10 +122,10 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx,
                  * + substitutes for |, because c is 1 bit
                  */
                 c += ((size_t)tweak.c[i]) << 1;
-                tweak1.c[i] = (u8)c;
+                tweak1.c[i] = (uint8_t)c;
                 c = c >> 8;
             }
-            tweak1.c[0] ^= (u8)(0x87 & (0 - c));
+            tweak1.c[0] ^= (uint8_t)(0x87 & (0 - c));
         }
 #if defined(STRICT_ALIGNMENT)
         memcpy(scratch.c, inp, 16);
@@ -140,7 +140,7 @@ int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx,
         scratch.u[1] ^= tweak1.u[1];

         for (i = 0; i < len; ++i) {
-            u8 c = inp[16 + i];
+            uint8_t c = inp[16 + i];
             out[16 + i] = scratch.c[i];
             scratch.c[i] = c;
         }
diff --git a/crypto/modes/xts128gb.c b/crypto/modes/xts128gb.c
index 563077277c..586d69e48c 100644
--- a/crypto/modes/xts128gb.c
+++ b/crypto/modes/xts128gb.c
@@ -14,9 +14,9 @@

 #ifndef STRICT_ALIGNMENT
 #ifdef __GNUC__
-typedef u64 u64_a1 __attribute((__aligned__(1)));
+typedef uint64_t u64_a1 __attribute((__aligned__(1)));
 #else
-typedef u64 u64_a1;
+typedef uint64_t u64_a1;
 #endif
 #endif

@@ -27,9 +27,9 @@ int ossl_crypto_xts128gb_encrypt(const XTS128_CONTEXT *ctx,
 {
     DECLARE_IS_ENDIAN;
     union {
-        u64 u[2];
-        u32 d[4];
-        u8 c[16];
+        uint64_t u[2];
+        uint32_t d[4];
+        uint8_t c[16];
     } tweak, scratch;
     unsigned int i;

@@ -69,18 +69,18 @@ int ossl_crypto_xts128gb_encrypt(const XTS128_CONTEXT *ctx,
             return 0;

         if (IS_LITTLE_ENDIAN) {
-            u8 res;
-            u64 hi, lo;
+            uint8_t res;
+            uint64_t hi, lo;
 #ifdef BSWAP8
             hi = BSWAP8(tweak.u[0]);
             lo = BSWAP8(tweak.u[1]);
 #else
-            u8 *p = tweak.c;
+            uint8_t *p = tweak.c;

-            hi = (u64)GETU32(p) << 32 | GETU32(p + 4);
-            lo = (u64)GETU32(p + 8) << 32 | GETU32(p + 12);
+            hi = (uint64_t)GETU32(p) << 32 | GETU32(p + 4);
+            lo = (uint64_t)GETU32(p + 8) << 32 | GETU32(p + 12);
 #endif
-            res = (u8)lo & 1;
+            res = (uint8_t)lo & 1;
             tweak.u[0] = (lo >> 1) | (hi << 63);
             tweak.u[1] = hi >> 1;
             if (res)
@@ -91,13 +91,13 @@ int ossl_crypto_xts128gb_encrypt(const XTS128_CONTEXT *ctx,
 #else
             p = tweak.c;

-            hi = (u64)GETU32(p) << 32 | GETU32(p + 4);
-            lo = (u64)GETU32(p + 8) << 32 | GETU32(p + 12);
+            hi = (uint64_t)GETU32(p) << 32 | GETU32(p + 4);
+            lo = (uint64_t)GETU32(p + 8) << 32 | GETU32(p + 12);
 #endif
             tweak.u[0] = lo;
             tweak.u[1] = hi;
         } else {
-            u8 carry, res;
+            uint8_t carry, res;
             carry = 0;
             for (i = 0; i < 16; ++i) {
                 res = (tweak.c[i] << 7) & 0x80;
@@ -110,7 +110,7 @@ int ossl_crypto_xts128gb_encrypt(const XTS128_CONTEXT *ctx,
     }
     if (enc) {
         for (i = 0; i < len; ++i) {
-            u8 c = inp[i];
+            uint8_t c = inp[i];
             out[i] = scratch.c[i];
             scratch.c[i] = c;
         }
@@ -122,23 +122,23 @@ int ossl_crypto_xts128gb_encrypt(const XTS128_CONTEXT *ctx,
         memcpy(out - 16, scratch.c, 16);
     } else {
         union {
-            u64 u[2];
-            u8 c[16];
+            uint64_t u[2];
+            uint8_t c[16];
         } tweak1;

         if (IS_LITTLE_ENDIAN) {
-            u8 res;
-            u64 hi, lo;
+            uint8_t res;
+            uint64_t hi, lo;
 #ifdef BSWAP8
             hi = BSWAP8(tweak.u[0]);
             lo = BSWAP8(tweak.u[1]);
 #else
-            u8 *p = tweak.c;
+            uint8_t *p = tweak.c;

-            hi = (u64)GETU32(p) << 32 | GETU32(p + 4);
-            lo = (u64)GETU32(p + 8) << 32 | GETU32(p + 12);
+            hi = (uint64_t)GETU32(p) << 32 | GETU32(p + 4);
+            lo = (uint64_t)GETU32(p + 8) << 32 | GETU32(p + 12);
 #endif
-            res = (u8)lo & 1;
+            res = (uint8_t)lo & 1;
             tweak1.u[0] = (lo >> 1) | (hi << 63);
             tweak1.u[1] = hi >> 1;
             if (res)
@@ -149,13 +149,13 @@ int ossl_crypto_xts128gb_encrypt(const XTS128_CONTEXT *ctx,
 #else
             p = tweak1.c;

-            hi = (u64)GETU32(p) << 32 | GETU32(p + 4);
-            lo = (u64)GETU32(p + 8) << 32 | GETU32(p + 12);
+            hi = (uint64_t)GETU32(p) << 32 | GETU32(p + 4);
+            lo = (uint64_t)GETU32(p + 8) << 32 | GETU32(p + 12);
 #endif
             tweak1.u[0] = lo;
             tweak1.u[1] = hi;
         } else {
-            u8 carry, res;
+            uint8_t carry, res;
             carry = 0;
             for (i = 0; i < 16; ++i) {
                 res = (tweak.c[i] << 7) & 0x80;
@@ -178,7 +178,7 @@ int ossl_crypto_xts128gb_encrypt(const XTS128_CONTEXT *ctx,
         scratch.u[1] ^= tweak1.u[1];

         for (i = 0; i < len; ++i) {
-            u8 c = inp[16 + i];
+            uint8_t c = inp[16 + i];
             out[16 + i] = scratch.c[i];
             scratch.c[i] = c;
         }
diff --git a/crypto/poly1305/poly1305.c b/crypto/poly1305/poly1305.c
index 656dee783c..09167cb9d4 100644
--- a/crypto/poly1305/poly1305.c
+++ b/crypto/poly1305/poly1305.c
@@ -7,6 +7,7 @@
  * https://www.openssl.org/source/license.html
  */

+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <openssl/crypto.h>
@@ -60,8 +61,6 @@ static unsigned int U8TOU32(const unsigned char *p)
  *                                              <https://github.com/dot-asm>
  */

-typedef unsigned int u32;
-
 /*
  * poly1305_blocks processes a multiple of POLY1305_BLOCK_SIZE blocks
  * of |inp| no longer than |len|. Behaviour for |len| not divisible by
@@ -82,7 +81,7 @@ typedef unsigned int u32;
  *      handled locally.
  */
 static void
-poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit);
+poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, uint32_t padbit);

 /*
  * Type-agnostic "rip-off" from constant_time.h
@@ -92,22 +91,21 @@ poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit);

 #if defined(INT64_MAX) && defined(INT128_MAX)

-typedef unsigned long u64;
 typedef uint128_t u128;

 typedef struct {
-    u64 h[3];
-    u64 r[2];
+    uint64_t h[3];
+    uint64_t r[2];
 } poly1305_internal;

 /* pick 32-bit unsigned integer in little endian order */
-static u64 U8TOU64(const unsigned char *p)
+static uint64_t U8TOU64(const unsigned char *p)
 {
-    return (((u64)(p[0] & 0xff)) | ((u64)(p[1] & 0xff) << 8) | ((u64)(p[2] & 0xff) << 16) | ((u64)(p[3] & 0xff) << 24) | ((u64)(p[4] & 0xff) << 32) | ((u64)(p[5] & 0xff) << 40) | ((u64)(p[6] & 0xff) << 48) | ((u64)(p[7] & 0xff) << 56));
+    return (((uint64_t)(p[0] & 0xff)) | ((uint64_t)(p[1] & 0xff) << 8) | ((uint64_t)(p[2] & 0xff) << 16) | ((uint64_t)(p[3] & 0xff) << 24) | ((uint64_t)(p[4] & 0xff) << 32) | ((uint64_t)(p[5] & 0xff) << 40) | ((uint64_t)(p[6] & 0xff) << 48) | ((uint64_t)(p[7] & 0xff) << 56));
 }

 /* store a 32-bit unsigned integer in little endian */
-static void U64TO8(unsigned char *p, u64 v)
+static void U64TO8(unsigned char *p, uint64_t v)
 {
     p[0] = (unsigned char)((v) & 0xff);
     p[1] = (unsigned char)((v >> 8) & 0xff);
@@ -134,12 +132,12 @@ static void poly1305_init(void *ctx, const unsigned char key[16])
 }

 static void
-poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit)
+poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, uint32_t padbit)
 {
     poly1305_internal *st = (poly1305_internal *)ctx;
-    u64 r0, r1;
-    u64 s1;
-    u64 h0, h1, h2, c;
+    uint64_t r0, r1;
+    uint64_t s1;
+    uint64_t h0, h1, h2, c;
     u128 d0, d1;

     r0 = st->r[0];
@@ -153,13 +151,13 @@ poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit)

     while (len >= POLY1305_BLOCK_SIZE) {
         /* h += m[i] */
-        h0 = (u64)(d0 = (u128)h0 + U8TOU64(inp + 0));
-        h1 = (u64)(d1 = (u128)h1 + (d0 >> 64) + U8TOU64(inp + 8));
+        h0 = (uint64_t)(d0 = (u128)h0 + U8TOU64(inp + 0));
+        h1 = (uint64_t)(d1 = (u128)h1 + (d0 >> 64) + U8TOU64(inp + 8));
         /*
          * padbit can be zero only when original len was
          * POLY1305_BLOCK_SIZE, but we don't check
          */
-        h2 += (u64)(d1 >> 64) + padbit;
+        h2 += (uint64_t)(d1 >> 64) + padbit;

         /* h *= r "%" p, where "%" stands for "partial remainder" */
         d0 = ((u128)h0 * r0) + ((u128)h1 * s1);
@@ -168,9 +166,9 @@ poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit)

         /* last reduction step: */
         /* a) h2:h0 = h2<<128 + d1<<64 + d0 */
-        h0 = (u64)d0;
-        h1 = (u64)(d1 += d0 >> 64);
-        h2 += (u64)(d1 >> 64);
+        h0 = (uint64_t)d0;
+        h1 = (uint64_t)(d1 += d0 >> 64);
+        h2 += (uint64_t)(d1 >> 64);
         /* b) (h2:h0 += (h2:h0>>130) * 5) %= 2^130 */
         c = (h2 >> 2) + (h2 & ~3UL);
         h2 &= 3;
@@ -197,22 +195,22 @@ poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit)
 }

 static void poly1305_emit(void *ctx, unsigned char mac[16],
-    const u32 nonce[4])
+    const uint32_t nonce[4])
 {
     poly1305_internal *st = (poly1305_internal *)ctx;
-    u64 h0, h1, h2;
-    u64 g0, g1, g2;
+    uint64_t h0, h1, h2;
+    uint64_t g0, g1, g2;
     u128 t;
-    u64 mask;
+    uint64_t mask;

     h0 = st->h[0];
     h1 = st->h[1];
     h2 = st->h[2];

     /* compare to modulus by computing h + -p */
-    g0 = (u64)(t = (u128)h0 + 5);
-    g1 = (u64)(t = (u128)h1 + (t >> 64));
-    g2 = h2 + (u64)(t >> 64);
+    g0 = (uint64_t)(t = (u128)h0 + 5);
+    g1 = (uint64_t)(t = (u128)h1 + (t >> 64));
+    g2 = h2 + (uint64_t)(t >> 64);

     /* if there was carry into 131st bit, h1:h0 = g1:g0 */
     mask = 0 - (g2 >> 2);
@@ -223,8 +221,8 @@ static void poly1305_emit(void *ctx, unsigned char mac[16],
     h1 = (h1 & mask) | g1;

     /* mac = (h + nonce) % (2^128) */
-    h0 = (u64)(t = (u128)h0 + nonce[0] + ((u64)nonce[1] << 32));
-    h1 = (u64)(t = (u128)h1 + nonce[2] + ((u64)nonce[3] << 32) + (t >> 64));
+    h0 = (uint64_t)(t = (u128)h0 + nonce[0] + ((uint64_t)nonce[1] << 32));
+    h1 = (uint64_t)(t = (u128)h1 + nonce[2] + ((uint64_t)nonce[3] << 32) + (t >> 64));

     U64TO8(mac + 0, h0);
     U64TO8(mac + 8, h1);
@@ -232,17 +230,9 @@ static void poly1305_emit(void *ctx, unsigned char mac[16],

 #else

-#if defined(_WIN32) && !defined(__MINGW32__)
-typedef unsigned __int64 u64;
-#elif defined(__arch64__)
-typedef unsigned long u64;
-#else
-typedef unsigned long long u64;
-#endif
-
 typedef struct {
-    u32 h[5];
-    u32 r[4];
+    uint32_t h[5];
+    uint32_t r[4];
 } poly1305_internal;

 /* store a 32-bit unsigned integer in little endian */
@@ -273,13 +263,13 @@ static void poly1305_init(void *ctx, const unsigned char key[16])
 }

 static void
-poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit)
+poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, uint32_t padbit)
 {
     poly1305_internal *st = (poly1305_internal *)ctx;
-    u32 r0, r1, r2, r3;
-    u32 s1, s2, s3;
-    u32 h0, h1, h2, h3, h4, c;
-    u64 d0, d1, d2, d3;
+    uint32_t r0, r1, r2, r3;
+    uint32_t s1, s2, s3;
+    uint32_t h0, h1, h2, h3, h4, c;
+    uint64_t d0, d1, d2, d3;

     r0 = st->r[0];
     r1 = st->r[1];
@@ -298,26 +288,26 @@ poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit)

     while (len >= POLY1305_BLOCK_SIZE) {
         /* h += m[i] */
-        h0 = (u32)(d0 = (u64)h0 + U8TOU32(inp + 0));
-        h1 = (u32)(d1 = (u64)h1 + (d0 >> 32) + U8TOU32(inp + 4));
-        h2 = (u32)(d2 = (u64)h2 + (d1 >> 32) + U8TOU32(inp + 8));
-        h3 = (u32)(d3 = (u64)h3 + (d2 >> 32) + U8TOU32(inp + 12));
-        h4 += (u32)(d3 >> 32) + padbit;
+        h0 = (uint32_t)(d0 = (uint64_t)h0 + U8TOU32(inp + 0));
+        h1 = (uint32_t)(d1 = (uint64_t)h1 + (d0 >> 32) + U8TOU32(inp + 4));
+        h2 = (uint32_t)(d2 = (uint64_t)h2 + (d1 >> 32) + U8TOU32(inp + 8));
+        h3 = (uint32_t)(d3 = (uint64_t)h3 + (d2 >> 32) + U8TOU32(inp + 12));
+        h4 += (uint32_t)(d3 >> 32) + padbit;

         /* h *= r "%" p, where "%" stands for "partial remainder" */
-        d0 = ((u64)h0 * r0) + ((u64)h1 * s3) + ((u64)h2 * s2) + ((u64)h3 * s1);
-        d1 = ((u64)h0 * r1) + ((u64)h1 * r0) + ((u64)h2 * s3) + ((u64)h3 * s2) + (h4 * s1);
-        d2 = ((u64)h0 * r2) + ((u64)h1 * r1) + ((u64)h2 * r0) + ((u64)h3 * s3) + (h4 * s2);
-        d3 = ((u64)h0 * r3) + ((u64)h1 * r2) + ((u64)h2 * r1) + ((u64)h3 * r0) + (h4 * s3);
+        d0 = ((uint64_t)h0 * r0) + ((uint64_t)h1 * s3) + ((uint64_t)h2 * s2) + ((uint64_t)h3 * s1);
+        d1 = ((uint64_t)h0 * r1) + ((uint64_t)h1 * r0) + ((uint64_t)h2 * s3) + ((uint64_t)h3 * s2) + (h4 * s1);
+        d2 = ((uint64_t)h0 * r2) + ((uint64_t)h1 * r1) + ((uint64_t)h2 * r0) + ((uint64_t)h3 * s3) + (h4 * s2);
+        d3 = ((uint64_t)h0 * r3) + ((uint64_t)h1 * r2) + ((uint64_t)h2 * r1) + ((uint64_t)h3 * r0) + (h4 * s3);
         h4 = (h4 * r0);

         /* last reduction step: */
         /* a) h4:h0 = h4<<128 + d3<<96 + d2<<64 + d1<<32 + d0 */
-        h0 = (u32)d0;
-        h1 = (u32)(d1 += d0 >> 32);
-        h2 = (u32)(d2 += d1 >> 32);
-        h3 = (u32)(d3 += d2 >> 32);
-        h4 += (u32)(d3 >> 32);
+        h0 = (uint32_t)d0;
+        h1 = (uint32_t)(d1 += d0 >> 32);
+        h2 = (uint32_t)(d2 += d1 >> 32);
+        h3 = (uint32_t)(d3 += d2 >> 32);
+        h4 += (uint32_t)(d3 >> 32);
         /* b) (h4:h0 += (h4:h0>>130) * 5) %= 2^130 */
         c = (h4 >> 2) + (h4 & ~3U);
         h4 &= 3;
@@ -348,13 +338,13 @@ poly1305_blocks(void *ctx, const unsigned char *inp, size_t len, u32 padbit)
 }

 static void poly1305_emit(void *ctx, unsigned char mac[16],
-    const u32 nonce[4])
+    const uint32_t nonce[4])
 {
     poly1305_internal *st = (poly1305_internal *)ctx;
-    u32 h0, h1, h2, h3, h4;
-    u32 g0, g1, g2, g3, g4;
-    u64 t;
-    u32 mask;
+    uint32_t h0, h1, h2, h3, h4;
+    uint32_t g0, g1, g2, g3, g4;
+    uint64_t t;
+    uint32_t mask;

     h0 = st->h[0];
     h1 = st->h[1];
@@ -363,11 +353,11 @@ static void poly1305_emit(void *ctx, unsigned char mac[16],
     h4 = st->h[4];

     /* compare to modulus by computing h + -p */
-    g0 = (u32)(t = (u64)h0 + 5);
-    g1 = (u32)(t = (u64)h1 + (t >> 32));
-    g2 = (u32)(t = (u64)h2 + (t >> 32));
-    g3 = (u32)(t = (u64)h3 + (t >> 32));
-    g4 = h4 + (u32)(t >> 32);
+    g0 = (uint32_t)(t = (uint64_t)h0 + 5);
+    g1 = (uint32_t)(t = (uint64_t)h1 + (t >> 32));
+    g2 = (uint32_t)(t = (uint64_t)h2 + (t >> 32));
+    g3 = (uint32_t)(t = (uint64_t)h3 + (t >> 32));
+    g4 = h4 + (uint32_t)(t >> 32);

     /* if there was carry into 131st bit, h3:h0 = g3:g0 */
     mask = 0 - (g4 >> 2);
@@ -382,10 +372,10 @@ static void poly1305_emit(void *ctx, unsigned char mac[16],
     h3 = (h3 & mask) | g3;

     /* mac = (h + nonce) % (2^128) */
-    h0 = (u32)(t = (u64)h0 + nonce[0]);
-    h1 = (u32)(t = (u64)h1 + (t >> 32) + nonce[1]);
-    h2 = (u32)(t = (u64)h2 + (t >> 32) + nonce[2]);
-    h3 = (u32)(t = (u64)h3 + (t >> 32) + nonce[3]);
+    h0 = (uint32_t)(t = (uint64_t)h0 + nonce[0]);
+    h1 = (uint32_t)(t = (uint64_t)h1 + (t >> 32) + nonce[1]);
+    h2 = (uint32_t)(t = (uint64_t)h2 + (t >> 32) + nonce[2]);
+    h3 = (uint32_t)(t = (uint64_t)h3 + (t >> 32) + nonce[3]);

     U32TO8(mac + 0, h0);
     U32TO8(mac + 4, h1);
diff --git a/crypto/poly1305/poly1305_base2_44.c b/crypto/poly1305/poly1305_base2_44.c
index 7e28970fbe..e64f5294d8 100644
--- a/crypto/poly1305/poly1305_base2_44.c
+++ b/crypto/poly1305/poly1305_base2_44.c
@@ -13,29 +13,27 @@
  * slower than compiler-generated base 2^64 code on [high-end] x86_64,
  * even though amount of multiplications is 50% higher. Go figure...
  */
+#include <stdint.h>
 #include <stdlib.h>

-typedef unsigned char u8;
-typedef unsigned int u32;
-typedef unsigned long u64;
 typedef uint128_t u128;

 typedef struct {
-    u64 h[3];
-    u64 s[2];
-    u64 r[3];
+    uint64_t h[3];
+    uint64_t s[2];
+    uint64_t r[3];
 } poly1305_internal;

 #define POLY1305_BLOCK_SIZE 16

 /* pick 64-bit unsigned integer in little endian order */
-static u64 U8TOU64(const unsigned char *p)
+static uint64_t U8TOU64(const unsigned char *p)
 {
-    return (((u64)(p[0] & 0xff)) | ((u64)(p[1] & 0xff) << 8) | ((u64)(p[2] & 0xff) << 16) | ((u64)(p[3] & 0xff) << 24) | ((u64)(p[4] & 0xff) << 32) | ((u64)(p[5] & 0xff) << 40) | ((u64)(p[6] & 0xff) << 48) | ((u64)(p[7] & 0xff) << 56));
+    return (((uint64_t)(p[0] & 0xff)) | ((uint64_t)(p[1] & 0xff) << 8) | ((uint64_t)(p[2] & 0xff) << 16) | ((uint64_t)(p[3] & 0xff) << 24) | ((uint64_t)(p[4] & 0xff) << 32) | ((uint64_t)(p[5] & 0xff) << 40) | ((uint64_t)(p[6] & 0xff) << 48) | ((uint64_t)(p[7] & 0xff) << 56));
 }

 /* store a 64-bit unsigned integer in little endian */
-static void U64TO8(unsigned char *p, u64 v)
+static void U64TO8(unsigned char *p, uint64_t v)
 {
     p[0] = (unsigned char)((v) & 0xff);
     p[1] = (unsigned char)((v >> 8) & 0xff);
@@ -50,7 +48,7 @@ static void U64TO8(unsigned char *p, u64 v)
 int poly1305_init(void *ctx, const unsigned char key[16])
 {
     poly1305_internal *st = (poly1305_internal *)ctx;
-    u64 r0, r1;
+    uint64_t r0, r1;

     /* h = 0 */
     st->h[0] = 0;
@@ -72,14 +70,14 @@ int poly1305_init(void *ctx, const unsigned char key[16])
 }

 void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len,
-    u32 padbit)
+    uint32_t padbit)
 {
     poly1305_internal *st = (poly1305_internal *)ctx;
-    u64 r0, r1, r2;
-    u64 s1, s2;
-    u64 h0, h1, h2, c;
+    uint64_t r0, r1, r2;
+    uint64_t s1, s2;
+    uint64_t h0, h1, h2, c;
     u128 d0, d1, d2;
-    u64 pad = (u64)padbit << 40;
+    uint64_t pad = (uint64_t)padbit << 40;

     r0 = st->r[0];
     r1 = st->r[1];
@@ -93,7 +91,7 @@ void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len,
     h2 = st->h[2];

     while (len >= POLY1305_BLOCK_SIZE) {
-        u64 m0, m1;
+        uint64_t m0, m1;

         m0 = U8TOU64(inp + 0);
         m1 = U8TOU64(inp + 8);
@@ -109,9 +107,9 @@ void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len,
         d2 = ((u128)h0 * r2) + ((u128)h1 * r1) + ((u128)h2 * r0);

         /* "lazy" reduction step */
-        h0 = (u64)d0 & 0x0fffffffffff;
-        h1 = (u64)(d1 += (u64)(d0 >> 44)) & 0x0fffffffffff;
-        h2 = (u64)(d2 += (u64)(d1 >> 44)) & 0x03ffffffffff; /* last 42 bits */
+        h0 = (uint64_t)d0 & 0x0fffffffffff;
+        h1 = (uint64_t)(d1 += (uint64_t)(d0 >> 44)) & 0x0fffffffffff;
+        h2 = (uint64_t)(d2 += (uint64_t)(d1 >> 44)) & 0x03ffffffffff; /* last 42 bits */

         c = (d2 >> 42);
         h0 += c + (c << 2);
@@ -125,29 +123,29 @@ void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len,
     st->h[2] = h2;
 }

-void poly1305_emit(void *ctx, unsigned char mac[16], const u32 nonce[4])
+void poly1305_emit(void *ctx, unsigned char mac[16], const uint32_t nonce[4])
 {
     poly1305_internal *st = (poly1305_internal *)ctx;
-    u64 h0, h1, h2;
-    u64 g0, g1, g2;
+    uint64_t h0, h1, h2;
+    uint64_t g0, g1, g2;
     u128 t;
-    u64 mask;
+    uint64_t mask;

     h0 = st->h[0];
     h1 = st->h[1];
     h2 = st->h[2];

     /* after "lazy" reduction, convert 44+bit digits to 64-bit ones */
-    h0 = (u64)(t = (u128)h0 + (h1 << 44));
+    h0 = (uint64_t)(t = (u128)h0 + (h1 << 44));
     h1 >>= 20;
-    h1 = (u64)(t = (u128)h1 + (h2 << 24) + (t >> 64));
+    h1 = (uint64_t)(t = (u128)h1 + (h2 << 24) + (t >> 64));
     h2 >>= 40;
-    h2 += (u64)(t >> 64);
+    h2 += (uint64_t)(t >> 64);

     /* compare to modulus by computing h + -p */
-    g0 = (u64)(t = (u128)h0 + 5);
-    g1 = (u64)(t = (u128)h1 + (t >> 64));
-    g2 = h2 + (u64)(t >> 64);
+    g0 = (uint64_t)(t = (u128)h0 + 5);
+    g1 = (uint64_t)(t = (u128)h1 + (t >> 64));
+    g2 = h2 + (uint64_t)(t >> 64);

     /* if there was carry into 131st bit, h1:h0 = g1:g0 */
     mask = 0 - (g2 >> 2);
@@ -158,8 +156,8 @@ void poly1305_emit(void *ctx, unsigned char mac[16], const u32 nonce[4])
     h1 = (h1 & mask) | g1;

     /* mac = (h + nonce) % (2^128) */
-    h0 = (u64)(t = (u128)h0 + nonce[0] + ((u64)nonce[1] << 32));
-    h1 = (u64)(t = (u128)h1 + nonce[2] + ((u64)nonce[3] << 32) + (t >> 64));
+    h0 = (uint64_t)(t = (u128)h0 + nonce[0] + ((uint64_t)nonce[1] << 32));
+    h1 = (uint64_t)(t = (u128)h1 + nonce[2] + ((uint64_t)nonce[3] << 32) + (t >> 64));

     U64TO8(mac + 0, h0);
     U64TO8(mac + 8, h1);
diff --git a/crypto/poly1305/poly1305_ieee754.c b/crypto/poly1305/poly1305_ieee754.c
index bd7426466e..16d3d0f5a9 100644
--- a/crypto/poly1305/poly1305_ieee754.c
+++ b/crypto/poly1305/poly1305_ieee754.c
@@ -50,14 +50,12 @@
 #error "this is gcc-specific template"
 #endif

+#include <stdint.h>
 #include <stdlib.h>

-typedef unsigned char u8;
-typedef unsigned int u32;
-typedef unsigned long long u64;
 typedef union {
     double d;
-    u64 u;
+    uint64_t u;
 } elem64;

 #define TWO(p) ((double)(1ULL << (p)))
@@ -70,22 +68,22 @@ typedef union {
 #define EXP(p) ((1023ULL + (p)) << 52)

 #if defined(__x86_64__) || (defined(__PPC__) && defined(__LITTLE_ENDIAN__))
-#define U8TOU32(p) (*(const u32 *)(p))
-#define U32TO8(p, v) (*(u32 *)(p) = (v))
+#define U8TOU32(p) (*(const uint32_t *)(p))
+#define U32TO8(p, v) (*(uint32_t *)(p) = (v))
 #elif defined(__PPC__) || defined(__POWERPC__)
-#define U8TOU32(p) ({u32 ret; asm ("lwbrx	%0,0,%1":"=r"(ret):"b"(p)); ret; })
+#define U8TOU32(p) ({uint32_t ret; asm ("lwbrx	%0,0,%1":"=r"(ret):"b"(p)); ret; })
 #define U32TO8(p, v) asm("stwbrx %0,0,%1" ::"r"(v), "b"(p) : "memory")
 #elif defined(__s390x__)
-#define U8TOU32(p) ({u32 ret; asm ("lrv	%0,%1":"=d"(ret):"m"(*(u32 *)(p))); ret; })
-#define U32TO8(p, v) asm("strv	%1,%0" : "=m"(*(u32 *)(p)) : "d"(v))
+#define U8TOU32(p) ({uint32_t ret; asm ("lrv	%0,%1":"=d"(ret):"m"(*(uint32_t *)(p))); ret; })
+#define U32TO8(p, v) asm("strv	%1,%0" : "=m"(*(uint32_t *)(p)) : "d"(v))
 #endif

 #ifndef U8TOU32
-#define U8TOU32(p) ((u32)(p)[0] | (u32)(p)[1] << 8 | (u32)(p)[2] << 16 | (u32)(p)[3] << 24)
+#define U8TOU32(p) ((uint32_t)(p)[0] | (uint32_t)(p)[1] << 8 | (uint32_t)(p)[2] << 16 | (uint32_t)(p)[3] << 24)
 #endif
 #ifndef U32TO8
-#define U32TO8(p, v) ((p)[0] = (u8)(v), (p)[1] = (u8)((v) >> 8), \
-    (p)[2] = (u8)((v) >> 16), (p)[3] = (u8)((v) >> 24))
+#define U32TO8(p, v) ((p)[0] = (uint8_t)(v), (p)[1] = (uint8_t)((v) >> 8), \
+    (p)[2] = (uint8_t)((v) >> 16), (p)[3] = (uint8_t)((v) >> 24))
 #endif

 typedef struct {
@@ -96,15 +94,15 @@ typedef struct {

 /* "round toward zero (truncate), mask all exceptions" */
 #if defined(__x86_64__)
-static const u32 mxcsr = 0x7f80;
+static const uint32_t mxcsr = 0x7f80;
 #elif defined(__PPC__) || defined(__POWERPC__)
-static const u64 one = 1;
+static const uint64_t one = 1;
 #elif defined(__s390x__)
-static const u32 fpc = 1;
+static const uint32_t fpc = 1;
 #elif defined(__sparc__)
-static const u64 fsr = 1ULL << 30;
+static const uint64_t fsr = 1ULL << 30;
 #elif defined(__mips__)
-static const u32 fcsr = 1;
+static const uint32_t fcsr = 1;
 #else
 #error "unrecognized platform"
 #endif
@@ -132,7 +130,7 @@ int poly1305_init(void *ctx, const unsigned char key[16])
          * set "truncate" rounding mode
          */
 #if defined(__x86_64__)
-        u32 mxcsr_orig;
+        uint32_t mxcsr_orig;

         asm volatile("stmxcsr	%0" : "=m"(mxcsr_orig));
         asm volatile("ldmxcsr	%0" ::"m"(mxcsr));
@@ -142,17 +140,17 @@ int poly1305_init(void *ctx, const unsigned char key[16])
         asm volatile("mffs	%0" : "=f"(fpscr_orig));
         asm volatile("mtfsf	255,%0" ::"f"(fpscr));
 #elif defined(__s390x__)
-        u32 fpc_orig;
+        uint32_t fpc_orig;

         asm volatile("stfpc	%0" : "=m"(fpc_orig));
         asm volatile("lfpc	%0" ::"m"(fpc));
 #elif defined(__sparc__)
-        u64 fsr_orig;
+        uint64_t fsr_orig;

         asm volatile("stx	%%fsr,%0" : "=m"(fsr_orig));
         asm volatile("ldx	%0,%%fsr" ::"m"(fsr));
 #elif defined(__mips__)
-        u32 fcsr_orig;
+        uint32_t fcsr_orig;

         asm volatile("cfc1	%0,$31" : "=r"(fcsr_orig));
         asm volatile("ctc1	%0,$31" ::"r"(fcsr));
@@ -221,7 +219,7 @@ void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len,
 {
     poly1305_internal *st = (poly1305_internal *)ctx;
     elem64 in0, in1, in2, in3;
-    u64 pad = (u64)padbit << 32;
+    uint64_t pad = (uint64_t)padbit << 32;

     double x0, x1, x2, x3;
     double h0lo, h0hi, h1lo, h1hi, h2lo, h2hi, h3lo, h3hi;
@@ -247,7 +245,7 @@ void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len,
      * set "truncate" rounding mode
      */
 #if defined(__x86_64__)
-    u32 mxcsr_orig;
+    uint32_t mxcsr_orig;

     asm volatile("stmxcsr	%0" : "=m"(mxcsr_orig));
     asm volatile("ldmxcsr	%0" ::"m"(mxcsr));
@@ -257,17 +255,17 @@ void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len,
     asm volatile("mffs		%0" : "=f"(fpscr_orig));
     asm volatile("mtfsf	255,%0" ::"f"(fpscr));
 #elif defined(__s390x__)
-    u32 fpc_orig;
+    uint32_t fpc_orig;

     asm volatile("stfpc	%0" : "=m"(fpc_orig));
     asm volatile("lfpc		%0" ::"m"(fpc));
 #elif defined(__sparc__)
-    u64 fsr_orig;
+    uint64_t fsr_orig;

     asm volatile("stx		%%fsr,%0" : "=m"(fsr_orig));
     asm volatile("ldx		%0,%%fsr" ::"m"(fsr));
 #elif defined(__mips__)
-    u32 fcsr_orig;
+    uint32_t fcsr_orig;

     asm volatile("cfc1		%0,$31" : "=r"(fcsr_orig));
     asm volatile("ctc1		%0,$31" ::"r"(fcsr));
@@ -422,13 +420,13 @@ void poly1305_blocks(void *ctx, const unsigned char *inp, size_t len,
 #endif
 }

-void poly1305_emit(void *ctx, unsigned char mac[16], const u32 nonce[4])
+void poly1305_emit(void *ctx, unsigned char mac[16], const uint32_t nonce[4])
 {
     poly1305_internal *st = (poly1305_internal *)ctx;
-    u64 h0, h1, h2, h3, h4;
-    u32 g0, g1, g2, g3, g4;
-    u64 t;
-    u32 mask;
+    uint64_t h0, h1, h2, h3, h4;
+    uint32_t g0, g1, g2, g3, g4;
+    uint64_t t;
+    uint32_t mask;

     /*
      * thanks to bias masking exponent gives integer result
@@ -456,11 +454,11 @@ void poly1305_emit(void *ctx, unsigned char mac[16], const u32 nonce[4])
     h2 &= 0xffffffffU;

     /* compute h + -p */
-    g0 = (u32)(t = h0 + 5);
-    g1 = (u32)(t = h1 + (t >> 32));
-    g2 = (u32)(t = h2 + (t >> 32));
-    g3 = (u32)(t = h3 + (t >> 32));
-    g4 = h4 + (u32)(t >> 32);
+    g0 = (uint32_t)(t = h0 + 5);
+    g1 = (uint32_t)(t = h1 + (t >> 32));
+    g2 = (uint32_t)(t = h2 + (t >> 32));
+    g3 = (uint32_t)(t = h3 + (t >> 32));
+    g4 = h4 + (uint32_t)(t >> 32);

     /* if there was carry, select g0-g3 */
     mask = 0 - (g4 >> 2);
@@ -475,10 +473,10 @@ void poly1305_emit(void *ctx, unsigned char mac[16], const u32 nonce[4])
     g3 |= (h3 & mask);

     /* mac = (h + nonce) % (2^128) */
-    g0 = (u32)(t = (u64)g0 + nonce[0]);
-    g1 = (u32)(t = (u64)g1 + (t >> 32) + nonce[1]);
-    g2 = (u32)(t = (u64)g2 + (t >> 32) + nonce[2]);
-    g3 = (u32)(t = (u64)g3 + (t >> 32) + nonce[3]);
+    g0 = (uint32_t)(t = (uint64_t)g0 + nonce[0]);
+    g1 = (uint32_t)(t = (uint64_t)g1 + (t >> 32) + nonce[1]);
+    g2 = (uint32_t)(t = (uint64_t)g2 + (t >> 32) + nonce[2]);
+    g3 = (uint32_t)(t = (uint64_t)g3 + (t >> 32) + nonce[3]);

     U32TO8(mac + 0, g0);
     U32TO8(mac + 4, g1);
diff --git a/crypto/whrlpool/wp_block.c b/crypto/whrlpool/wp_block.c
index dab8cf9793..13b3f7b37f 100644
--- a/crypto/whrlpool/wp_block.c
+++ b/crypto/whrlpool/wp_block.c
@@ -44,17 +44,9 @@

 #include "internal/cryptlib.h"
 #include "wp_local.h"
+#include <stdint.h>
 #include <string.h>

-typedef unsigned char u8;
-#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32)
-typedef unsigned __int64 u64;
-#elif defined(__arch64__)
-typedef unsigned long u64;
-#else
-typedef unsigned long long u64;
-#endif
-
 #define ROUNDS 10

 #define STRICT_ALIGNMENT
@@ -69,16 +61,16 @@ typedef unsigned long long u64;

 #ifndef STRICT_ALIGNMENT
 #ifdef __GNUC__
-typedef u64 u64_a1 __attribute((__aligned__(1)));
+typedef uint64_t u64_a1 __attribute((__aligned__(1)));
 #else
-typedef u64 u64_a1;
+typedef uint64_t u64_a1;
 #endif
 #endif

 #if defined(__GNUC__) && !defined(STRICT_ALIGNMENT)
-typedef u64 u64_aX __attribute((__aligned__(1)));
+typedef uint64_t u64_aX __attribute((__aligned__(1)));
 #else
-typedef u64 u64_aX;
+typedef uint64_t u64_aX;
 #endif

 #undef SMALL_REGISTER_BANK
@@ -114,7 +106,7 @@ typedef u64 u64_aX;
 #elif defined(__GNUC__) && __GNUC__ >= 2
 #if defined(__x86_64) || defined(__x86_64__)
 #if defined(L_ENDIAN)
-#define ROTATE(a, n) ({ u64 ret; asm ("rolq %1,%0"   \
+#define ROTATE(a, n) ({ uint64_t ret; asm ("rolq %1,%0"   \
                                    : "=r"(ret) : "J"(n),"0"(a) : "cc"); ret; })
 #elif defined(B_ENDIAN)
 /*
@@ -124,15 +116,15 @@ typedef u64 u64_aX;
  * won't do same for x86_64? Naturally no. And this line is waiting
  * ready for that brave soul:-)
  */
-#define ROTATE(a, n) ({ u64 ret; asm ("rorq %1,%0"   \
+#define ROTATE(a, n) ({ uint64_t ret; asm ("rorq %1,%0"   \
                                    : "=r"(ret) : "J"(n),"0"(a) : "cc"); ret; })
 #endif
 #elif defined(__ia64) || defined(__ia64__)
 #if defined(L_ENDIAN)
-#define ROTATE(a, n) ({ u64 ret; asm ("shrp %0=%1,%1,%2"     \
+#define ROTATE(a, n) ({ uint64_t ret; asm ("shrp %0=%1,%1,%2"     \
                                    : "=r"(ret) : "r"(a),"M"(64-(n))); ret; })
 #elif defined(B_ENDIAN)
-#define ROTATE(a, n) ({ u64 ret; asm ("shrp %0=%1,%1,%2"     \
+#define ROTATE(a, n) ({ uint64_t ret; asm ("shrp %0=%1,%1,%2"     \
                                    : "=r"(ret) : "r"(a),"M"(n)); ret; })
 #endif
 #endif
@@ -210,7 +202,7 @@ typedef u64 u64_aX;
 #define N 2
 #define LL(c0, c1, c2, c3, c4, c5, c6, c7) c0, c1, c2, c3, c4, c5, c6, c7, \
                                            c0, c1, c2, c3, c4, c5, c6, c7
-#define C0(K, i) (((u64 *)(Cx.c + 0))[2 * K.c[(i) * 8 + 0]])
+#define C0(K, i) (((uint64_t *)(Cx.c + 0))[2 * K.c[(i) * 8 + 0]])
 #define C1(K, i) (((u64_a1 *)(Cx.c + 7))[2 * K.c[(i) * 8 + 1]])
 #define C2(K, i) (((u64_a1 *)(Cx.c + 6))[2 * K.c[(i) * 8 + 2]])
 #define C3(K, i) (((u64_a1 *)(Cx.c + 5))[2 * K.c[(i) * 8 + 3]])
@@ -221,8 +213,8 @@ typedef u64 u64_aX;
 #endif

 static const union {
-    u8 c[(256 * N + ROUNDS) * sizeof(u64)];
-    u64 q[(256 * N + ROUNDS)];
+    uint8_t c[(256 * N + ROUNDS) * sizeof(uint64_t)];
+    uint64_t q[(256 * N + ROUNDS)];
 } Cx = {
     { /* Note endian-neutral representation:-) */
         LL(0x18, 0x18, 0x60, 0x18, 0xc0, 0x78, 0x30, 0xd8),
@@ -496,10 +488,10 @@ static const union {
 void whirlpool_block(WHIRLPOOL_CTX *ctx, const void *inp, size_t n)
 {
     int r;
-    const u8 *p = inp;
+    const uint8_t *p = inp;
     union {
-        u64 q[8];
-        u8 c[64];
+        uint64_t q[8];
+        uint8_t c[64];
     } S, K, *H = (void *)ctx->H.q;

 #ifdef GO_FOR_MMX
@@ -507,7 +499,7 @@ void whirlpool_block(WHIRLPOOL_CTX *ctx, const void *inp, size_t n)
 #endif
     do {
 #ifdef OPENSSL_SMALL_FOOTPRINT
-        u64 L[8];
+        uint64_t L[8];
         int i;

         for (i = 0; i < 64; i++)
@@ -526,7 +518,7 @@ void whirlpool_block(WHIRLPOOL_CTX *ctx, const void *inp, size_t n)
         for (i = 0; i < 64; i++)
             H->c[i] ^= S.c[i] ^ p[i];
 #else
-        u64 L0, L1, L2, L3, L4, L5, L6, L7;
+        uint64_t L0, L1, L2, L3, L4, L5, L6, L7;

 #ifdef STRICT_ALIGNMENT
         if ((size_t)p & 7) {
diff --git a/include/crypto/aes_platform.h b/include/crypto/aes_platform.h
index de65183417..13a31c5708 100644
--- a/include/crypto/aes_platform.h
+++ b/include/crypto/aes_platform.h
@@ -84,12 +84,12 @@ void AES_xts_decrypt(const unsigned char *inp, unsigned char *out, size_t len,
 #define AES_GCM_DEC_BYTES 128
 size_t ppc_aes_gcm_encrypt(const unsigned char *in, unsigned char *out,
     size_t len, const void *key, unsigned char ivec[16],
-    u64 *Xi);
+    uint64_t *Xi);
 size_t ppc_aes_gcm_decrypt(const unsigned char *in, unsigned char *out,
     size_t len, const void *key, unsigned char ivec[16],
-    u64 *Xi);
+    uint64_t *Xi);
 #define AES_GCM_ASM_PPC(gctx) ((gctx)->ctr == aes_p8_ctr32_encrypt_blocks && (gctx)->gcm.funcs.ghash == gcm_ghash_p8)
-void gcm_ghash_p8(u64 Xi[2], const u128 Htable[16], const u8 *inp, size_t len);
+void gcm_ghash_p8(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp, size_t len);
 #endif /* OPENSSL_SYS_AIX || OPENSSL_SYS_MACOSX */
 #endif /* PPC */

@@ -157,10 +157,10 @@ size_t unroll8_eor3_aes_gcm_dec_192_kernel(const uint8_t *ciphertext, uint64_t p
 size_t unroll8_eor3_aes_gcm_dec_256_kernel(const uint8_t *ciphertext, uint64_t plaintext_length, uint8_t *plaintext,
     uint64_t *Xi, unsigned char ivec[16], const void *key);
 size_t armv8_aes_gcm_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key,
-    unsigned char ivec[16], u64 *Xi);
+    unsigned char ivec[16], uint64_t *Xi);
 size_t armv8_aes_gcm_decrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key,
-    unsigned char ivec[16], u64 *Xi);
-void gcm_ghash_v8(u64 Xi[2], const u128 Htable[16], const u8 *inp, size_t len);
+    unsigned char ivec[16], uint64_t *Xi);
+void gcm_ghash_v8(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp, size_t len);
 #endif
 #endif
 #endif
@@ -286,10 +286,10 @@ void aesni_ccm64_decrypt_blocks(const unsigned char *in,

 #if defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64)
 size_t aesni_gcm_encrypt(const unsigned char *in, unsigned char *out, size_t len,
-    const void *key, unsigned char ivec[16], u64 *Xi);
+    const void *key, unsigned char ivec[16], uint64_t *Xi);
 size_t aesni_gcm_decrypt(const unsigned char *in, unsigned char *out, size_t len,
-    const void *key, unsigned char ivec[16], u64 *Xi);
-void gcm_ghash_avx(u64 Xi[2], const u128 Htable[16], const u8 *in, size_t len);
+    const void *key, unsigned char ivec[16], uint64_t *Xi);
+void gcm_ghash_avx(uint64_t Xi[2], const u128 Htable[16], const uint8_t *in, size_t len);

 #define AES_gcm_encrypt aesni_gcm_encrypt
 #define AES_gcm_decrypt aesni_gcm_decrypt
@@ -478,12 +478,12 @@ void rv64i_zvkb_zvkned_ctr32_encrypt_blocks(const unsigned char *in,
 size_t rv64i_zvkb_zvkg_zvkned_aes_gcm_encrypt(const unsigned char *in,
     unsigned char *out, size_t len,
     const void *key,
-    unsigned char ivec[16], u64 *Xi);
+    unsigned char ivec[16], uint64_t *Xi);

 size_t rv64i_zvkb_zvkg_zvkned_aes_gcm_decrypt(const unsigned char *in,
     unsigned char *out, size_t len,
     const void *key,
-    unsigned char ivec[16], u64 *Xi);
+    unsigned char ivec[16], uint64_t *Xi);

 void rv64i_zvbb_zvkg_zvkned_aes_xts_encrypt(const unsigned char *in,
     unsigned char *out, size_t length,
@@ -497,7 +497,7 @@ void rv64i_zvbb_zvkg_zvkned_aes_xts_decrypt(const unsigned char *in,
     const AES_KEY *key2,
     const unsigned char iv[16]);

-void gcm_ghash_rv64i_zvkg(u64 Xi[2], const u128 Htable[16], const u8 *inp,
+void gcm_ghash_rv64i_zvkg(uint64_t Xi[2], const u128 Htable[16], const uint8_t *inp,
     size_t len);

 #define AES_GCM_ENC_BYTES 64
diff --git a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha1_hw.c b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha1_hw.c
index c3acebf278..47ab95d6fa 100644
--- a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha1_hw.c
+++ b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha1_hw.c
@@ -112,7 +112,7 @@ typedef struct {
     const unsigned char *inp;
     unsigned char *out;
     int blocks;
-    u64 iv[2];
+    uint64_t iv[2];
 } CIPH_DESC;

 void sha1_multi_block(SHA1_MB_CTX *, const HASH_DESC *, int);
@@ -129,17 +129,17 @@ static size_t tls1_multi_block_encrypt(void *vctx,
     CIPH_DESC ciph_d[8];
     unsigned char storage[sizeof(SHA1_MB_CTX) + 32];
     union {
-        u64 q[16];
-        u32 d[32];
-        u8 c[128];
+        uint64_t q[16];
+        uint32_t d[32];
+        uint8_t c[128];
     } blocks[8];
     SHA1_MB_CTX *mctx;
     unsigned int frag, last, packlen, i;
     unsigned int x4 = 4 * n4x, minblocks, processed = 0;
     size_t ret = 0;
-    u8 *IVs;
+    uint8_t *IVs;
 #if defined(BSWAP8)
-    u64 seqnum;
+    uint64_t seqnum;
 #endif

     /* ask for IVs in bulk */
@@ -195,16 +195,16 @@ static size_t tls1_multi_block_encrypt(void *vctx,
         blocks[i].q[0] = BSWAP8(seqnum + i);
 #else
         for (carry = i, j = 8; j--;) {
-            blocks[i].c[j] = ((u8 *)sctx->md.data)[j] + carry;
+            blocks[i].c[j] = ((uint8_t *)sctx->md.data)[j] + carry;
             carry = (blocks[i].c[j] - carry) >> (sizeof(carry) * 8 - 1);
         }
 #endif
-        blocks[i].c[8] = ((u8 *)sctx->md.data)[8];
-        blocks[i].c[9] = ((u8 *)sctx->md.data)[9];
-        blocks[i].c[10] = ((u8 *)sctx->md.data)[10];
+        blocks[i].c[8] = ((uint8_t *)sctx->md.data)[8];
+        blocks[i].c[9] = ((uint8_t *)sctx->md.data)[9];
+        blocks[i].c[10] = ((uint8_t *)sctx->md.data)[10];
         /* fix length */
-        blocks[i].c[11] = (u8)(len >> 8);
-        blocks[i].c[12] = (u8)(len);
+        blocks[i].c[11] = (uint8_t)(len >> 8);
+        blocks[i].c[12] = (uint8_t)(len);

         memcpy(blocks[i].c + 13, hash_d[i].ptr, 64 - 13);
         hash_d[i].ptr += 64 - 13;
@@ -349,11 +349,11 @@ static size_t tls1_multi_block_encrypt(void *vctx,
         len += 16; /* account for explicit iv */

         /* arrange header */
-        out0[0] = ((u8 *)sctx->md.data)[8];
-        out0[1] = ((u8 *)sctx->md.data)[9];
-        out0[2] = ((u8 *)sctx->md.data)[10];
-        out0[3] = (u8)(len >> 8);
-        out0[4] = (u8)(len);
+        out0[0] = ((uint8_t *)sctx->md.data)[8];
+        out0[1] = ((uint8_t *)sctx->md.data)[9];
+        out0[2] = ((uint8_t *)sctx->md.data)[10];
+        out0[3] = (uint8_t)(len >> 8);
+        out0[4] = (uint8_t)(len);

         ret += len + 5;
         inp += frag;
diff --git a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha256_hw.c b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha256_hw.c
index b51e6d2809..15d75d6372 100644
--- a/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha256_hw.c
+++ b/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha256_hw.c
@@ -116,7 +116,7 @@ typedef struct {
     const unsigned char *inp;
     unsigned char *out;
     int blocks;
-    u64 iv[2];
+    uint64_t iv[2];
 } CIPH_DESC;

 void sha256_multi_block(SHA256_MB_CTX *, const HASH_DESC *, int);
@@ -133,17 +133,17 @@ static size_t tls1_multi_block_encrypt(void *vctx,
     CIPH_DESC ciph_d[8];
     unsigned char storage[sizeof(SHA256_MB_CTX) + 32];
     union {
-        u64 q[16];
-        u32 d[32];
-        u8 c[128];
+        uint64_t q[16];
+        uint32_t d[32];
+        uint8_t c[128];
     } blocks[8];
     SHA256_MB_CTX *mctx;
     unsigned int frag, last, packlen, i;
     unsigned int x4 = 4 * n4x, minblocks, processed = 0;
     size_t ret = 0;
-    u8 *IVs;
+    uint8_t *IVs;
 #if defined(BSWAP8)
-    u64 seqnum;
+    uint64_t seqnum;
 #endif

     /* ask for IVs in bulk */
@@ -203,16 +203,16 @@ static size_t tls1_multi_block_encrypt(void *vctx,
         blocks[i].q[0] = BSWAP8(seqnum + i);
 #else
         for (carry = i, j = 8; j--;) {
-            blocks[i].c[j] = ((u8 *)sctx->md.data)[j] + carry;
+            blocks[i].c[j] = ((uint8_t *)sctx->md.data)[j] + carry;
             carry = (blocks[i].c[j] - carry) >> (sizeof(carry) * 8 - 1);
         }
 #endif
-        blocks[i].c[8] = ((u8 *)sctx->md.data)[8];
-        blocks[i].c[9] = ((u8 *)sctx->md.data)[9];
-        blocks[i].c[10] = ((u8 *)sctx->md.data)[10];
+        blocks[i].c[8] = ((uint8_t *)sctx->md.data)[8];
+        blocks[i].c[9] = ((uint8_t *)sctx->md.data)[9];
+        blocks[i].c[10] = ((uint8_t *)sctx->md.data)[10];
         /* fix length */
-        blocks[i].c[11] = (u8)(len >> 8);
-        blocks[i].c[12] = (u8)(len);
+        blocks[i].c[11] = (uint8_t)(len >> 8);
+        blocks[i].c[12] = (uint8_t)(len);

         memcpy(blocks[i].c + 13, hash_d[i].ptr, 64 - 13);
         hash_d[i].ptr += 64 - 13;
@@ -372,11 +372,11 @@ static size_t tls1_multi_block_encrypt(void *vctx,
         len += 16; /* account for explicit iv */

         /* arrange header */
-        out0[0] = ((u8 *)sctx->md.data)[8];
-        out0[1] = ((u8 *)sctx->md.data)[9];
-        out0[2] = ((u8 *)sctx->md.data)[10];
-        out0[3] = (u8)(len >> 8);
-        out0[4] = (u8)(len);
+        out0[0] = ((uint8_t *)sctx->md.data)[8];
+        out0[1] = ((uint8_t *)sctx->md.data)[9];
+        out0[2] = ((uint8_t *)sctx->md.data)[10];
+        out0[3] = (uint8_t)(len >> 8);
+        out0[4] = (uint8_t)(len);

         ret += len + 5;
         inp += frag;
diff --git a/providers/implementations/ciphers/cipher_aes_gcm_hw_armv8.inc b/providers/implementations/ciphers/cipher_aes_gcm_hw_armv8.inc
index 60fff493d8..42a305a00d 100644
--- a/providers/implementations/ciphers/cipher_aes_gcm_hw_armv8.inc
+++ b/providers/implementations/ciphers/cipher_aes_gcm_hw_armv8.inc
@@ -13,7 +13,7 @@
  */

 size_t armv8_aes_gcm_encrypt(const unsigned char *in, unsigned char *out, size_t len,
-                             const void *key, unsigned char ivec[16], u64 *Xi)
+                             const void *key, unsigned char ivec[16], uint64_t *Xi)
 {
     AES_KEY *aes_key = (AES_KEY *)key;
     size_t align_bytes = len - len % 16;
@@ -45,7 +45,7 @@ size_t armv8_aes_gcm_encrypt(const unsigned char *in, unsigned char *out, size_t
 }

 size_t armv8_aes_gcm_decrypt(const unsigned char *in, unsigned char *out, size_t len,
-                             const void *key, unsigned char ivec[16], u64 *Xi)
+                             const void *key, unsigned char ivec[16], uint64_t *Xi)
 {
     AES_KEY *aes_key = (AES_KEY *)key;
     size_t align_bytes = len - len % 16;
diff --git a/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc b/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc
index 6279629e50..4d1238a744 100644
--- a/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc
+++ b/providers/implementations/ciphers/cipher_aes_gcm_hw_ppc.inc
@@ -23,14 +23,14 @@ static int aes_ppc_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
     return 1;
 }

-static inline u32 UTO32(unsigned char *buf)
+static inline uint32_t UTO32(unsigned char *buf)
 {
-    return ((u32) buf[0] << 24) | ((u32) buf[1] << 16) | ((u32) buf[2] << 8) | ((u32) buf[3]);
+    return ((uint32_t) buf[0] << 24) | ((uint32_t) buf[1] << 16) | ((uint32_t) buf[2] << 8) | ((uint32_t) buf[3]);
 }

-static inline u32 add32TOU(unsigned char buf[4], u32 n)
+static inline uint32_t add32TOU(unsigned char buf[4], uint32_t n)
 {
-    u32 r;
+    uint32_t r;

     r = UTO32(buf);
     r += n;
@@ -42,20 +42,20 @@ static inline u32 add32TOU(unsigned char buf[4], u32 n)
 }

 static size_t ppc_aes_gcm_crypt(const unsigned char *in, unsigned char *out, size_t len,
-                                const void *key, unsigned char ivec[16], u64 *Xi, int encrypt)
+                                const void *key, unsigned char ivec[16], uint64_t *Xi, int encrypt)
 {
     size_t s = 0;
     size_t ndone = 0;
     int ctr_reset = 0;
-    u64 blocks_unused;
-    u64 nb = len / 16;
-    u64 next_ctr = 0;
+    uint64_t blocks_unused;
+    uint64_t nb = len / 16;
+    uint64_t next_ctr = 0;
     unsigned char ctr_saved[12];

     memcpy(ctr_saved, ivec, 12);

     while (nb) {
-        blocks_unused = (u64) 0xffffffffU + 1 - (u64) UTO32 (ivec + 12);
+        blocks_unused = (uint64_t) 0xffffffffU + 1 - (uint64_t) UTO32 (ivec + 12);
         if (nb > blocks_unused) {
             len = blocks_unused * 16;
             nb -= blocks_unused;
@@ -71,7 +71,7 @@ static size_t ppc_aes_gcm_crypt(const unsigned char *in, unsigned char *out, siz
                     : ppc_aes_gcm_decrypt(in, out, len, key, ivec, Xi);

         /* add counter to ivec */
-        add32TOU(ivec + 12, (u32) next_ctr);
+        add32TOU(ivec + 12, (uint32_t) next_ctr);
         if (ctr_reset) {
             ctr_reset = 0;
             in += len;
diff --git a/providers/implementations/ciphers/cipher_aes_gcm_hw_vaes_avx512.inc b/providers/implementations/ciphers/cipher_aes_gcm_hw_vaes_avx512.inc
index df98cdec50..5406548f3e 100644
--- a/providers/implementations/ciphers/cipher_aes_gcm_hw_vaes_avx512.inc
+++ b/providers/implementations/ciphers/cipher_aes_gcm_hw_vaes_avx512.inc
@@ -39,7 +39,7 @@ void ossl_aes_gcm_update_aad_avx512(void *gcm128ctx, const unsigned char *aad,
                                     size_t aadlen);
 void ossl_aes_gcm_finalize_avx512(void *gcm128ctx, unsigned int pblocklen);

-void ossl_gcm_gmult_avx512(u64 Xi[2], const void *gcm128ctx);
+void ossl_gcm_gmult_avx512(uint64_t Xi[2], const void *gcm128ctx);

 static int vaes_gcm_setkey(PROV_GCM_CTX *ctx, const unsigned char *key,
                            size_t keylen)
@@ -86,7 +86,7 @@ static int vaes_gcm_aadupdate(PROV_GCM_CTX *ctx,
                               size_t aad_len)
 {
     GCM128_CONTEXT *gcmctx = &ctx->gcm;
-    u64 alen = gcmctx->len.u[0];
+    uint64_t alen = gcmctx->len.u[0];
     unsigned int ares;
     size_t i, lenBlks;

@@ -146,7 +146,7 @@ static int vaes_gcm_cipherupdate(PROV_GCM_CTX *ctx, const unsigned char *in,
                                  size_t len, unsigned char *out)
 {
     GCM128_CONTEXT *gcmctx = &ctx->gcm;
-    u64 mlen = gcmctx->len.u[1];
+    uint64_t mlen = gcmctx->len.u[1];

     mlen += len;
     if (mlen > ((U64(1) << 36) - 32) || (mlen < len))
diff --git a/providers/implementations/ciphers/cipher_aes_gcm_siv_polyval.c b/providers/implementations/ciphers/cipher_aes_gcm_siv_polyval.c
index 5c9988cabf..08188c8aaf 100644
--- a/providers/implementations/ciphers/cipher_aes_gcm_siv_polyval.c
+++ b/providers/implementations/ciphers/cipher_aes_gcm_siv_polyval.c
@@ -71,7 +71,7 @@ void ossl_polyval_ghash_init(u128 Htable[16], const uint64_t H[2])
         tmp[1] = GSWAP8(tmp[1]);
     }

-    ossl_gcm_init_4bit(Htable, (u64 *)tmp);
+    ossl_gcm_init_4bit(Htable, (uint64_t *)tmp);
 }

 /* Implementation of POLYVAL via existing GHASH implementation */
@@ -89,7 +89,7 @@ void ossl_polyval_ghash_hash(const u128 Htable[16], uint8_t *tag, const uint8_t
      */
     for (i = 0; i < len; i += 16) {
         byte_reverse16((uint8_t *)tmp, &inp[i]);
-        ossl_gcm_ghash_4bit((u64 *)out, Htable, (uint8_t *)tmp, 16);
+        ossl_gcm_ghash_4bit((uint64_t *)out, Htable, (uint8_t *)tmp, 16);
     }
     byte_reverse16(tag, (uint8_t *)out);
 }
diff --git a/providers/implementations/rands/drbg_ctr.c b/providers/implementations/rands/drbg_ctr.c
index ff81e44189..f99f8f198f 100644
--- a/providers/implementations/rands/drbg_ctr.c
+++ b/providers/implementations/rands/drbg_ctr.c
@@ -71,12 +71,12 @@ typedef struct rand_drbg_ctr_st {
 static void inc_128(PROV_DRBG_CTR *ctr)
 {
     unsigned char *p = &ctr->V[0];
-    u32 n = 16, c = 1;
+    uint32_t n = 16, c = 1;

     do {
         --n;
         c += p[n];
-        p[n] = (u8)c;
+        p[n] = (uint8_t)c;
         c >>= 8;
     } while (n);
 }
@@ -391,12 +391,12 @@ static int drbg_ctr_reseed_wrapper(void *vdrbg, int prediction_resistance,

 static void ctr96_inc(unsigned char *counter)
 {
-    u32 n = 12, c = 1;
+    uint32_t n = 12, c = 1;

     do {
         --n;
         c += counter[n];
-        counter[n] = (u8)c;
+        counter[n] = (uint8_t)c;
         c >>= 8;
     } while (n);
 }
diff --git a/test/modes_internal_test.c b/test/modes_internal_test.c
index ae0b8fcc81..211ba6dbf6 100644
--- a/test/modes_internal_test.c
+++ b/test/modes_internal_test.c
@@ -273,8 +273,8 @@ static int test_aes_cts128_nist(int idx)
  */

 /* Test Case 1 */
-static const u8 K1[16], P1[] = { 0 }, A1[] = { 0 }, IV1[12], C1[] = { 0 };
-static const u8 T1[] = {
+static const uint8_t K1[16], P1[] = { 0 }, A1[] = { 0 }, IV1[12], C1[] = { 0 };
+static const uint8_t T1[] = {
     0x58, 0xe2, 0xfc, 0xce, 0xfa, 0x7e, 0x30, 0x61,
     0x36, 0x7f, 0x1d, 0x57, 0xa4, 0xe7, 0x45, 0x5a
 };
@@ -283,25 +283,25 @@ static const u8 T1[] = {
 #define K2 K1
 #define A2 A1
 #define IV2 IV1
-static const u8 P2[16];
-static const u8 C2[] = {
+static const uint8_t P2[16];
+static const uint8_t C2[] = {
     0x03, 0x88, 0xda, 0xce, 0x60, 0xb6, 0xa3, 0x92,
     0xf3, 0x28, 0xc2, 0xb9, 0x71, 0xb2, 0xfe, 0x78
 };

-static const u8 T2[] = {
+static const uint8_t T2[] = {
     0xab, 0x6e, 0x47, 0xd4, 0x2c, 0xec, 0x13, 0xbd,
     0xf5, 0x3a, 0x67, 0xb2, 0x12, 0x57, 0xbd, 0xdf
 };

 /* Test Case 3 */
 #define A3 A2
-static const u8 K3[] = {
+static const uint8_t K3[] = {
     0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
     0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08
 };

-static const u8 P3[] = {
+static const uint8_t P3[] = {
     0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
@@ -312,12 +312,12 @@ static const u8 P3[] = {
     0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55
 };

-static const u8 IV3[] = {
+static const uint8_t IV3[] = {
     0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
     0xde, 0xca, 0xf8, 0x88
 };

-static const u8 C3[] = {
+static const uint8_t C3[] = {
     0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24,
     0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c,
     0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0,
@@ -328,7 +328,7 @@ static const u8 C3[] = {
     0x3d, 0x58, 0xe0, 0x91, 0x47, 0x3f, 0x59, 0x85
 };

-static const u8 T3[] = {
+static const uint8_t T3[] = {
     0x4d, 0x5c, 0x2a, 0xf3, 0x27, 0xcd, 0x64, 0xa6,
     0x2c, 0xf3, 0x5a, 0xbd, 0x2b, 0xa6, 0xfa, 0xb4
 };
@@ -336,7 +336,7 @@ static const u8 T3[] = {
 /* Test Case 4 */
 #define K4 K3
 #define IV4 IV3
-static const u8 P4[] = {
+static const uint8_t P4[] = {
     0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
@@ -347,13 +347,13 @@ static const u8 P4[] = {
     0xba, 0x63, 0x7b, 0x39
 };

-static const u8 A4[] = {
+static const uint8_t A4[] = {
     0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
     0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
     0xab, 0xad, 0xda, 0xd2
 };

-static const u8 C4[] = {
+static const uint8_t C4[] = {
     0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24,
     0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c,
     0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0,
@@ -364,7 +364,7 @@ static const u8 C4[] = {
     0x3d, 0x58, 0xe0, 0x91
 };

-static const u8 T4[] = {
+static const uint8_t T4[] = {
     0x5b, 0xc9, 0x4f, 0xbc, 0x32, 0x21, 0xa5, 0xdb,
     0x94, 0xfa, 0xe9, 0x5a, 0xe7, 0x12, 0x1a, 0x47
 };
@@ -373,11 +373,11 @@ static const u8 T4[] = {
 #define K5 K4
 #define P5 P4
 #define A5 A4
-static const u8 IV5[] = {
+static const uint8_t IV5[] = {
     0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad
 };

-static const u8 C5[] = {
+static const uint8_t C5[] = {
     0x61, 0x35, 0x3b, 0x4c, 0x28, 0x06, 0x93, 0x4a,
     0x77, 0x7f, 0xf5, 0x1f, 0xa2, 0x2a, 0x47, 0x55,
     0x69, 0x9b, 0x2a, 0x71, 0x4f, 0xcd, 0xc6, 0xf8,
@@ -388,7 +388,7 @@ static const u8 C5[] = {
     0xc2, 0x3f, 0x45, 0x98
 };

-static const u8 T5[] = {
+static const uint8_t T5[] = {
     0x36, 0x12, 0xd2, 0xe7, 0x9e, 0x3b, 0x07, 0x85,
     0x56, 0x1b, 0xe1, 0x4a, 0xac, 0xa2, 0xfc, 0xcb
 };
@@ -397,7 +397,7 @@ static const u8 T5[] = {
 #define K6 K5
 #define P6 P5
 #define A6 A5
-static const u8 IV6[] = {
+static const uint8_t IV6[] = {
     0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5,
     0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa,
     0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1,
@@ -408,7 +408,7 @@ static const u8 IV6[] = {
     0xa6, 0x37, 0xb3, 0x9b
 };

-static const u8 C6[] = {
+static const uint8_t C6[] = {
     0x8c, 0xe2, 0x49, 0x98, 0x62, 0x56, 0x15, 0xb6,
     0x03, 0xa0, 0x33, 0xac, 0xa1, 0x3f, 0xb8, 0x94,
     0xbe, 0x91, 0x12, 0xa5, 0xc3, 0xa2, 0x11, 0xa8,
@@ -419,14 +419,14 @@ static const u8 C6[] = {
     0x4c, 0x34, 0xae, 0xe5
 };

-static const u8 T6[] = {
+static const uint8_t T6[] = {
     0x61, 0x9c, 0xc5, 0xae, 0xff, 0xfe, 0x0b, 0xfa,
     0x46, 0x2a, 0xf4, 0x3c, 0x16, 0x99, 0xd0, 0x50
 };

 /* Test Case 7 */
-static const u8 K7[24], P7[] = { 0 }, A7[] = { 0 }, IV7[12], C7[] = { 0 };
-static const u8 T7[] = {
+static const uint8_t K7[24], P7[] = { 0 }, A7[] = { 0 }, IV7[12], C7[] = { 0 };
+static const uint8_t T7[] = {
     0xcd, 0x33, 0xb2, 0x8a, 0xc7, 0x73, 0xf7, 0x4b,
     0xa0, 0x0e, 0xd1, 0xf3, 0x12, 0x57, 0x24, 0x35
 };
@@ -435,26 +435,26 @@ static const u8 T7[] = {
 #define K8 K7
 #define IV8 IV7
 #define A8 A7
-static const u8 P8[16];
-static const u8 C8[] = {
+static const uint8_t P8[16];
+static const uint8_t C8[] = {
     0x98, 0xe7, 0x24, 0x7c, 0x07, 0xf0, 0xfe, 0x41,
     0x1c, 0x26, 0x7e, 0x43, 0x84, 0xb0, 0xf6, 0x00
 };

-static const u8 T8[] = {
+static const uint8_t T8[] = {
     0x2f, 0xf5, 0x8d, 0x80, 0x03, 0x39, 0x27, 0xab,
     0x8e, 0xf4, 0xd4, 0x58, 0x75, 0x14, 0xf0, 0xfb
 };

 /* Test Case 9 */
 #define A9 A8
-static const u8 K9[] = {
+static const uint8_t K9[] = {
     0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
     0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
     0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c
 };

-static const u8 P9[] = {
+static const uint8_t P9[] = {
     0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
@@ -465,12 +465,12 @@ static const u8 P9[] = {
     0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55
 };

-static const u8 IV9[] = {
+static const uint8_t IV9[] = {
     0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
     0xde, 0xca, 0xf8, 0x88
 };

-static const u8 C9[] = {
+static const uint8_t C9[] = {
     0x39, 0x80, 0xca, 0x0b, 0x3c, 0x00, 0xe8, 0x41,
     0xeb, 0x06, 0xfa, 0xc4, 0x87, 0x2a, 0x27, 0x57,
     0x85, 0x9e, 0x1c, 0xea, 0xa6, 0xef, 0xd9, 0x84,
@@ -481,7 +481,7 @@ static const u8 C9[] = {
     0xcc, 0xda, 0x27, 0x10, 0xac, 0xad, 0xe2, 0x56
 };

-static const u8 T9[] = {
+static const uint8_t T9[] = {
     0x99, 0x24, 0xa7, 0xc8, 0x58, 0x73, 0x36, 0xbf,
     0xb1, 0x18, 0x02, 0x4d, 0xb8, 0x67, 0x4a, 0x14
 };
@@ -489,7 +489,7 @@ static const u8 T9[] = {
 /* Test Case 10 */
 #define K10 K9
 #define IV10 IV9
-static const u8 P10[] = {
+static const uint8_t P10[] = {
     0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
@@ -500,13 +500,13 @@ static const u8 P10[] = {
     0xba, 0x63, 0x7b, 0x39
 };

-static const u8 A10[] = {
+static const uint8_t A10[] = {
     0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
     0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
     0xab, 0xad, 0xda, 0xd2
 };

-static const u8 C10[] = {
+static const uint8_t C10[] = {
     0x39, 0x80, 0xca, 0x0b, 0x3c, 0x00, 0xe8, 0x41,
     0xeb, 0x06, 0xfa, 0xc4, 0x87, 0x2a, 0x27, 0x57,
     0x85, 0x9e, 0x1c, 0xea, 0xa6, 0xef, 0xd9, 0x84,
@@ -517,7 +517,7 @@ static const u8 C10[] = {
     0xcc, 0xda, 0x27, 0x10
 };

-static const u8 T10[] = {
+static const uint8_t T10[] = {
     0x25, 0x19, 0x49, 0x8e, 0x80, 0xf1, 0x47, 0x8f,
     0x37, 0xba, 0x55, 0xbd, 0x6d, 0x27, 0x61, 0x8c
 };
@@ -526,9 +526,9 @@ static const u8 T10[] = {
 #define K11 K10
 #define P11 P10
 #define A11 A10
-static const u8 IV11[] = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad };
+static const uint8_t IV11[] = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad };

-static const u8 C11[] = {
+static const uint8_t C11[] = {
     0x0f, 0x10, 0xf5, 0x99, 0xae, 0x14, 0xa1, 0x54,
     0xed, 0x24, 0xb3, 0x6e, 0x25, 0x32, 0x4d, 0xb8,
     0xc5, 0x66, 0x63, 0x2e, 0xf2, 0xbb, 0xb3, 0x4f,
@@ -539,7 +539,7 @@ static const u8 C11[] = {
     0xa0, 0xf0, 0x62, 0xf7
 };

-static const u8 T11[] = {
+static const uint8_t T11[] = {
     0x65, 0xdc, 0xc5, 0x7f, 0xcf, 0x62, 0x3a, 0x24,
     0x09, 0x4f, 0xcc, 0xa4, 0x0d, 0x35, 0x33, 0xf8
 };
@@ -548,7 +548,7 @@ static const u8 T11[] = {
 #define K12 K11
 #define P12 P11
 #define A12 A11
-static const u8 IV12[] = {
+static const uint8_t IV12[] = {
     0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5,
     0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa,
     0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1,
@@ -559,7 +559,7 @@ static const u8 IV12[] = {
     0xa6, 0x37, 0xb3, 0x9b
 };

-static const u8 C12[] = {
+static const uint8_t C12[] = {
     0xd2, 0x7e, 0x88, 0x68, 0x1c, 0xe3, 0x24, 0x3c,
     0x48, 0x30, 0x16, 0x5a, 0x8f, 0xdc, 0xf9, 0xff,
     0x1d, 0xe9, 0xa1, 0xd8, 0xe6, 0xb4, 0x47, 0xef,
@@ -570,14 +570,14 @@ static const u8 C12[] = {
     0xe9, 0xb7, 0x37, 0x3b
 };

-static const u8 T12[] = {
+static const uint8_t T12[] = {
     0xdc, 0xf5, 0x66, 0xff, 0x29, 0x1c, 0x25, 0xbb,
     0xb8, 0x56, 0x8f, 0xc3, 0xd3, 0x76, 0xa6, 0xd9
 };

 /* Test Case 13 */
-static const u8 K13[32], P13[] = { 0 }, A13[] = { 0 }, IV13[12], C13[] = { 0 };
-static const u8 T13[] = {
+static const uint8_t K13[32], P13[] = { 0 }, A13[] = { 0 }, IV13[12], C13[] = { 0 };
+static const uint8_t T13[] = {
     0x53, 0x0f, 0x8a, 0xfb, 0xc7, 0x45, 0x36, 0xb9,
     0xa9, 0x63, 0xb4, 0xf1, 0xc4, 0xcb, 0x73, 0x8b
 };
@@ -585,27 +585,27 @@ static const u8 T13[] = {
 /* Test Case 14 */
 #define K14 K13
 #define A14 A13
-static const u8 P14[16], IV14[12];
-static const u8 C14[] = {
+static const uint8_t P14[16], IV14[12];
+static const uint8_t C14[] = {
     0xce, 0xa7, 0x40, 0x3d, 0x4d, 0x60, 0x6b, 0x6e,
     0x07, 0x4e, 0xc5, 0xd3, 0xba, 0xf3, 0x9d, 0x18
 };

-static const u8 T14[] = {
+static const uint8_t T14[] = {
     0xd0, 0xd1, 0xc8, 0xa7, 0x99, 0x99, 0x6b, 0xf0,
     0x26, 0x5b, 0x98, 0xb5, 0xd4, 0x8a, 0xb9, 0x19
 };

 /* Test Case 15 */
 #define A15 A14
-static const u8 K15[] = {
+static const uint8_t K15[] = {
     0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
     0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
     0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
     0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08
 };

-static const u8 P15[] = {
+static const uint8_t P15[] = {
     0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
@@ -616,12 +616,12 @@ static const u8 P15[] = {
     0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55
 };

-static const u8 IV15[] = {
+static const uint8_t IV15[] = {
     0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
     0xde, 0xca, 0xf8, 0x88
 };

-static const u8 C15[] = {
+static const uint8_t C15[] = {
     0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07,
     0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d,
     0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9,
@@ -632,7 +632,7 @@ static const u8 C15[] = {
     0xbc, 0xc9, 0xf6, 0x62, 0x89, 0x80, 0x15, 0xad
 };

-static const u8 T15[] = {
+static const uint8_t T15[] = {
     0xb0, 0x94, 0xda, 0xc5, 0xd9, 0x34, 0x71, 0xbd,
     0xec, 0x1a, 0x50, 0x22, 0x70, 0xe3, 0xcc, 0x6c
 };
@@ -640,7 +640,7 @@ static const u8 T15[] = {
 /* Test Case 16 */
 #define K16 K15
 #define IV16 IV15
-static const u8 P16[] = {
+static const uint8_t P16[] = {
     0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
@@ -651,13 +651,13 @@ static const u8 P16[] = {
     0xba, 0x63, 0x7b, 0x39
 };

-static const u8 A16[] = {
+static const uint8_t A16[] = {
     0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
     0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
     0xab, 0xad, 0xda, 0xd2
 };

-static const u8 C16[] = {
+static const uint8_t C16[] = {
     0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07,
     0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d,
     0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9,
@@ -668,7 +668,7 @@ static const u8 C16[] = {
     0xbc, 0xc9, 0xf6, 0x62
 };

-static const u8 T16[] = {
+static const uint8_t T16[] = {
     0x76, 0xfc, 0x6e, 0xce, 0x0f, 0x4e, 0x17, 0x68,
     0xcd, 0xdf, 0x88, 0x53, 0xbb, 0x2d, 0x55, 0x1b
 };
@@ -677,9 +677,9 @@ static const u8 T16[] = {
 #define K17 K16
 #define P17 P16
 #define A17 A16
-static const u8 IV17[] = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad };
+static const uint8_t IV17[] = { 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad };

-static const u8 C17[] = {
+static const uint8_t C17[] = {
     0xc3, 0x76, 0x2d, 0xf1, 0xca, 0x78, 0x7d, 0x32,
     0xae, 0x47, 0xc1, 0x3b, 0xf1, 0x98, 0x44, 0xcb,
     0xaf, 0x1a, 0xe1, 0x4d, 0x0b, 0x97, 0x6a, 0xfa,
@@ -690,7 +690,7 @@ static const u8 C17[] = {
     0xf4, 0x7c, 0x9b, 0x1f
 };

-static const u8 T17[] = {
+static const uint8_t T17[] = {
     0x3a, 0x33, 0x7d, 0xbf, 0x46, 0xa7, 0x92, 0xc4,
     0x5e, 0x45, 0x49, 0x13, 0xfe, 0x2e, 0xa8, 0xf2
 };
@@ -699,7 +699,7 @@ static const u8 T17[] = {
 #define K18 K17
 #define P18 P17
 #define A18 A17
-static const u8 IV18[] = {
+static const uint8_t IV18[] = {
     0x93, 0x13, 0x22, 0x5d, 0xf8, 0x84, 0x06, 0xe5,
     0x55, 0x90, 0x9c, 0x5a, 0xff, 0x52, 0x69, 0xaa,
     0x6a, 0x7a, 0x95, 0x38, 0x53, 0x4f, 0x7d, 0xa1,
@@ -710,7 +710,7 @@ static const u8 IV18[] = {
     0xa6, 0x37, 0xb3, 0x9b
 };

-static const u8 C18[] = {
+static const uint8_t C18[] = {
     0x5a, 0x8d, 0xef, 0x2f, 0x0c, 0x9e, 0x53, 0xf1,
     0xf7, 0x5d, 0x78, 0x53, 0x65, 0x9e, 0x2a, 0x20,
     0xee, 0xb2, 0xb2, 0x2a, 0xaf, 0xde, 0x64, 0x19,
@@ -721,7 +721,7 @@ static const u8 C18[] = {
     0x44, 0xae, 0x7e, 0x3f
 };

-static const u8 T18[] = {
+static const uint8_t T18[] = {
     0xa4, 0x4a, 0x82, 0x66, 0xee, 0x1c, 0x8e, 0xb0,
     0xc8, 0xb5, 0xd4, 0xcf, 0x5a, 0xe9, 0xf1, 0x9a
 };
@@ -731,7 +731,7 @@ static const u8 T18[] = {
 #define P19 P1
 #define IV19 IV1
 #define C19 C1
-static const u8 A19[] = {
+static const uint8_t A19[] = {
     0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
     0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
     0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
@@ -750,7 +750,7 @@ static const u8 A19[] = {
     0xbc, 0xc9, 0xf6, 0x62, 0x89, 0x80, 0x15, 0xad
 };

-static const u8 T19[] = {
+static const uint8_t T19[] = {
     0x5f, 0xea, 0x79, 0x3a, 0x2d, 0x6f, 0x97, 0x4d,
     0x37, 0xe6, 0x8e, 0x0c, 0xb8, 0xff, 0x94, 0x92
 };
@@ -759,10 +759,10 @@ static const u8 T19[] = {
 #define K20 K1
 #define A20 A1
 /* this results in 0xff in counter LSB */
-static const u8 IV20[64] = { 0xff, 0xff, 0xff, 0xff };
+static const uint8_t IV20[64] = { 0xff, 0xff, 0xff, 0xff };

-static const u8 P20[288];
-static const u8 C20[] = {
+static const uint8_t P20[288];
+static const uint8_t C20[] = {
     0x56, 0xb3, 0x37, 0x3c, 0xa9, 0xef, 0x6e, 0x4a,
     0x2b, 0x64, 0xfe, 0x1e, 0x9a, 0x17, 0xb6, 0x14,
     0x25, 0xf1, 0x0d, 0x47, 0xa7, 0x5a, 0x5f, 0xce,
@@ -801,7 +801,7 @@ static const u8 C20[] = {
     0x70, 0x8a, 0x70, 0xee, 0x7d, 0x75, 0x16, 0x5c
 };

-static const u8 T20[] = {
+static const uint8_t T20[] = {
     0x8b, 0x30, 0x7f, 0x6b, 0x33, 0x28, 0x6d, 0x0a,
     0xb0, 0x26, 0xa9, 0xed, 0x3f, 0xe1, 0xe8, 0x5f
 };