Skip to content

Commit

Permalink
Fix verify_tls_init() - Fix crucial generated_master_hash
Browse files Browse the repository at this point in the history
Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Mar 1, 2022
1 parent e1494a0 commit ec1ac19
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions easytls
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ easytls_verbose ()
[ -z "${flash_config}" ] || return 0
verbose_message="${*}"
[ -z "${verbose_message}" ] && print "" && return 0
"${EASYTLS_PRINTF}" "* ${verbose_message}"
"${EASYTLS_PRINTF}" '%s\n' "* ${verbose_message}"
} # => easytls_verbose ()

# Verbose messages ON/OFF
Expand Down Expand Up @@ -9230,7 +9230,7 @@ generate_master_hash ()
{
# Respect no file hash mode
if [ -n "${FILE_HASH_DISABLED}" ]; then
generated_faster_hash="${fixed_hash}"
generated_master_hash="${fixed_hash}"
return 0
fi

Expand Down Expand Up @@ -9336,7 +9336,7 @@ old_faster_hash ()
save_master_hash ()
{
# file hashing is disabled
[ -z "${FILE_HASH_DISABLED}" ] || return 0
#[ -z "${FILE_HASH_DISABLED}" ] || return 0

[ -n "${update_master_hash}" ] || return 0
[ -z "${master_save_hash_block}" ] || \
Expand All @@ -9355,7 +9355,7 @@ save_master_hash ()
verify_master_hash ()
{
# file hashing is disabled
[ -z "${FILE_HASH_DISABLED}" ] || return 0
#[ -z "${FILE_HASH_DISABLED}" ] || return 0

[ "${master_verify_hash_block}" ] && \
die "Master verify hash must only run once"
Expand Down Expand Up @@ -9955,15 +9955,17 @@ main ()
esac

# Must have init TLS now - and PKI when not No-CA mode
verify_tls_init || {
if verify_tls_init; then
if [ -z "${EASYTLS_NO_CA}" ]; then
verify_pki_init || {
error_msg "Easy-RSA has not been initialised."
die "main - verify_pki_init"
}
fi
else
error_msg "Easy-TLS has not been initialised."
error_msg "See help: ./easytls help init-tls"
# shellcheck disable=2312
error_msg "$(cmd_help init-tls)"
exit 1
# die "verify_tls_init (1)"
}
[ -n "${EASYTLS_NO_CA}" ] || verify_pki_init
die "main - verify_tls_init"
fi

# Rehash all file hashes
# shellcheck disable=SC2249 # (info): default *) case
Expand Down

1 comment on commit ec1ac19

@TinCanTech
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.