rots-util: show error messages from OpenSSL
This commit is contained in:
parent
4ffea90a17
commit
7cf51a56ad
1 changed files with 6 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include <getopt.h>
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/ssl.h>
|
||||
|
@ -175,17 +176,20 @@ int do_sign(int argc, char *argv[])
|
|||
|
||||
if (!(key = open_priv_key(args.key))) {
|
||||
fprintf(stderr, "error: unable to read the private key.\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(cert = X509_open_cert(args.cert))) {
|
||||
fprintf(stderr, "error: unable to read the X509 certificate.\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
OPENSSL_free(key);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!(cn = X509_get_common_name(cert))) {
|
||||
fprintf(stderr, "error: unable to get the common name.\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
OPENSSL_free(cert);
|
||||
OPENSSL_free(key);
|
||||
return -1;
|
||||
|
@ -193,6 +197,7 @@ int do_sign(int argc, char *argv[])
|
|||
|
||||
if (sign(args.image, cn, args.digest, key) < 0) {
|
||||
fprintf(stderr, "error: unable to sign the payload.\n");
|
||||
ERR_print_errors_fp(stderr);
|
||||
OPENSSL_free(cn);
|
||||
OPENSSL_free(cert);
|
||||
OPENSSL_free(key);
|
||||
|
|
Loading…
Add table
Reference in a new issue