Botan  1.10.9
ssl3_mac.h
Go to the documentation of this file.
1 /*
2 * SSL3-MAC
3 * (C) 1999-2004 Jack Lloyd
4 *
5 * Distributed under the terms of the Botan license
6 */
7 
8 #ifndef BOTAN_SSL3_MAC_H__
9 #define BOTAN_SSL3_MAC_H__
10 
11 #include <botan/hash.h>
12 #include <botan/mac.h>
13 
14 namespace Botan {
15 
16 /**
17 * A MAC only used in SSLv3. Do not use elsewhere! Use HMAC instead.
18 */
19 class BOTAN_DLL SSL3_MAC : public MessageAuthenticationCode
20  {
21  public:
22  std::string name() const;
23  size_t output_length() const { return hash->output_length(); }
24  MessageAuthenticationCode* clone() const;
25 
26  void clear();
27 
29  {
30  return Key_Length_Specification(hash->output_length());
31  }
32 
33  /**
34  * @param hash the underlying hash to use
35  */
36  SSL3_MAC(HashFunction* hash);
37  ~SSL3_MAC() { delete hash; }
38  private:
39  void add_data(const byte[], size_t);
40  void final_result(byte[]);
41  void key_schedule(const byte[], size_t);
42 
43  HashFunction* hash;
44  SecureVector<byte> i_key, o_key;
45  };
46 
47 }
48 
49 #endif
size_t output_length() const
Definition: ssl3_mac.h:23
unsigned char byte
Definition: types.h:22
Key_Length_Specification key_spec() const
Definition: ssl3_mac.h:28