CycloneBOOT 2.6.6
Secure Bootloader for ARM Cortex-M MCU
Loading...
Searching...
No Matches
key_provider.h
Go to the documentation of this file.
1
31#ifndef _KEY_PROVIDER_H
32#define _KEY_PROVIDER_H
33
34// Dependencies
35#include "os_port.h"
36#include "core/cboot_error.h"
37#include "boot_config.h"
38
39// Key provider support
40#ifndef KEY_PROVIDER_SUPPORT
41#define KEY_PROVIDER_SUPPORT DISABLED
42#elif ((KEY_PROVIDER_SUPPORT != ENABLED) && (KEY_PROVIDER_SUPPORT != DISABLED))
43#error KEY_PROVIDER_SUPPORT parameter is not valid!
44#endif
45
46// Maximum cipher key size a provider may return (AES-256)
47#define KEY_PROVIDER_MAX_KEY_SIZE 32
48
49// C++ guard
50#ifdef __cplusplus
51extern "C"
52{
53#endif
54
67typedef cboot_error_t (*KeyProviderCallback)(uint8_t *key, size_t *keyLen);
68
69// Cipher key provider related functions
71cboot_error_t keyProviderGetKey(uint8_t *key, size_t *keyLen);
72
73// Registered key provider callback
74extern KeyProviderCallback keyProviderCallback;
75
76// C++ guard
77#ifdef __cplusplus
78}
79#endif
80
81#endif // !_KEY_PROVIDER_H
Error codes description.
cboot_error_t
Error codes.
Definition cboot_error.h:57
cboot_error_t keyProviderRegisterCallback(KeyProviderCallback callback)
Register cipher key provider callback function.
Definition key_provider.c:51
cboot_error_t keyProviderGetKey(uint8_t *key, size_t *keyLen)
Retrieve the cipher key from the registered provider.
Definition key_provider.c:71
cboot_error_t(* KeyProviderCallback)(uint8_t *key, size_t *keyLen)
Cipher key provider callback function.
Definition key_provider.h:67