summaryrefslogtreecommitdiff
path: root/src/pluto/demux.c
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2010-11-28 11:42:20 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2010-11-28 11:42:20 +0000
commitf73fba54dc8b30c6482e1e8abf15bbf455592fcd (patch)
treea449515607c5e51a5c703d7a9b1149c9e4a11560 /src/pluto/demux.c
parentb8064f4099997a9e2179f3ad4ace605f5ccac3a1 (diff)
downloadvyos-strongswan-f73fba54dc8b30c6482e1e8abf15bbf455592fcd.tar.gz
vyos-strongswan-f73fba54dc8b30c6482e1e8abf15bbf455592fcd.zip
[svn-upgrade] new version strongswan (4.5.0)
Diffstat (limited to 'src/pluto/demux.c')
-rw-r--r--src/pluto/demux.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/pluto/demux.c b/src/pluto/demux.c
index 617353c6c..0590a3585 100644
--- a/src/pluto/demux.c
+++ b/src/pluto/demux.c
@@ -1782,7 +1782,7 @@ process_packet(struct msg_digest **mdp)
* the last phase 1 block, not the last block sent.
*/
{
- size_t crypter_block_size;
+ size_t crypter_block_size, crypter_iv_size;
encryption_algorithm_t enc_alg;
crypter_t *crypter;
chunk_t data, iv;
@@ -1791,6 +1791,7 @@ process_packet(struct msg_digest **mdp)
enc_alg = oakley_to_encryption_algorithm(st->st_oakley.encrypt);
crypter = lib->crypto->create_crypter(lib->crypto, enc_alg, st->st_enc_key.len);
crypter_block_size = crypter->get_block_size(crypter);
+ crypter_iv_size = crypter->get_iv_size(crypter);
if (pbs_left(&md->message_pbs) % crypter_block_size != 0)
{
@@ -1817,17 +1818,17 @@ process_packet(struct msg_digest **mdp)
}
/* form iv by truncation */
- st->st_new_iv_len = crypter_block_size;
+ st->st_new_iv_len = crypter_iv_size;
iv = chunk_create(st->st_new_iv, st->st_new_iv_len);
- new_iv = alloca(crypter_block_size);
- memcpy(new_iv, data.ptr + data.len - crypter_block_size,
- crypter_block_size);
+ new_iv = alloca(crypter_iv_size);
+ memcpy(new_iv, data.ptr + data.len - crypter_iv_size,
+ crypter_iv_size);
crypter->set_key(crypter, st->st_enc_key);
crypter->decrypt(crypter, data, iv, NULL);
crypter->destroy(crypter);
- memcpy(st->st_new_iv, new_iv, crypter_block_size);
+ memcpy(st->st_new_iv, new_iv, crypter_iv_size);
if (restore_iv)
{
memcpy(st->st_new_iv, new_iv, new_iv_len);
@@ -2307,7 +2308,7 @@ complete_state_transition(struct msg_digest **mdp, stf_status result)
/* tell whack and log of progress */
{
- const char *story = state_story[st->st_state - STATE_MAIN_R0];
+ const char *story = state_story[st->st_state];
enum rc_type w = RC_NEW_STATE + st->st_state;
char sadetails[128];