From de5c4f910203dd976ad8c17eff90874f548d6bc3 Mon Sep 17 00:00:00 2001 From: Othmar Gsenger Date: Thu, 31 Jan 2008 11:39:39 +0000 Subject: packet and cypher fixes --- cypher.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'cypher.h') diff --git a/cypher.h b/cypher.h index e408cd4..8acc046 100644 --- a/cypher.h +++ b/cypher.h @@ -33,6 +33,8 @@ #include "datatypes.h" #include "buffer.h" +#include "encryptedPacket.h" +#include "plainPacket.h" #include @@ -45,7 +47,10 @@ public: void setKey(Buffer key) {}; void setSalt(Buffer salt) {}; - virtual void cypher(Buffer& in, Buffer& out, u_int32_t length, seq_nr_t seq_nr, sender_id_t sender_id) {}; + void encrypt(const PlainPacket & in,EncryptedPacket & out, seq_nr_t seq_nr, sender_id_t sender_id); + void decrypt(const EncryptedPacket & in,PlainPacket & out); +private: + virtual void cypher(u_int8_t * in, u_int8_t * out, u_int32_t length, seq_nr_t seq_nr, sender_id_t sender_id) {}; }; class NullCypher : public Cypher @@ -54,7 +59,7 @@ public: NullCypher() {}; ~NullCypher() {}; protected: - void cypher(Buffer& in, Buffer& out, u_int32_t length, seq_nr_t seq_nr, sender_id_t sender_id); + void cypher(u_int8_t * in, u_int8_t * out, u_int32_t length, seq_nr_t seq_nr, sender_id_t sender_id); }; class AesIcmCypher : public Cypher @@ -64,12 +69,12 @@ public: ~AesIcmCypher(); void setKey(Buffer key); void setSalt(Buffer salt); - void cypher(Buffer& in, Buffer& out, u_int32_t length, seq_nr_t seq_nr, sender_id_t sender_id); static const char* MIN_GCRYPT_VERSION; static const u_int32_t GCRYPT_SEC_MEM = 16384; // 16k secure memory protected: + void cypher(u_int8_t * in, u_int8_t * out, u_int32_t length, seq_nr_t seq_nr, sender_id_t sender_id); gcry_cipher_hd_t cipher_; Buffer salt_; }; -- cgit v1.2.3