summaryrefslogtreecommitdiff
path: root/src/cipher.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/cipher.h')
-rw-r--r--src/cipher.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/cipher.h b/src/cipher.h
index 036eb72..137540b 100644
--- a/src/cipher.h
+++ b/src/cipher.h
@@ -39,7 +39,7 @@
#include <gcrypt.h>
#include "key_derivation.h"
#else
-typedef u_int8_t* key_derivation_t;
+typedef u_int8_t key_derivation_t;
#endif
enum cipher_type_enum { c_unknown, c_null, c_aes_ctr };
@@ -50,9 +50,7 @@ struct cipher_struct {
u_int16_t key_length_;
buffer_t key_;
buffer_t salt_;
-#ifndef NO_CRYPT
- gcry_cipher_hd_t handle_;
-#endif
+ void* params_;
};
typedef struct cipher_struct cipher_t;
@@ -66,9 +64,20 @@ int32_t cipher_null_crypt(u_int8_t* in, u_int32_t ilen, u_int8_t* out, u_int32_t
#ifndef NO_CRYPT
+struct cipher_aesctr_param_struct {
+ gcry_cipher_hd_t handle_;
+ buffer_t ctr_;
+#ifndef NO_LIBGMP
+ mpz_t mp_ctr;
+ mpz_t mp_sid_mux;
+ mpz_t mp_seq;
+#endif
+};
+typedef struct cipher_aesctr_param_struct cipher_aesctr_param_t;
+
int cipher_aesctr_init(cipher_t* c);
void cipher_aesctr_close(cipher_t* c);
-buffer_t cipher_aesctr_calc_ctr(cipher_t* c, key_derivation_t* kd, seq_nr_t seq_nr, sender_id_t sender_id, mux_t mux);
+int cipher_aesctr_calc_ctr(cipher_t* c, key_derivation_t* kd, seq_nr_t seq_nr, sender_id_t sender_id, mux_t mux);
int32_t cipher_aesctr_crypt(cipher_t* c, key_derivation_t* kd, u_int8_t* in, u_int32_t ilen, u_int8_t* out, u_int32_t olen, seq_nr_t seq_nr, sender_id_t sender_id, mux_t mux);
#endif