passwordfile/util/openssl.cpp

40 lines
670 B
C++
Raw Normal View History

2015-09-06 20:33:27 +02:00
#include "./openssl.h"
2015-04-22 19:06:29 +02:00
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/evp.h>
2016-06-10 23:18:21 +02:00
/*!
* \brief Contains utility classes and functions.
*/
2015-04-22 19:06:29 +02:00
namespace Util {
2016-06-10 23:18:21 +02:00
/*!
* \brief Contains functions utilizing the usage of OpenSSL.
*/
2015-04-22 19:06:29 +02:00
namespace OpenSsl {
2016-06-10 23:18:21 +02:00
/*!
* \brief Initializes OpenSSL.
*/
2015-04-22 19:06:29 +02:00
void init()
{
// load the human readable error strings for libcrypto
ERR_load_crypto_strings();
// load all digest and cipher algorithms
OpenSSL_add_all_algorithms();
}
2016-06-10 23:18:21 +02:00
/*!
* \brief Cleans resources of OpenSSL.
*/
2015-04-22 19:06:29 +02:00
void clean()
{
// removes all digests and ciphers
EVP_cleanup();
// remove error strings
ERR_free_strings();
}
}
}