mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-04-27 22:32:31 +02:00
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
0b197c4d30
commit
b0966fd243
19
src/evmctl.c
19
src/evmctl.c
@ -45,11 +45,13 @@
|
||||
#include <attr/xattr.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/rsa.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
#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);
|
||||
|
||||
OpenSSL_add_all_digests();
|
||||
|
||||
md = EVP_get_digestbyname("sha1");
|
||||
if (!md) {
|
||||
log_errno("EVP_get_digestbyname() failed");
|
||||
@ -500,8 +500,6 @@ static int calc_file_hash(const char *file, uint8_t *hash)
|
||||
return -1;
|
||||
}
|
||||
|
||||
OpenSSL_add_all_digests();
|
||||
|
||||
md = EVP_get_digestbyname(hash_algo);
|
||||
if (!md) {
|
||||
log_errno("EVP_get_digestbyname() failed");
|
||||
@ -566,8 +564,6 @@ static int calc_dir_hash(const char *file, uint8_t *hash)
|
||||
return -1;
|
||||
}
|
||||
|
||||
OpenSSL_add_all_digests();
|
||||
|
||||
md = EVP_get_digestbyname(hash_algo);
|
||||
if (!md) {
|
||||
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)
|
||||
usage();
|
||||
else
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user