|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
Crypto + encoding host APIs - mbedTLS wrappers + TROPIC01 TRNG. More...
#include "plugin_manager/host_api.h"#include "cdc_hal/ISecureElement.h"#include "cdc_core/Crypto.h"#include "HexUtil.h"#include "mbedtls/sha256.h"#include "mbedtls/md.h"#include "mbedtls/base64.h"#include "esp_random.h"#include <cstdint>#include <cstring>#include <cstdio>#include <string>Go to the source code of this file.
Functions | |
| int | host_random (uint8_t *buf, size_t len) |
| Fill buf with hardware-RNG bytes; may fall back to PRNG. | |
| int | host_random_strict (uint8_t *buf, size_t len) |
| Fill buf with hardware-RNG bytes only; fails without TRNG. | |
| int | host_sha256 (const uint8_t *data, size_t len, uint8_t out[32]) |
| SHA-256 hash of data into the 32-byte out. | |
| int | host_hmac_sha256 (const uint8_t *key, size_t klen, const uint8_t *data, size_t dlen, uint8_t out[32]) |
| HMAC-SHA-256 of data under key into the 32-byte out. | |
| int | host_aes_gcm_encrypt (const uint8_t *key, const uint8_t *iv, const uint8_t *aad, size_t aad_len, const uint8_t *pt, size_t pt_len, uint8_t *ct, uint8_t tag[16]) |
| AES-256-GCM encrypt. | |
| int | host_aes_gcm_decrypt (const uint8_t *key, const uint8_t *iv, const uint8_t *aad, size_t aad_len, const uint8_t *ct, size_t ct_len, const uint8_t tag[16], uint8_t *pt) |
| AES-256-GCM decrypt and verify. | |
| int | host_base32_encode (const uint8_t *in, size_t in_len, char *out, size_t out_size) |
| Base32-encode in into NUL-terminated out. | |
| int | host_base32_decode (const char *in, size_t in_len, uint8_t *out, size_t out_size) |
| Base32-decode in into raw bytes in out. | |
| int | host_base64_encode (const uint8_t *in, size_t in_len, char *out, size_t out_size) |
| Base64-encode in into NUL-terminated out. | |
| int | host_base64_decode (const char *in, size_t in_len, uint8_t *out, size_t out_size) |
| Base64-decode in into raw bytes in out. | |
| int | host_hex_encode (const uint8_t *in, size_t in_len, char *out, size_t out_size) |
| Lowercase-hex-encode in into NUL-terminated out. | |
| int | host_hex_decode (const char *in, size_t in_len, uint8_t *out, size_t out_size) |
| Hex-decode in (case-insensitive) into raw bytes in out. | |
Crypto + encoding host APIs - mbedTLS wrappers + TROPIC01 TRNG.
Definition in file host_api_crypto.cpp.