BSB Developer Docs
Loading...
Searching...
No Matches
crypto_common.h
1#pragma once
2#include <furi.h>
3#include "../crypto_test.h"
4#include <furi_hal_crypto.h>
5
6typedef enum {
7 CryptoCommonTestResultOk,
8 CryptoCommonTestResultOkNoWrap,
9 CryptoCommonTestResultFail,
10} CryptoCommonTestResult;
11
12#define CRYPTO_COMMON_CHECK_STATUS_EQ(expected, actual, tag) \
13 if((expected) != (actual)) { \
14 printf( \
15 ANSI_FG_RED "%s: unexpected status (expected = %u, actual = %u)" ANSI_RESET "\r\n", \
16 tag, \
17 expected, \
18 actual); \
19 result = false; \
20 break; \
21 }
22
23#define CRYPTO_COMMON_CHECK_STATUS(status, tag) \
24 if((status) != FuriHalCryptoStatusOk) { \
25 printf(ANSI_FG_RED "%s operation failed (status = %u)" ANSI_RESET "\r\n", tag, status); \
26 result = false; \
27 break; \
28 }
29
30void crypto_common_print_buffer_char(const char* tag, const uint8_t* buffer, uint16_t length);
31
32void crypto_common_print_buffer_hex(const char* tag, const uint8_t* buffer, uint16_t length);
33
34void crypto_common_print_key(const char* tag, const FuriHalCryptoKey* key);
35
36CryptoCommonTestResult
37 crypto_common_test_result_compose(CryptoCommonTestResult a, CryptoCommonTestResult b);
Definition furi_hal_crypto.h:104