kernel: lib: Add convert functions for hex strings and binary arrays

Move duplicate hex2bin and add bin2hex function so that application can
use the functions and avoid code duplication.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2019-05-28 13:20:35 +02:00 committed by Carles Cufí
commit 7a93e948a9
9 changed files with 161 additions and 140 deletions

View file

@ -64,16 +64,6 @@
#include <tinycrypt/ecc.h>
#include <test_utils.h>
int hex2int(char hex);
/*
* Convert hex string to byte string
* Return number of bytes written to buf, or 0 on error
*/
int hex2bin(uint8_t *buf, const size_t buflen, const char *hex,
const size_t hexlen);
/*
* Convert hex string to zero-padded nanoECC scalar
*/