nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches
cracen_psa_hash.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
13#ifndef CRACEN_PSA_HASH_H
14#define CRACEN_PSA_HASH_H
15
16#include <psa/crypto.h>
17#include <stddef.h>
18#include <stdint.h>
19#include <string.h>
20#include <zephyr/sys/__assert.h>
21#include <nrf_security_mem_helpers.h>
23
37psa_status_t cracen_hash_compute(psa_algorithm_t alg, const uint8_t *input, size_t input_length,
38 uint8_t *hash, size_t hash_size, size_t *hash_length);
39
49
57static inline psa_status_t cracen_hash_clone(const cracen_hash_operation_t *source_operation,
58 cracen_hash_operation_t *target_operation)
59{
60 __ASSERT_NO_MSG(source_operation != NULL);
61 __ASSERT_NO_MSG(target_operation != NULL);
62
63 memcpy(target_operation, source_operation, sizeof(cracen_hash_operation_t));
64
65 return PSA_SUCCESS;
66}
67
78 const size_t input_length);
79
91psa_status_t cracen_hash_finish(cracen_hash_operation_t *operation, uint8_t *hash, size_t hash_size,
92 size_t *hash_length);
93
101{
102 __ASSERT_NO_MSG(operation != NULL);
103
104 safe_memzero(operation, sizeof(cracen_hash_operation_t));
105
106 return PSA_SUCCESS;
107}
108
111#endif /* CRACEN_PSA_HASH_H */
int32_t psa_status_t
Definition error.h:26
#define PSA_SUCCESS
Definition error.h:29
psa_status_t cracen_hash_finish(cracen_hash_operation_t *operation, uint8_t *hash, size_t hash_size, size_t *hash_length)
Finish a hash operation.
static psa_status_t cracen_hash_abort(cracen_hash_operation_t *operation)
Abort a hash operation.
Definition cracen_psa_hash.h:100
psa_status_t cracen_hash_setup(cracen_hash_operation_t *operation, psa_algorithm_t alg)
Set up a hash operation.
psa_status_t cracen_hash_update(cracen_hash_operation_t *operation, const uint8_t *input, const size_t input_length)
Add a message fragment to a multi-part hash operation.
psa_status_t cracen_hash_compute(psa_algorithm_t alg, const uint8_t *input, size_t input_length, uint8_t *hash, size_t hash_size, size_t *hash_length)
Compute the hash of a message.
static psa_status_t cracen_hash_clone(const cracen_hash_operation_t *source_operation, cracen_hash_operation_t *target_operation)
Clone a hash operation.
Definition cracen_psa_hash.h:57
Definition cracen_psa_primitives.h:262