added openssl initialization and error reporting
Added openssl initialization and error reporting. Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
This commit is contained in:
parent
0799e24820
commit
192f897b8e
19
src/evmctl.c
19
src/evmctl.c
@ -45,11 +45,13 @@
|
|||||||
#include <attr/xattr.h>
|
#include <attr/xattr.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
#include <openssl/sha.h>
|
|
||||||
#include <openssl/sha.h>
|
#include <openssl/sha.h>
|
||||||
#include <openssl/rsa.h>
|
#include <openssl/rsa.h>
|
||||||
#include <openssl/pem.h>
|
#include <openssl/pem.h>
|
||||||
#include <openssl/hmac.h>
|
#include <openssl/hmac.h>
|
||||||
|
#include <openssl/engine.h>
|
||||||
|
#include <openssl/evp.h>
|
||||||
|
#include <openssl/err.h>
|
||||||
|
|
||||||
#define USE_FPRINTF
|
#define USE_FPRINTF
|
||||||
|
|
||||||
@ -404,8 +406,6 @@ static int calc_evm_hash(const char *file, const char *keyfile, unsigned char *h
|
|||||||
|
|
||||||
log_info("generation: %u\n", generation);
|
log_info("generation: %u\n", generation);
|
||||||
|
|
||||||
OpenSSL_add_all_digests();
|
|
||||||
|
|
||||||
md = EVP_get_digestbyname("sha1");
|
md = EVP_get_digestbyname("sha1");
|
||||||
if (!md) {
|
if (!md) {
|
||||||
log_errno("EVP_get_digestbyname() failed");
|
log_errno("EVP_get_digestbyname() failed");
|
||||||
@ -500,8 +500,6 @@ static int calc_file_hash(const char *file, uint8_t *hash)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenSSL_add_all_digests();
|
|
||||||
|
|
||||||
md = EVP_get_digestbyname(hash_algo);
|
md = EVP_get_digestbyname(hash_algo);
|
||||||
if (!md) {
|
if (!md) {
|
||||||
log_errno("EVP_get_digestbyname() failed");
|
log_errno("EVP_get_digestbyname() failed");
|
||||||
@ -566,8 +564,6 @@ static int calc_dir_hash(const char *file, uint8_t *hash)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenSSL_add_all_digests();
|
|
||||||
|
|
||||||
md = EVP_get_digestbyname(hash_algo);
|
md = EVP_get_digestbyname(hash_algo);
|
||||||
if (!md) {
|
if (!md) {
|
||||||
log_errno("EVP_get_digestbyname() failed");
|
log_errno("EVP_get_digestbyname() failed");
|
||||||
@ -1221,10 +1217,19 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OpenSSL_add_all_algorithms();
|
||||||
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
if (argv[optind] == NULL)
|
if (argv[optind] == NULL)
|
||||||
usage();
|
usage();
|
||||||
else
|
else
|
||||||
err = call_command(cmds, argv[optind++]);
|
err = call_command(cmds, argv[optind++]);
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
log_err("error: %s\n", ERR_error_string(ERR_get_error(), NULL));
|
||||||
|
|
||||||
|
ERR_free_strings();
|
||||||
|
EVP_cleanup();
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user