OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
libDER.h
Go to the documentation of this file.
1/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */
2
3/*
4 * libDER.h - main header for libDER, a ROM-capable DER decoding library.
5 *
6 * Created Nov. 4 2005 by dmitch
7 */
8
9#ifndef _LIB_DER_H_
10#define _LIB_DER_H_
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#include "libDER_config.h"
17/*
18 * Error returns generated by this library.
19 */
20typedef enum {
22 DR_EndOfSequence, /* end of sequence or set */
23 DR_UnexpectedTag, /* unexpected tag found while decoding */
24 DR_DecodeError, /* misc. decoding error (badly formatted DER) */
25 DR_Unimplemented, /* function not implemented in this configuration */
26 DR_IncompleteSeq, /* incomplete sequence */
27 DR_ParamErr, /* incoming parameter error */
28 DR_BufOverflow /* buffer overflow */
29 /* etc. */
31
32/*
33 * Primary representation of a block of memory.
34 */
35typedef struct {
38} DERItem;
39
40/*
41 * The structure of a sequence during decode or encode is expressed as
42 * an array of DERItemSpecs. While decoding or encoding a sequence,
43 * each item in the sequence corresponds to one DERItemSpec.
44 */
45typedef struct {
46 DERSize offset; /* offset of destination DERItem */
47 DERTag tag; /* DER tag */
48 DERShort options; /* DER_DEC_xxx or DER_ENC_xxx */
50
51/*
52 * Macro to obtain offset of a DERDecodedInfo within a struct.
53 * FIXME this is going to need reworking to avoid compiler warnings
54 * on 64-bit compiles. It'll work OK as long as an offset can't be larger
55 * than a DERSize, but the cast from a pointer to a DERSize may
56 * provoke compiler warnings.
57 */
58#define DER_OFFSET(type, field) ((DERSize)(&((type *)0)->field))
59
60#ifdef __cplusplus
61}
62#endif
63
64#endif /* _LIB_DER_H_ */
65
DERReturn
Definition libDER.h:20
@ DR_Success
Definition libDER.h:21
@ DR_ParamErr
Definition libDER.h:27
@ DR_Unimplemented
Definition libDER.h:25
@ DR_BufOverflow
Definition libDER.h:28
@ DR_EndOfSequence
Definition libDER.h:22
@ DR_UnexpectedTag
Definition libDER.h:23
@ DR_DecodeError
Definition libDER.h:24
@ DR_IncompleteSeq
Definition libDER.h:26
size_t DERSize
uint16_t DERShort
uint64_t DERTag
uint8_t DERByte
DERByte * data
Definition libDER.h:36
DERSize length
Definition libDER.h:37
DERTag tag
Definition libDER.h:47
DERShort options
Definition libDER.h:48
DERSize offset
Definition libDER.h:46