Contiki-NG
Loading...
Searching...
No Matches
cose-error.h File Reference

COSE library error definitions. More...

#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Macros

#define COSE_SUCCESS_CHECK(result)
 Check if a COSE operation was successful.
#define COSE_FAILED(result)
 Check if a COSE operation failed.
#define COSE_CHECK(call)
 Macro for checking and propagating COSE errors.

Enumerations

enum  cose_error_t {
}
 COSE operation error codes. More...

Functions

const char * cose_error_string (cose_error_t error)
 Get a human-readable error message for a COSE error.

Detailed Description

COSE library error definitions.

This header defines error codes for COSE (CBOR Object Signing and Encryption) operations as specified in RFC 8152.

Author
Niclas Finne nicla.nosp@m.s.fi.nosp@m.nne@r.nosp@m.i.se, Nicolas Tsiftes nicol.nosp@m.as.t.nosp@m.sifte.nosp@m.s@ri.nosp@m..se

Definition in file cose-error.h.

Macro Definition Documentation

◆ COSE_CHECK

#define COSE_CHECK ( call)
Value:
do { \
cose_error_t _result = (call); \
if(COSE_FAILED(_result)) { \
return _result; \
} \
} while(0)
cose_error_t
COSE operation error codes.
Definition cose-error.h:53
#define COSE_FAILED(result)
Check if a COSE operation failed.
Definition cose-error.h:107

Macro for checking and propagating COSE errors.

Usage: COSE_CHECK(some_cose_function(params));

Definition at line 121 of file cose-error.h.

◆ COSE_FAILED

#define COSE_FAILED ( result)
Value:
((result) < COSE_SUCCESS)

Check if a COSE operation failed.

Parameters
resultThe result to check
Returns
true if failed, false otherwise

Definition at line 107 of file cose-error.h.

◆ COSE_SUCCESS_CHECK

#define COSE_SUCCESS_CHECK ( result)
Value:
((result) == COSE_SUCCESS)

Check if a COSE operation was successful.

Parameters
resultThe result to check
Returns
true if successful, false otherwise

Definition at line 100 of file cose-error.h.

Enumeration Type Documentation

◆ cose_error_t

COSE operation error codes.

Error codes for COSE operations use negative values to distinguish them from success (0) and positive return values (e.g., sizes).

Enumerator
COSE_ERR_INVALID_PARAMETER 

Invalid parameter provided.

COSE_ERR_NULL_POINTER 

Null pointer provided.

COSE_ERR_BUFFER_TOO_SMALL 

Buffer too small for operation.

COSE_ERR_INVALID_LENGTH 

Invalid length parameter.

COSE_ERR_UNSUPPORTED_ALGORITHM 

Algorithm not supported.

COSE_ERR_MEMORY_ALLOCATION 

Memory allocation failed.

COSE_ERR_BUFFER_OVERFLOW 

Buffer overflow detected.

COSE_ERR_CRYPTO_KEYGEN 

Key generation failed.

COSE_ERR_CRYPTO_SIGN 

Digital signature failed.

COSE_ERR_CRYPTO_VERIFY 

Signature verification failed.

COSE_ERR_CRYPTO_ENCRYPT 

Encryption operation failed.

COSE_ERR_CRYPTO_DECRYPT 

Decryption operation failed.

COSE_ERR_CRYPTO_AUTHENTICATION 

Authentication tag verification failed.

COSE_ERR_CRYPTO_INVALID_KEY 

Invalid cryptographic key.

COSE_ERR_CBOR_ENCODING 

CBOR encoding failed.

COSE_ERR_CBOR_DECODING 

CBOR decoding failed.

COSE_ERR_CBOR_INVALID_TYPE 

Invalid CBOR data type.

COSE_ERR_CBOR_MALFORMED 

Malformed CBOR data.

COSE_ERR_INVALID_STRUCTURE 

Invalid COSE structure.

COSE_ERR_MISSING_HEADER 

Required header missing.

COSE_ERR_INVALID_HEADER 

Invalid header content.

COSE_ERR_MISSING_PAYLOAD 

Required payload missing.

COSE_ERR_NOT_IMPLEMENTED 

Feature not implemented.

COSE_ERR_INTERNAL_ERROR 

Internal implementation error.

COSE_ERR_UNKNOWN 

Unknown error condition.

Definition at line 53 of file cose-error.h.

Function Documentation

◆ cose_error_string()