8 #include <botan/internal/openssl_engine.h>     9 #include <openssl/evp.h>    18 class EVP_HashFunction : 
public HashFunction
    22       std::string name()
 const { 
return algo_name; }
    23       HashFunction* clone() 
const;
    25       size_t output_length()
 const    27          return EVP_MD_size(EVP_MD_CTX_md(&md));
    30       size_t hash_block_size()
 const    32          return EVP_MD_block_size(EVP_MD_CTX_md(&md));
    35       EVP_HashFunction(
const EVP_MD*, 
const std::string&);
    38       void add_data(
const byte[], 
size_t);
    39       void final_result(
byte[]);
    42       std::string algo_name;
    49 void EVP_HashFunction::add_data(
const byte input[], 
size_t length)
    51    EVP_DigestUpdate(&md, input, length);
    57 void EVP_HashFunction::final_result(
byte output[])
    59    EVP_DigestFinal_ex(&md, output, 0);
    60    const EVP_MD* algo = EVP_MD_CTX_md(&md);
    61    EVP_DigestInit_ex(&md, algo, 0);
    67 void EVP_HashFunction::clear()
    69    const EVP_MD* algo = EVP_MD_CTX_md(&md);
    70    EVP_DigestInit_ex(&md, algo, 0);
    76 HashFunction* EVP_HashFunction::clone()
 const    78    const EVP_MD* algo = EVP_MD_CTX_md(&md);
    79    return new EVP_HashFunction(algo, name());
    85 EVP_HashFunction::EVP_HashFunction(
const EVP_MD* algo,
    86                                    const std::string& name) :
    90    EVP_DigestInit_ex(&md, algo, 0);
    96 EVP_HashFunction::~EVP_HashFunction()
    98    EVP_MD_CTX_cleanup(&md);
   109 #if !defined(OPENSSL_NO_SHA)   111       return new EVP_HashFunction(EVP_sha1(), 
"SHA-160");
   114 #if !defined(OPENSSL_NO_SHA256)   116       return new EVP_HashFunction(EVP_sha224(), 
"SHA-224");
   118       return new EVP_HashFunction(EVP_sha256(), 
"SHA-256");
   121 #if !defined(OPENSSL_NO_SHA512)   123       return new EVP_HashFunction(EVP_sha384(), 
"SHA-384");
   125       return new EVP_HashFunction(EVP_sha512(), 
"SHA-512");
   128 #if !defined(OPENSSL_NO_MD2)   130       return new EVP_HashFunction(EVP_md2(), 
"MD2");
   133 #if !defined(OPENSSL_NO_MD4)   135       return new EVP_HashFunction(EVP_md4(), 
"MD4");
   138 #if !defined(OPENSSL_NO_MD5)   140       return new EVP_HashFunction(EVP_md5(), 
"MD5");
   143 #if !defined(OPENSSL_NO_RIPEMD)   145       return new EVP_HashFunction(EVP_ripemd160(), 
"RIPEMD-160");
 HashFunction * find_hash(const SCAN_Name &, Algorithm_Factory &) const
std::string algo_name() const