diff options
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_gcm.c')
-rw-r--r-- | src/libstrongswan/plugins/openssl/openssl_gcm.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_gcm.c b/src/libstrongswan/plugins/openssl/openssl_gcm.c index 89d1cd589..842111bd3 100644 --- a/src/libstrongswan/plugins/openssl/openssl_gcm.c +++ b/src/libstrongswan/plugins/openssl/openssl_gcm.c @@ -20,6 +20,7 @@ #include "openssl_gcm.h" #include <openssl/evp.h> +#include <crypto/iv/iv_gen_seq.h> /** as defined in RFC 4106 */ #define IV_LEN 8 @@ -54,6 +55,11 @@ struct private_aead_t { size_t icv_size; /** + * IV generator + */ + iv_gen_t *iv_gen; + + /** * The cipher to use */ const EVP_CIPHER *cipher; @@ -161,6 +167,12 @@ METHOD(aead_t, get_iv_size, size_t, return IV_LEN; } +METHOD(aead_t, get_iv_gen, iv_gen_t*, + private_aead_t *this) +{ + return this->iv_gen; +} + METHOD(aead_t, get_key_size, size_t, private_aead_t *this) { @@ -183,6 +195,7 @@ METHOD(aead_t, destroy, void, private_aead_t *this) { chunk_clear(&this->key); + this->iv_gen->destroy(this->iv_gen); free(this); } @@ -200,6 +213,7 @@ aead_t *openssl_gcm_create(encryption_algorithm_t algo, size_t key_size) .get_block_size = _get_block_size, .get_icv_size = _get_icv_size, .get_iv_size = _get_iv_size, + .get_iv_gen = _get_iv_gen, .get_key_size = _get_key_size, .set_key = _set_key, .destroy = _destroy, @@ -258,6 +272,7 @@ aead_t *openssl_gcm_create(encryption_algorithm_t algo, size_t key_size) } this->key = chunk_alloc(key_size); + this->iv_gen = iv_gen_seq_create(); return &this->public; } |