diff options
Diffstat (limited to 'src/libstrongswan/plugins')
60 files changed, 380 insertions, 380 deletions
diff --git a/src/libstrongswan/plugins/aes/aes_crypter.c b/src/libstrongswan/plugins/aes/aes_crypter.c index f9775c8b8..8829ba162 100644 --- a/src/libstrongswan/plugins/aes/aes_crypter.c +++ b/src/libstrongswan/plugins/aes/aes_crypter.c @@ -49,27 +49,27 @@ struct private_aes_crypter_t { /** * Number of words in the key input block. */ - u_int32_t aes_Nkey; + uint32_t aes_Nkey; /** * The number of cipher rounds. */ - u_int32_t aes_Nrnd; + uint32_t aes_Nrnd; /** * The encryption key schedule. */ - u_int32_t aes_e_key[AES_KS_LENGTH]; + uint32_t aes_e_key[AES_KS_LENGTH]; /** * The decryption key schedule. */ - u_int32_t aes_d_key[AES_KS_LENGTH]; + uint32_t aes_d_key[AES_KS_LENGTH]; /** * Key size of this AES cypher object. */ - u_int32_t key_size; + uint32_t key_size; }; /** @@ -88,7 +88,7 @@ struct private_aes_crypter_t { */ #define bval(x,n) ((unsigned char)((x) >> 8 * (n))) #define bytes2word(b0, b1, b2, b3) \ - ((u_int32_t)(b3) << 24 | (u_int32_t)(b2) << 16 | (u_int32_t)(b1) << 8 | (b0)) + ((uint32_t)(b3) << 24 | (uint32_t)(b2) << 16 | (uint32_t)(b1) << 8 | (b0)) /* little endian processor without data alignment restrictions: AES_LE_OK */ @@ -105,15 +105,15 @@ struct private_aes_crypter_t { #ifdef AES_LE_OK /* little endian processor without data alignment restrictions */ -#define word_in(x) *(u_int32_t*)(x) -#define const_word_in(x) *(const u_int32_t*)(x) -#define word_out(x,v) *(u_int32_t*)(x) = (v) -#define const_word_out(x,v) *(const u_int32_t*)(x) = (v) +#define word_in(x) *(uint32_t*)(x) +#define const_word_in(x) *(const uint32_t*)(x) +#define word_out(x,v) *(uint32_t*)(x) = (v) +#define const_word_out(x,v) *(const uint32_t*)(x) = (v) #else /* slower but generic big endian or with data alignment restrictions */ /* some additional "const" touches to stop "gcc -Wcast-qual" complains --jjo */ -#define word_in(x) ((u_int32_t)(((unsigned char *)(x))[0])|((u_int32_t)(((unsigned char *)(x))[1])<<8)|((u_int32_t)(((unsigned char *)(x))[2])<<16)|((u_int32_t)(((unsigned char *)(x))[3])<<24)) -#define const_word_in(x) ((const u_int32_t)(((const unsigned char *)(x))[0])|((const u_int32_t)(((const unsigned char *)(x))[1])<<8)|((const u_int32_t)(((const unsigned char *)(x))[2])<<16)|((const u_int32_t)(((const unsigned char *)(x))[3])<<24)) +#define word_in(x) ((uint32_t)(((unsigned char *)(x))[0])|((uint32_t)(((unsigned char *)(x))[1])<<8)|((uint32_t)(((unsigned char *)(x))[2])<<16)|((uint32_t)(((unsigned char *)(x))[3])<<24)) +#define const_word_in(x) ((const uint32_t)(((const unsigned char *)(x))[0])|((const uint32_t)(((const unsigned char *)(x))[1])<<8)|((const uint32_t)(((const unsigned char *)(x))[2])<<16)|((const uint32_t)(((const unsigned char *)(x))[3])<<24)) #define word_out(x,v) ((unsigned char *)(x))[0]=(v),((unsigned char *)(x))[1]=((v)>>8),((unsigned char *)(x))[2]=((v)>>16),((unsigned char *)(x))[3]=((v)>>24) #define const_word_out(x,v) ((const unsigned char *)(x))[0]=(v),((const unsigned char *)(x))[1]=((v)>>8),((const unsigned char *)(x))[2]=((v)>>16),((const unsigned char *)(x))[3]=((v)>>24) #endif @@ -156,7 +156,7 @@ struct private_aes_crypter_t { // this table can be a table of bytes if the key schedule // code is adjusted accordingly -static const u_int32_t rcon_tab[29] = +static const uint32_t rcon_tab[29] = { w0(01), w0(02), w0(04), w0(08), w0(10), w0(20), w0(40), w0(80), @@ -320,7 +320,7 @@ static const u_int32_t rcon_tab[29] = #undef r #define r r0 -static const u_int32_t ft_tab[4][256] = +static const uint32_t ft_tab[4][256] = { { f_table }, #undef r #define r r1 @@ -335,7 +335,7 @@ static const u_int32_t ft_tab[4][256] = #undef r #define r r0 -static const u_int32_t it_tab[4][256] = +static const uint32_t it_tab[4][256] = { { i_table }, #undef r #define r r1 @@ -386,7 +386,7 @@ static const u_int32_t it_tab[4][256] = #undef r #define r(p,q,r,s) w0(q) -static const u_int32_t fl_tab[4][256] = +static const uint32_t fl_tab[4][256] = { { f_table }, #undef r #define r(p,q,r,s) w1(q) @@ -401,7 +401,7 @@ static const u_int32_t fl_tab[4][256] = #undef w #define w w0 -static const u_int32_t il_tab[4][256] = +static const uint32_t il_tab[4][256] = { { li_table }, #undef w #define w w1 @@ -483,7 +483,7 @@ static const u_int32_t il_tab[4][256] = #undef r #define r r0 -static const u_int32_t im_tab[4][256] = +static const uint32_t im_tab[4][256] = { { m_table }, #undef r #define r r1 @@ -717,8 +717,8 @@ static const u_int32_t im_tab[4][256] = static void encrypt_block(const private_aes_crypter_t *this, const unsigned char in_blk[], unsigned char out_blk[]) { - u_int32_t locals(b0, b1); - const u_int32_t *kp = this->aes_e_key; + uint32_t locals(b0, b1); + const uint32_t *kp = this->aes_e_key; state_in(b0, in_blk, kp); kp += nc; @@ -754,8 +754,8 @@ static void encrypt_block(const private_aes_crypter_t *this, static void decrypt_block(const private_aes_crypter_t *this, const unsigned char in_blk[], unsigned char out_blk[]) { - u_int32_t locals(b0, b1); - const u_int32_t *kp = this->aes_d_key; + uint32_t locals(b0, b1); + const uint32_t *kp = this->aes_d_key; state_in(b0, in_blk, kp); kp += nc; @@ -789,8 +789,8 @@ METHOD(crypter_t, decrypt, bool, private_aes_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *decrypted) { int pos; - const u_int32_t *iv_i; - u_int8_t *in, *out; + const uint32_t *iv_i; + uint8_t *in, *out; if (decrypted) { @@ -811,16 +811,16 @@ METHOD(crypter_t, decrypt, bool, decrypt_block(this, in, out); if (pos==0) { - iv_i=(const u_int32_t*) (iv.ptr); + iv_i=(const uint32_t*) (iv.ptr); } else { - iv_i=(const u_int32_t*) (in-16); + iv_i=(const uint32_t*) (in-16); } - *((u_int32_t *)(&out[ 0])) ^= iv_i[0]; - *((u_int32_t *)(&out[ 4])) ^= iv_i[1]; - *((u_int32_t *)(&out[ 8])) ^= iv_i[2]; - *((u_int32_t *)(&out[12])) ^= iv_i[3]; + *((uint32_t *)(&out[ 0])) ^= iv_i[0]; + *((uint32_t *)(&out[ 4])) ^= iv_i[1]; + *((uint32_t *)(&out[ 8])) ^= iv_i[2]; + *((uint32_t *)(&out[12])) ^= iv_i[3]; in-=16; out-=16; pos-=16; @@ -832,8 +832,8 @@ METHOD(crypter_t, encrypt, bool, private_aes_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *encrypted) { int pos; - const u_int32_t *iv_i; - u_int8_t *in, *out; + const uint32_t *iv_i; + uint8_t *in, *out; in = data.ptr; out = data.ptr; @@ -848,16 +848,16 @@ METHOD(crypter_t, encrypt, bool, { if (pos==0) { - iv_i=(const u_int32_t*) iv.ptr; + iv_i=(const uint32_t*) iv.ptr; } else { - iv_i=(const u_int32_t*) (out-16); + iv_i=(const uint32_t*) (out-16); } - *((u_int32_t *)(&out[ 0])) = iv_i[0]^*((const u_int32_t *)(&in[ 0])); - *((u_int32_t *)(&out[ 4])) = iv_i[1]^*((const u_int32_t *)(&in[ 4])); - *((u_int32_t *)(&out[ 8])) = iv_i[2]^*((const u_int32_t *)(&in[ 8])); - *((u_int32_t *)(&out[12])) = iv_i[3]^*((const u_int32_t *)(&in[12])); + *((uint32_t *)(&out[ 0])) = iv_i[0]^*((const uint32_t *)(&in[ 0])); + *((uint32_t *)(&out[ 4])) = iv_i[1]^*((const uint32_t *)(&in[ 4])); + *((uint32_t *)(&out[ 8])) = iv_i[2]^*((const uint32_t *)(&in[ 8])); + *((uint32_t *)(&out[12])) = iv_i[3]^*((const uint32_t *)(&in[12])); encrypt_block(this, out, out); in+=16; out+=16; @@ -887,8 +887,8 @@ METHOD(crypter_t, get_key_size, size_t, METHOD(crypter_t, set_key, bool, private_aes_crypter_t *this, chunk_t key) { - u_int32_t *kf, *kt, rci, f = 0; - u_int8_t *in_key = key.ptr; + uint32_t *kf, *kt, rci, f = 0; + uint8_t *in_key = key.ptr; this->aes_Nrnd = (this->aes_Nkey > (nc) ? this->aes_Nkey : (nc)) + 6; @@ -948,7 +948,7 @@ METHOD(crypter_t, set_key, bool, if(!f) { - u_int32_t i; + uint32_t i; kt = this->aes_d_key + nc * this->aes_Nrnd; kf = this->aes_e_key; diff --git a/src/libstrongswan/plugins/aesni/aesni_ccm.c b/src/libstrongswan/plugins/aesni/aesni_ccm.c index d523bc17a..12074860e 100644 --- a/src/libstrongswan/plugins/aesni/aesni_ccm.c +++ b/src/libstrongswan/plugins/aesni/aesni_ccm.c @@ -83,7 +83,7 @@ struct private_aesni_ccm_t { * First block with control information */ typedef struct __attribute__((packed)) { - BITFIELD4(u_int8_t, + BITFIELD4(uint8_t, /* size of p length field q, as q-1 */ q_len: 3, /* size of our ICV t, as (t-2)/2 */ @@ -105,7 +105,7 @@ typedef struct __attribute__((packed)) { * Counter block */ typedef struct __attribute__((packed)) { - BITFIELD3(u_int8_t, + BITFIELD3(uint8_t, /* size of p length field q, as q-1 */ q_len: 3, zero: 3, @@ -140,7 +140,7 @@ static void build_b0(private_aesni_ccm_t *this, size_t len, size_t alen, /** * Build a counter block for counter i */ -static void build_ctr(private_aesni_ccm_t *this, u_int32_t i, u_char *iv, +static void build_ctr(private_aesni_ccm_t *this, uint32_t i, u_char *iv, void *out) { ctr_t *ctr = out; @@ -157,7 +157,7 @@ static void build_ctr(private_aesni_ccm_t *this, u_int32_t i, u_char *iv, * Calculate the ICV for the b0 and associated data */ static __m128i icv_header(private_aesni_ccm_t *this, size_t len, u_char *iv, - u_int16_t alen, u_char *assoc) + uint16_t alen, u_char *assoc) { __m128i *ks, b, t, c; u_int i, round, blocks, rem; diff --git a/src/libstrongswan/plugins/aesni/aesni_cmac.c b/src/libstrongswan/plugins/aesni/aesni_cmac.c index d6a87e6d7..07580c822 100644 --- a/src/libstrongswan/plugins/aesni/aesni_cmac.c +++ b/src/libstrongswan/plugins/aesni/aesni_cmac.c @@ -65,7 +65,7 @@ struct private_mac_t { }; METHOD(mac_t, get_mac, bool, - private_mac_t *this, chunk_t data, u_int8_t *out) + private_mac_t *this, chunk_t data, uint8_t *out) { __m128i *ks, t, l, *bi; u_int blocks, rem, i; diff --git a/src/libstrongswan/plugins/aesni/aesni_ctr.c b/src/libstrongswan/plugins/aesni/aesni_ctr.c index 989813814..d9a555a85 100644 --- a/src/libstrongswan/plugins/aesni/aesni_ctr.c +++ b/src/libstrongswan/plugins/aesni/aesni_ctr.c @@ -61,7 +61,7 @@ struct private_aesni_ctr_t { struct { char nonce[4]; char iv[8]; - u_int32_t counter; + uint32_t counter; } __attribute__((packed, aligned(sizeof(__m128i)))) state; }; diff --git a/src/libstrongswan/plugins/aesni/aesni_gcm.c b/src/libstrongswan/plugins/aesni/aesni_gcm.c index 53c0b144e..330dc6cd3 100644 --- a/src/libstrongswan/plugins/aesni/aesni_gcm.c +++ b/src/libstrongswan/plugins/aesni/aesni_gcm.c @@ -316,7 +316,7 @@ static __m128i icv_tailer(private_aesni_gcm_t *this, __m128i y, __m128i b; htoun64(&b, alen * 8); - htoun64((u_char*)&b + sizeof(u_int64_t), dlen * 8); + htoun64((u_char*)&b + sizeof(uint64_t), dlen * 8); return ghash(this->h, y, b); } diff --git a/src/libstrongswan/plugins/aesni/aesni_xcbc.c b/src/libstrongswan/plugins/aesni/aesni_xcbc.c index 24a75cec0..974c5fedc 100644 --- a/src/libstrongswan/plugins/aesni/aesni_xcbc.c +++ b/src/libstrongswan/plugins/aesni/aesni_xcbc.c @@ -70,7 +70,7 @@ struct private_aesni_mac_t { }; METHOD(mac_t, get_mac, bool, - private_aesni_mac_t *this, chunk_t data, u_int8_t *out) + private_aesni_mac_t *this, chunk_t data, uint8_t *out) { __m128i *ks, e, *bi; u_int blocks, rem, i; diff --git a/src/libstrongswan/plugins/af_alg/af_alg_hasher.c b/src/libstrongswan/plugins/af_alg/af_alg_hasher.c index 611975533..62fea51cc 100644 --- a/src/libstrongswan/plugins/af_alg/af_alg_hasher.c +++ b/src/libstrongswan/plugins/af_alg/af_alg_hasher.c @@ -107,7 +107,7 @@ METHOD(hasher_t, reset, bool, } METHOD(hasher_t, get_hash, bool, - private_af_alg_hasher_t *this, chunk_t chunk, u_int8_t *hash) + private_af_alg_hasher_t *this, chunk_t chunk, uint8_t *hash) { return this->ops->hash(this->ops, chunk, hash, this->size); } diff --git a/src/libstrongswan/plugins/af_alg/af_alg_ops.c b/src/libstrongswan/plugins/af_alg/af_alg_ops.c index 331d1e801..7e129300f 100644 --- a/src/libstrongswan/plugins/af_alg/af_alg_ops.c +++ b/src/libstrongswan/plugins/af_alg/af_alg_ops.c @@ -108,7 +108,7 @@ METHOD(af_alg_ops_t, hash, bool, } METHOD(af_alg_ops_t, crypt, bool, - private_af_alg_ops_t *this, u_int32_t type, chunk_t iv, chunk_t data, + private_af_alg_ops_t *this, uint32_t type, chunk_t iv, chunk_t data, char *out) { struct msghdr msg = {}; diff --git a/src/libstrongswan/plugins/af_alg/af_alg_ops.h b/src/libstrongswan/plugins/af_alg/af_alg_ops.h index e34f22977..51342d71c 100644 --- a/src/libstrongswan/plugins/af_alg/af_alg_ops.h +++ b/src/libstrongswan/plugins/af_alg/af_alg_ops.h @@ -64,7 +64,7 @@ struct af_alg_ops_t { * @param out buffer write processed data to * @return TRUE if successful */ - bool (*crypt)(af_alg_ops_t *this, u_int32_t type, chunk_t iv, chunk_t data, + bool (*crypt)(af_alg_ops_t *this, uint32_t type, chunk_t iv, chunk_t data, char *out); /** diff --git a/src/libstrongswan/plugins/af_alg/af_alg_prf.c b/src/libstrongswan/plugins/af_alg/af_alg_prf.c index 2b7d51376..8c3627a22 100644 --- a/src/libstrongswan/plugins/af_alg/af_alg_prf.c +++ b/src/libstrongswan/plugins/af_alg/af_alg_prf.c @@ -106,7 +106,7 @@ static size_t lookup_alg(pseudo_random_function_t algo, char **name, bool *xcbc) } METHOD(prf_t, get_bytes, bool, - private_af_alg_prf_t *this, chunk_t seed, u_int8_t *buffer) + private_af_alg_prf_t *this, chunk_t seed, uint8_t *buffer) { return this->ops->hash(this->ops, seed, buffer, this->block_size); } diff --git a/src/libstrongswan/plugins/af_alg/af_alg_signer.c b/src/libstrongswan/plugins/af_alg/af_alg_signer.c index 1403144ab..e54b457e7 100644 --- a/src/libstrongswan/plugins/af_alg/af_alg_signer.c +++ b/src/libstrongswan/plugins/af_alg/af_alg_signer.c @@ -109,7 +109,7 @@ static size_t lookup_alg(integrity_algorithm_t algo, char **name, } METHOD(signer_t, get_signature, bool, - private_af_alg_signer_t *this, chunk_t data, u_int8_t *buffer) + private_af_alg_signer_t *this, chunk_t data, uint8_t *buffer) { return this->ops->hash(this->ops, data, buffer, this->block_size); } diff --git a/src/libstrongswan/plugins/agent/agent_private_key.c b/src/libstrongswan/plugins/agent/agent_private_key.c index c2e82a9f1..bb55c45c0 100644 --- a/src/libstrongswan/plugins/agent/agent_private_key.c +++ b/src/libstrongswan/plugins/agent/agent_private_key.c @@ -98,18 +98,18 @@ static u_char read_byte(chunk_t *blob) } /** - * read a u_int32_t from a blob + * read a uint32_t from a blob */ -static u_int32_t read_uint32(chunk_t *blob) +static uint32_t read_uint32(chunk_t *blob) { - u_int32_t val; + uint32_t val; - if (blob->len < sizeof(u_int32_t)) + if (blob->len < sizeof(uint32_t)) { return 0; } - val = ntohl(*(u_int32_t*)blob->ptr); - *blob = chunk_skip(*blob, sizeof(u_int32_t)); + val = ntohl(*(uint32_t*)blob->ptr); + *blob = chunk_skip(*blob, sizeof(uint32_t)); return val; } @@ -182,7 +182,7 @@ static bool read_key(private_agent_private_key_t *this, public_key_t *pubkey) blob = chunk_create(buf, sizeof(buf)); blob.len = read(this->socket, blob.ptr, blob.len); - if (blob.len < sizeof(u_int32_t) + sizeof(u_char) || + if (blob.len < sizeof(uint32_t) + sizeof(u_char) || read_uint32(&blob) != blob.len || read_byte(&blob) != SSH_AGENT_ID_RESPONSE) { @@ -236,7 +236,7 @@ METHOD(private_key_t, sign, bool, private_agent_private_key_t *this, signature_scheme_t scheme, chunk_t data, chunk_t *signature) { - u_int32_t len, flags; + uint32_t len, flags; char buf[2048]; chunk_t blob; @@ -247,7 +247,7 @@ METHOD(private_key_t, sign, bool, return FALSE; } - len = htonl(1 + sizeof(u_int32_t) * 3 + this->key.len + data.len); + len = htonl(1 + sizeof(uint32_t) * 3 + this->key.len + data.len); buf[0] = SSH_AGENT_SIGN_REQUEST; if (write(this->socket, &len, sizeof(len)) != sizeof(len) || write(this->socket, &buf, 1) != 1) @@ -281,7 +281,7 @@ METHOD(private_key_t, sign, bool, blob = chunk_create(buf, sizeof(buf)); blob.len = read(this->socket, blob.ptr, blob.len); - if (blob.len < sizeof(u_int32_t) + sizeof(u_char) || + if (blob.len < sizeof(uint32_t) + sizeof(u_char) || read_uint32(&blob) != blob.len || read_byte(&blob) != SSH_AGENT_SIGN_RESPONSE) { diff --git a/src/libstrongswan/plugins/blowfish/blowfish.h b/src/libstrongswan/plugins/blowfish/blowfish.h index 9aa30df4b..ad853afd8 100644 --- a/src/libstrongswan/plugins/blowfish/blowfish.h +++ b/src/libstrongswan/plugins/blowfish/blowfish.h @@ -98,7 +98,7 @@ extern "C" { #else #include <sys/types.h> #endif -#define BF_LONG u_int32_t +#define BF_LONG uint32_t #endif #define BF_ROUNDS 16 diff --git a/src/libstrongswan/plugins/blowfish/blowfish_crypter.c b/src/libstrongswan/plugins/blowfish/blowfish_crypter.c index 253f9b4a4..1708e078d 100644 --- a/src/libstrongswan/plugins/blowfish/blowfish_crypter.c +++ b/src/libstrongswan/plugins/blowfish/blowfish_crypter.c @@ -84,14 +84,14 @@ struct private_blowfish_crypter_t { /** * Key size of this Blowfish cipher object. */ - u_int32_t key_size; + uint32_t key_size; }; METHOD(crypter_t, decrypt, bool, private_blowfish_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *decrypted) { - u_int8_t *in, *out; + uint8_t *in, *out; if (decrypted) { @@ -116,7 +116,7 @@ METHOD(crypter_t, encrypt, bool, private_blowfish_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *encrypted) { - u_int8_t *in, *out; + uint8_t *in, *out; if (encrypted) { diff --git a/src/libstrongswan/plugins/ccm/ccm_aead.c b/src/libstrongswan/plugins/ccm/ccm_aead.c index 676d67681..9cf9bedf5 100644 --- a/src/libstrongswan/plugins/ccm/ccm_aead.c +++ b/src/libstrongswan/plugins/ccm/ccm_aead.c @@ -60,7 +60,7 @@ struct private_ccm_aead_t { * First block with control information */ typedef struct __attribute__((packed)) { - BITFIELD4(u_int8_t, + BITFIELD4(uint8_t, /* size of p length field q, as q-1 */ q_len: 3, /* size of our ICV t, as (t-2)/2 */ @@ -82,7 +82,7 @@ typedef struct __attribute__((packed)) { * Counter block */ typedef struct __attribute__((packed)) { - BITFIELD3(u_int8_t, + BITFIELD3(uint8_t, /* size of p length field q, as q-1 */ q_len: 3, zero: 3, @@ -117,7 +117,7 @@ static void build_b0(private_ccm_aead_t *this, chunk_t plain, chunk_t assoc, /** * Build a counter block for counter i */ -static void build_ctr(private_ccm_aead_t *this, u_int32_t i, chunk_t iv, +static void build_ctr(private_ccm_aead_t *this, uint32_t i, chunk_t iv, char *out) { ctr_t *ctr = (ctr_t*)out; diff --git a/src/libstrongswan/plugins/chapoly/chapoly_aead.c b/src/libstrongswan/plugins/chapoly/chapoly_aead.c index 50ad84b21..39d51e9f8 100644 --- a/src/libstrongswan/plugins/chapoly/chapoly_aead.c +++ b/src/libstrongswan/plugins/chapoly/chapoly_aead.c @@ -84,8 +84,8 @@ static bool poly_head(private_chapoly_aead_t *this, u_char *assoc, size_t len) static bool poly_tail(private_chapoly_aead_t *this, size_t alen, size_t clen) { struct { - u_int64_t alen; - u_int64_t clen; + uint64_t alen; + uint64_t clen; } b; b.alen = htole64(alen); @@ -190,7 +190,7 @@ METHOD(aead_t, encrypt, bool, { u_char *out; - if (sizeof(plain.len) > sizeof(u_int32_t) && plain.len > P_MAX) + if (sizeof(plain.len) > sizeof(uint32_t) && plain.len > P_MAX) { return FALSE; } @@ -220,7 +220,7 @@ METHOD(aead_t, decrypt, bool, return FALSE; } encr.len -= POLY_ICV_SIZE; - if (sizeof(encr.len) > sizeof(u_int32_t) && encr.len > P_MAX) + if (sizeof(encr.len) > sizeof(uint32_t) && encr.len > P_MAX) { return FALSE; } diff --git a/src/libstrongswan/plugins/chapoly/chapoly_drv_portable.c b/src/libstrongswan/plugins/chapoly/chapoly_drv_portable.c index dfed4d53d..59962b819 100644 --- a/src/libstrongswan/plugins/chapoly/chapoly_drv_portable.c +++ b/src/libstrongswan/plugins/chapoly/chapoly_drv_portable.c @@ -39,30 +39,30 @@ struct private_chapoly_drv_portable_t { /** * ChaCha20 state matrix */ - u_int32_t m[16]; + uint32_t m[16]; /** * Poly1305 update key */ - u_int32_t r[5]; + uint32_t r[5]; /** * Poly1305 state */ - u_int32_t h[5]; + uint32_t h[5]; /** * Poly1305 finalize key */ - u_int32_t s[4]; + uint32_t s[4]; }; /** * XOR a 32-bit integer into an unaligned destination */ -static inline void xor32u(void *p, u_int32_t x) +static inline void xor32u(void *p, uint32_t x) { - u_int32_t y; + uint32_t y; memcpy(&y, p, sizeof(y)); y ^= x; @@ -72,7 +72,7 @@ static inline void xor32u(void *p, u_int32_t x) /** * Multiply two 64-bit words */ -static inline u_int64_t mlt(u_int64_t a, u_int64_t b) +static inline uint64_t mlt(uint64_t a, uint64_t b) { return a * b; } @@ -80,7 +80,7 @@ static inline u_int64_t mlt(u_int64_t a, u_int64_t b) /** * Shift a 64-bit unsigned integer v right by n bits, clamp to 32 bit */ -static inline u_int32_t sr(u_int64_t v, u_char n) +static inline uint32_t sr(uint64_t v, u_char n) { return v >> n; } @@ -88,13 +88,13 @@ static inline u_int32_t sr(u_int64_t v, u_char n) /** * Circular left shift by n bits */ -static inline u_int32_t rotl32(u_int32_t v, u_char n) +static inline uint32_t rotl32(uint32_t v, u_char n) { return (v << n) | (v >> (sizeof(v) * 8 - n)); } /** - * AND two values, using a native integer size >= sizeof(u_int32_t) + * AND two values, using a native integer size >= sizeof(uint32_t) */ static inline u_long and(u_long v, u_long mask) { @@ -106,8 +106,8 @@ static inline u_long and(u_long v, u_long mask) */ static void chacha_block_xor(private_chapoly_drv_portable_t *this, void *data) { - u_int32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, xa, xb, xc, xd, xe, xf; - u_int32_t *out = data; + uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, xa, xb, xc, xd, xe, xf; + uint32_t *out = data; u_int i; x0 = this->m[ 0]; @@ -246,10 +246,10 @@ METHOD(chapoly_drv_t, init, bool, METHOD(chapoly_drv_t, poly, bool, private_chapoly_drv_portable_t *this, u_char *data, u_int blocks) { - u_int32_t r0, r1, r2, r3, r4; - u_int32_t s1, s2, s3, s4; - u_int32_t h0, h1, h2, h3, h4; - u_int64_t d0, d1, d2, d3, d4; + uint32_t r0, r1, r2, r3, r4; + uint32_t s1, s2, s3, s4; + uint32_t h0, h1, h2, h3, h4; + uint64_t d0, d1, d2, d3, d4; u_int i; r0 = this->r[0]; @@ -345,10 +345,10 @@ METHOD(chapoly_drv_t, decrypt, bool, METHOD(chapoly_drv_t, finish, bool, private_chapoly_drv_portable_t *this, u_char *mac) { - u_int32_t h0, h1, h2, h3, h4; - u_int32_t g0, g1, g2, g3, g4; - u_int32_t mask; - u_int64_t f = 0; + uint32_t h0, h1, h2, h3, h4; + uint32_t g0, g1, g2, g3, g4; + uint32_t mask; + uint64_t f = 0; /* fully carry h */ h0 = this->h[0]; @@ -371,7 +371,7 @@ METHOD(chapoly_drv_t, finish, bool, g4 = h4 + (g3 >> 26) - (1 << 26); g3 &= 0x3ffffff; /* select h if h < p, or h + -p if h >= p */ - mask = (g4 >> ((sizeof(u_int32_t) * 8) - 1)) - 1; + mask = (g4 >> ((sizeof(uint32_t) * 8) - 1)) - 1; g0 &= mask; g1 &= mask; g2 &= mask; diff --git a/src/libstrongswan/plugins/chapoly/chapoly_drv_ssse3.c b/src/libstrongswan/plugins/chapoly/chapoly_drv_ssse3.c index df88e7d77..3981ed522 100644 --- a/src/libstrongswan/plugins/chapoly/chapoly_drv_ssse3.c +++ b/src/libstrongswan/plugins/chapoly/chapoly_drv_ssse3.c @@ -45,30 +45,30 @@ struct private_chapoly_drv_ssse3_t { /** * Poly1305 update key */ - u_int32_t r[5]; + uint32_t r[5]; /** * Poly1305 update key r^2 */ - u_int32_t u[5]; + uint32_t u[5]; /** * Poly1305 state */ - u_int32_t h[5]; + uint32_t h[5]; /** * Poly1305 finalize key */ - u_int32_t s[4]; + uint32_t s[4]; }; /** * Read a 32-bit integer from an unaligned address */ -static inline u_int32_t ru32(void *p) +static inline uint32_t ru32(void *p) { - u_int32_t ret; + uint32_t ret; memcpy(&ret, p, sizeof(ret)); return ret; @@ -77,7 +77,7 @@ static inline u_int32_t ru32(void *p) /** * Write a 32-bit word to an unaligned address */ -static inline void wu32(void *p, u_int32_t v) +static inline void wu32(void *p, uint32_t v) { memcpy(p, &v, sizeof(v)); } @@ -85,13 +85,13 @@ static inline void wu32(void *p, u_int32_t v) /** * Shift a 64-bit unsigned integer v right by n bits, clamp to 32 bit */ -static inline u_int32_t sr(u_int64_t v, u_char n) +static inline uint32_t sr(uint64_t v, u_char n) { return v >> n; } /** - * AND two values, using a native integer size >= sizeof(u_int32_t) + * AND two values, using a native integer size >= sizeof(uint32_t) */ static inline u_long and(u_long v, u_long mask) { @@ -189,7 +189,7 @@ static void chacha_4block_xor(private_chapoly_drv_ssse3_t *this, void *data) { __m128i x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, xa, xb, xc, xd, xe, xf; __m128i r8, r16, ctrinc, t, *out = data; - u_int32_t *m = (u_int32_t*)this->m; + uint32_t *m = (uint32_t*)this->m; u_int i; r8 = _mm_set_epi8(14, 13, 12, 15, 10, 9, 8, 11, 6, 5, 4, 7, 2, 1, 0, 3); @@ -364,7 +364,7 @@ METHOD(chapoly_drv_t, set_key, bool, /** * r[127:64] = h[95:64] * a, r[63:0] = h[31:0] * b */ -static inline __m128i mul2(__m128i h, u_int32_t a, u_int32_t b) +static inline __m128i mul2(__m128i h, uint32_t a, uint32_t b) { return _mm_mul_epu32(h, _mm_set_epi32(0, a, 0, b)); } @@ -374,7 +374,7 @@ static inline __m128i mul2(__m128i h, u_int32_t a, u_int32_t b) * z = x[127:64] + x[63:0] + y[127:64] + y[63:0] */ static inline void sum2(__m128i a, __m128i b, __m128i x, __m128i y, - u_int64_t *c, u_int64_t *z) + uint64_t *c, uint64_t *z) { __m128i r, s; @@ -392,10 +392,10 @@ static inline void sum2(__m128i a, __m128i b, __m128i x, __m128i y, * r = a[127:64] + b[127:64] + c[127:64] + d[127:64] + e[127:64] * + a[63:0] + b[63:0] + c[63:0] + d[63:0] + e[63:0] */ -static inline u_int64_t sum5(__m128i a, __m128i b, __m128i c, +static inline uint64_t sum5(__m128i a, __m128i b, __m128i c, __m128i d, __m128i e) { - u_int64_t r; + uint64_t r; a = _mm_add_epi64(a, b); c = _mm_add_epi64(c, d); @@ -414,10 +414,10 @@ static inline u_int64_t sum5(__m128i a, __m128i b, __m128i c, static void make_u(private_chapoly_drv_ssse3_t *this) { __m128i r01, r23, r44, x0, x1, y0, y1, z0; - u_int32_t r0, r1, r2, r3, r4; - u_int32_t u0, u1, u2, u3, u4; - u_int32_t s1, s2, s3, s4; - u_int64_t d0, d1, d2, d3, d4; + uint32_t r0, r1, r2, r3, r4; + uint32_t u0, u1, u2, u3, u4; + uint32_t s1, s2, s3, s4; + uint64_t d0, d1, d2, d3, d4; r0 = this->r[0]; r1 = this->r[1]; @@ -513,12 +513,12 @@ METHOD(chapoly_drv_t, init, bool, */ static void poly2(private_chapoly_drv_ssse3_t *this, u_char *data, u_int dblks) { - u_int32_t r0, r1, r2, r3, r4, u0, u1, u2, u3, u4; - u_int32_t s1, s2, s3, s4, v1, v2, v3, v4; + uint32_t r0, r1, r2, r3, r4, u0, u1, u2, u3, u4; + uint32_t s1, s2, s3, s4, v1, v2, v3, v4; __m128i hc0, hc1, hc2, hc3, hc4; - u_int32_t h0, h1, h2, h3, h4; - u_int32_t c0, c1, c2, c3, c4; - u_int64_t d0, d1, d2, d3, d4; + uint32_t h0, h1, h2, h3, h4; + uint32_t c0, c1, c2, c3, c4; + uint64_t d0, d1, d2, d3, d4; u_int i; r0 = this->r[0]; @@ -622,13 +622,13 @@ static void poly2(private_chapoly_drv_ssse3_t *this, u_char *data, u_int dblks) */ static void poly1(private_chapoly_drv_ssse3_t *this, u_char *data) { - u_int32_t r0, r1, r2, r3, r4; - u_int32_t s1, s2, s3, s4; - u_int32_t h0, h1, h2, h3, h4; - u_int64_t d0, d1, d2, d3, d4; + uint32_t r0, r1, r2, r3, r4; + uint32_t s1, s2, s3, s4; + uint32_t h0, h1, h2, h3, h4; + uint64_t d0, d1, d2, d3, d4; __m128i h01, h23, h44; __m128i x0, x1, y0, y1, z0; - u_int32_t t0, t1; + uint32_t t0, t1; r0 = this->r[0]; r1 = this->r[1]; @@ -764,10 +764,10 @@ METHOD(chapoly_drv_t, decrypt, bool, METHOD(chapoly_drv_t, finish, bool, private_chapoly_drv_ssse3_t *this, u_char *mac) { - u_int32_t h0, h1, h2, h3, h4; - u_int32_t g0, g1, g2, g3, g4; - u_int32_t mask; - u_int64_t f = 0; + uint32_t h0, h1, h2, h3, h4; + uint32_t g0, g1, g2, g3, g4; + uint32_t mask; + uint64_t f = 0; /* fully carry h */ h0 = this->h[0]; @@ -790,7 +790,7 @@ METHOD(chapoly_drv_t, finish, bool, g4 = h4 + (g3 >> 26) - (1 << 26); g3 &= 0x3ffffff; /* select h if h < p, or h + -p if h >= p */ - mask = (g4 >> ((sizeof(u_int32_t) * 8) - 1)) - 1; + mask = (g4 >> ((sizeof(uint32_t) * 8) - 1)) - 1; g0 &= mask; g1 &= mask; g2 &= mask; diff --git a/src/libstrongswan/plugins/cmac/cmac.c b/src/libstrongswan/plugins/cmac/cmac.c index 4f222ff4e..22f077f58 100644 --- a/src/libstrongswan/plugins/cmac/cmac.c +++ b/src/libstrongswan/plugins/cmac/cmac.c @@ -39,7 +39,7 @@ struct private_mac_t { /** * Block size, in bytes */ - u_int8_t b; + uint8_t b; /** * Crypter with key K @@ -49,22 +49,22 @@ struct private_mac_t { /** * K1 */ - u_int8_t *k1; + uint8_t *k1; /** * K2 */ - u_int8_t *k2; + uint8_t *k2; /** * T */ - u_int8_t *t; + uint8_t *t; /** * remaining, unprocessed bytes in append mode */ - u_int8_t *remaining; + uint8_t *remaining; /** * number of bytes in remaining @@ -127,7 +127,7 @@ static bool update(private_mac_t *this, chunk_t data) /** * process last block M_last */ -static bool final(private_mac_t *this, u_int8_t *out) +static bool final(private_mac_t *this, uint8_t *out) { chunk_t iv; @@ -179,7 +179,7 @@ static bool final(private_mac_t *this, u_int8_t *out) } METHOD(mac_t, get_mac, bool, - private_mac_t *this, chunk_t data, u_int8_t *out) + private_mac_t *this, chunk_t data, uint8_t *out) { /* update T, do not process last block */ if (!update(this, data)) @@ -316,7 +316,7 @@ mac_t *cmac_create(encryption_algorithm_t algo, size_t key_size) { private_mac_t *this; crypter_t *crypter; - u_int8_t b; + uint8_t b; crypter = lib->crypto->create_crypter(lib->crypto, algo, key_size); if (!crypter) diff --git a/src/libstrongswan/plugins/ctr/ctr_ipsec_crypter.c b/src/libstrongswan/plugins/ctr/ctr_ipsec_crypter.c index 59d201a6f..854030b8c 100644 --- a/src/libstrongswan/plugins/ctr/ctr_ipsec_crypter.c +++ b/src/libstrongswan/plugins/ctr/ctr_ipsec_crypter.c @@ -38,7 +38,7 @@ struct private_ctr_ipsec_crypter_t { struct { char nonce[4]; char iv[8]; - u_int32_t counter; + uint32_t counter; } __attribute__((packed)) state; }; diff --git a/src/libstrongswan/plugins/des/des_crypter.c b/src/libstrongswan/plugins/des/des_crypter.c index 6010f9d8b..d236bd429 100644 --- a/src/libstrongswan/plugins/des/des_crypter.c +++ b/src/libstrongswan/plugins/des/des_crypter.c @@ -96,7 +96,7 @@ struct private_des_crypter_t { #define DES_ENCRYPT 1 #define DES_DECRYPT 0 -#define DES_LONG u_int32_t +#define DES_LONG uint32_t #if defined(WIN32) || defined(WIN16) #ifndef MSDOS @@ -1420,7 +1420,7 @@ METHOD(crypter_t, decrypt, bool, private_des_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *decrypted) { des_cblock ivb; - u_int8_t *out; + uint8_t *out; out = data.ptr; if (decrypted) @@ -1439,7 +1439,7 @@ METHOD(crypter_t, encrypt, bool, private_des_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *encrypted) { des_cblock ivb; - u_int8_t *out; + uint8_t *out; out = data.ptr; if (encrypted) @@ -1456,7 +1456,7 @@ METHOD(crypter_t, encrypt, bool, METHOD(crypter_t, decrypt_ecb, bool, private_des_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *decrypted) { - u_int8_t *out; + uint8_t *out; out = data.ptr; if (decrypted) @@ -1472,7 +1472,7 @@ METHOD(crypter_t, decrypt_ecb, bool, METHOD(crypter_t, encrypt_ecb, bool, private_des_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *encrypted) { - u_int8_t *out; + uint8_t *out; out = data.ptr; if (encrypted) @@ -1489,7 +1489,7 @@ METHOD(crypter_t, decrypt3, bool, private_des_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *decrypted) { des_cblock ivb; - u_int8_t *out; + uint8_t *out; out = data.ptr; if (decrypted) @@ -1508,7 +1508,7 @@ METHOD(crypter_t, encrypt3, bool, private_des_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *encrypted) { des_cblock ivb; - u_int8_t *out; + uint8_t *out; out = data.ptr; if (encrypted) diff --git a/src/libstrongswan/plugins/dnskey/dnskey_builder.c b/src/libstrongswan/plugins/dnskey/dnskey_builder.c index 71040437d..fd2471a48 100644 --- a/src/libstrongswan/plugins/dnskey/dnskey_builder.c +++ b/src/libstrongswan/plugins/dnskey/dnskey_builder.c @@ -26,10 +26,10 @@ typedef enum dnskey_algorithm_t dnskey_algorithm_t; * Header of a DNSKEY resource record */ struct dnskey_rr_t { - u_int16_t flags; - u_int8_t protocol; - u_int8_t algorithm; - u_int8_t data[]; + uint16_t flags; + uint8_t protocol; + uint8_t algorithm; + uint8_t data[]; } __attribute__((__packed__)); /** diff --git a/src/libstrongswan/plugins/fips_prf/fips_prf.c b/src/libstrongswan/plugins/fips_prf/fips_prf.c index 92977909e..47676b32f 100644 --- a/src/libstrongswan/plugins/fips_prf/fips_prf.c +++ b/src/libstrongswan/plugins/fips_prf/fips_prf.c @@ -31,7 +31,7 @@ struct private_fips_prf_t { /** * key of prf function, "b" long */ - u_int8_t *key; + uint8_t *key; /** * size of "b" in bytes @@ -46,19 +46,19 @@ struct private_fips_prf_t { /** * G function, either SHA1 or DES */ - bool (*g)(private_fips_prf_t *this, chunk_t c, u_int8_t res[]); + bool (*g)(private_fips_prf_t *this, chunk_t c, uint8_t res[]); }; /** * sum = (a + b) mod 2 ^ (length * 8) */ -static void add_mod(size_t length, u_int8_t a[], u_int8_t b[], u_int8_t sum[]) +static void add_mod(size_t length, uint8_t a[], uint8_t b[], uint8_t sum[]) { int i, c = 0; for(i = length - 1; i >= 0; i--) { - u_int32_t tmp; + uint32_t tmp; tmp = a[i] + b[i] + c; sum[i] = 0xff & tmp; @@ -69,7 +69,7 @@ static void add_mod(size_t length, u_int8_t a[], u_int8_t b[], u_int8_t sum[]) /** * calculate "chunk mod 2^(length*8)" and save it into buffer */ -static void chunk_mod(size_t length, chunk_t chunk, u_int8_t buffer[]) +static void chunk_mod(size_t length, chunk_t chunk, uint8_t buffer[]) { if (chunk.len < length) { @@ -105,14 +105,14 @@ static void chunk_mod(size_t length, chunk_t chunk, u_int8_t buffer[]) * 0x8e, 0x20, 0xd7, 0x37, 0xa3, 0x27, 0x51, 0x16 */ METHOD(prf_t, get_bytes, bool, - private_fips_prf_t *this, chunk_t seed, u_int8_t w[]) + private_fips_prf_t *this, chunk_t seed, uint8_t w[]) { int i; - u_int8_t xval[this->b]; - u_int8_t xseed[this->b]; - u_int8_t sum[this->b]; - u_int8_t *xkey = this->key; - u_int8_t one[this->b]; + uint8_t xval[this->b]; + uint8_t xseed[this->b]; + uint8_t sum[this->b]; + uint8_t *xkey = this->key; + uint8_t one[this->b]; if (!w) { @@ -175,9 +175,9 @@ METHOD(prf_t, set_key, bool, /** * Implementation of the G() function based on SHA1 */ -static bool g_sha1(private_fips_prf_t *this, chunk_t c, u_int8_t res[]) +static bool g_sha1(private_fips_prf_t *this, chunk_t c, uint8_t res[]) { - u_int8_t buf[64]; + uint8_t buf[64]; if (c.len < sizeof(buf)) { diff --git a/src/libstrongswan/plugins/gcm/gcm_aead.c b/src/libstrongswan/plugins/gcm/gcm_aead.c index 6e1694a34..e9a072461 100644 --- a/src/libstrongswan/plugins/gcm/gcm_aead.c +++ b/src/libstrongswan/plugins/gcm/gcm_aead.c @@ -67,11 +67,11 @@ struct private_gcm_aead_t { #if ULONG_MAX == 18446744073709551615UL && defined(htobe64) # define htobeword htobe64 # define bewordtoh be64toh -# define SHIFT_WORD_TYPE u_int64_t +# define SHIFT_WORD_TYPE uint64_t #else # define htobeword htonl # define bewordtoh ntohl -# define SHIFT_WORD_TYPE u_int32_t +# define SHIFT_WORD_TYPE uint32_t #endif /** diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c b/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c index a737cb13d..80a8dc90d 100644 --- a/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c +++ b/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c @@ -52,7 +52,7 @@ struct private_gcrypt_crypter_t { struct { char nonce[4]; char iv[8]; - u_int32_t counter; + uint32_t counter; } __attribute__((packed)) ctr; }; diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_hasher.c b/src/libstrongswan/plugins/gcrypt/gcrypt_hasher.c index af7993101..199c1d6c9 100644 --- a/src/libstrongswan/plugins/gcrypt/gcrypt_hasher.c +++ b/src/libstrongswan/plugins/gcrypt/gcrypt_hasher.c @@ -51,7 +51,7 @@ METHOD(hasher_t, reset, bool, } METHOD(hasher_t, get_hash, bool, - private_gcrypt_hasher_t *this, chunk_t chunk, u_int8_t *hash) + private_gcrypt_hasher_t *this, chunk_t chunk, uint8_t *hash) { gcry_md_write(this->hd, chunk.ptr, chunk.len); if (hash) diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_rng.c b/src/libstrongswan/plugins/gcrypt/gcrypt_rng.c index dc34a8d66..bf11758b1 100644 --- a/src/libstrongswan/plugins/gcrypt/gcrypt_rng.c +++ b/src/libstrongswan/plugins/gcrypt/gcrypt_rng.c @@ -36,7 +36,7 @@ struct private_gcrypt_rng_t { }; METHOD(rng_t, get_bytes, bool, - private_gcrypt_rng_t *this, size_t bytes, u_int8_t *buffer) + private_gcrypt_rng_t *this, size_t bytes, uint8_t *buffer) { switch (this->quality) { diff --git a/src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c b/src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c index 052b10741..e5d418ea4 100644 --- a/src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c +++ b/src/libstrongswan/plugins/gmp/gmp_rsa_private_key.c @@ -142,7 +142,7 @@ chunk_t gmp_mpz_to_chunk(const mpz_t value) static void mpz_clear_sensitive(mpz_t z) { size_t len = mpz_size(z) * GMP_LIMB_BITS / BITS_PER_BYTE; - u_int8_t *zeros = alloca(len); + uint8_t *zeros = alloca(len); memset(zeros, 0, len); /* overwrite mpz_t with zero bytes before clearing it */ diff --git a/src/libstrongswan/plugins/hmac/hmac.c b/src/libstrongswan/plugins/hmac/hmac.c index 96a14aed9..c777b47cd 100644 --- a/src/libstrongswan/plugins/hmac/hmac.c +++ b/src/libstrongswan/plugins/hmac/hmac.c @@ -38,7 +38,7 @@ struct private_mac_t { /** * Block size, as in RFC. */ - u_int8_t b; + uint8_t b; /** * Hash function. @@ -57,7 +57,7 @@ struct private_mac_t { }; METHOD(mac_t, get_mac, bool, - private_mac_t *this, chunk_t data, u_int8_t *out) + private_mac_t *this, chunk_t data, uint8_t *out) { /* H(K XOR opad, H(K XOR ipad, text)) * @@ -66,7 +66,7 @@ METHOD(mac_t, get_mac, bool, * */ - u_int8_t buffer[this->h->get_hash_size(this->h)]; + uint8_t buffer[this->h->get_hash_size(this->h)]; chunk_t inner; if (out == NULL) @@ -96,7 +96,7 @@ METHOD(mac_t, set_key, bool, private_mac_t *this, chunk_t key) { int i; - u_int8_t buffer[this->b]; + uint8_t buffer[this->b]; memset(buffer, 0, this->b); diff --git a/src/libstrongswan/plugins/md4/md4_hasher.c b/src/libstrongswan/plugins/md4/md4_hasher.c index 06c9ec2f8..ada6c05da 100644 --- a/src/libstrongswan/plugins/md4/md4_hasher.c +++ b/src/libstrongswan/plugins/md4/md4_hasher.c @@ -39,7 +39,7 @@ #define S33 11 #define S34 15 -static u_int8_t PADDING[64] = { +static uint8_t PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 @@ -65,11 +65,11 @@ static u_int8_t PADDING[64] = { (a) = ROTATE_LEFT ((a), (s)); \ } #define GG(a, b, c, d, x, s) { \ - (a) += G ((b), (c), (d)) + (x) + (u_int32_t)0x5a827999; \ + (a) += G ((b), (c), (d)) + (x) + (uint32_t)0x5a827999; \ (a) = ROTATE_LEFT ((a), (s)); \ } #define HH(a, b, c, d, x, s) { \ - (a) += H ((b), (c), (d)) + (x) + (u_int32_t)0x6ed9eba1; \ + (a) += H ((b), (c), (d)) + (x) + (uint32_t)0x6ed9eba1; \ (a) = ROTATE_LEFT ((a), (s)); \ } @@ -87,40 +87,40 @@ struct private_md4_hasher_t { /* * State of the hasher. */ - u_int32_t state[4]; - u_int32_t count[2]; - u_int8_t buffer[64]; + uint32_t state[4]; + uint32_t count[2]; + uint8_t buffer[64]; }; #if BYTE_ORDER != LITTLE_ENDIAN -/* Encodes input (u_int32_t) into output (u_int8_t). Assumes len is +/* Encodes input (uint32_t) into output (uint8_t). Assumes len is * a multiple of 4. */ -static void Encode (u_int8_t *output, u_int32_t *input, size_t len) +static void Encode (uint8_t *output, uint32_t *input, size_t len) { size_t i, j; for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (u_int8_t)(input[i] & 0xff); - output[j+1] = (u_int8_t)((input[i] >> 8) & 0xff); - output[j+2] = (u_int8_t)((input[i] >> 16) & 0xff); - output[j+3] = (u_int8_t)((input[i] >> 24) & 0xff); + output[j] = (uint8_t)(input[i] & 0xff); + output[j+1] = (uint8_t)((input[i] >> 8) & 0xff); + output[j+2] = (uint8_t)((input[i] >> 16) & 0xff); + output[j+3] = (uint8_t)((input[i] >> 24) & 0xff); } } -/* Decodes input (u_int8_t) into output (u_int32_t). Assumes len is +/* Decodes input (uint8_t) into output (uint32_t). Assumes len is * a multiple of 4. */ -static void Decode(u_int32_t *output, u_int8_t *input, size_t len) +static void Decode(uint32_t *output, uint8_t *input, size_t len) { size_t i, j; for (i = 0, j = 0; j < len; i++, j += 4) { - output[i] = ((u_int32_t)input[j]) | (((u_int32_t)input[j+1]) << 8) | - (((u_int32_t)input[j+2]) << 16) | (((u_int32_t)input[j+3]) << 24); + output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) | + (((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24); } } @@ -132,9 +132,9 @@ static void Decode(u_int32_t *output, u_int8_t *input, size_t len) /* * MD4 basic transformation. Transforms state based on block. */ -static void MD4Transform(u_int32_t state[4], u_int8_t block[64]) +static void MD4Transform(uint32_t state[4], uint8_t block[64]) { - u_int32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode(x, block, 64); @@ -202,13 +202,13 @@ static void MD4Transform(u_int32_t state[4], u_int8_t block[64]) * operation, processing another message block, and updating the * context. */ -static void MD4Update(private_md4_hasher_t *this, u_int8_t *input, size_t inputLen) +static void MD4Update(private_md4_hasher_t *this, uint8_t *input, size_t inputLen) { - u_int32_t i; + uint32_t i; size_t index, partLen; /* Compute number of bytes mod 64 */ - index = (u_int8_t)((this->count[0] >> 3) & 0x3F); + index = (uint8_t)((this->count[0] >> 3) & 0x3F); /* Update number of bits */ if ((this->count[0] += (inputLen << 3)) < (inputLen << 3)) @@ -243,9 +243,9 @@ static void MD4Update(private_md4_hasher_t *this, u_int8_t *input, size_t inputL /* MD4 finalization. Ends an MD4 message-digest operation, writing the * the message digest and zeroizing the context. */ -static void MD4Final (private_md4_hasher_t *this, u_int8_t digest[16]) +static void MD4Final (private_md4_hasher_t *this, uint8_t digest[16]) { - u_int8_t bits[8]; + uint8_t bits[8]; size_t index, padLen; /* Save number of bits */ @@ -280,7 +280,7 @@ METHOD(hasher_t, reset, bool, } METHOD(hasher_t, get_hash, bool, - private_md4_hasher_t *this, chunk_t chunk, u_int8_t *buffer) + private_md4_hasher_t *this, chunk_t chunk, uint8_t *buffer) { MD4Update(this, chunk.ptr, chunk.len); if (buffer != NULL) diff --git a/src/libstrongswan/plugins/md5/md5_hasher.c b/src/libstrongswan/plugins/md5/md5_hasher.c index 99b505e58..d14c10ae5 100644 --- a/src/libstrongswan/plugins/md5/md5_hasher.c +++ b/src/libstrongswan/plugins/md5/md5_hasher.c @@ -42,7 +42,7 @@ #define S43 15 #define S44 21 -static u_int8_t PADDING[64] = { +static uint8_t PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 @@ -66,22 +66,22 @@ static u_int8_t PADDING[64] = { Rotation is separate from addition to prevent recomputation. */ #define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ + (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ + (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ + (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } #define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (u_int32_t)(ac); \ + (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \ (a) = ROTATE_LEFT ((a), (s)); \ (a) += (b); \ } @@ -102,41 +102,41 @@ struct private_md5_hasher_t { /* * State of the hasher. */ - u_int32_t state[5]; - u_int32_t count[2]; - u_int8_t buffer[64]; + uint32_t state[5]; + uint32_t count[2]; + uint8_t buffer[64]; }; #if BYTE_ORDER != LITTLE_ENDIAN -/* Encodes input (u_int32_t) into output (u_int8_t). Assumes len is +/* Encodes input (uint32_t) into output (uint8_t). Assumes len is * a multiple of 4. */ -static void Encode (u_int8_t *output, u_int32_t *input, size_t len) +static void Encode (uint8_t *output, uint32_t *input, size_t len) { size_t i, j; for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (u_int8_t)(input[i] & 0xff); - output[j+1] = (u_int8_t)((input[i] >> 8) & 0xff); - output[j+2] = (u_int8_t)((input[i] >> 16) & 0xff); - output[j+3] = (u_int8_t)((input[i] >> 24) & 0xff); + output[j] = (uint8_t)(input[i] & 0xff); + output[j+1] = (uint8_t)((input[i] >> 8) & 0xff); + output[j+2] = (uint8_t)((input[i] >> 16) & 0xff); + output[j+3] = (uint8_t)((input[i] >> 24) & 0xff); } } -/* Decodes input (u_int8_t) into output (u_int32_t). Assumes len is +/* Decodes input (uint8_t) into output (uint32_t). Assumes len is * a multiple of 4. */ -static void Decode(u_int32_t *output, u_int8_t *input, size_t len) +static void Decode(uint32_t *output, uint8_t *input, size_t len) { size_t i, j; for (i = 0, j = 0; j < len; i++, j += 4) { - output[i] = ((u_int32_t)input[j]) | (((u_int32_t)input[j+1]) << 8) | - (((u_int32_t)input[j+2]) << 16) | (((u_int32_t)input[j+3]) << 24); + output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) | + (((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24); } } @@ -147,9 +147,9 @@ static void Decode(u_int32_t *output, u_int8_t *input, size_t len) /* MD5 basic transformation. Transforms state based on block. */ -static void MD5Transform(u_int32_t state[4], u_int8_t block[64]) +static void MD5Transform(uint32_t state[4], uint8_t block[64]) { - u_int32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; Decode(x, block, 64); @@ -235,13 +235,13 @@ static void MD5Transform(u_int32_t state[4], u_int8_t block[64]) * operation, processing another message block, and updating the * context. */ -static void MD5Update(private_md5_hasher_t *this, u_int8_t *input, size_t inputLen) +static void MD5Update(private_md5_hasher_t *this, uint8_t *input, size_t inputLen) { - u_int32_t i; + uint32_t i; size_t index, partLen; /* Compute number of bytes mod 64 */ - index = (u_int8_t)((this->count[0] >> 3) & 0x3F); + index = (uint8_t)((this->count[0] >> 3) & 0x3F); /* Update number of bits */ if ((this->count[0] += (inputLen << 3)) < (inputLen << 3)) @@ -276,9 +276,9 @@ static void MD5Update(private_md5_hasher_t *this, u_int8_t *input, size_t inputL /* MD5 finalization. Ends an MD5 message-digest operation, writing the * the message digest and zeroizing the context. */ -static void MD5Final (private_md5_hasher_t *this, u_int8_t digest[16]) +static void MD5Final (private_md5_hasher_t *this, uint8_t digest[16]) { - u_int8_t bits[8]; + uint8_t bits[8]; size_t index, padLen; /* Save number of bits */ @@ -313,7 +313,7 @@ METHOD(hasher_t, reset, bool, } METHOD(hasher_t, get_hash, bool, - private_md5_hasher_t *this, chunk_t chunk, u_int8_t *buffer) + private_md5_hasher_t *this, chunk_t chunk, uint8_t *buffer) { MD5Update(this, chunk.ptr, chunk.len); if (buffer != NULL) diff --git a/src/libstrongswan/plugins/nonce/nonce_nonceg.c b/src/libstrongswan/plugins/nonce/nonce_nonceg.c index 64ed2e08d..22c161df6 100644 --- a/src/libstrongswan/plugins/nonce/nonce_nonceg.c +++ b/src/libstrongswan/plugins/nonce/nonce_nonceg.c @@ -36,7 +36,7 @@ struct private_nonce_nonceg_t { }; METHOD(nonce_gen_t, get_nonce, bool, - private_nonce_nonceg_t *this, size_t size, u_int8_t *buffer) + private_nonce_nonceg_t *this, size_t size, uint8_t *buffer) { return this->rng->get_bytes(this->rng, size, buffer); } diff --git a/src/libstrongswan/plugins/ntru/ntru_drbg.c b/src/libstrongswan/plugins/ntru/ntru_drbg.c index ef0d3d9c8..b7a951d00 100644 --- a/src/libstrongswan/plugins/ntru/ntru_drbg.c +++ b/src/libstrongswan/plugins/ntru/ntru_drbg.c @@ -35,17 +35,17 @@ struct private_ntru_drbg_t { /** * Security strength in bits of the DRBG */ - u_int32_t strength; + uint32_t strength; /** * Number of requests for pseudorandom bits */ - u_int32_t reseed_counter; + uint32_t reseed_counter; /** * Maximum number of requests for pseudorandom bits */ - u_int32_t max_requests; + uint32_t max_requests; /** * True entropy source @@ -111,7 +111,7 @@ static bool update(private_ntru_drbg_t *this, chunk_t data) return TRUE; } -METHOD(ntru_drbg_t, get_strength, u_int32_t, +METHOD(ntru_drbg_t, get_strength, uint32_t, private_ntru_drbg_t *this) { return this->strength; @@ -142,7 +142,7 @@ METHOD(ntru_drbg_t, reseed, bool, } METHOD(ntru_drbg_t, generate, bool, - private_ntru_drbg_t *this, u_int32_t strength, u_int32_t len, u_int8_t *out) + private_ntru_drbg_t *this, uint32_t strength, uint32_t len, uint8_t *out) { size_t delta; chunk_t output; @@ -206,14 +206,14 @@ METHOD(ntru_drbg_t, destroy, void, /* * Described in header. */ -ntru_drbg_t *ntru_drbg_create(u_int32_t strength, chunk_t pers_str, +ntru_drbg_t *ntru_drbg_create(uint32_t strength, chunk_t pers_str, rng_t *entropy) { private_ntru_drbg_t *this; chunk_t seed; signer_t *hmac; size_t entropy_len; - u_int32_t max_requests; + uint32_t max_requests; if (strength > MAX_STRENGTH_BITS) { diff --git a/src/libstrongswan/plugins/ntru/ntru_drbg.h b/src/libstrongswan/plugins/ntru/ntru_drbg.h index 83cef11be..3fee1800b 100644 --- a/src/libstrongswan/plugins/ntru/ntru_drbg.h +++ b/src/libstrongswan/plugins/ntru/ntru_drbg.h @@ -36,7 +36,7 @@ struct ntru_drbg_t { * * @return configured security strength in bits */ - u_int32_t (*get_strength)(ntru_drbg_t *this); + uint32_t (*get_strength)(ntru_drbg_t *this); /** * Reseed the instantiated DRBG @@ -54,8 +54,8 @@ struct ntru_drbg_t { * @param out address of output buffer * @return TRUE if successful */ - bool (*generate)(ntru_drbg_t *this, u_int32_t strength, u_int32_t len, - u_int8_t *out); + bool (*generate)(ntru_drbg_t *this, uint32_t strength, uint32_t len, + uint8_t *out); /** * Get a reference on an ntru_drbg_t object increasing the count by one @@ -77,7 +77,7 @@ struct ntru_drbg_t { * @param pers_str personalization string * @param entropy entropy source to use */ -ntru_drbg_t *ntru_drbg_create(u_int32_t strength, chunk_t pers_str, +ntru_drbg_t *ntru_drbg_create(uint32_t strength, chunk_t pers_str, rng_t *entropy); #endif /** NTRU_DRBG_H_ @}*/ diff --git a/src/libstrongswan/plugins/ntru/ntru_ke.c b/src/libstrongswan/plugins/ntru/ntru_ke.c index 3b5df81d9..efc660bed 100644 --- a/src/libstrongswan/plugins/ntru/ntru_ke.c +++ b/src/libstrongswan/plugins/ntru/ntru_ke.c @@ -66,7 +66,7 @@ struct private_ntru_ke_t { /** * Cryptographical strength in bits of the NTRU Parameter Set */ - u_int32_t strength; + uint32_t strength; /** * NTRU Public Key @@ -247,7 +247,7 @@ ntru_ke_t *ntru_ke_create(diffie_hellman_group_t group, chunk_t g, chunk_t p) rng_t *entropy; ntru_drbg_t *drbg; char *parameter_set; - u_int32_t strength; + uint32_t strength; parameter_set = lib->settings->get_str(lib->settings, "%s.plugins.ntru.parameter_set", "optimum", lib->ns); diff --git a/src/libstrongswan/plugins/openssl/openssl_crypter.c b/src/libstrongswan/plugins/openssl/openssl_crypter.c index 26f4700b8..a02f78a93 100644 --- a/src/libstrongswan/plugins/openssl/openssl_crypter.c +++ b/src/libstrongswan/plugins/openssl/openssl_crypter.c @@ -43,7 +43,7 @@ struct private_openssl_crypter_t { /** * Look up an OpenSSL algorithm name and validate its key size */ -static char* lookup_algorithm(u_int16_t ikev2_algo, size_t *key_size) +static char* lookup_algorithm(uint16_t ikev2_algo, size_t *key_size) { struct { /* identifier specified in IKEv2 */ diff --git a/src/libstrongswan/plugins/openssl/openssl_hasher.c b/src/libstrongswan/plugins/openssl/openssl_hasher.c index 50b14698b..8f7df0f8a 100644 --- a/src/libstrongswan/plugins/openssl/openssl_hasher.c +++ b/src/libstrongswan/plugins/openssl/openssl_hasher.c @@ -53,7 +53,7 @@ METHOD(hasher_t, reset, bool, } METHOD(hasher_t, get_hash, bool, - private_openssl_hasher_t *this, chunk_t chunk, u_int8_t *hash) + private_openssl_hasher_t *this, chunk_t chunk, uint8_t *hash) { if (EVP_DigestUpdate(this->ctx, chunk.ptr, chunk.len) != 1) { diff --git a/src/libstrongswan/plugins/openssl/openssl_hmac.c b/src/libstrongswan/plugins/openssl/openssl_hmac.c index 065187a8c..b99a0c947 100644 --- a/src/libstrongswan/plugins/openssl/openssl_hmac.c +++ b/src/libstrongswan/plugins/openssl/openssl_hmac.c @@ -94,7 +94,7 @@ METHOD(mac_t, set_key, bool, } METHOD(mac_t, get_mac, bool, - private_mac_t *this, chunk_t data, u_int8_t *out) + private_mac_t *this, chunk_t data, uint8_t *out) { if (!this->key_set) { diff --git a/src/libstrongswan/plugins/openssl/openssl_rng.c b/src/libstrongswan/plugins/openssl/openssl_rng.c index c807bb607..f8e98fc0f 100644 --- a/src/libstrongswan/plugins/openssl/openssl_rng.c +++ b/src/libstrongswan/plugins/openssl/openssl_rng.c @@ -47,7 +47,7 @@ struct private_openssl_rng_t { }; METHOD(rng_t, get_bytes, bool, - private_openssl_rng_t *this, size_t bytes, u_int8_t *buffer) + private_openssl_rng_t *this, size_t bytes, uint8_t *buffer) { if (this->quality == RNG_WEAK) { diff --git a/src/libstrongswan/plugins/openssl/openssl_sha1_prf.c b/src/libstrongswan/plugins/openssl/openssl_sha1_prf.c index 446c93e2b..f6df03f12 100644 --- a/src/libstrongswan/plugins/openssl/openssl_sha1_prf.c +++ b/src/libstrongswan/plugins/openssl/openssl_sha1_prf.c @@ -40,7 +40,7 @@ struct private_openssl_sha1_prf_t { }; METHOD(prf_t, get_bytes, bool, - private_openssl_sha1_prf_t *this, chunk_t seed, u_int8_t *bytes) + private_openssl_sha1_prf_t *this, chunk_t seed, uint8_t *bytes) { #if OPENSSL_VERSION_NUMBER >= 0x10000000L if (!SHA1_Update(&this->ctx, seed.ptr, seed.len)) @@ -53,7 +53,7 @@ METHOD(prf_t, get_bytes, bool, if (bytes) { - u_int32_t *hash = (u_int32_t*)bytes; + uint32_t *hash = (uint32_t*)bytes; hash[0] = htonl(this->ctx.h0); hash[1] = htonl(this->ctx.h1); diff --git a/src/libstrongswan/plugins/padlock/padlock_rng.c b/src/libstrongswan/plugins/padlock/padlock_rng.c index 517914ab5..6b337d82c 100644 --- a/src/libstrongswan/plugins/padlock/padlock_rng.c +++ b/src/libstrongswan/plugins/padlock/padlock_rng.c @@ -81,7 +81,7 @@ METHOD(rng_t, allocate_bytes, bool, } METHOD(rng_t, get_bytes, bool, - private_padlock_rng_t *this, size_t bytes, u_int8_t *buffer) + private_padlock_rng_t *this, size_t bytes, uint8_t *buffer) { chunk_t chunk; diff --git a/src/libstrongswan/plugins/padlock/padlock_sha1_hasher.c b/src/libstrongswan/plugins/padlock/padlock_sha1_hasher.c index 4489b902a..107ade09b 100644 --- a/src/libstrongswan/plugins/padlock/padlock_sha1_hasher.c +++ b/src/libstrongswan/plugins/padlock/padlock_sha1_hasher.c @@ -54,9 +54,9 @@ static void padlock_sha1(int len, u_char *in, u_char *out) /** * sha1() a buffer of data into digest */ -static void sha1(chunk_t data, u_int32_t *digest) +static void sha1(chunk_t data, uint32_t *digest) { - u_int32_t hash[128] PADLOCK_ALIGN; + uint32_t hash[128] PADLOCK_ALIGN; hash[0] = 0x67452301; hash[1] = 0xefcdab89; @@ -91,18 +91,18 @@ METHOD(hasher_t, reset, bool, } METHOD(hasher_t, get_hash, bool, - private_padlock_sha1_hasher_t *this, chunk_t chunk, u_int8_t *hash) + private_padlock_sha1_hasher_t *this, chunk_t chunk, uint8_t *hash) { if (hash) { if (this->data.len) { append_data(this, chunk); - sha1(this->data, (u_int32_t*)hash); + sha1(this->data, (uint32_t*)hash); } else { /* hash directly if no previous data found */ - sha1(chunk, (u_int32_t*)hash); + sha1(chunk, (uint32_t*)hash); } reset(this); } diff --git a/src/libstrongswan/plugins/pem/pem_builder.c b/src/libstrongswan/plugins/pem/pem_builder.c index f0e508abf..719a2a69e 100644 --- a/src/libstrongswan/plugins/pem/pem_builder.c +++ b/src/libstrongswan/plugins/pem/pem_builder.c @@ -93,7 +93,7 @@ static status_t pem_decrypt(chunk_t *blob, encryption_algorithm_t alg, chunk_t hash; chunk_t decrypted; chunk_t key = {alloca(key_size), key_size}; - u_int8_t padding, *last_padding_pos, *first_padding_pos; + uint8_t padding, *last_padding_pos, *first_padding_pos; /* build key from passphrase and IV */ hasher = lib->crypto->create_hasher(lib->crypto, HASH_MD5); diff --git a/src/libstrongswan/plugins/pgp/pgp_builder.c b/src/libstrongswan/plugins/pgp/pgp_builder.c index 152e83aaa..fe0be45d9 100644 --- a/src/libstrongswan/plugins/pgp/pgp_builder.c +++ b/src/libstrongswan/plugins/pgp/pgp_builder.c @@ -26,7 +26,7 @@ */ static public_key_t *parse_public_key(chunk_t blob) { - u_int32_t alg; + uint32_t alg; public_key_t *key; if (!pgp_read_scalar(&blob, 1, &alg)) @@ -74,7 +74,7 @@ static public_key_t *parse_rsa_public_key(chunk_t blob) static private_key_t *parse_rsa_private_key(chunk_t blob) { chunk_t mpi[6]; - u_int32_t s2k; + uint32_t s2k; int i; for (i = 0; i < 2; i++) @@ -143,7 +143,7 @@ static private_key_t *parse_private_key(chunk_t blob) { chunk_t packet; pgp_packet_tag_t tag; - u_int32_t version, created, days, alg; + uint32_t version, created, days, alg; private_key_t *key; if (!pgp_read_packet(&blob, &packet, &tag)) diff --git a/src/libstrongswan/plugins/pgp/pgp_cert.c b/src/libstrongswan/plugins/pgp/pgp_cert.c index 89d7094ad..0ffce4cfc 100644 --- a/src/libstrongswan/plugins/pgp/pgp_cert.c +++ b/src/libstrongswan/plugins/pgp/pgp_cert.c @@ -40,17 +40,17 @@ struct private_pgp_cert_t { /** * version of the public key */ - u_int32_t version; + uint32_t version; /** * creation time */ - u_int32_t created; + uint32_t created; /** * days the certificate is valid */ - u_int32_t valid; + uint32_t valid; /** * userid of the certificate @@ -349,7 +349,7 @@ static bool parse_public_key(private_pgp_cert_t *this, chunk_t packet) */ static bool parse_signature(private_pgp_cert_t *this, chunk_t packet) { - u_int32_t version, len, type, created; + uint32_t version, len, type, created; if (!pgp_read_scalar(&packet, 1, &version)) { diff --git a/src/libstrongswan/plugins/pgp/pgp_utils.c b/src/libstrongswan/plugins/pgp/pgp_utils.c index bb15627fd..283bf8c36 100644 --- a/src/libstrongswan/plugins/pgp/pgp_utils.c +++ b/src/libstrongswan/plugins/pgp/pgp_utils.c @@ -73,9 +73,9 @@ ENUM_END(pgp_packet_tag_names, PGP_PKT_MOD_DETECT_CODE); /** * Read a PGP scalar of bytes length, advance blob */ -bool pgp_read_scalar(chunk_t *blob, size_t bytes, u_int32_t *scalar) +bool pgp_read_scalar(chunk_t *blob, size_t bytes, uint32_t *scalar) { - u_int32_t res = 0; + uint32_t res = 0; if (bytes > blob->len) { @@ -96,7 +96,7 @@ bool pgp_read_scalar(chunk_t *blob, size_t bytes, u_int32_t *scalar) */ bool pgp_read_mpi(chunk_t *blob, chunk_t *mpi) { - u_int32_t bits, bytes; + uint32_t bits, bytes; if (!pgp_read_scalar(blob, 2, &bits)) { @@ -117,7 +117,7 @@ bool pgp_read_mpi(chunk_t *blob, chunk_t *mpi) /** * Read length of an PGP old packet length encoding */ -static bool pgp_old_packet_length(chunk_t *blob, u_int32_t *length) +static bool pgp_old_packet_length(chunk_t *blob, uint32_t *length) { /* bits 0 and 1 define the packet length type */ u_char type; @@ -141,7 +141,7 @@ static bool pgp_old_packet_length(chunk_t *blob, u_int32_t *length) */ bool pgp_read_packet(chunk_t *blob, chunk_t *data, pgp_packet_tag_t *tag) { - u_int32_t len; + uint32_t len; u_char t; if (!blob->len) diff --git a/src/libstrongswan/plugins/pgp/pgp_utils.h b/src/libstrongswan/plugins/pgp/pgp_utils.h index 203a0a85d..180292a7a 100644 --- a/src/libstrongswan/plugins/pgp/pgp_utils.h +++ b/src/libstrongswan/plugins/pgp/pgp_utils.h @@ -115,7 +115,7 @@ bool pgp_read_mpi(chunk_t *blob, chunk_t *mpi); * @param scalar resultin scalar * @return TRUE if scalar parsed successfully */ -bool pgp_read_scalar(chunk_t *blob, size_t bytes, u_int32_t *scalar); +bool pgp_read_scalar(chunk_t *blob, size_t bytes, uint32_t *scalar); /** * Parse a PGP packet. diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_hasher.c b/src/libstrongswan/plugins/pkcs11/pkcs11_hasher.c index 80079b9a9..847f03115 100644 --- a/src/libstrongswan/plugins/pkcs11/pkcs11_hasher.c +++ b/src/libstrongswan/plugins/pkcs11/pkcs11_hasher.c @@ -146,7 +146,7 @@ METHOD(hasher_t, reset, bool, } METHOD(hasher_t, get_hash, bool, - private_pkcs11_hasher_t *this, chunk_t chunk, u_int8_t *hash) + private_pkcs11_hasher_t *this, chunk_t chunk, uint8_t *hash) { CK_RV rv; CK_ULONG len; diff --git a/src/libstrongswan/plugins/pkcs11/pkcs11_rng.c b/src/libstrongswan/plugins/pkcs11/pkcs11_rng.c index d18028b45..753835187 100644 --- a/src/libstrongswan/plugins/pkcs11/pkcs11_rng.c +++ b/src/libstrongswan/plugins/pkcs11/pkcs11_rng.c @@ -44,7 +44,7 @@ struct private_pkcs11_rng_t { }; METHOD(rng_t, get_bytes, bool, - private_pkcs11_rng_t *this, size_t bytes, u_int8_t *buffer) + private_pkcs11_rng_t *this, size_t bytes, uint8_t *buffer) { CK_RV rv; rv = this->lib->f->C_GenerateRandom(this->session, buffer, bytes); diff --git a/src/libstrongswan/plugins/pkcs12/pkcs12_decode.c b/src/libstrongswan/plugins/pkcs12/pkcs12_decode.c index 4441b278f..82fc0c0b9 100644 --- a/src/libstrongswan/plugins/pkcs12/pkcs12_decode.c +++ b/src/libstrongswan/plugins/pkcs12/pkcs12_decode.c @@ -324,7 +324,7 @@ end: * Verify the given MAC with available passwords. */ static bool verify_mac(hash_algorithm_t hash, chunk_t salt, - u_int64_t iterations, chunk_t data, chunk_t mac) + uint64_t iterations, chunk_t data, chunk_t mac) { integrity_algorithm_t integ; enumerator_t *enumerator; @@ -450,7 +450,7 @@ static bool parse_PFX(private_pkcs12_t *this, chunk_t blob) data = chunk_empty; hash_algorithm_t hash = HASH_UNKNOWN; container_t *container = NULL; - u_int64_t iterations = 0; + uint64_t iterations = 0; bool success = FALSE; parser = asn1_parser_create(PFXObjects, blob); diff --git a/src/libstrongswan/plugins/plugin_feature.c b/src/libstrongswan/plugins/plugin_feature.c index 0ea5eeaf8..4c92c412c 100644 --- a/src/libstrongswan/plugins/plugin_feature.c +++ b/src/libstrongswan/plugins/plugin_feature.c @@ -57,7 +57,7 @@ ENUM(plugin_feature_names, FEATURE_NONE, FEATURE_CUSTOM, /** * See header. */ -u_int32_t plugin_feature_hash(plugin_feature_t *feature) +uint32_t plugin_feature_hash(plugin_feature_t *feature) { chunk_t data = chunk_empty; diff --git a/src/libstrongswan/plugins/plugin_feature.h b/src/libstrongswan/plugins/plugin_feature.h index 03f1ba8cc..ee7808a94 100644 --- a/src/libstrongswan/plugins/plugin_feature.h +++ b/src/libstrongswan/plugins/plugin_feature.h @@ -362,7 +362,7 @@ static inline void plugin_features_add(plugin_feature_t *features, * @param feature feature to hash * @return hash value of the feature */ -u_int32_t plugin_feature_hash(plugin_feature_t *feature); +uint32_t plugin_feature_hash(plugin_feature_t *feature); /** * Check if feature a matches to feature b. diff --git a/src/libstrongswan/plugins/random/random_rng.c b/src/libstrongswan/plugins/random/random_rng.c index 177b3c2e5..3760630ab 100644 --- a/src/libstrongswan/plugins/random/random_rng.c +++ b/src/libstrongswan/plugins/random/random_rng.c @@ -41,7 +41,7 @@ struct private_random_rng_t { }; METHOD(rng_t, get_bytes, bool, - private_random_rng_t *this, size_t bytes, u_int8_t *buffer) + private_random_rng_t *this, size_t bytes, uint8_t *buffer) { size_t done; ssize_t got; diff --git a/src/libstrongswan/plugins/rc2/rc2_crypter.c b/src/libstrongswan/plugins/rc2/rc2_crypter.c index 256acf817..d9681e834 100644 --- a/src/libstrongswan/plugins/rc2/rc2_crypter.c +++ b/src/libstrongswan/plugins/rc2/rc2_crypter.c @@ -19,11 +19,11 @@ typedef struct private_rc2_crypter_t private_rc2_crypter_t; #define RC2_BLOCK_SIZE 8 -#define ROL16(x, k) ({ u_int16_t _x = (x); (_x << (k)) | (_x >> (16 - (k))); }) -#define ROR16(x, k) ({ u_int16_t _x = (x); (_x >> (k)) | (_x << (16 - (k))); }) +#define ROL16(x, k) ({ uint16_t _x = (x); (_x << (k)) | (_x >> (16 - (k))); }) +#define ROR16(x, k) ({ uint16_t _x = (x); (_x >> (k)) | (_x << (16 - (k))); }) -#define GET16(x) ({ u_char *_x = (x); (u_int16_t)_x[0] | ((u_int16_t)_x[1] << 8); }) -#define PUT16(x, v) ({ u_char *_x = (x); u_int16_t _v = (v); _x[0] = _v, _x[1] = _v >> 8; }) +#define GET16(x) ({ u_char *_x = (x); (uint16_t)_x[0] | ((uint16_t)_x[1] << 8); }) +#define PUT16(x, v) ({ u_char *_x = (x); uint16_t _v = (v); _x[0] = _v, _x[1] = _v >> 8; }) /** * Private data of rc2_crypter_t @@ -38,7 +38,7 @@ struct private_rc2_crypter_t { /** * The expanded key in 16-bit words */ - u_int16_t K[64]; + uint16_t K[64]; /** * Key size in bytes @@ -95,7 +95,7 @@ static const u_char PITABLE[256] = */ static void encrypt_block(private_rc2_crypter_t *this, u_char R[]) { - register u_int16_t R0, R1, R2, R3, *Kj; + register uint16_t R0, R1, R2, R3, *Kj; int rounds = 3, mix = 5; R0 = GET16(R); @@ -139,7 +139,7 @@ static void encrypt_block(private_rc2_crypter_t *this, u_char R[]) */ static void decrypt_block(private_rc2_crypter_t *this, u_char R[]) { - register u_int16_t R0, R1, R2, R3, *Kj; + register uint16_t R0, R1, R2, R3, *Kj; int rounds = 3, mix = 5; R0 = GET16(R); @@ -185,7 +185,7 @@ static void decrypt_block(private_rc2_crypter_t *this, u_char R[]) METHOD(crypter_t, decrypt, bool, private_rc2_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *decrypted) { - u_int8_t *in, *out, *prev; + uint8_t *in, *out, *prev; if (data.len % RC2_BLOCK_SIZE || iv.len != RC2_BLOCK_SIZE) { @@ -222,7 +222,7 @@ METHOD(crypter_t, decrypt, bool, METHOD(crypter_t, encrypt, bool, private_rc2_crypter_t *this, chunk_t data, chunk_t iv, chunk_t *encrypted) { - u_int8_t *in, *out, *end, *prev; + uint8_t *in, *out, *end, *prev; if (data.len % RC2_BLOCK_SIZE || iv.len != RC2_BLOCK_SIZE) { @@ -273,7 +273,7 @@ METHOD(crypter_t, get_key_size, size_t, METHOD(crypter_t, set_key, bool, private_rc2_crypter_t *this, chunk_t key) { - u_int8_t L[128], T8, TM, idx; + uint8_t L[128], T8, TM, idx; int i; if (key.len != this->T) diff --git a/src/libstrongswan/plugins/rdrand/rdrand_rng.c b/src/libstrongswan/plugins/rdrand/rdrand_rng.c index fa66f3ad7..b7225b6a2 100644 --- a/src/libstrongswan/plugins/rdrand/rdrand_rng.c +++ b/src/libstrongswan/plugins/rdrand/rdrand_rng.c @@ -54,7 +54,7 @@ struct private_rdrand_rng_t { /** * Get a two byte word using RDRAND */ -static bool rdrand16(u_int16_t *out) +static bool rdrand16(uint16_t *out) { u_char res; int i; @@ -76,7 +76,7 @@ static bool rdrand16(u_int16_t *out) /** * Get a four byte word using RDRAND */ -static bool rdrand32(u_int32_t *out) +static bool rdrand32(uint32_t *out) { u_char res; int i; @@ -99,7 +99,7 @@ static bool rdrand32(u_int32_t *out) /** * Get a eight byte word using RDRAND */ -static bool rdrand64(u_int64_t *out) +static bool rdrand64(uint64_t *out) { u_char res; int i; @@ -122,9 +122,9 @@ static bool rdrand64(u_int64_t *out) /** * Get a one byte word using RDRAND */ -static bool rdrand8(u_int8_t *out) +static bool rdrand8(uint8_t *out) { - u_int16_t u16; + uint16_t u16; if (!rdrand16(&u16)) { @@ -141,15 +141,15 @@ static bool rdrand128(void *out) { #ifdef __x86_64__ if (!rdrand64(out) || - !rdrand64(out + sizeof(u_int64_t))) + !rdrand64(out + sizeof(uint64_t))) { return FALSE; } #else /* __i386__ */ if (!rdrand32(out) || - !rdrand32(out + 1 * sizeof(u_int32_t)) || - !rdrand32(out + 2 * sizeof(u_int32_t)) || - !rdrand32(out + 3 * sizeof(u_int32_t))) + !rdrand32(out + 1 * sizeof(uint32_t)) || + !rdrand32(out + 2 * sizeof(uint32_t)) || + !rdrand32(out + 3 * sizeof(uint32_t))) { return FALSE; } @@ -165,9 +165,9 @@ static bool reseed() int i; #ifdef __x86_64__ - u_int64_t tmp; + uint64_t tmp; - for (i = 0; i < 511 * 16 / sizeof(u_int64_t); i++) + for (i = 0; i < 511 * 16 / sizeof(uint64_t); i++) { if (!rdrand64(&tmp)) { @@ -175,9 +175,9 @@ static bool reseed() } } #else /* __i386__ */ - u_int32_t tmp; + uint32_t tmp; - for (i = 0; i < 511 * 16 / sizeof(u_int32_t); i++) + for (i = 0; i < 511 * 16 / sizeof(uint32_t); i++) { if (!rdrand32(&tmp)) { @@ -202,48 +202,48 @@ static bool rdrand_chunk(private_rdrand_rng_t *this, chunk_t chunk) } /* align to 2 byte */ - if (chunk.len >= sizeof(u_int8_t)) + if (chunk.len >= sizeof(uint8_t)) { if ((uintptr_t)chunk.ptr % 2) { - if (!rdrand8((u_int8_t*)chunk.ptr)) + if (!rdrand8((uint8_t*)chunk.ptr)) { return FALSE; } - chunk = chunk_skip(chunk, sizeof(u_int8_t)); + chunk = chunk_skip(chunk, sizeof(uint8_t)); } } /* align to 4 byte */ - if (chunk.len >= sizeof(u_int16_t)) + if (chunk.len >= sizeof(uint16_t)) { if ((uintptr_t)chunk.ptr % 4) { - if (!rdrand16((u_int16_t*)chunk.ptr)) + if (!rdrand16((uint16_t*)chunk.ptr)) { return FALSE; } - chunk = chunk_skip(chunk, sizeof(u_int16_t)); + chunk = chunk_skip(chunk, sizeof(uint16_t)); } } #ifdef __x86_64__ /* align to 8 byte */ - if (chunk.len >= sizeof(u_int32_t)) + if (chunk.len >= sizeof(uint32_t)) { if ((uintptr_t)chunk.ptr % 8) { - if (!rdrand32((u_int32_t*)chunk.ptr)) + if (!rdrand32((uint32_t*)chunk.ptr)) { return FALSE; } - chunk = chunk_skip(chunk, sizeof(u_int32_t)); + chunk = chunk_skip(chunk, sizeof(uint32_t)); } } /* fill with 8 byte words */ - while (chunk.len >= sizeof(u_int64_t)) + while (chunk.len >= sizeof(uint64_t)) { if (this->quality == RNG_STRONG && chunk.len % FORCE_RESEED == 0) { @@ -252,27 +252,27 @@ static bool rdrand_chunk(private_rdrand_rng_t *this, chunk_t chunk) return FALSE; } } - if (!rdrand64((u_int64_t*)chunk.ptr)) + if (!rdrand64((uint64_t*)chunk.ptr)) { return FALSE; } - chunk = chunk_skip(chunk, sizeof(u_int64_t)); + chunk = chunk_skip(chunk, sizeof(uint64_t)); } /* append 4 byte word */ - if (chunk.len >= sizeof(u_int32_t)) + if (chunk.len >= sizeof(uint32_t)) { - if (!rdrand32((u_int32_t*)chunk.ptr)) + if (!rdrand32((uint32_t*)chunk.ptr)) { return FALSE; } - chunk = chunk_skip(chunk, sizeof(u_int32_t)); + chunk = chunk_skip(chunk, sizeof(uint32_t)); } #else /* __i386__ */ /* fill with 4 byte words */ - while (chunk.len >= sizeof(u_int32_t)) + while (chunk.len >= sizeof(uint32_t)) { if (this->quality == RNG_STRONG && chunk.len % FORCE_RESEED == 0) { @@ -281,11 +281,11 @@ static bool rdrand_chunk(private_rdrand_rng_t *this, chunk_t chunk) return FALSE; } } - if (!rdrand32((u_int32_t*)chunk.ptr)) + if (!rdrand32((uint32_t*)chunk.ptr)) { return FALSE; } - chunk = chunk_skip(chunk, sizeof(u_int32_t)); + chunk = chunk_skip(chunk, sizeof(uint32_t)); } #endif /* __x86_64__ / __i386__ */ @@ -299,23 +299,23 @@ static bool rdrand_chunk(private_rdrand_rng_t *this, chunk_t chunk) } /* append 2 byte word */ - if (chunk.len >= sizeof(u_int16_t)) + if (chunk.len >= sizeof(uint16_t)) { - if (!rdrand16((u_int16_t*)chunk.ptr)) + if (!rdrand16((uint16_t*)chunk.ptr)) { return FALSE; } - chunk = chunk_skip(chunk, sizeof(u_int16_t)); + chunk = chunk_skip(chunk, sizeof(uint16_t)); } /* append 1 byte word */ - if (chunk.len >= sizeof(u_int8_t)) + if (chunk.len >= sizeof(uint8_t)) { - if (!rdrand8((u_int8_t*)chunk.ptr)) + if (!rdrand8((uint8_t*)chunk.ptr)) { return FALSE; } - chunk = chunk_skip(chunk, sizeof(u_int8_t)); + chunk = chunk_skip(chunk, sizeof(uint8_t)); } return TRUE; @@ -378,7 +378,7 @@ static bool rdrand_mixed(private_rdrand_rng_t *this, chunk_t chunk) } METHOD(rng_t, get_bytes, bool, - private_rdrand_rng_t *this, size_t bytes, u_int8_t *buffer) + private_rdrand_rng_t *this, size_t bytes, uint8_t *buffer) { switch (this->quality) { diff --git a/src/libstrongswan/plugins/sha1/sha1_hasher.c b/src/libstrongswan/plugins/sha1/sha1_hasher.c index b51a26152..fca65dfa2 100644 --- a/src/libstrongswan/plugins/sha1/sha1_hasher.c +++ b/src/libstrongswan/plugins/sha1/sha1_hasher.c @@ -59,20 +59,20 @@ struct private_sha1_hasher_t { /* * State of the hasher. Shared with sha1_prf.c, do not change it!!! */ - u_int32_t state[5]; - u_int32_t count[2]; - u_int8_t buffer[64]; + uint32_t state[5]; + uint32_t count[2]; + uint8_t buffer[64]; }; /* * Hash a single 512-bit block. This is the core of the algorithm. * */ -static void SHA1Transform(u_int32_t state[5], const unsigned char buffer[64]) +static void SHA1Transform(uint32_t state[5], const unsigned char buffer[64]) { - u_int32_t a, b, c, d, e; + uint32_t a, b, c, d, e; typedef union { - u_int8_t c[64]; - u_int32_t l[16]; + uint8_t c[64]; + uint32_t l[16]; } CHAR64LONG16; CHAR64LONG16 block[1]; /* use array to appear as a pointer */ memcpy(block, buffer, 64); @@ -118,10 +118,10 @@ static void SHA1Transform(u_int32_t state[5], const unsigned char buffer[64]) /** * Run your data through this. Also used in sha1_prf. */ -void SHA1Update(private_sha1_hasher_t* this, u_int8_t *data, u_int32_t len) +void SHA1Update(private_sha1_hasher_t* this, uint8_t *data, uint32_t len) { - u_int32_t i; - u_int32_t j; + uint32_t i; + uint32_t j; j = this->count[0]; if ((this->count[0] += len << 3) < j) @@ -151,15 +151,15 @@ void SHA1Update(private_sha1_hasher_t* this, u_int8_t *data, u_int32_t len) /* * Add padding and return the message digest. */ -static void SHA1Final(private_sha1_hasher_t *this, u_int8_t *digest) +static void SHA1Final(private_sha1_hasher_t *this, uint8_t *digest) { - u_int32_t i; - u_int8_t finalcount[8]; - u_int8_t c; + uint32_t i; + uint8_t finalcount[8]; + uint8_t c; for (i = 0; i < 8; i++) { - finalcount[i] = (u_int8_t)((this->count[(i >= 4 ? 0 : 1)] + finalcount[i] = (uint8_t)((this->count[(i >= 4 ? 0 : 1)] >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ } c = 0200; @@ -172,7 +172,7 @@ static void SHA1Final(private_sha1_hasher_t *this, u_int8_t *digest) SHA1Update(this, finalcount, 8); /* Should cause a SHA1Transform() */ for (i = 0; i < 20; i++) { - digest[i] = (u_int8_t)((this->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); + digest[i] = (uint8_t)((this->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); } } @@ -191,7 +191,7 @@ METHOD(hasher_t, reset, bool, } METHOD(hasher_t, get_hash, bool, - private_sha1_hasher_t *this, chunk_t chunk, u_int8_t *buffer) + private_sha1_hasher_t *this, chunk_t chunk, uint8_t *buffer) { SHA1Update(this, chunk.ptr, chunk.len); if (buffer != NULL) diff --git a/src/libstrongswan/plugins/sha1/sha1_prf.c b/src/libstrongswan/plugins/sha1/sha1_prf.c index cc4924a80..464f4c9ec 100644 --- a/src/libstrongswan/plugins/sha1/sha1_prf.c +++ b/src/libstrongswan/plugins/sha1/sha1_prf.c @@ -33,9 +33,9 @@ struct private_sha1_hasher_t { /* * State of the hasher. From sha1_hasher.c, do not change it! */ - u_int32_t state[5]; - u_int32_t count[2]; - u_int8_t buffer[64]; + uint32_t state[5]; + uint32_t count[2]; + uint8_t buffer[64]; }; /** @@ -57,12 +57,12 @@ struct private_sha1_prf_t { /** * From sha1_hasher.c */ -extern void SHA1Update(private_sha1_hasher_t* this, u_int8_t *data, u_int32_t len); +extern void SHA1Update(private_sha1_hasher_t* this, uint8_t *data, uint32_t len); METHOD(prf_t, get_bytes, bool, - private_sha1_prf_t *this, chunk_t seed, u_int8_t *bytes) + private_sha1_prf_t *this, chunk_t seed, uint8_t *bytes) { - u_int32_t *hash = (u_int32_t*)bytes; + uint32_t *hash = (uint32_t*)bytes; SHA1Update(this->hasher, seed.ptr, seed.len); @@ -98,14 +98,14 @@ METHOD(prf_t, set_key, bool, private_sha1_prf_t *this, chunk_t key) { int i, rounds; - u_int32_t *iv = (u_int32_t*)key.ptr; + uint32_t *iv = (uint32_t*)key.ptr; if (!this->hasher->public.hasher_interface.reset( &this->hasher->public.hasher_interface)) { return FALSE; } - rounds = min(key.len/sizeof(u_int32_t), sizeof(this->hasher->state)); + rounds = min(key.len/sizeof(uint32_t), sizeof(this->hasher->state)); for (i = 0; i < rounds; i++) { this->hasher->state[i] ^= htonl(iv[i]); diff --git a/src/libstrongswan/plugins/sha2/sha2_hasher.c b/src/libstrongswan/plugins/sha2/sha2_hasher.c index 1c6dd2533..89e7675e3 100644 --- a/src/libstrongswan/plugins/sha2/sha2_hasher.c +++ b/src/libstrongswan/plugins/sha2/sha2_hasher.c @@ -33,9 +33,9 @@ struct private_sha512_hasher_t { sha2_hasher_t public; unsigned char sha_out[128]; /* results are here, bytes 0..47/0..63 */ - u_int64_t sha_H[8]; - u_int64_t sha_blocks; - u_int64_t sha_blocksMSB; + uint64_t sha_H[8]; + uint64_t sha_blocks; + uint64_t sha_blocksMSB; int sha_bufCnt; }; @@ -52,23 +52,23 @@ struct private_sha256_hasher_t { sha2_hasher_t public; unsigned char sha_out[64]; /* results are here, bytes 0...31 */ - u_int32_t sha_H[8]; - u_int64_t sha_blocks; + uint32_t sha_H[8]; + uint64_t sha_blocks; int sha_bufCnt; }; -static const u_int32_t sha224_hashInit[8] = { +static const uint32_t sha224_hashInit[8] = { 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 }; -static const u_int32_t sha256_hashInit[8] = { +static const uint32_t sha256_hashInit[8] = { 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 }; -static const u_int32_t sha256_K[64] = { +static const uint32_t sha256_K[64] = { 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, @@ -82,19 +82,19 @@ static const u_int32_t sha256_K[64] = { 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 }; -static const u_int64_t sha512_hashInit[8] = { +static const uint64_t sha512_hashInit[8] = { 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL, 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL }; -static const u_int64_t sha384_hashInit[8] = { +static const uint64_t sha384_hashInit[8] = { 0xcbbb9d5dc1059ed8ULL, 0x629a292a367cd507ULL, 0x9159015a3070dd17ULL, 0x152fecd8f70e5939ULL, 0x67332667ffc00b31ULL, 0x8eb44a8768581511ULL, 0xdb0c2e0d64f98fa7ULL, 0x47b5481dbefa4fa4ULL }; -static const u_int64_t sha512_K[80] = { +static const uint64_t sha512_K[80] = { 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, 0xd807aa98a3030242ULL, @@ -143,14 +143,14 @@ static void sha256_transform(private_sha256_hasher_t *ctx, const unsigned char *datap) { register int j; - u_int32_t a, b, c, d, e, f, g, h; - u_int32_t T1, T2, W[64], Wm2, Wm15; + uint32_t a, b, c, d, e, f, g, h; + uint32_t T1, T2, W[64], Wm2, Wm15; /* read the data, big endian byte order */ j = 0; do { - W[j] = (((u_int32_t)(datap[0]))<<24) | (((u_int32_t)(datap[1]))<<16) | - (((u_int32_t)(datap[2]))<<8 ) | ((u_int32_t)(datap[3])); + W[j] = (((uint32_t)(datap[0]))<<24) | (((uint32_t)(datap[1]))<<16) | + (((uint32_t)(datap[2]))<<8 ) | ((uint32_t)(datap[3])); datap += 4; } while(++j < 16); @@ -229,8 +229,8 @@ static void sha256_write(private_sha256_hasher_t *ctx, static void sha256_final(private_sha256_hasher_t *ctx) { register int j; - u_int64_t bitLength; - u_int32_t i; + uint64_t bitLength; + uint32_t i; unsigned char padByte, *datap; bitLength = (ctx->sha_blocks << 9) | (ctx->sha_bufCnt << 3); @@ -287,16 +287,16 @@ static void sha512_transform(private_sha512_hasher_t *ctx, const unsigned char *datap) { register int j; - u_int64_t a, b, c, d, e, f, g, h; - u_int64_t T1, T2, W[80], Wm2, Wm15; + uint64_t a, b, c, d, e, f, g, h; + uint64_t T1, T2, W[80], Wm2, Wm15; /* read the data, big endian byte order */ j = 0; do { - W[j] = (((u_int64_t)(datap[0]))<<56) | (((u_int64_t)(datap[1]))<<48) | - (((u_int64_t)(datap[2]))<<40) | (((u_int64_t)(datap[3]))<<32) | - (((u_int64_t)(datap[4]))<<24) | (((u_int64_t)(datap[5]))<<16) | - (((u_int64_t)(datap[6]))<<8 ) | ((u_int64_t)(datap[7])); + W[j] = (((uint64_t)(datap[0]))<<56) | (((uint64_t)(datap[1]))<<48) | + (((uint64_t)(datap[2]))<<40) | (((uint64_t)(datap[3]))<<32) | + (((uint64_t)(datap[4]))<<24) | (((uint64_t)(datap[5]))<<16) | + (((uint64_t)(datap[6]))<<8 ) | ((uint64_t)(datap[7])); datap += 8; } while(++j < 16); @@ -374,8 +374,8 @@ static void sha512_write(private_sha512_hasher_t *ctx, static void sha512_final(private_sha512_hasher_t *ctx) { register int j; - u_int64_t bitLength, bitLengthMSB; - u_int64_t i; + uint64_t bitLength, bitLengthMSB; + uint64_t i; unsigned char padByte, *datap; bitLength = (ctx->sha_blocks << 10) | (ctx->sha_bufCnt << 3); @@ -469,7 +469,7 @@ METHOD(hasher_t, reset512, bool, } METHOD(hasher_t, get_hash224, bool, - private_sha256_hasher_t *this, chunk_t chunk, u_int8_t *buffer) + private_sha256_hasher_t *this, chunk_t chunk, uint8_t *buffer) { sha256_write(this, chunk.ptr, chunk.len); if (buffer != NULL) @@ -482,7 +482,7 @@ METHOD(hasher_t, get_hash224, bool, } METHOD(hasher_t, get_hash256, bool, - private_sha256_hasher_t *this, chunk_t chunk, u_int8_t *buffer) + private_sha256_hasher_t *this, chunk_t chunk, uint8_t *buffer) { sha256_write(this, chunk.ptr, chunk.len); if (buffer != NULL) @@ -495,7 +495,7 @@ METHOD(hasher_t, get_hash256, bool, } METHOD(hasher_t, get_hash384, bool, - private_sha512_hasher_t *this, chunk_t chunk, u_int8_t *buffer) + private_sha512_hasher_t *this, chunk_t chunk, uint8_t *buffer) { sha512_write(this, chunk.ptr, chunk.len); if (buffer != NULL) @@ -508,7 +508,7 @@ METHOD(hasher_t, get_hash384, bool, } METHOD(hasher_t, get_hash512, bool, - private_sha512_hasher_t *this, chunk_t chunk, u_int8_t *buffer) + private_sha512_hasher_t *this, chunk_t chunk, uint8_t *buffer) { sha512_write(this, chunk.ptr, chunk.len); if (buffer != NULL) diff --git a/src/libstrongswan/plugins/winhttp/winhttp_fetcher.c b/src/libstrongswan/plugins/winhttp/winhttp_fetcher.c index 5f0b58479..da56954ab 100644 --- a/src/libstrongswan/plugins/winhttp/winhttp_fetcher.c +++ b/src/libstrongswan/plugins/winhttp/winhttp_fetcher.c @@ -120,7 +120,7 @@ static bool read_result(private_winhttp_fetcher_t *this, HINTERNET request, { DWORD received; char buf[1024]; - u_int32_t code; + uint32_t code; DWORD codelen = sizeof(code); if (!WinHttpReceiveResponse(request, NULL)) diff --git a/src/libstrongswan/plugins/xcbc/xcbc.c b/src/libstrongswan/plugins/xcbc/xcbc.c index d852a2932..820298e27 100644 --- a/src/libstrongswan/plugins/xcbc/xcbc.c +++ b/src/libstrongswan/plugins/xcbc/xcbc.c @@ -40,7 +40,7 @@ struct private_mac_t { /** * Block size, in bytes */ - u_int8_t b; + uint8_t b; /** * crypter using k1 @@ -50,22 +50,22 @@ struct private_mac_t { /** * k2 */ - u_int8_t *k2; + uint8_t *k2; /** * k3 */ - u_int8_t *k3; + uint8_t *k3; /** * E */ - u_int8_t *e; + uint8_t *e; /** * remaining, unprocessed bytes in append mode */ - u_int8_t *remaining; + uint8_t *remaining; /** * number of bytes in remaining @@ -138,7 +138,7 @@ static bool update(private_mac_t *this, chunk_t data) /** * run last round, data is in this->e */ -static bool final(private_mac_t *this, u_int8_t *out) +static bool final(private_mac_t *this, uint8_t *out) { chunk_t iv; @@ -193,7 +193,7 @@ static bool final(private_mac_t *this, u_int8_t *out) } METHOD(mac_t, get_mac, bool, - private_mac_t *this, chunk_t data, u_int8_t *out) + private_mac_t *this, chunk_t data, uint8_t *out) { /* update E, do not process last block */ if (!update(this, data)) @@ -294,7 +294,7 @@ static mac_t *xcbc_create(encryption_algorithm_t algo, size_t key_size) { private_mac_t *this; crypter_t *crypter; - u_int8_t b; + uint8_t b; crypter = lib->crypto->create_crypter(lib->crypto, algo, key_size); if (!crypter) |