SHA-256
API
noxtls_sha256_init
noxtls_return_t noxtls_sha256_init(noxtls_sha_ctx_t * ctx, noxtls_hash_algos_t algo);
Initialize SHA-256
Parameters:
ctx— noxtls_sha_ctx_t to initialize for SHA-256algo— noxtls_hash_algos_t (e.g. SHA-224, SHA-256)
Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, NOXTLS_RETURN_NULL if ctx is NULL
noxtls_sha256_update
noxtls_return_t noxtls_sha256_update(noxtls_sha_ctx_t * ctx, const uint8_t * input, uint32_t len);
Update SHA-256
Parameters:
ctx— noxtls_sha_ctx_t (from noxtls_sha256_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_sha256_round
noxtls_return_t noxtls_sha256_round(noxtls_sha_ctx_t * ctx, const uint8_t * input);
SHA-256 round
Parameters:
ctx— noxtls_sha_ctx_t (from noxtls_sha256_init)input— Data to round
Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, NOXTLS_RETURN_NULL if ctx is NULL
noxtls_sha256_finish
noxtls_return_t noxtls_sha256_finish(noxtls_sha_ctx_t * ctx, uint8_t * hash);
Finish SHA-256 operation
Parameters:
ctx— noxtls_sha_ctx_t (from noxtls_sha256_init)hash— Output buffer for the 32-byte (SHA-256) or 28-byte (SHA-224) digest
Returns: noxtls_return_t: NOXTLS_RETURN_SUCCESS on success, or another error code otherwise
noxtls_sha256_pad
noxtls_return_t noxtls_sha256_pad(uint8_t * data, uint32_t zero_pad, uint32_t len);
Finish SHA-256 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_sha256_verify
noxtls_return_t noxtls_sha256_verify(const uint8_t * data, uint32_t len, const uint8_t * expected);
Verify SHA-256
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
noxtls_sha224_verify
noxtls_return_t noxtls_sha224_verify(const uint8_t * data, uint32_t len, const uint8_t * expected);
Verify SHA-224
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