diff options
author | lloyd <[email protected]> | 2010-12-01 19:20:52 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-12-01 19:20:52 +0000 |
commit | cf4f1c45066f640478f2da37761c0ca8024c5064 (patch) | |
tree | bfc1da1456f42099caf7cd9b907fa964b034490c | |
parent | fcb3739b50c8b4f556476977dbc4ebcc2e8f060f (diff) |
Fix OpenSSL engine compile :/
-rw-r--r-- | doc/log.txt | 1 | ||||
-rw-r--r-- | src/engine/openssl/ossl_arc4.cpp | 8 | ||||
-rw-r--r-- | src/engine/openssl/ossl_bc.cpp | 13 | ||||
-rw-r--r-- | src/engine/openssl/ossl_md.cpp | 12 |
4 files changed, 26 insertions, 8 deletions
diff --git a/doc/log.txt b/doc/log.txt index 509c8a6b8..b347fdb71 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -1,6 +1,7 @@ * 1.9.12-dev, ????-??-?? - Fix compilation problems in Python wrappers + - Fix compilation problem in OpenSSL engine * 1.9.11, 2010-11-29 - Many SSL/TLS APIs have changed. This API is still unstable. diff --git a/src/engine/openssl/ossl_arc4.cpp b/src/engine/openssl/ossl_arc4.cpp index 1273d239d..0b1f7f1f3 100644 --- a/src/engine/openssl/ossl_arc4.cpp +++ b/src/engine/openssl/ossl_arc4.cpp @@ -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); diff --git a/src/engine/openssl/ossl_bc.cpp b/src/engine/openssl/ossl_bc.cpp index 74f0316dc..36f78205f 100644 --- a/src/engine/openssl/ossl_bc.cpp +++ b/src/engine/openssl/ossl_bc.cpp @@ -29,6 +29,8 @@ class EVP_BlockCipher : public BlockCipher 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 BlockCipher 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 @@ class EVP_BlockCipher : public BlockCipher */ 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 EVP_CIPHER* algo, 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 @@ void EVP_BlockCipher::key_schedule(const byte key[], size_t length) 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()); } /* diff --git a/src/engine/openssl/ossl_md.cpp b/src/engine/openssl/ossl_md.cpp index 0e16b3d90..3fcee91d6 100644 --- a/src/engine/openssl/ossl_md.cpp +++ b/src/engine/openssl/ossl_md.cpp @@ -22,7 +22,15 @@ class EVP_HashFunction : public HashFunction 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(); @@ -76,8 +84,6 @@ HashFunction* EVP_HashFunction::clone() 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); |