summaryrefslogtreecommitdiff
path: root/src/cipher.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cipher.c')
-rw-r--r--src/cipher.c8
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);