From f2cb32c940f07f1f5c8a7b2f15121872d2436b0a Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 1 Jan 2009 22:36:57 +0000 Subject: added key derivation - not tested yet --- src/cipher.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/cipher.c') diff --git a/src/cipher.c b/src/cipher.c index 3a74641..8c086ee 100644 --- a/src/cipher.c +++ b/src/cipher.c @@ -186,6 +186,9 @@ u_int32_t cipher_null_crypt(u_int8_t* in, u_int32_t ilen, u_int8_t* out, u_int32 int cipher_aesctr_init(cipher_t* c, int key_length) { + if(!c) + return -1; + c->key_length_ = key_length; int algo; @@ -202,6 +205,8 @@ int cipher_aesctr_init(cipher_t* c, int key_length) log_printf(ERR, "failed to open cipher: %s/%s", gcry_strerror(err), gcry_strsource(err)); return -1; } + + return 0; } void cipher_aesctr_close(cipher_t* c) @@ -219,6 +224,9 @@ buffer_t cipher_aesctr_calc_ctr(cipher_t* c, seq_nr_t seq_nr, sender_id_t sender result.buf_ = NULL; result.length_ = 0; + if(!c) + return result; + mpz_t ctr, sid_mux, seq; mpz_init2(ctr, 128); mpz_init2(sid_mux, 96); -- cgit v1.2.3