diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2013-11-01 13:32:07 +0100 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2013-11-01 13:32:07 +0100 |
commit | 5313d2d78ca150515f7f5eb39801c100690b6b29 (patch) | |
tree | c78e420367283bb1b16f14210b12687cdfbd26eb /src/libstrongswan/crypto/aead.c | |
parent | 6b99c8d9cff7b3e8ae8f3204b99e7ea40f791349 (diff) | |
download | vyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.tar.gz vyos-strongswan-5313d2d78ca150515f7f5eb39801c100690b6b29.zip |
Imported Upstream version 5.1.1
Diffstat (limited to 'src/libstrongswan/crypto/aead.c')
-rw-r--r-- | src/libstrongswan/crypto/aead.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/libstrongswan/crypto/aead.c b/src/libstrongswan/crypto/aead.c index 32a0e6759..afcc11fbe 100644 --- a/src/libstrongswan/crypto/aead.c +++ b/src/libstrongswan/crypto/aead.c @@ -1,4 +1,7 @@ /* + * Copyright (C) 2013 Tobias Brunner + * Hochschule fuer Technik Rapperswil + * * Copyright (C) 2010 Martin Willi * Copyright (C) 2010 revosec AG * @@ -16,6 +19,7 @@ #include "aead.h" #include <utils/debug.h> +#include <crypto/iv/iv_gen_rand.h> typedef struct private_aead_t private_aead_t; @@ -35,9 +39,14 @@ struct private_aead_t { crypter_t *crypter; /** - * draditional signer + * traditional signer */ signer_t *signer; + + /** + * IV generator + */ + iv_gen_t *iv_gen; }; METHOD(aead_t, encrypt, bool, @@ -126,6 +135,12 @@ METHOD(aead_t, get_iv_size, size_t, return this->crypter->get_iv_size(this->crypter); } +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) { @@ -148,6 +163,7 @@ METHOD(aead_t, set_key, bool, METHOD(aead_t, destroy, void, private_aead_t *this) { + this->iv_gen->destroy(this->iv_gen); this->crypter->destroy(this->crypter); this->signer->destroy(this->signer); free(this); @@ -167,12 +183,14 @@ aead_t *aead_create(crypter_t *crypter, signer_t *signer) .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 = crypter, .signer = signer, + .iv_gen = iv_gen_rand_create(), ); return &this->public; |