summaryrefslogtreecommitdiff
path: root/src/libstrongswan/crypto/iv
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/crypto/iv')
-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
4 files changed, 21 insertions, 21 deletions
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;