summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins/openssl/openssl_gcm.c
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2013-11-01 13:32:07 +0100
committerYves-Alexis Perez <corsac@debian.org>2013-11-01 13:32:07 +0100
commit5313d2d78ca150515f7f5eb39801c100690b6b29 (patch)
treec78e420367283bb1b16f14210b12687cdfbd26eb /src/libstrongswan/plugins/openssl/openssl_gcm.c
parent6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (diff)
downloadvyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.tar.gz
vyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.zip
Imported Upstream version 5.1.1
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_gcm.c')
-rw-r--r--src/libstrongswan/plugins/openssl/openssl_gcm.c15
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;
}