| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef APP_INTERNAL_H |
| 21 |
#define APP_INTERNAL_H |
| 22 |
|
| 23 |
#include <stdint.h> |
| 24 |
|
| 25 |
#include <kcapi.h> |
| 26 |
|
| 27 |
#ifdef __cplusplus |
| 28 |
extern "C" |
| 29 |
{ |
| 30 |
#endif |
| 31 |
|
| 32 |
#define STDIN_FD 0 |
| 33 |
#define STDOUT_FD 1 |
| 34 |
#define MAX_ALG_PAGES 16 |
| 35 |
#define TMPBUFLEN (4096 * (MAX_ALG_PAGES - 1)) |
| 36 |
|
| 37 |
#define KCAPI_APP_ALIGN 8 |
| 38 |
#define __aligned(x) __attribute__((aligned(x))) |
| 39 |
|
| 40 |
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) |
| 41 |
|
| 42 |
enum { false, true }; |
| 43 |
typedef _Bool bool; |
| 44 |
|
| 45 |
void dolog(enum kcapi_verbosity severity, const char *fmt, ...); |
| 46 |
void dolog_bin(enum kcapi_verbosity severity, |
| 47 |
const uint8_t *bin, uint32_t binlen, const char *explanation); |
| 48 |
void set_verbosity(const char *name, enum kcapi_verbosity level); |
| 49 |
void hex2bin(const char *hex, uint32_t hexlen, uint8_t *bin, uint32_t binlen); |
| 50 |
int hex2bin_alloc(const char *hex, uint32_t hexlen, |
| 51 |
uint8_t **bin, uint32_t *binlen); |
| 52 |
void bin2hex(const uint8_t *bin, size_t binlen, |
| 53 |
char *hex, size_t hexlen, int u); |
| 54 |
void bin2print(const uint8_t *bin, size_t binlen, |
| 55 |
const char *filename, FILE *outfile, uint32_t lfcr); |
| 56 |
ssize_t read_complete(int fd, uint8_t *buf, size_t buflen); |
| 57 |
int check_filetype(int fd, struct stat *sb, const char *filename); |
| 58 |
|
| 59 |
#ifdef __cplusplus |
| 60 |
} |
| 61 |
#endif |
| 62 |
|
| 63 |
#endif |