Error API - zpc/error.h

In file zpc/error.h, libzpc provides one API to handle all errors that may occur for cryptographic operations.

The error.h header file contains ZPC_ERROR_XXX definitions of error codes greater than 0. Each error code is mapped to the corresponding error explanation string.

#define ZPC_ERROR_ARG1NULL 1
Function argument 1 is NULL.
#define ZPC_ERROR_ARG2NULL 2
Function argument 2 is NULL.
#define ZPC_ERROR_ARG3NULL 3
Function argument 3 is NULL.
#define ZPC_ERROR_ARG4NULL 4
Function argument 4 is NULL.
#define ZPC_ERROR_ARG5NULL 5
Function argument 5 is NULL.
#define ZPC_ERROR_ARG6NULL 6
Function argument 6 is NULL.
#define ZPC_ERROR_ARG7NULL 7
Function argument 7 is NULL.
#define ZPC_ERROR_ARG8NULL 8
Function argument 8 is NULL.
#define ZPC_ERROR_ARG1RANGE 9
Function argument 1 is out of range.
#define ZPC_ERROR_ARG2RANGE 10
Function argument 2 is out of range.
#define ZPC_ERROR_ARG3RANGE 11
Function argument 3 is out of range.
#define ZPC_ERROR_ARG4RANGE 12
Function argument 4 is out of range.
#define ZPC_ERROR_ARG5RANGE 13
Function argument 5 is out of range.
#define ZPC_ERROR_ARG6RANGE 14
Function argument 6 is out of range.
#define ZPC_ERROR_ARG7RANGE 15
Function argument 7 is out of range.
#define ZPC_ERROR_ARG8RANGE 16
Function argument 8 is out of range.
#define ZPC_ERROR_MALLOC 17
Malloc failed.
#define ZPC_ERROR_KEYNOTSET 18
Key not set.
#define ZPC_ERROR_KEYSIZE 19
Invalid key size.
#define ZPC_ERROR_IVNOTSET 20
IV not set.
#define ZPC_ERROR_IVSIZE 21
Invalid IV size.
#define ZPC_ERROR_TAGSIZE 22
Invalid tag size.
#define ZPC_ERROR_TAGMISMATCH 23
Tag mismatch.
#define ZPC_ERROR_HWCAPS 24
Function not supported.
#define ZPC_ERROR_SMALLOUTBUF 25
Output buffer too small.
#define ZPC_ERROR_APQNSNOTSET 26
APQNs not set.
#define ZPC_ERROR_KEYTYPE 27
Invalid key type.
#define ZPC_ERROR_KEYTYPENOTSET 28
Key type not set.
#define ZPC_ERROR_IOCTLGENSECK2 29
PKEY_GENSECK2 ioctl failed.
#define ZPC_ERROR_IOCTLCLR2SECK2 30
PKEY_CLR2SECK2 ioctl failed.
#define ZPC_ERROR_IOCTLBLOB2PROTK2 31
PKEY_BLOB2PROTK2 ioctl failed.
#define ZPC_ERROR_WKVPMISMATCH 32
Wrapping key verification pattern mismatch.
#define ZPC_ERROR_DEVPKEY 33
Opening /dev/pkey failed.
#define ZPC_ERROR_CLEN 34
Ciphertext too long.
#define ZPC_ERROR_MLEN 35
Message too long.
#define ZPC_ERROR_AADLEN 36
Additional authenticated data too long.
#define ZPC_ERROR_PARSE 38
Parse error.
#define ZPC_ERROR_APQNNOTFOUND 39
APQN not found in APQN list.
#define ZPC_ERROR_MKVPLEN 40
MKVP too long.
#define ZPC_ERROR_INITLOCK 42
Initializing a lock failed.
#define ZPC_ERROR_OBJINUSE 43
Object is in use.
#define ZPC_ERROR_IOCTLAPQNS4KT 44
PKEY_APQNS4KT ioctl failed.
#define ZPC_ERROR_KEYSIZENOTSET 45
Key-size not set.
#define ZPC_ERROR_IOCTLGENPROTK 46
PKEY_GENPROTK ioctl failed.
#define ZPC_ERROR_PROTKEYONLY 47
Protected-key only.
#define ZPC_ERROR_KEYSEQUAL 48
Keys are equal.
#define ZPC_ERROR_NOTSUP 49
Not supported.
#define ZPC_ERROR_EC_INVALID_CURVE 50
Invalid EC curve.
# define ZPC_ERROR_EC_CURVE_NOTSET 51
EC curve not set.
# define ZPC_ERROR_EC_PRIVKEY_NOTSET 52
EC private key not set.
# define ZPC_ERROR_EC_PUBKEY_NOTSET 53
EC public key not set.
# define ZPC_ERROR_EC_NO_KEY_PARTS 54
No EC key parts given.
# define ZPC_ERROR_EC_SIGNATURE_INVALID 55
Signature invalid.
# define ZPC_ERROR_IOCTLBLOB2PROTK3 56
PKEY_BLOB2PROTK3 ioctl failed.
# define ZPC_ERROR_IOCTLCLR2SECK3 57
PKEY_CLR2SECK3 ioctl failed.
# define ZPC_ERROR_APQNS_NOTSET 58
No APQNs set for this key, but required for this operation.
# define ZPC_ERROR_EC_SIGNATURE_LENGTH 59
Length of given signature is invalid for this EC key.
# define ZPC_ERROR_EC_KEY_PARTS_INCONSISTENT 60
Given public/private key parts are inconsistent. They do not belong o the same EC key.
# define ZPC_ERROR_CCA_HOST_LIB_NOT_AVAILABLE 61
The CCA host library is not available, but required for this function.
# define ZPC_ERROR_EP11_HOST_LIB_NOT_AVAILABLE 62
The EP11 host library is not available, but required for this function.
# define ZPC_ERROR_EC_PUBKEY_LENGTH 63
The given EC public key length is invalid.
# define ZPC_ERROR_EC_PRIVKEY_LENGTH 64
The given ECC private key length is invalid.
# define ZPC_ERROR_EC_NO_CCA_SECUREKEY_TOKEN 65
The given buffer does not contain a valid CCA secure key token.
# define ZPC_ERROR_EC_NO_EP11_SECUREKEY_TOKEN 66
The given buffer does not contain a valid EP11 secure key token.
# define ZPC_ERROR_EC_EP11_SPKI_INVALID_LENGTH 67
The imported buffer contains an EP11 SubjectPublicKeyInfo (SPKI) with an invalid length.
# define ZPC_ERROR_EC_EP11_SPKI_INVALID_CURVE 68
The imported buffer contains an EP11 SubjectPublicKeyInfo (SPKI) with an invalid EC curve.
# define ZPC_ERROR_EC_EP11_SPKI_INVALID_PUBKEY 69
The imported buffer contains an EP11 SubjectPublicKeyInfo (SPKI) with an invalid public key.
# define ZPC_ERROR_EC_EP11_SPKI_INVALID_MKVP 70
The imported buffer contains an EP11 MACed SubjectPublicKeyInfo (SPKI) with an unknown MKVP.
# define ZPC_ERROR_BLOB_NOT_PKEY_EXTRACTABLE 71
The imported buffer contains a key blob that cannot be transformed into a protected key.
# define ZPC_ERROR_APQNS_INVALID_VERSION 72
At least one APQN version is invalid for this function.
# define ZPC_ERROR_AES_NO_EP11_SECUREKEY_TOKEN 73
The given buffer does not contain a valid EP11 AES secure key token.
# define ZPC_ERROR_AES_NO_CCA_DATAKEY_TOKEN 74
The given buffer does not contain a valid CCA AES DATA key token.
# define ZPC_ERROR_AES_NO_CCA_CIPHERKEY_TOKEN 75
The given buffer does not contain a valid CCA AES CIPHER key token.
# define ZPC_ERROR_RNDGEN 76
Error creating random bytes.
# define ZPC_ERROR_GCM_IV_CREATED_INTERNALLY 77
Invalid usage of a GCM context with an internally created IV.
#define ZPC_ERROR_UV_PVSECRETS_NOT_AVAILABLE 78
Support for UV retrievable secrets is not available, but required for this function.
#define ZPC_ERROR_PVSECRET_TYPE_NOT_SUPPORTED 79
The given pvsecret type is not supported by libzpc.
#define ZPC_ERROR_PVSECRET_ID_NOT_FOUND_IN_UV_OR_INVALID_TYPE 80
The given pvsecret ID does either not exist or belongs to a different secret type.
#define ZPC_ERROR_IOCTLVERIFYKEY2 81
PKEY_VERIFYKEY2 ioctl failed.
#define ZPC_ERROR_HMAC_HASH_FUNCTION_NOTSET 82
HMAC hash function not set.
#define ZPC_ERROR_HMAC_HASH_FUNCTION_INVALID 83
HMAC hash function invalid.
#define ZPC_ERROR_HMAC_KEYGEN_VIA_SYSFS 84
HMAC key generation via sysfs attributes failed.
#define ZPC_ERROR_CREATE_BLOCKSIZED_KEY 85
Creating a block-sized HMAC key failed.
#define ZPC_ERROR_XTS_KEYGEN_VIA_SYSFS 86
Creating a full-xts key via sysfs attributes failed.

zpc_error_string

Purpose:

Map an error code to a string containing the corresponding error explanation.

Format:

const char * zpc_error_string (
      int err )

Parameters:

Direction Name Description
input err An error code.

Return:

A pointer to a string containing the textual error explanation.