aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/crypto')
-rw-r--r--src/libstrongswan/crypto/hashers/hasher.h2
-rw-r--r--src/libstrongswan/crypto/iv/iv_gen.h6
-rw-r--r--src/libstrongswan/crypto/iv/iv_gen_null.c4
-rw-r--r--src/libstrongswan/crypto/iv/iv_gen_rand.c4
-rw-r--r--src/libstrongswan/crypto/iv/iv_gen_seq.c28
-rw-r--r--src/libstrongswan/crypto/mac.h2
-rw-r--r--src/libstrongswan/crypto/mgf1/mgf1.c2
-rw-r--r--src/libstrongswan/crypto/nonce_gen.h2
-rw-r--r--src/libstrongswan/crypto/pkcs5.c12
-rw-r--r--src/libstrongswan/crypto/prf_plus.c4
-rw-r--r--src/libstrongswan/crypto/prf_plus.h2
-rw-r--r--src/libstrongswan/crypto/prfs/mac_prf.c2
-rw-r--r--src/libstrongswan/crypto/prfs/prf.h2
-rw-r--r--src/libstrongswan/crypto/proposal/proposal_keywords.c2
-rw-r--r--src/libstrongswan/crypto/proposal/proposal_keywords.h8
-rw-r--r--src/libstrongswan/crypto/rngs/rng.c4
-rw-r--r--src/libstrongswan/crypto/rngs/rng.h4
-rw-r--r--src/libstrongswan/crypto/signers/mac_signer.c8
-rw-r--r--src/libstrongswan/crypto/signers/signer.h2
19 files changed, 50 insertions, 50 deletions
diff --git a/src/libstrongswan/crypto/hashers/hasher.h b/src/libstrongswan/crypto/hashers/hasher.h
index 272502cf0..2d28b207d 100644
--- a/src/libstrongswan/crypto/hashers/hasher.h
+++ b/src/libstrongswan/crypto/hashers/hasher.h
@@ -90,7 +90,7 @@ struct hasher_t {
* @return TRUE if hash created successfully
*/
bool (*get_hash)(hasher_t *this, chunk_t data,
- u_int8_t *hash) __attribute__((warn_unused_result));
+ uint8_t *hash) __attribute__((warn_unused_result));
/**
* Hash data and allocate space for the hash.
diff --git a/src/libstrongswan/crypto/iv/iv_gen.h b/src/libstrongswan/crypto/iv/iv_gen.h
index 81b0701ce..292fc329f 100644
--- a/src/libstrongswan/crypto/iv/iv_gen.h
+++ b/src/libstrongswan/crypto/iv/iv_gen.h
@@ -38,8 +38,8 @@ struct iv_gen_t {
* @param buffer pointer where the generated IV will be written
* @return TRUE if IV allocation was successful, FALSE otherwise
*/
- bool (*get_iv)(iv_gen_t *this, u_int64_t seq, size_t size,
- u_int8_t *buffer) __attribute__((warn_unused_result));
+ bool (*get_iv)(iv_gen_t *this, uint64_t seq, size_t size,
+ uint8_t *buffer) __attribute__((warn_unused_result));
/**
* Generates an IV and allocates space for it.
@@ -49,7 +49,7 @@ struct iv_gen_t {
* @param chunk chunk which will hold the generated IV
* @return TRUE if IV allocation was successful, FALSE otherwise
*/
- bool (*allocate_iv)(iv_gen_t *this, u_int64_t seq, size_t size,
+ bool (*allocate_iv)(iv_gen_t *this, uint64_t seq, size_t size,
chunk_t *chunk) __attribute__((warn_unused_result));
/**
diff --git a/src/libstrongswan/crypto/iv/iv_gen_null.c b/src/libstrongswan/crypto/iv/iv_gen_null.c
index b13de0674..3b8f93986 100644
--- a/src/libstrongswan/crypto/iv/iv_gen_null.c
+++ b/src/libstrongswan/crypto/iv/iv_gen_null.c
@@ -29,13 +29,13 @@ struct private_iv_gen_t {
};
METHOD(iv_gen_t, get_iv, bool,
- private_iv_gen_t *this, u_int64_t seq, size_t size, u_int8_t *buffer)
+ private_iv_gen_t *this, uint64_t seq, size_t size, uint8_t *buffer)
{
return size == 0;
}
METHOD(iv_gen_t, allocate_iv, bool,
- private_iv_gen_t *this, u_int64_t seq, size_t size, chunk_t *chunk)
+ private_iv_gen_t *this, uint64_t seq, size_t size, chunk_t *chunk)
{
*chunk = chunk_empty;
return size == 0;
diff --git a/src/libstrongswan/crypto/iv/iv_gen_rand.c b/src/libstrongswan/crypto/iv/iv_gen_rand.c
index 2bed63fcc..1474b3a12 100644
--- a/src/libstrongswan/crypto/iv/iv_gen_rand.c
+++ b/src/libstrongswan/crypto/iv/iv_gen_rand.c
@@ -36,7 +36,7 @@ struct private_iv_gen_t {
};
METHOD(iv_gen_t, get_iv, bool,
- private_iv_gen_t *this, u_int64_t seq, size_t size, u_int8_t *buffer)
+ private_iv_gen_t *this, uint64_t seq, size_t size, uint8_t *buffer)
{
if (!this->rng)
{
@@ -46,7 +46,7 @@ METHOD(iv_gen_t, get_iv, bool,
}
METHOD(iv_gen_t, allocate_iv, bool,
- private_iv_gen_t *this, u_int64_t seq, size_t size, chunk_t *chunk)
+ private_iv_gen_t *this, uint64_t seq, size_t size, chunk_t *chunk)
{
if (!this->rng)
{
diff --git a/src/libstrongswan/crypto/iv/iv_gen_seq.c b/src/libstrongswan/crypto/iv/iv_gen_seq.c
index 9f99c5192..56620291c 100644
--- a/src/libstrongswan/crypto/iv/iv_gen_seq.c
+++ b/src/libstrongswan/crypto/iv/iv_gen_seq.c
@@ -18,7 +18,7 @@
/**
* Magic value for the initial IV state
*/
-#define SEQ_IV_INIT_STATE (~(u_int64_t)0)
+#define SEQ_IV_INIT_STATE (~(uint64_t)0)
#define SEQ_IV_HIGH_MASK (1ULL << 63)
typedef struct private_iv_gen_t private_iv_gen_t;
@@ -36,30 +36,30 @@ struct private_iv_gen_t {
/**
* Previously passed sequence number in lower space to enforce uniqueness
*/
- u_int64_t prevl;
+ uint64_t prevl;
/**
* Previously passed sequence number in upper space to enforce uniqueness
*/
- u_int64_t prevh;
+ uint64_t prevh;
/**
* Salt to mask counter
*/
- u_int8_t *salt;
+ uint8_t *salt;
};
METHOD(iv_gen_t, get_iv, bool,
- private_iv_gen_t *this, u_int64_t seq, size_t size, u_int8_t *buffer)
+ private_iv_gen_t *this, uint64_t seq, size_t size, uint8_t *buffer)
{
- u_int8_t iv[sizeof(u_int64_t)];
+ uint8_t iv[sizeof(uint64_t)];
size_t len = size;
if (!this->salt)
{
return FALSE;
}
- if (size < sizeof(u_int64_t))
+ if (size < sizeof(uint64_t))
{
return FALSE;
}
@@ -83,19 +83,19 @@ METHOD(iv_gen_t, get_iv, bool,
{
this->prevl = seq;
}
- if (len > sizeof(u_int64_t))
+ if (len > sizeof(uint64_t))
{
- len = sizeof(u_int64_t);
+ len = sizeof(uint64_t);
memset(buffer, 0, size - len);
}
htoun64(iv, seq);
- memxor(iv, this->salt, sizeof(u_int64_t));
- memcpy(buffer + size - len, iv + sizeof(u_int64_t) - len, len);
+ memxor(iv, this->salt, sizeof(uint64_t));
+ memcpy(buffer + size - len, iv + sizeof(uint64_t) - len, len);
return TRUE;
}
METHOD(iv_gen_t, allocate_iv, bool,
- private_iv_gen_t *this, u_int64_t seq, size_t size, chunk_t *chunk)
+ private_iv_gen_t *this, uint64_t seq, size_t size, chunk_t *chunk)
{
*chunk = chunk_alloc(size);
if (!get_iv(this, seq, chunk->len, chunk->ptr))
@@ -131,8 +131,8 @@ iv_gen_t *iv_gen_seq_create()
rng = lib->crypto->create_rng(lib->crypto, RNG_STRONG);
if (rng)
{
- this->salt = malloc(sizeof(u_int64_t));
- if (!rng->get_bytes(rng, sizeof(u_int64_t), this->salt))
+ this->salt = malloc(sizeof(uint64_t));
+ if (!rng->get_bytes(rng, sizeof(uint64_t), this->salt))
{
free(this->salt);
this->salt = NULL;
diff --git a/src/libstrongswan/crypto/mac.h b/src/libstrongswan/crypto/mac.h
index f7b43ba39..f23c6750f 100644
--- a/src/libstrongswan/crypto/mac.h
+++ b/src/libstrongswan/crypto/mac.h
@@ -47,7 +47,7 @@ struct mac_t {
* @return TRUE if mac generated successfully
*/
bool (*get_mac)(mac_t *this, chunk_t data,
- u_int8_t *out) __attribute__((warn_unused_result));
+ uint8_t *out) __attribute__((warn_unused_result));
/**
* Get the size of the resulting MAC.
diff --git a/src/libstrongswan/crypto/mgf1/mgf1.c b/src/libstrongswan/crypto/mgf1/mgf1.c
index 4bbcd6e99..5116dfefa 100644
--- a/src/libstrongswan/crypto/mgf1/mgf1.c
+++ b/src/libstrongswan/crypto/mgf1/mgf1.c
@@ -39,7 +39,7 @@ struct private_mgf1_t {
/**
* Counter
*/
- u_int32_t counter;
+ uint32_t counter;
/**
* Set if counter has reached 2^32
diff --git a/src/libstrongswan/crypto/nonce_gen.h b/src/libstrongswan/crypto/nonce_gen.h
index 7dae4f776..98d159e12 100644
--- a/src/libstrongswan/crypto/nonce_gen.h
+++ b/src/libstrongswan/crypto/nonce_gen.h
@@ -38,7 +38,7 @@ struct nonce_gen_t {
* @return TRUE if nonce allocation was successful, FALSE otherwise
*/
bool (*get_nonce)(nonce_gen_t *this, size_t size,
- u_int8_t *buffer) __attribute__((warn_unused_result));
+ uint8_t *buffer) __attribute__((warn_unused_result));
/**
* Generates a nonce and allocates space for it.
diff --git a/src/libstrongswan/crypto/pkcs5.c b/src/libstrongswan/crypto/pkcs5.c
index 478926f2f..8a1452425 100644
--- a/src/libstrongswan/crypto/pkcs5.c
+++ b/src/libstrongswan/crypto/pkcs5.c
@@ -41,7 +41,7 @@ struct private_pkcs5_t {
/**
* Iterations for key derivation
*/
- u_int64_t iterations;
+ uint64_t iterations;
/**
* Encryption algorithm
@@ -110,7 +110,7 @@ struct private_pkcs5_t {
*/
static bool verify_padding(crypter_t *crypter, chunk_t *blob)
{
- u_int8_t padding, count;
+ uint8_t padding, count;
padding = count = blob->ptr[blob->len - 1];
@@ -181,10 +181,10 @@ static bool pkcs12_kdf(private_pkcs5_t *this, chunk_t password, chunk_t keymat)
* Function F of PBKDF2
*/
static bool pbkdf2_f(chunk_t block, prf_t *prf, chunk_t seed,
- u_int64_t iterations)
+ uint64_t iterations)
{
chunk_t u;
- u_int64_t i;
+ uint64_t i;
u = chunk_alloca(prf->get_block_size(prf));
if (!prf->get_bytes(prf, seed, u.ptr))
@@ -212,7 +212,7 @@ static bool pbkdf2(private_pkcs5_t *this, chunk_t password, chunk_t key)
prf_t *prf;
chunk_t keymat, block, seed;
size_t blocks;
- u_int32_t i = 0;
+ uint32_t i = 0;
prf = this->data.pbes2.prf;
@@ -247,7 +247,7 @@ static bool pbkdf1(private_pkcs5_t *this, chunk_t password, chunk_t key)
{
hasher_t *hasher;
chunk_t hash;
- u_int64_t i;
+ uint64_t i;
hasher = this->data.pbes1.hasher;
diff --git a/src/libstrongswan/crypto/prf_plus.c b/src/libstrongswan/crypto/prf_plus.c
index 94be1d5bf..6b7f8f851 100644
--- a/src/libstrongswan/crypto/prf_plus.c
+++ b/src/libstrongswan/crypto/prf_plus.c
@@ -44,7 +44,7 @@ struct private_prf_plus_t {
/**
* Octet which will be appended to the seed, 0 if not used
*/
- u_int8_t counter;
+ uint8_t counter;
/**
* Already given out bytes in current buffer.
@@ -58,7 +58,7 @@ struct private_prf_plus_t {
};
METHOD(prf_plus_t, get_bytes, bool,
- private_prf_plus_t *this, size_t length, u_int8_t *buffer)
+ private_prf_plus_t *this, size_t length, uint8_t *buffer)
{
size_t round, written = 0;
diff --git a/src/libstrongswan/crypto/prf_plus.h b/src/libstrongswan/crypto/prf_plus.h
index f994dce16..2c4b8852d 100644
--- a/src/libstrongswan/crypto/prf_plus.h
+++ b/src/libstrongswan/crypto/prf_plus.h
@@ -39,7 +39,7 @@ struct prf_plus_t {
* @return TRUE if bytes generated successfully
*/
bool (*get_bytes)(prf_plus_t *this, size_t length,
- u_int8_t *buffer) __attribute__((warn_unused_result));
+ uint8_t *buffer) __attribute__((warn_unused_result));
/**
* Allocate pseudo random bytes.
diff --git a/src/libstrongswan/crypto/prfs/mac_prf.c b/src/libstrongswan/crypto/prfs/mac_prf.c
index b5f6be982..3f8eb7e5c 100644
--- a/src/libstrongswan/crypto/prfs/mac_prf.c
+++ b/src/libstrongswan/crypto/prfs/mac_prf.c
@@ -36,7 +36,7 @@ struct private_prf_t {
};
METHOD(prf_t, get_bytes, bool,
- private_prf_t *this, chunk_t seed, u_int8_t *buffer)
+ private_prf_t *this, chunk_t seed, uint8_t *buffer)
{
return this->mac->get_mac(this->mac, seed, buffer);
}
diff --git a/src/libstrongswan/crypto/prfs/prf.h b/src/libstrongswan/crypto/prfs/prf.h
index 46e23b244..bf443e5f4 100644
--- a/src/libstrongswan/crypto/prfs/prf.h
+++ b/src/libstrongswan/crypto/prfs/prf.h
@@ -80,7 +80,7 @@ struct prf_t {
* @return TRUE if bytes generated successfully
*/
bool (*get_bytes)(prf_t *this, chunk_t seed,
- u_int8_t *buffer) __attribute__((warn_unused_result));
+ uint8_t *buffer) __attribute__((warn_unused_result));
/**
* Generates pseudo random bytes and allocate space for them.
diff --git a/src/libstrongswan/crypto/proposal/proposal_keywords.c b/src/libstrongswan/crypto/proposal/proposal_keywords.c
index bbb97d088..282d40e7b 100644
--- a/src/libstrongswan/crypto/proposal/proposal_keywords.c
+++ b/src/libstrongswan/crypto/proposal/proposal_keywords.c
@@ -134,7 +134,7 @@ METHOD(proposal_keywords_t, get_token, const proposal_token_t*,
METHOD(proposal_keywords_t, register_token, void,
private_proposal_keywords_t *this, const char *name, transform_type_t type,
- u_int16_t algorithm, u_int16_t keysize)
+ uint16_t algorithm, uint16_t keysize)
{
proposal_token_t *token;
diff --git a/src/libstrongswan/crypto/proposal/proposal_keywords.h b/src/libstrongswan/crypto/proposal/proposal_keywords.h
index 5cdbafc51..856abdce6 100644
--- a/src/libstrongswan/crypto/proposal/proposal_keywords.h
+++ b/src/libstrongswan/crypto/proposal/proposal_keywords.h
@@ -69,12 +69,12 @@ struct proposal_token_t {
/**
* The IKE id of the algorithm.
*/
- u_int16_t algorithm;
+ uint16_t algorithm;
/**
* The key size associated with the specific algorithm.
*/
- u_int16_t keysize;
+ uint16_t keysize;
};
/**
@@ -100,8 +100,8 @@ struct proposal_keywords_t {
* @param keysize the key size associated with the specific algorithm
*/
void (*register_token)(proposal_keywords_t *this, const char *name,
- transform_type_t type, u_int16_t algorithm,
- u_int16_t keysize);
+ transform_type_t type, uint16_t algorithm,
+ uint16_t keysize);
/**
* Register an algorithm name parser.
diff --git a/src/libstrongswan/crypto/rngs/rng.c b/src/libstrongswan/crypto/rngs/rng.c
index f8fd50d3f..1f39dedb8 100644
--- a/src/libstrongswan/crypto/rngs/rng.c
+++ b/src/libstrongswan/crypto/rngs/rng.c
@@ -25,9 +25,9 @@ ENUM(rng_quality_names, RNG_WEAK, RNG_TRUE,
/*
* Described in header.
*/
-bool rng_get_bytes_not_zero(rng_t *rng, size_t len, u_int8_t *buffer, bool all)
+bool rng_get_bytes_not_zero(rng_t *rng, size_t len, uint8_t *buffer, bool all)
{
- u_int8_t *pos = buffer, *check = buffer + (all ? len : min(1, len));
+ uint8_t *pos = buffer, *check = buffer + (all ? len : min(1, len));
if (!rng->get_bytes(rng, len, pos))
{
diff --git a/src/libstrongswan/crypto/rngs/rng.h b/src/libstrongswan/crypto/rngs/rng.h
index aee829d71..0ca2cb114 100644
--- a/src/libstrongswan/crypto/rngs/rng.h
+++ b/src/libstrongswan/crypto/rngs/rng.h
@@ -57,7 +57,7 @@ struct rng_t {
* @return TRUE if bytes successfully written
*/
bool (*get_bytes)(rng_t *this, size_t len,
- u_int8_t *buffer) __attribute__((warn_unused_result));
+ uint8_t *buffer) __attribute__((warn_unused_result));
/**
* Generates random bytes and allocate space for them.
@@ -85,7 +85,7 @@ struct rng_t {
* @param all TRUE if all bytes have to be non-zero, FALSE for first
* @return TRUE if bytes successfully written
*/
-bool rng_get_bytes_not_zero(rng_t *rng, size_t len, u_int8_t *buffer,
+bool rng_get_bytes_not_zero(rng_t *rng, size_t len, uint8_t *buffer,
bool all) __attribute__((warn_unused_result));
/**
diff --git a/src/libstrongswan/crypto/signers/mac_signer.c b/src/libstrongswan/crypto/signers/mac_signer.c
index 1094c4473..4426782b4 100644
--- a/src/libstrongswan/crypto/signers/mac_signer.c
+++ b/src/libstrongswan/crypto/signers/mac_signer.c
@@ -41,11 +41,11 @@ struct private_signer_t {
};
METHOD(signer_t, get_signature, bool,
- private_signer_t *this, chunk_t data, u_int8_t *buffer)
+ private_signer_t *this, chunk_t data, uint8_t *buffer)
{
if (buffer)
{
- u_int8_t mac[this->mac->get_mac_size(this->mac)];
+ uint8_t mac[this->mac->get_mac_size(this->mac)];
if (!this->mac->get_mac(this->mac, data, mac))
{
@@ -62,7 +62,7 @@ METHOD(signer_t, allocate_signature, bool,
{
if (chunk)
{
- u_int8_t mac[this->mac->get_mac_size(this->mac)];
+ uint8_t mac[this->mac->get_mac_size(this->mac)];
if (!this->mac->get_mac(this->mac, data, mac))
{
@@ -78,7 +78,7 @@ METHOD(signer_t, allocate_signature, bool,
METHOD(signer_t, verify_signature, bool,
private_signer_t *this, chunk_t data, chunk_t signature)
{
- u_int8_t mac[this->mac->get_mac_size(this->mac)];
+ uint8_t mac[this->mac->get_mac_size(this->mac)];
if (signature.len != this->truncation)
{
diff --git a/src/libstrongswan/crypto/signers/signer.h b/src/libstrongswan/crypto/signers/signer.h
index e0cf7eb5a..01b702da1 100644
--- a/src/libstrongswan/crypto/signers/signer.h
+++ b/src/libstrongswan/crypto/signers/signer.h
@@ -96,7 +96,7 @@ struct signer_t {
* @return TRUE if signature created successfully
*/
bool (*get_signature)(signer_t *this, chunk_t data,
- u_int8_t *buffer) __attribute__((warn_unused_result));
+ uint8_t *buffer) __attribute__((warn_unused_result));
/**
* Generate a signature and allocate space for it.