Skip to content

Commit

Permalink
include/ox: Add WARN_UNUSED_RESULT on all functions
Browse files Browse the repository at this point in the history
This is an extract of
#443
which includes all the changes on .h files included in include/ox_*.h
  • Loading branch information
Xavier Chapron committed Dec 5, 2023
1 parent 7fd0071 commit bd5c984
Show file tree
Hide file tree
Showing 5 changed files with 248 additions and 202 deletions.
8 changes: 4 additions & 4 deletions include/ox_aes.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ typedef struct cx_aes_key_s cx_aes_key_t;
* - CX_OK on success
* - CX_INVALID_PARAMETER
*/
SYSCALL cx_err_t cx_aes_set_key_hw(const cx_aes_key_t *key PLENGTH(sizeof(cx_aes_key_t)),
uint32_t mode);
SYSCALL WARN_UNUSED_RESULT cx_err_t
cx_aes_set_key_hw(const cx_aes_key_t *key PLENGTH(sizeof(cx_aes_key_t)), uint32_t mode);

/**
* @brief Resets the AES context.
Expand All @@ -111,7 +111,7 @@ SYSCALL void cx_aes_reset_hw(void);
* - CX_OK on success
* - INVALID_PARAMETER
*/
SYSCALL cx_err_t cx_aes_block_hw(const unsigned char *inblock PLENGTH(16),
unsigned char *outblock PLENGTH(16));
SYSCALL WARN_UNUSED_RESULT cx_err_t cx_aes_block_hw(const unsigned char *inblock PLENGTH(16),
unsigned char *outblock PLENGTH(16));

#endif
52 changes: 26 additions & 26 deletions include/ox_bls.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@
* - CX_EC_INVALID_POINT
* - CX_EC_INFINITE_POINT
*/
SYSCALL cx_err_t cx_bls12381_key_gen(uint8_t mode,
const uint8_t *secret,
size_t secret_len,
const uint8_t *salt,
size_t salt_len,
uint8_t *key_info,
size_t key_info_len,
cx_ecfp_384_private_key_t *private_key,
uint8_t *public_key,
size_t public_key_len);
SYSCALL WARN_UNUSED_RESULT cx_err_t cx_bls12381_key_gen(uint8_t mode,
const uint8_t *secret,
size_t secret_len,
const uint8_t *salt,
size_t salt_len,
uint8_t *key_info,
size_t key_info_len,
cx_ecfp_384_private_key_t *private_key,
uint8_t *public_key,
size_t public_key_len);

/**
* @brief Hash a message to be signed with BLS12-381 signature scheme.
Expand All @@ -96,12 +96,12 @@ SYSCALL cx_err_t cx_bls12381_key_gen(uint8_t mode,
* - CX_INVALID_PARAMETER
* - CX_MEMORY_FULL
*/
SYSCALL cx_err_t cx_hash_to_field(const uint8_t *msg,
size_t msg_len,
const uint8_t *dst,
size_t dst_len,
uint8_t *hash,
size_t hash_len);
SYSCALL WARN_UNUSED_RESULT cx_err_t cx_hash_to_field(const uint8_t *msg,
size_t msg_len,
const uint8_t *dst,
size_t dst_len,
uint8_t *hash,
size_t hash_len);

/**
* @brief Sign the hash of a message.
Expand Down Expand Up @@ -131,11 +131,11 @@ SYSCALL cx_err_t cx_hash_to_field(const uint8_t *msg,
* - CX_INTERNAL_ERROR
* - CX_INVALID_PARAMETER
*/
SYSCALL cx_err_t ox_bls12381_sign(const cx_ecfp_384_private_key_t *key,
const uint8_t *message,
size_t message_len,
uint8_t *signature,
size_t signature_len);
SYSCALL WARN_UNUSED_RESULT cx_err_t ox_bls12381_sign(const cx_ecfp_384_private_key_t *key,
const uint8_t *message,
size_t message_len,
uint8_t *signature,
size_t signature_len);

/**
* @brief Aggregate multiple signatures.
Expand All @@ -159,11 +159,11 @@ SYSCALL cx_err_t ox_bls12381_sign(const cx_ecfp_384_private_key_t *key,
* - CX_INTERNAL_ERROR
* - CX_INVALID_PARAMETER
*/
SYSCALL cx_err_t cx_bls12381_aggregate(const uint8_t *in,
size_t in_len,
bool first,
uint8_t *aggregated_signature,
size_t signature_len);
SYSCALL WARN_UNUSED_RESULT cx_err_t cx_bls12381_aggregate(const uint8_t *in,
size_t in_len,
bool first,
uint8_t *aggregated_signature,
size_t signature_len);

#endif // HAVE_BLS
#endif // OX_BLS_H
Loading

0 comments on commit bd5c984

Please sign in to comment.