EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Functions
zymkey4_driver.c File Reference

File containing the implementation of zymkey4 driver configuration utilities. More...

#include <sys/types.h>
#include <zymkey/zk_app_utils.h>
#include "../utils/allocs.h"
#include "../utils/log.h"
#include "../utils/os.h"
Include dependency graph for zymkey4_driver.c:

Functions

zkCTX * init_zymkey4 (void)
 Initialises an HSM context. More...
 
int close_zymkey4 (zkCTX *ctx)
 Closes the zymkey4 context. More...
 
int generate_zymkey4_key (zkCTX *ctx, uint8_t *key, size_t key_size)
 Generate a random Zymkey4 key. More...
 
int encrypt_zymkey4_blob (zkCTX *ctx, uint8_t *in, size_t in_size, uint8_t **out, size_t *out_size)
 Encrypt a byte array wiht the Zymkey4 HSM. More...
 
int decrypt_zymkey4_blob (zkCTX *ctx, uint8_t *in, size_t in_size, uint8_t **out, size_t *out_size)
 Decrypt a byte array wiht the Zymkey4 HSM. More...
 

Detailed Description

File containing the implementation of zymkey4 driver configuration utilities.

Author
Alexandru Mereacre
Date
2021

Function Documentation

◆ close_zymkey4()

int close_zymkey4 ( zkCTX *  ctx)

Closes the zymkey4 context.

Parameters
ctxThe Zymkey4 context
Returns
int 0 on success, -1 on failure

◆ decrypt_zymkey4_blob()

int decrypt_zymkey4_blob ( zkCTX *  ctx,
uint8_t *  in,
size_t  in_size,
uint8_t **  out,
size_t *  out_size 
)

Decrypt a byte array wiht the Zymkey4 HSM.

Parameters
ctxThe Zymkey4 context
inThe input array
in_sizeThe input array size
outThe output decrypted array
out_sizeThe output array size
Returns
int 0 on success, -1 on failure

◆ encrypt_zymkey4_blob()

int encrypt_zymkey4_blob ( zkCTX *  ctx,
uint8_t *  in,
size_t  in_size,
uint8_t **  out,
size_t *  out_size 
)

Encrypt a byte array wiht the Zymkey4 HSM.

Parameters
ctxThe Zymkey4 context
inThe input array
in_sizeThe input array size
outThe output encrypted array
out_sizeThe output array size
Returns
int 0 on success, -1 on failure

◆ generate_zymkey4_key()

int generate_zymkey4_key ( zkCTX *  ctx,
uint8_t *  key,
size_t  key_size 
)

Generate a random Zymkey4 key.

Parameters
ctxThe Zymkey4 context
keyThe returned key
key_sizeThe key size
Returns
int 0 on success, -1 on failure

◆ init_zymkey4()

zkCTX* init_zymkey4 ( void  )

Initialises an HSM context.

Returns
zkCTX* The returned Zymkey4 context, NULL on error