Skip to main content
Version: 0.1.23

SHA-512

Types

noxtls_sha512_ctx_t

Opaque context for incremental SHA-512/SHA-384 hashing. Used by noxtls_sha512_init, noxtls_sha512_update, noxtls_sha512_round, noxtls_sha512_finish. Allocate and pass to init; do not access fields directly.

noxtls_hash_algos_t

Enumeration of hash algorithms. For SHA-512 APIs use NOXTLS_SHA_384 or NOXTLS_SHA_512. See Common hash API for the full list.

API

noxtls_sha512_set_debug

void noxtls_sha512_set_debug(uint8_t lvl);

Set SHA-512 debug level

Parameters:

  • lvl — Debug level

noxtls_sha512_init

noxtls_return_t noxtls_sha512_init(noxtls_sha512_ctx_t * ctx, noxtls_hash_algos_t algo);

Initialize SHA-512

Parameters:

Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, NOXTLS_RETURN_NULL if ctx is NULL

noxtls_sha512_update

noxtls_return_t noxtls_sha512_update(noxtls_sha512_ctx_t * ctx, const uint8_t * input, uint32_t len);

Update SHA-512

Parameters:

Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, NOXTLS_RETURN_NULL if ctx is NULL

noxtls_sha512_round

noxtls_return_t noxtls_sha512_round(noxtls_sha512_ctx_t * ctx, const uint8_t * input);

SHA-512 round

Parameters:

Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, NOXTLS_RETURN_NULL if ctx is NULL

noxtls_sha512_finish

noxtls_return_t noxtls_sha512_finish(noxtls_sha512_ctx_t * ctx, uint8_t * hash);

Finish SHA-512 operation

Parameters:

Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, or another error code otherwise

noxtls_sha512_pad

noxtls_return_t noxtls_sha512_pad(uint8_t * data, uint32_t zero_pad, uint32_t len);

Finish SHA-512 operation

Parameters:

  • data — is the HCI controller sink
  • zero_pad — is the Host Callback
  • len — is the BT HCI Callback

Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, or another error code otherwise

noxtls_sha512_verify

noxtls_return_t noxtls_sha512_verify(const uint8_t * data, uint32_t len, const uint8_t * expected);

Verify SHA-512

Parameters:

  • data — Data to verify
  • len — Length of data to verify
  • expected — Expected hash

Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, NOXTLS_RETURN_FAILED if verification fails