|
|
7e1ffc |
diff --color -ruNp a/lib/fips.c b/lib/fips.c
|
|
|
7e1ffc |
--- a/lib/fips.c 2022-11-15 16:10:56.183185457 +0100
|
|
|
7e1ffc |
+++ b/lib/fips.c 2022-11-15 16:10:23.488530716 +0100
|
|
|
7e1ffc |
@@ -360,11 +360,6 @@ static int check_lib_hmac(struct hmac_en
|
|
|
7e1ffc |
return gnutls_assert_val(ret);
|
|
|
7e1ffc |
}
|
|
|
7e1ffc |
|
|
|
7e1ffc |
- if (strncmp(entry->path, path, GNUTLS_PATH_MAX)) {
|
|
|
7e1ffc |
- _gnutls_debug_log("Library path for %s does not match with HMAC file\n", lib);
|
|
|
7e1ffc |
- return gnutls_assert_val(GNUTLS_E_PARSING_ERROR);
|
|
|
7e1ffc |
- }
|
|
|
7e1ffc |
-
|
|
|
7e1ffc |
_gnutls_debug_log("Loading: %s\n", path);
|
|
|
7e1ffc |
ret = gnutls_load_file(path, &data);
|
|
|
7e1ffc |
if (ret < 0) {
|
|
|
7e1ffc |
diff --color -ruNp a/lib/fipshmac.c b/lib/fipshmac.c
|
|
|
7e1ffc |
--- a/lib/fipshmac.c 2022-11-15 16:10:56.183185457 +0100
|
|
|
7e1ffc |
+++ b/lib/fipshmac.c 2022-11-15 16:10:23.489530737 +0100
|
|
|
7e1ffc |
@@ -102,20 +102,30 @@ static int get_hmac(const char *path, ch
|
|
|
7e1ffc |
static int print_lib_path(const char *path)
|
|
|
7e1ffc |
{
|
|
|
7e1ffc |
int ret;
|
|
|
7e1ffc |
+ char *real_path = NULL;
|
|
|
7e1ffc |
char hmac[HMAC_STR_SIZE];
|
|
|
7e1ffc |
|
|
|
7e1ffc |
- ret = get_hmac(path, hmac, sizeof(hmac));
|
|
|
7e1ffc |
+ real_path = canonicalize_file_name(path);
|
|
|
7e1ffc |
+ if (real_path == NULL) {
|
|
|
7e1ffc |
+ fprintf(stderr, "Could not get realpath from %s\n", path);
|
|
|
7e1ffc |
+ ret = GNUTLS_E_FILE_ERROR;
|
|
|
7e1ffc |
+ goto cleanup;
|
|
|
7e1ffc |
+ }
|
|
|
7e1ffc |
+
|
|
|
7e1ffc |
+ ret = get_hmac(real_path, hmac, sizeof(hmac));
|
|
|
7e1ffc |
if (ret < 0) {
|
|
|
7e1ffc |
fprintf(stderr, "Could not calculate HMAC for %s: %s\n",
|
|
|
7e1ffc |
- last_component(path), gnutls_strerror(ret));
|
|
|
7e1ffc |
- return ret;
|
|
|
7e1ffc |
+ last_component(real_path), gnutls_strerror(ret));
|
|
|
7e1ffc |
+ goto cleanup;
|
|
|
7e1ffc |
}
|
|
|
7e1ffc |
|
|
|
7e1ffc |
printf("[%s]\n", last_component(path));
|
|
|
7e1ffc |
- printf("path = %s\n", path);
|
|
|
7e1ffc |
+ printf("path = %s\n", real_path);
|
|
|
7e1ffc |
printf("hmac = %s\n", hmac);
|
|
|
7e1ffc |
|
|
|
7e1ffc |
- return 0;
|
|
|
7e1ffc |
+cleanup:
|
|
|
7e1ffc |
+ free(real_path);
|
|
|
7e1ffc |
+ return ret;
|
|
|
7e1ffc |
}
|
|
|
7e1ffc |
|
|
|
7e1ffc |
static int print_lib_dl(const char *lib, const char *sym)
|