diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/x509/x509_addr.c | 136 | ||||
| -rw-r--r-- | src/lib/libcrypto/x509/x509_asid.c | 128 |
2 files changed, 218 insertions, 46 deletions
diff --git a/src/lib/libcrypto/x509/x509_addr.c b/src/lib/libcrypto/x509/x509_addr.c index 5946c71238..4e5e0b3b7e 100644 --- a/src/lib/libcrypto/x509/x509_addr.c +++ b/src/lib/libcrypto/x509/x509_addr.c | |||
| @@ -29,29 +29,117 @@ | |||
| 29 | * OpenSSL ASN.1 template translation of RFC 3779 2.2.3. | 29 | * OpenSSL ASN.1 template translation of RFC 3779 2.2.3. |
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | ASN1_SEQUENCE(IPAddressRange) = { | 32 | static const ASN1_TEMPLATE IPAddressRange_seq_tt[] = { |
| 33 | ASN1_SIMPLE(IPAddressRange, min, ASN1_BIT_STRING), | 33 | { |
| 34 | ASN1_SIMPLE(IPAddressRange, max, ASN1_BIT_STRING) | 34 | .flags = 0, |
| 35 | } ASN1_SEQUENCE_END(IPAddressRange) | 35 | .tag = 0, |
| 36 | 36 | .offset = offsetof(IPAddressRange, min), | |
| 37 | ASN1_CHOICE(IPAddressOrRange) = { | 37 | .field_name = "min", |
| 38 | ASN1_SIMPLE(IPAddressOrRange, u.addressPrefix, ASN1_BIT_STRING), | 38 | .item = &ASN1_BIT_STRING_it, |
| 39 | ASN1_SIMPLE(IPAddressOrRange, u.addressRange, IPAddressRange) | 39 | }, |
| 40 | } ASN1_CHOICE_END(IPAddressOrRange) | 40 | { |
| 41 | 41 | .flags = 0, | |
| 42 | ASN1_CHOICE(IPAddressChoice) = { | 42 | .tag = 0, |
| 43 | ASN1_SIMPLE(IPAddressChoice, u.inherit, ASN1_NULL), | 43 | .offset = offsetof(IPAddressRange, max), |
| 44 | ASN1_SEQUENCE_OF(IPAddressChoice, u.addressesOrRanges, IPAddressOrRange) | 44 | .field_name = "max", |
| 45 | } ASN1_CHOICE_END(IPAddressChoice) | 45 | .item = &ASN1_BIT_STRING_it, |
| 46 | 46 | }, | |
| 47 | ASN1_SEQUENCE(IPAddressFamily) = { | 47 | }; |
| 48 | ASN1_SIMPLE(IPAddressFamily, addressFamily, ASN1_OCTET_STRING), | 48 | |
| 49 | ASN1_SIMPLE(IPAddressFamily, ipAddressChoice, IPAddressChoice) | 49 | const ASN1_ITEM IPAddressRange_it = { |
| 50 | } ASN1_SEQUENCE_END(IPAddressFamily) | 50 | .itype = ASN1_ITYPE_SEQUENCE, |
| 51 | 51 | .utype = V_ASN1_SEQUENCE, | |
| 52 | ASN1_ITEM_TEMPLATE(IPAddrBlocks) = | 52 | .templates = IPAddressRange_seq_tt, |
| 53 | ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, | 53 | .tcount = sizeof(IPAddressRange_seq_tt) / sizeof(ASN1_TEMPLATE), |
| 54 | IPAddrBlocks, IPAddressFamily) | 54 | .funcs = NULL, |
| 55 | .size = sizeof(IPAddressRange), | ||
| 56 | .sname = "IPAddressRange", | ||
| 57 | }; | ||
| 58 | |||
| 59 | static const ASN1_TEMPLATE IPAddressOrRange_ch_tt[] = { | ||
| 60 | { | ||
| 61 | .flags = 0, | ||
| 62 | .tag = 0, | ||
| 63 | .offset = offsetof(IPAddressOrRange, u.addressPrefix), | ||
| 64 | .field_name = "u.addressPrefix", | ||
| 65 | .item = &ASN1_BIT_STRING_it, | ||
| 66 | }, | ||
| 67 | { | ||
| 68 | .flags = 0, | ||
| 69 | .tag = 0, | ||
| 70 | .offset = offsetof(IPAddressOrRange, u.addressRange), | ||
| 71 | .field_name = "u.addressRange", | ||
| 72 | .item = &IPAddressRange_it, | ||
| 73 | }, | ||
| 74 | }; | ||
| 75 | |||
| 76 | const ASN1_ITEM IPAddressOrRange_it = { | ||
| 77 | .itype = ASN1_ITYPE_CHOICE, | ||
| 78 | .utype = offsetof(IPAddressOrRange, type), | ||
| 79 | .templates = IPAddressOrRange_ch_tt, | ||
| 80 | .tcount = sizeof(IPAddressOrRange_ch_tt) / sizeof(ASN1_TEMPLATE), | ||
| 81 | .funcs = NULL, | ||
| 82 | .size = sizeof(IPAddressOrRange), | ||
| 83 | .sname = "IPAddressOrRange", | ||
| 84 | }; | ||
| 85 | |||
| 86 | static const ASN1_TEMPLATE IPAddressChoice_ch_tt[] = { | ||
| 87 | { | ||
| 88 | .flags = 0, | ||
| 89 | .tag = 0, | ||
| 90 | .offset = offsetof(IPAddressChoice, u.inherit), | ||
| 91 | .field_name = "u.inherit", | ||
| 92 | .item = &ASN1_NULL_it, | ||
| 93 | }, | ||
| 94 | { | ||
| 95 | .flags = ASN1_TFLG_SEQUENCE_OF, | ||
| 96 | .tag = 0, | ||
| 97 | .offset = offsetof(IPAddressChoice, u.addressesOrRanges), | ||
| 98 | .field_name = "u.addressesOrRanges", | ||
| 99 | .item = &IPAddressOrRange_it, | ||
| 100 | }, | ||
| 101 | }; | ||
| 102 | |||
| 103 | const ASN1_ITEM IPAddressChoice_it = { | ||
| 104 | .itype = ASN1_ITYPE_CHOICE, | ||
| 105 | .utype = offsetof(IPAddressChoice, type), | ||
| 106 | .templates = IPAddressChoice_ch_tt, | ||
| 107 | .tcount = sizeof(IPAddressChoice_ch_tt) / sizeof(ASN1_TEMPLATE), | ||
| 108 | .funcs = NULL, | ||
| 109 | .size = sizeof(IPAddressChoice), | ||
| 110 | .sname = "IPAddressChoice", | ||
| 111 | }; | ||
| 112 | |||
| 113 | static const ASN1_TEMPLATE IPAddressFamily_seq_tt[] = { | ||
| 114 | { | ||
| 115 | .flags = 0, | ||
| 116 | .tag = 0, | ||
| 117 | .offset = offsetof(IPAddressFamily, addressFamily), | ||
| 118 | .field_name = "addressFamily", | ||
| 119 | .item = &ASN1_OCTET_STRING_it, | ||
| 120 | }, | ||
| 121 | { | ||
| 122 | .flags = 0, | ||
| 123 | .tag = 0, | ||
| 124 | .offset = offsetof(IPAddressFamily, ipAddressChoice), | ||
| 125 | .field_name = "ipAddressChoice", | ||
| 126 | .item = &IPAddressChoice_it, | ||
| 127 | }, | ||
| 128 | }; | ||
| 129 | |||
| 130 | const ASN1_ITEM IPAddressFamily_it = { | ||
| 131 | .itype = ASN1_ITYPE_SEQUENCE, | ||
| 132 | .utype = V_ASN1_SEQUENCE, | ||
| 133 | .templates = IPAddressFamily_seq_tt, | ||
| 134 | .tcount = sizeof(IPAddressFamily_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
| 135 | .funcs = NULL, | ||
| 136 | .size = sizeof(IPAddressFamily), | ||
| 137 | .sname = "IPAddressFamily", | ||
| 138 | }; | ||
| 139 | |||
| 140 | static const ASN1_TEMPLATE IPAddrBlocks_item_tt = | ||
| 141 | ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, IPAddrBlocks, | ||
| 142 | IPAddressFamily) | ||
| 55 | static_ASN1_ITEM_TEMPLATE_END(IPAddrBlocks) | 143 | static_ASN1_ITEM_TEMPLATE_END(IPAddrBlocks) |
| 56 | 144 | ||
| 57 | IPAddressRange * | 145 | IPAddressRange * |
| @@ -1154,7 +1242,7 @@ static void *v2i_IPAddrBlocks(const struct v3_ext_method *method, | |||
| 1154 | const X509V3_EXT_METHOD v3_addr = { | 1242 | const X509V3_EXT_METHOD v3_addr = { |
| 1155 | NID_sbgp_ipAddrBlock, /* nid */ | 1243 | NID_sbgp_ipAddrBlock, /* nid */ |
| 1156 | 0, /* flags */ | 1244 | 0, /* flags */ |
| 1157 | ASN1_ITEM_ref(IPAddrBlocks), /* template */ | 1245 | &IPAddrBlocks_it, |
| 1158 | 0, 0, 0, 0, /* old functions, ignored */ | 1246 | 0, 0, 0, 0, /* old functions, ignored */ |
| 1159 | 0, /* i2s */ | 1247 | 0, /* i2s */ |
| 1160 | 0, /* s2i */ | 1248 | 0, /* s2i */ |
diff --git a/src/lib/libcrypto/x509/x509_asid.c b/src/lib/libcrypto/x509/x509_asid.c index bcb6e4ea1d..59c7cabb13 100644 --- a/src/lib/libcrypto/x509/x509_asid.c +++ b/src/lib/libcrypto/x509/x509_asid.c | |||
| @@ -26,29 +26,113 @@ | |||
| 26 | 26 | ||
| 27 | #ifndef OPENSSL_NO_RFC3779 | 27 | #ifndef OPENSSL_NO_RFC3779 |
| 28 | 28 | ||
| 29 | /* | 29 | static const ASN1_TEMPLATE ASRange_seq_tt[] = { |
| 30 | * OpenSSL ASN.1 template translation of RFC 3779 3.2.3. | 30 | { |
| 31 | */ | 31 | .flags = 0, |
| 32 | .tag = 0, | ||
| 33 | .offset = offsetof(ASRange, min), | ||
| 34 | .field_name = "min", | ||
| 35 | .item = &ASN1_INTEGER_it, | ||
| 36 | }, | ||
| 37 | { | ||
| 38 | .flags = 0, | ||
| 39 | .tag = 0, | ||
| 40 | .offset = offsetof(ASRange, max), | ||
| 41 | .field_name = "max", | ||
| 42 | .item = &ASN1_INTEGER_it, | ||
| 43 | }, | ||
| 44 | }; | ||
| 45 | |||
| 46 | const ASN1_ITEM ASRange_it = { | ||
| 47 | .itype = ASN1_ITYPE_SEQUENCE, | ||
| 48 | .utype = V_ASN1_SEQUENCE, | ||
| 49 | .templates = ASRange_seq_tt, | ||
| 50 | .tcount = sizeof(ASRange_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
| 51 | .funcs = NULL, | ||
| 52 | .size = sizeof(ASRange), | ||
| 53 | .sname = "ASRange", | ||
| 54 | }; | ||
| 55 | |||
| 56 | static const ASN1_TEMPLATE ASIdOrRange_ch_tt[] = { | ||
| 57 | { | ||
| 58 | .flags = 0, | ||
| 59 | .tag = 0, | ||
| 60 | .offset = offsetof(ASIdOrRange, u.id), | ||
| 61 | .field_name = "u.id", | ||
| 62 | .item = &ASN1_INTEGER_it, | ||
| 63 | }, | ||
| 64 | { | ||
| 65 | .flags = 0, | ||
| 66 | .tag = 0, | ||
| 67 | .offset = offsetof(ASIdOrRange, u.range), | ||
| 68 | .field_name = "u.range", | ||
| 69 | .item = &ASRange_it, | ||
| 70 | }, | ||
| 71 | }; | ||
| 72 | |||
| 73 | const ASN1_ITEM ASIdOrRange_it = { | ||
| 74 | .itype = ASN1_ITYPE_CHOICE, | ||
| 75 | .utype = offsetof(ASIdOrRange, type), | ||
| 76 | .templates = ASIdOrRange_ch_tt, | ||
| 77 | .tcount = sizeof(ASIdOrRange_ch_tt) / sizeof(ASN1_TEMPLATE), | ||
| 78 | .funcs = NULL, | ||
| 79 | .size = sizeof(ASIdOrRange), | ||
| 80 | .sname = "ASIdOrRange", | ||
| 81 | }; | ||
| 82 | |||
| 83 | static const ASN1_TEMPLATE ASIdentifierChoice_ch_tt[] = { | ||
| 84 | { | ||
| 85 | .flags = 0, | ||
| 86 | .tag = 0, | ||
| 87 | .offset = offsetof(ASIdentifierChoice, u.inherit), | ||
| 88 | .field_name = "u.inherit", | ||
| 89 | .item = &ASN1_NULL_it, | ||
| 90 | }, | ||
| 91 | { | ||
| 92 | .flags = ASN1_TFLG_SEQUENCE_OF, | ||
| 93 | .tag = 0, | ||
| 94 | .offset = offsetof(ASIdentifierChoice, u.asIdsOrRanges), | ||
| 95 | .field_name = "u.asIdsOrRanges", | ||
| 96 | .item = &ASIdOrRange_it, | ||
| 97 | }, | ||
| 98 | }; | ||
| 99 | |||
| 100 | const ASN1_ITEM ASIdentifierChoice_it = { | ||
| 101 | .itype = ASN1_ITYPE_CHOICE, | ||
| 102 | .utype = offsetof(ASIdentifierChoice, type), | ||
| 103 | .templates = ASIdentifierChoice_ch_tt, | ||
| 104 | .tcount = sizeof(ASIdentifierChoice_ch_tt) / sizeof(ASN1_TEMPLATE), | ||
| 105 | .funcs = NULL, | ||
| 106 | .size = sizeof(ASIdentifierChoice), | ||
| 107 | .sname = "ASIdentifierChoice", | ||
| 108 | }; | ||
| 109 | |||
| 110 | static const ASN1_TEMPLATE ASIdentifiers_seq_tt[] = { | ||
| 111 | { | ||
| 112 | .flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_OPTIONAL, | ||
| 113 | .tag = 0, | ||
| 114 | .offset = offsetof(ASIdentifiers, asnum), | ||
| 115 | .field_name = "asnum", | ||
| 116 | .item = &ASIdentifierChoice_it, | ||
| 117 | }, | ||
| 118 | { | ||
| 119 | .flags = ASN1_TFLG_EXPLICIT | ASN1_TFLG_OPTIONAL, | ||
| 120 | .tag = 1, | ||
| 121 | .offset = offsetof(ASIdentifiers, rdi), | ||
| 122 | .field_name = "rdi", | ||
| 123 | .item = &ASIdentifierChoice_it, | ||
| 124 | }, | ||
| 125 | }; | ||
| 32 | 126 | ||
| 33 | ASN1_SEQUENCE(ASRange) = { | 127 | const ASN1_ITEM ASIdentifiers_it = { |
| 34 | ASN1_SIMPLE(ASRange, min, ASN1_INTEGER), | 128 | .itype = ASN1_ITYPE_SEQUENCE, |
| 35 | ASN1_SIMPLE(ASRange, max, ASN1_INTEGER) | 129 | .utype = V_ASN1_SEQUENCE, |
| 36 | } ASN1_SEQUENCE_END(ASRange) | 130 | .templates = ASIdentifiers_seq_tt, |
| 37 | 131 | .tcount = sizeof(ASIdentifiers_seq_tt) / sizeof(ASN1_TEMPLATE), | |
| 38 | ASN1_CHOICE(ASIdOrRange) = { | 132 | .funcs = NULL, |
| 39 | ASN1_SIMPLE(ASIdOrRange, u.id, ASN1_INTEGER), | 133 | .size = sizeof(ASIdentifiers), |
| 40 | ASN1_SIMPLE(ASIdOrRange, u.range, ASRange) | 134 | .sname = "ASIdentifiers", |
| 41 | } ASN1_CHOICE_END(ASIdOrRange) | 135 | }; |
| 42 | |||
| 43 | ASN1_CHOICE(ASIdentifierChoice) = { | ||
| 44 | ASN1_SIMPLE(ASIdentifierChoice, u.inherit, ASN1_NULL), | ||
| 45 | ASN1_SEQUENCE_OF(ASIdentifierChoice, u.asIdsOrRanges, ASIdOrRange) | ||
| 46 | } ASN1_CHOICE_END(ASIdentifierChoice) | ||
| 47 | |||
| 48 | ASN1_SEQUENCE(ASIdentifiers) = { | ||
| 49 | ASN1_EXP_OPT(ASIdentifiers, asnum, ASIdentifierChoice, 0), | ||
| 50 | ASN1_EXP_OPT(ASIdentifiers, rdi, ASIdentifierChoice, 1) | ||
| 51 | } ASN1_SEQUENCE_END(ASIdentifiers) | ||
| 52 | 136 | ||
| 53 | ASRange * | 137 | ASRange * |
| 54 | d2i_ASRange(ASRange **a, const unsigned char **in, long len) | 138 | d2i_ASRange(ASRange **a, const unsigned char **in, long len) |
