OpenCore
1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
libDER_config.h
Go to the documentation of this file.
1
/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */
2
3
/*
4
* libDER_config.h - platform dependent #defines and typedefs for libDER
5
*
6
* Created Nov. 4 2005 by dmitch
7
*/
8
9
#ifndef _LIB_DER_CONFIG_H_
10
#define _LIB_DER_CONFIG_H_
11
12
#ifdef __cplusplus
13
extern
"C"
{
14
#endif
15
16
//
17
// edk2 porting - start
18
//
19
#include <Base.h>
20
#include <Library/BaseMemoryLib.h>
21
#include <Library/DebugLib.h>
22
23
#ifndef EFIUSER
24
typedef
UINT8
uint8_t
;
25
typedef
UINT16
uint16_t
;
26
typedef
UINT32
uint32_t
;
27
typedef
UINT64
uint64_t
;
28
typedef
UINTN
size_t
;
29
30
#ifndef bool
31
typedef
BOOLEAN
bool
;
32
#endif
/* bool */
33
34
#ifndef assert
35
#define assert ASSERT
36
#endif
/* assert */
37
38
#define memset(ptr, c, len) SetMem(ptr, len, c)
39
#define memmove(dst, src, len) CopyMem(dst, src, len)
40
#define memcmp(b1, b2, len) CompareMem(b1, b2, len)
41
42
#else
/* EFIUSER */
43
#include <stdio.h>
44
#include <stdint.h>
45
#include <stdbool.h>
46
#include <string.h>
47
#include <assert.h>
48
#endif
/* !EFIUSER */
49
50
#define DER_ENCODE_ENABLE 0
51
52
#define DER_TAG_SIZE 8
53
//
54
// edk2 porting - end
55
//
56
57
/*
58
* Basic data types: unsigned 8-bit integer, unsigned 32-bit integer
59
*/
60
typedef
uint8_t
DERByte
;
61
typedef
uint16_t
DERShort
;
62
typedef
size_t
DERSize
;
63
64
/*
65
* Use these #defines of you have memset, memmove, and memcmp; else
66
* write your own equivalents.
67
*/
68
69
#define DERMemset(ptr, c, len) memset(ptr, c, len)
70
#define DERMemmove(dst, src, len) memmove(dst, src, len)
71
#define DERMemcmp(b1, b2, len) memcmp(b1, b2, len)
72
73
74
/***
75
*** Compile time options to trim size of the library.
76
***/
77
78
// CHANGE: conditionally define
79
/* enable general DER encode */
80
#ifndef DER_ENCODE_ENABLE
81
#define DER_ENCODE_ENABLE 1
82
#endif
83
84
#ifndef DER_MULTIBYTE_TAGS
85
/* enable general DER decode */
86
#define DER_DECODE_ENABLE 1
87
#endif
88
89
#ifndef DER_MULTIBYTE_TAGS
90
/* enable multibyte tag support. */
91
#define DER_MULTIBYTE_TAGS 1
92
#endif
93
94
#ifndef DER_TAG_SIZE
95
/* Iff DER_MULTIBYTE_TAGS is 1 this is the sizeof(DERTag) in bytes. Note that
96
tags are still encoded and decoded from a minimally encoded DER
97
represantation. This value determines how big each DERItemSpecs is, we
98
choose 2 since that makes DERItemSpecs 8 bytes wide. */
99
#define DER_TAG_SIZE 2
100
#endif
101
102
103
/* ---------------------- Do not edit below this line ---------------------- */
104
105
/*
106
* Logical representation of a tag (the encoded representation is always in
107
* the minimal number of bytes). The top 3 bits encode class and method
108
* The remaining bits encode the tag value. To obtain smaller DERItemSpecs
109
* sizes, choose the smallest type that fits your needs. Most standard ASN.1
110
* usage only needs single byte tags, but ocasionally custom applications
111
* require a larger tag namespace.
112
*/
113
#if DER_MULTIBYTE_TAGS
114
115
#if DER_TAG_SIZE == 1
116
typedef
uint8_t
DERTag
;
117
#elif DER_TAG_SIZE == 2
118
typedef
uint16_t
DERTag
;
119
#elif DER_TAG_SIZE == 4
120
typedef
uint32_t
DERTag
;
121
#elif DER_TAG_SIZE == 8
122
typedef
uint64_t
DERTag
;
123
#else
124
#error DER_TAG_SIZE invalid
125
#endif
126
127
#else
/* DER_MULTIBYTE_TAGS */
128
typedef
DERByte
DERTag
;
129
#endif
/* !DER_MULTIBYTE_TAGS */
130
131
#ifdef __cplusplus
132
}
133
#endif
134
135
#endif
/* _LIB_DER_CONFIG_H_ */
DERSize
size_t DERSize
Definition
libDER_config.h:62
DERShort
uint16_t DERShort
Definition
libDER_config.h:61
size_t
UINTN size_t
Definition
libDER_config.h:28
DERTag
uint64_t DERTag
Definition
libDER_config.h:122
uint8_t
UINT8 uint8_t
Definition
libDER_config.h:24
bool
BOOLEAN bool
Definition
libDER_config.h:31
uint16_t
UINT16 uint16_t
Definition
libDER_config.h:25
DERByte
uint8_t DERByte
Definition
libDER_config.h:60
uint32_t
UINT32 uint32_t
Definition
libDER_config.h:26
uint64_t
UINT64 uint64_t
Definition
libDER_config.h:27
Library
OcAppleImg4Lib
libDER_config.h
Generated by
1.12.0