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:
ctx— noxtls_sha512_ctx_t to initializealgo— noxtls_hash_algos_t (NOXTLS_SHA_384 or NOXTLS_SHA_512)
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:
ctx— noxtls_sha512_ctx_t (from noxtls_sha512_init)input— Data to updatelen— Length of data to update
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:
ctx— noxtls_sha512_ctx_t (from noxtls_sha512_init)input— Data to round
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:
ctx— noxtls_sha512_ctx_t (from noxtls_sha512_init)hash— Output buffer for the 64-byte (SHA-512) or 48-byte (SHA-384) digest
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 sinkzero_pad— is the Host Callbacklen— 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 verifylen— Length of data to verifyexpected— Expected hash
Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, NOXTLS_RETURN_FAILED if verification fails