Skip to content

Commit b6af796

Browse files
committed
Make rc more informative
Searching for a given secret ID always means searching for an ID of a given secret type (AES-128-KEY, AES-192-KEY, HMAC-SHA-256-KEY, etc.). If this fails, there are two possible reasons: there is no secret with the given ID in the system, or the given ID belongs to a secret with another type. Therefore make the related rc and its description more informative. Signed-off-by: Joerg Schmidbauer <jschmidb@de.ibm.com>
1 parent 6c8aaa9 commit b6af796

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

include/zpc/error.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,10 @@ extern "C" {
482482
# define ZPC_ERROR_PVSECRET_TYPE_NOT_SUPPORTED 79
483483

484484
/**
485-
* \def ZPC_ERROR_PVSECRET_ID_NOT_FOUND_IN_UV
486-
* \brief the given pvsecret ID does not belong to a secret on this system.
485+
* \def ZPC_ERROR_PVSECRET_ID_NOT_FOUND_IN_UV_OR_INVALID_TYPE
486+
* \brief the given pvsecret ID does either not exist or belongs to a different secret type.
487487
*/
488-
# define ZPC_ERROR_PVSECRET_ID_NOT_FOUND_IN_UV 80
488+
# define ZPC_ERROR_PVSECRET_ID_NOT_FOUND_IN_UV_OR_INVALID_TYPE 80
489489

490490
/**
491491
* \def ZPC_ERROR_IOCTLVERIFYKEY2

src/aes_key.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ zpc_aes_key_import(struct zpc_aes_key *aes_key, const unsigned char *buf,
695695
}
696696
} else {
697697
if (aes_key_blob_is_valid_pvsecret_id(aes_key, buf) != 0) {
698-
rc = ZPC_ERROR_PVSECRET_ID_NOT_FOUND_IN_UV;
698+
rc = ZPC_ERROR_PVSECRET_ID_NOT_FOUND_IN_UV_OR_INVALID_TYPE;
699699
goto ret;
700700
}
701701
}

src/ecc_key.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ int zpc_ec_key_import(struct zpc_ec_key *ec_key, const unsigned char *buf,
678678

679679
if (ec_key->type == ZPC_EC_KEY_TYPE_PVSECRET) {
680680
if (ec_key_blob_is_valid_pvsecret_id(ec_key, buf) != 0) {
681-
rc = ZPC_ERROR_PVSECRET_ID_NOT_FOUND_IN_UV;
681+
rc = ZPC_ERROR_PVSECRET_ID_NOT_FOUND_IN_UV_OR_INVALID_TYPE;
682682
goto ret;
683683
}
684684
}

src/hmac_key.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ int zpc_hmac_key_import(struct zpc_hmac_key *hmac_key, const unsigned char *buf,
493493
}
494494

495495
if (hmac_key_blob_is_valid_pvsecret_id(hmac_key, buf) != 0) {
496-
rc = ZPC_ERROR_PVSECRET_ID_NOT_FOUND_IN_UV;
496+
rc = ZPC_ERROR_PVSECRET_ID_NOT_FOUND_IN_UV_OR_INVALID_TYPE;
497497
goto ret;
498498
}
499499

0 commit comments

Comments
 (0)