summaryrefslogtreecommitdiff
path: root/cypher.h
diff options
context:
space:
mode:
authorErwin Nindl <nine@wirdorange.org>2007-11-07 19:08:25 +0000
committerErwin Nindl <nine@wirdorange.org>2007-11-07 19:08:25 +0000
commitdd056636dd2cd8c83822ebecfc2448cf8b4b713c (patch)
treee2ca8e3f9565f7da7a7bbbd9a8d9ebd317b2e5b1 /cypher.h
parenti bin da beste deshalb haut des jetzt endlich so hin (diff)
* TunDevice: changed 'char* getTypeString()' to 'const char* getTypeString()'
to fix warning: deprecated conversion from string constant to ‘char*’ * removed libsrtp, use libgcrypt instead now * added buffer funcitons TODO: * fix IV issues * add authentification
Diffstat (limited to 'cypher.h')
-rw-r--r--cypher.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/cypher.h b/cypher.h
index c42b79b..ae56881 100644
--- a/cypher.h
+++ b/cypher.h
@@ -31,9 +31,15 @@
#ifndef _CYPHER_H_
#define _CYPHER_H_
+
+
#include "datatypes.h"
#include "buffer.h"
+extern "C" {
+#include <gcrypt.h>
+}
+
class Cypher
{
@@ -59,17 +65,22 @@ protected:
class AesIcmCypher : public Cypher
{
public:
- AesIcmCypher() : key_(Buffer(0)), salt_(Buffer(14)) {};
+ AesIcmCypher();
+ ~AesIcmCypher();
void setKey(Buffer key);
void setSalt(Buffer salt);
-// void cypher(Buffer& buf, 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:
- Buffer getBitStream(u_int32_t length, seq_nr_t seq_nr, sender_id_t sender_id);
+ Buffer getBitStream(u_int32_t length, seq_nr_t seq_nr, sender_id_t sender_id);
+ gcry_cipher_hd_t cipher_;
+ Buffer salt_;
private:
- Buffer key_;
- Buffer salt_; // size: 112 bit
+ static bool gcrypt_initialized_;
};
+
#endif