aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-27 15:46:02 +0000
committerlloyd <[email protected]>2008-09-27 15:46:02 +0000
commit4e5e7ed847a2f39a1f059e0c5403488571ef8e96 (patch)
tree84c9658717113585c9e96839874bd59eea7b2924 /include
parent224b5e6ed8e3154d185cf07e99bfd1e5556250fe (diff)
Add back from Ajisai 0.5.0 the implementations of the SSLv3 MAC and PRF
and the TLS v1.0 PRF. These were removed from Botan in v1.4.5. Initially I had felt that since these protocols were specific to SSL/TLS they should be placed in Ajisai (an SSL/TLS library based on Botan). However upon further reflection I have realized it is quite possible that other alternate implementations of SSL/TLS based on Botan would be quite desirable, and so to make that (a very slightly bit) easier I am adding back the SSL/TLS functions to Botan, so other SSL/TLS libs can use them directly.
Diffstat (limited to 'include')
-rw-r--r--include/kdf.h34
-rw-r--r--include/ssl3_mac.h34
2 files changed, 63 insertions, 5 deletions
diff --git a/include/kdf.h b/include/kdf.h
index 57f1dc047..ad7a11dbe 100644
--- a/include/kdf.h
+++ b/include/kdf.h
@@ -16,11 +16,11 @@ namespace Botan {
class BOTAN_DLL KDF1 : public KDF
{
public:
- KDF1(const std::string&);
- private:
SecureVector<byte> derive(u32bit, const byte[], u32bit,
const byte[], u32bit) const;
+ KDF1(const std::string&);
+ private:
const std::string hash_name;
};
@@ -30,11 +30,11 @@ class BOTAN_DLL KDF1 : public KDF
class BOTAN_DLL KDF2 : public KDF
{
public:
+ SecureVector<byte> derive(u32bit, const byte[], u32bit,
+ const byte[], u32bit) const;
KDF2(const std::string&);
private:
- SecureVector<byte> derive(u32bit, const byte[], u32bit,
- const byte[], u32bit) const;
const std::string hash_name;
};
@@ -44,12 +44,36 @@ class BOTAN_DLL KDF2 : public KDF
class BOTAN_DLL X942_PRF : public KDF
{
public:
+ SecureVector<byte> derive(u32bit, const byte[], u32bit,
+ const byte[], u32bit) const;
+
X942_PRF(const std::string&);
private:
+ std::string key_wrap_oid;
+ };
+
+/*************************************************
+* SSL3 PRF *
+*************************************************/
+class BOTAN_DLL SSL3_PRF : public KDF
+ {
+ public:
SecureVector<byte> derive(u32bit, const byte[], u32bit,
const byte[], u32bit) const;
+ };
- std::string key_wrap_oid;
+/*************************************************
+* TLS PRF *
+*************************************************/
+class BOTAN_DLL TLS_PRF : public KDF
+ {
+ public:
+ SecureVector<byte> derive(u32bit, const byte[], u32bit,
+ const byte[], u32bit) const;
+ private:
+ SecureVector<byte> P_hash(const std::string&, u32bit,
+ const byte[], u32bit,
+ const byte[], u32bit) const;
};
}
diff --git a/include/ssl3_mac.h b/include/ssl3_mac.h
new file mode 100644
index 000000000..8ab08c97d
--- /dev/null
+++ b/include/ssl3_mac.h
@@ -0,0 +1,34 @@
+/*************************************************
+* SSL3-MAC Header File *
+* (C) 1999-2004 Jack Lloyd *
+*************************************************/
+
+#ifndef BOTAN_SSL3_MAC_H__
+#define BOTAN_SSL3_MAC_H__
+
+#include <botan/base.h>
+
+namespace Botan {
+
+/*************************************************
+* SSL3-MAC *
+*************************************************/
+class SSL3_MAC : public MessageAuthenticationCode
+ {
+ public:
+ void clear() throw();
+ std::string name() const;
+ MessageAuthenticationCode* clone() const;
+ SSL3_MAC(const std::string&);
+ ~SSL3_MAC() { delete hash; }
+ private:
+ void add_data(const byte[], u32bit);
+ void final_result(byte[]);
+ void key(const byte[], u32bit);
+ HashFunction* hash;
+ SecureVector<byte> i_key, o_key;
+ };
+
+}
+
+#endif