Skip to content

Commit

Permalink
FAPI Test: test improve error messages
Browse files Browse the repository at this point in the history
* the error message for BIO_read_filename are improve.
* The used directory for the CA are displayed in the test log.
* The unneeded check-hook for the CA generation is removed.

Signed-off-by: Juergen Repp <juergen_repp@web.de>
  • Loading branch information
JuergenReppSIT committed Jan 12, 2024
1 parent b9050ef commit 3963ec0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 2 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -999,12 +999,11 @@ uninstall-local:
clean-hook:
-rm -r -f $(top_builddir)/ca

check-hook:
-rm -r -f $(top_builddir)/ca

prepare-check:
if INIT_CA
$(top_srcdir)/script/ekca/init_ca.sh $(top_builddir)
@echo "Build CI in:" 1>&2
@echo $(top_builddir) 1>&2
endif

check: prepare-check
Expand Down
10 changes: 8 additions & 2 deletions test/integration/main-fapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,10 @@ load_intermed_cert_and_key(const char *ca_key_path, EVP_PKEY **ca_key,
/* Load the intermediate certificate */
bio = BIO_new(BIO_s_file());
if (!bio || !BIO_read_filename(bio, ca_cert_path)) {
LOG_ERROR("Failure in BIO_read_filename %s", ca_cert_path);
unsigned long err = ERR_get_error();
char err_buffer[256];
ERR_error_string_n(err, err_buffer, sizeof(err_buffer));
LOG_ERROR("Failure in BIO_read_filename %s", err_buffer);
goto error_cleanup;
}
*ca_crt = PEM_read_bio_X509(bio, NULL, NULL, NULL);
Expand All @@ -959,7 +962,10 @@ load_intermed_cert_and_key(const char *ca_key_path, EVP_PKEY **ca_key,
/* Load the intermediate key. */
bio = BIO_new(BIO_s_file());
if (!bio || !BIO_read_filename(bio, ca_key_path)) {
LOG_ERROR("Failure in BIO_read_filename %s", ca_key_path);
unsigned long err = ERR_get_error();
char err_buffer[256];
ERR_error_string_n(err, err_buffer, sizeof(err_buffer));
LOG_ERROR("Failure in BIO_read_filename %s", err_buffer);
goto error_cleanup;
}
*ca_key = PEM_read_bio_PrivateKey(bio, NULL, pass_cb, NULL);
Expand Down

0 comments on commit 3963ec0

Please sign in to comment.