blob: 91bf1682e067c97d855ee2568ff2daa5c17e9ab9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/**
* \file
* \author Egor Tensin <Egor.Tensin@gmail.com>
* \date 2015
* \copyright This file is licensed under the terms of the MIT License.
* See LICENSE.txt for details.
* \brief Declares error codes, error formatting functions, etc.
*/
#pragma once
#include <stdlib.h>
#ifdef __cplusplus
extern "C"
{
#endif
typedef enum
{
AESNI_ERROR_SUCCESS,
AESNI_ERROR_NULL_ARGUMENT,
AESNI_ERROR_INVALID_PKCS7_PADDING,
}
AesNI_ErrorCode;
const char* aesni_strerror(AesNI_ErrorCode);
typedef struct
{
AesNI_ErrorCode ec;
union
{
struct
{
char arg_name[32];
}
null_arg;
}
params;
}
AesNI_ErrorDetails;
static __inline AesNI_ErrorCode aesni_get_error_code(const AesNI_ErrorDetails* err_details)
{
return err_details->ec;
}
size_t aesni_format_error(const AesNI_ErrorDetails*, char*, size_t);
void aesni_make_error_success(AesNI_ErrorDetails*);
void aesni_make_error_null_argument(AesNI_ErrorDetails*, const char* arg_name);
void aesni_make_error_invalid_pkcs7_padding(AesNI_ErrorDetails*);
#ifdef __cplusplus
}
#endif
|