EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
generic_hsm_driver.h
Go to the documentation of this file.
1 
11 #ifndef GENERIC_HSM_DRIVER_H
12 #define GENERIC_HSM_DRIVER_H
13 
14 #include <stdbool.h>
15 #include <inttypes.h>
16 #include <sys/types.h>
17 #include <sys/un.h>
18 
19 struct hsm_context {
20  void *hsm_ctx;
21 };
22 
28 struct hsm_context *init_hsm(void);
29 
36 int close_hsm(struct hsm_context *context);
37 
46 int generate_hsm_key(struct hsm_context *context, uint8_t *key,
47  size_t key_size);
48 
59 int encrypt_hsm_blob(struct hsm_context *context, uint8_t *in, size_t in_size,
60  uint8_t **out, size_t *out_size);
61 
72 int decrypt_hsm_blob(struct hsm_context *context, uint8_t *in, size_t in_size,
73  uint8_t **out, size_t *out_size);
74 #endif
int generate_hsm_key(struct hsm_context *context, uint8_t *key, size_t key_size)
Generate an HSM key.
Definition: generic_hsm_driver.c:67
int decrypt_hsm_blob(struct hsm_context *context, uint8_t *in, size_t in_size, uint8_t **out, size_t *out_size)
Decrypt a byte array wiht the HSM.
Definition: generic_hsm_driver.c:120
int encrypt_hsm_blob(struct hsm_context *context, uint8_t *in, size_t in_size, uint8_t **out, size_t *out_size)
Encrypt a byte array wiht the HSM.
Definition: generic_hsm_driver.c:88
int close_hsm(struct hsm_context *context)
Closes the HSM context.
Definition: generic_hsm_driver.c:49
struct hsm_context * init_hsm(void)
Initialises an HSM context.
Definition: generic_hsm_driver.c:23
Definition: generic_hsm_driver.h:19
void * hsm_ctx
Definition: generic_hsm_driver.h:20