diff options
author | Christian Pointner <equinox@anytun.org> | 2009-01-01 22:36:57 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2009-01-01 22:36:57 +0000 |
commit | f2cb32c940f07f1f5c8a7b2f15121872d2436b0a (patch) | |
tree | 9f8d7cacb08a680dbc89220f9e9feb6c09664f12 /src/cipher.c | |
parent | fixed build on OpenBSD (diff) |
added key derivation - not tested yet
Diffstat (limited to 'src/cipher.c')
-rw-r--r-- | src/cipher.c | 8 |
1 files changed, 8 insertions, 0 deletions
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); |