Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
Crypto Hash APIs. More...
Data Structures | |
struct | hash_ctx |
Structure encoding session parameters. More... | |
struct | hash_pkt |
Structure encoding IO parameters of a hash operation. More... | |
Typedefs | |
typedef int(* | hash_op_t) (struct hash_ctx *ctx, struct hash_pkt *pkt, bool finish) |
typedef void(* | hash_completion_cb) (struct hash_pkt *completed, int status) |
Enumerations | |
enum | hash_algo { CRYPTO_HASH_ALGO_SHA224 = 1 , CRYPTO_HASH_ALGO_SHA256 = 2 , CRYPTO_HASH_ALGO_SHA384 = 3 , CRYPTO_HASH_ALGO_SHA512 = 4 } |
Hash algorithm. More... | |
Functions | |
static int | hash_begin_session (const struct device *dev, struct hash_ctx *ctx, enum hash_algo algo) |
Setup a hash session. | |
static int | hash_free_session (const struct device *dev, struct hash_ctx *ctx) |
Cleanup a hash session. | |
static int | hash_callback_set (const struct device *dev, hash_completion_cb cb) |
Registers an async hash completion callback with the driver. | |
static int | hash_compute (struct hash_ctx *ctx, struct hash_pkt *pkt) |
Perform a cryptographic hash function. | |
static int | hash_update (struct hash_ctx *ctx, struct hash_pkt *pkt) |
Perform a cryptographic multipart hash operation. | |
Crypto Hash APIs.
typedef void(* hash_completion_cb) (struct hash_pkt *completed, int status) |
#include <zephyr/crypto/hash.h>
#include <zephyr/crypto/hash.h>
enum hash_algo |
#include <zephyr/crypto/hash.h>
Hash algorithm.
Enumerator | |
---|---|
CRYPTO_HASH_ALGO_SHA224 | |
CRYPTO_HASH_ALGO_SHA256 | |
CRYPTO_HASH_ALGO_SHA384 | |
CRYPTO_HASH_ALGO_SHA512 |
|
inlinestatic |
#include <zephyr/crypto/crypto.h>
Setup a hash session.
Initializes one time parameters, like the algorithm which may remain constant for all operations in the session. The state may be cached in hardware and/or driver data state variables.
dev | Pointer to the device structure for the driver instance. |
ctx | Pointer to the context structure. Various one time parameters like session capabilities and algorithm are supplied via this structure. The structure documentation specifies which fields are to be populated by the app before making this call. |
algo | The hash algorithm to be used in this session. e.g sha256 |
|
inlinestatic |
#include <zephyr/crypto/crypto.h>
Registers an async hash completion callback with the driver.
The application can register an async hash completion callback handler to be invoked by the driver, on completion of a prior request submitted via hash_compute(). Based on crypto device hardware semantics, this is likely to be invoked from an ISR context.
dev | Pointer to the device structure for the driver instance. |
cb | Pointer to application callback to be called by the driver. |
#include <zephyr/crypto/crypto.h>
Perform a cryptographic hash function.
ctx | Pointer to the hash context of this op. |
pkt | Structure holding the input/output. |
#include <zephyr/crypto/crypto.h>
Cleanup a hash session.
Clears the hardware and/or driver state of a session.
dev | Pointer to the device structure for the driver instance. |
ctx | Pointer to the crypto hash context structure of the session to be freed. |
#include <zephyr/crypto/crypto.h>
Perform a cryptographic multipart hash operation.
This function can be called zero or more times, passing a slice of the data. The hash is calculated using all the given pieces. To calculate the hash call hash_compute()
.
ctx | Pointer to the hash context of this op. |
pkt | Structure holding the input. |