1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
#
# old_revision [52e500a0ac32174fdce00c589290e69186b99bdd]
#
# patch "src/engine/openssl/ossl_arc4.cpp"
# from [4aed07563d8f2b1ada6a76cbe55b4e76e8877403]
# to [d8ca80a67a27f9b2a1bcfb1e1e1efb4122ea28aa]
#
# patch "src/engine/openssl/ossl_bc.cpp"
# from [9efd108ef8aebb28f4c0507bfcd3a08baf813531]
# to [947792c43bcccd42b8667a6d59e5bc477e374d0c]
#
# patch "src/engine/openssl/ossl_md.cpp"
# from [c8fe0b67a8f0797fa8be764e9aeb78d5960d9bd9]
# to [29482b218897968d26787b4f4e517c11f511767d]
#
============================================================
--- src/engine/openssl/ossl_bc.cpp 9efd108ef8aebb28f4c0507bfcd3a08baf813531
+++ src/engine/openssl/ossl_bc.cpp 947792c43bcccd42b8667a6d59e5bc477e374d0c
@@ -29,6 +29,8 @@ class EVP_BlockCipher : public BlockCiph
EVP_BlockCipher(const EVP_CIPHER*, const std::string&,
size_t, size_t, size_t);
+ Key_Length_Specification key_spec() const { return cipher_key_spec; }
+
~EVP_BlockCipher();
private:
void encrypt_n(const byte in[], byte out[], size_t blocks) const;
@@ -36,6 +38,7 @@ class EVP_BlockCipher : public BlockCiph
void key_schedule(const byte[], size_t);
size_t block_sz;
+ Key_Length_Specification cipher_key_spec;
std::string cipher_name;
mutable EVP_CIPHER_CTX encrypt, decrypt;
};
@@ -45,8 +48,8 @@ EVP_BlockCipher::EVP_BlockCipher(const E
*/
EVP_BlockCipher::EVP_BlockCipher(const EVP_CIPHER* algo,
const std::string& algo_name) :
- BlockCipher(EVP_CIPHER_key_length(algo)),
block_sz(EVP_CIPHER_block_size(algo)),
+ cipher_key_spec(EVP_CIPHER_key_length(algo)),
cipher_name(algo_name)
{
if(EVP_CIPHER_mode(algo) != EVP_CIPH_ECB_MODE)
@@ -69,8 +72,8 @@ EVP_BlockCipher::EVP_BlockCipher(const E
const std::string& algo_name,
size_t key_min, size_t key_max,
size_t key_mod) :
- BlockCipher(key_min, key_max, key_mod),
block_sz(EVP_CIPHER_block_size(algo)),
+ cipher_key_spec(key_min, key_max, key_mod),
cipher_name(algo_name)
{
if(EVP_CIPHER_mode(algo) != EVP_CIPH_ECB_MODE)
@@ -148,8 +151,10 @@ BlockCipher* EVP_BlockCipher::clone() co
BlockCipher* EVP_BlockCipher::clone() const
{
return new EVP_BlockCipher(EVP_CIPHER_CTX_cipher(&encrypt),
- cipher_name, MINIMUM_KEYLENGTH,
- MAXIMUM_KEYLENGTH, KEYLENGTH_MULTIPLE);
+ cipher_name,
+ cipher_key_spec.minimum_keylength(),
+ cipher_key_spec.maximum_keylength(),
+ cipher_key_spec.keylength_multiple());
}
/*
============================================================
--- src/engine/openssl/ossl_md.cpp c8fe0b67a8f0797fa8be764e9aeb78d5960d9bd9
+++ src/engine/openssl/ossl_md.cpp 29482b218897968d26787b4f4e517c11f511767d
@@ -22,8 +22,16 @@ class EVP_HashFunction : public HashFunc
std::string name() const { return algo_name; }
HashFunction* clone() const;
- size_t hash_block_size() const { return block_size; }
+ size_t output_length() const
+ {
+ return EVP_MD_size(EVP_MD_CTX_md(&md));
+ }
+ size_t hash_block_size() const
+ {
+ return EVP_MD_block_size(EVP_MD_CTX_md(&md));
+ }
+
EVP_HashFunction(const EVP_MD*, const std::string&);
~EVP_HashFunction();
private:
@@ -76,8 +84,6 @@ EVP_HashFunction::EVP_HashFunction(const
*/
EVP_HashFunction::EVP_HashFunction(const EVP_MD* algo,
const std::string& name) :
- HashFunction(EVP_MD_size(algo)),
- block_size(EVP_MD_block_size(algo)),
algo_name(name)
{
EVP_MD_CTX_init(&md);
============================================================
--- src/engine/openssl/ossl_arc4.cpp 4aed07563d8f2b1ada6a76cbe55b4e76e8877403
+++ src/engine/openssl/ossl_arc4.cpp d8ca80a67a27f9b2a1bcfb1e1e1efb4122ea28aa
@@ -23,7 +23,13 @@ class ARC4_OpenSSL : public StreamCipher
std::string name() const;
StreamCipher* clone() const { return new ARC4_OpenSSL(SKIP); }
- ARC4_OpenSSL(size_t s = 0) : StreamCipher(1, 32), SKIP(s) { clear(); }
+ Key_Length_Specification key_spec() const
+ {
+ return Key_Length_Specification(1, 32);
+ }
+
+
+ ARC4_OpenSSL(size_t s = 0) : SKIP(s) { clear(); }
~ARC4_OpenSSL() { clear(); }
private:
void cipher(const byte[], byte[], size_t);
|