OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
asn1Types.h
Go to the documentation of this file.
1/* Copyright (c) 2005-2007 Apple Inc. All Rights Reserved. */
2
3/*
4 * asn1Types.h - ASN.1/DER #defines - strictly hard coded per the real world
5 *
6 * Created Nov. 4 2005 by dmitch
7 */
8
9#ifndef _ASN1_TYPES_H_
10#define _ASN1_TYPES_H_
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16/* copied from libsecurity_asn1 project */
17
18#define ASN1_BOOLEAN 0x01
19#define ASN1_INTEGER 0x02
20#define ASN1_BIT_STRING 0x03
21#define ASN1_OCTET_STRING 0x04
22#define ASN1_NULL 0x05
23#define ASN1_OBJECT_ID 0x06
24#define ASN1_OBJECT_DESCRIPTOR 0x07
25/* External type and instance-of type 0x08 */
26#define ASN1_REAL 0x09
27#define ASN1_ENUMERATED 0x0a
28#define ASN1_EMBEDDED_PDV 0x0b
29#define ASN1_UTF8_STRING 0x0c
30/* 0x0d */
31/* 0x0e */
32/* 0x0f */
33#define ASN1_SEQUENCE 0x10
34#define ASN1_SET 0x11
35#define ASN1_NUMERIC_STRING 0x12
36#define ASN1_PRINTABLE_STRING 0x13
37#define ASN1_T61_STRING 0x14
38#define ASN1_VIDEOTEX_STRING 0x15
39#define ASN1_IA5_STRING 0x16
40#define ASN1_UTC_TIME 0x17
41#define ASN1_GENERALIZED_TIME 0x18
42#define ASN1_GRAPHIC_STRING 0x19
43#define ASN1_VISIBLE_STRING 0x1a
44#define ASN1_GENERAL_STRING 0x1b
45#define ASN1_UNIVERSAL_STRING 0x1c
46/* 0x1d */
47#define ASN1_BMP_STRING 0x1e
48#define ASN1_HIGH_TAG_NUMBER 0x1f
49#define ASN1_TELETEX_STRING ASN1_T61_STRING
50
51#ifdef DER_MULTIBYTE_TAGS
52
53#define ASN1_TAG_MASK ((DERTag)~0)
54#define ASN1_TAGNUM_MASK ((DERTag)~((DERTag)7 << (sizeof(DERTag) * 8 - 3)))
55
56#define ASN1_METHOD_MASK ((DERTag)1 << (sizeof(DERTag) * 8 - 3))
57#define ASN1_PRIMITIVE ((DERTag)0 << (sizeof(DERTag) * 8 - 3))
58#define ASN1_CONSTRUCTED ((DERTag)1 << (sizeof(DERTag) * 8 - 3))
59
60#define ASN1_CLASS_MASK ((DERTag)3 << (sizeof(DERTag) * 8 - 2))
61#define ASN1_UNIVERSAL ((DERTag)0 << (sizeof(DERTag) * 8 - 2))
62#define ASN1_APPLICATION ((DERTag)1 << (sizeof(DERTag) * 8 - 2))
63#define ASN1_CONTEXT_SPECIFIC ((DERTag)2 << (sizeof(DERTag) * 8 - 2))
64#define ASN1_PRIVATE ((DERTag)3 << (sizeof(DERTag) * 8 - 2))
65
66#else /* DER_MULTIBYTE_TAGS */
67
68#define ASN1_TAG_MASK 0xff
69#define ASN1_TAGNUM_MASK 0x1f
70#define ASN1_METHOD_MASK 0x20
71#define ASN1_PRIMITIVE 0x00
72#define ASN1_CONSTRUCTED 0x20
73
74#define ASN1_CLASS_MASK 0xc0
75#define ASN1_UNIVERSAL 0x00
76#define ASN1_APPLICATION 0x40
77#define ASN1_CONTEXT_SPECIFIC 0x80
78#define ASN1_PRIVATE 0xc0
79
80#endif /* !DER_MULTIBYTE_TAGS */
81
82/* sequence and set appear as the following */
83#define ASN1_CONSTR_SEQUENCE (ASN1_CONSTRUCTED | ASN1_SEQUENCE)
84#define ASN1_CONSTR_SET (ASN1_CONSTRUCTED | ASN1_SET)
85
86#ifdef __cplusplus
87}
88#endif
89
90#endif /* _ASN1_TYPES_H_ */
91