summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins/gcm/gcm_aead.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/gcm/gcm_aead.c
parent6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (diff)
downloadvyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.tar.gz
vyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.zip
Imported Upstream version 5.1.1
Diffstat (limited to 'src/libstrongswan/plugins/gcm/gcm_aead.c')
-rw-r--r--src/libstrongswan/plugins/gcm/gcm_aead.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libstrongswan/plugins/gcm/gcm_aead.c b/src/libstrongswan/plugins/gcm/gcm_aead.c
index 79ee65d98..ba5f2e4b3 100644
--- a/src/libstrongswan/plugins/gcm/gcm_aead.c
+++ b/src/libstrongswan/plugins/gcm/gcm_aead.c
@@ -16,6 +16,7 @@
#include "gcm_aead.h"
#include <limits.h>
+#include <crypto/iv/iv_gen_seq.h>
#define BLOCK_SIZE 16
#define NONCE_SIZE 12
@@ -40,6 +41,11 @@ struct private_gcm_aead_t {
crypter_t *crypter;
/**
+ * IV generator.
+ */
+ iv_gen_t *iv_gen;
+
+ /**
* Size of the integrity check value
*/
size_t icv_size;
@@ -337,6 +343,12 @@ METHOD(aead_t, get_iv_size, size_t,
return IV_SIZE;
}
+METHOD(aead_t, get_iv_gen, iv_gen_t*,
+ private_gcm_aead_t *this)
+{
+ return this->iv_gen;
+}
+
METHOD(aead_t, get_key_size, size_t,
private_gcm_aead_t *this)
{
@@ -356,6 +368,7 @@ METHOD(aead_t, destroy, void,
private_gcm_aead_t *this)
{
this->crypter->destroy(this->crypter);
+ this->iv_gen->destroy(this->iv_gen);
free(this);
}
@@ -405,12 +418,14 @@ gcm_aead_t *gcm_aead_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,
},
},
.crypter = lib->crypto->create_crypter(lib->crypto, algo, key_size),
+ .iv_gen = iv_gen_seq_create(),
.icv_size = icv_size,
);