diff options
Diffstat (limited to 'src/libstrongswan/crypto/iv/iv_gen_seq.c')
-rw-r--r-- | src/libstrongswan/crypto/iv/iv_gen_seq.c | 28 |
1 files changed, 14 insertions, 14 deletions
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; |