Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | /* |
michael@0 | 6 | * Templates that are compiled and exported from both libnss3 and libnssutil3. |
michael@0 | 7 | * They have to be, because they were previously exported from libnss3, and |
michael@0 | 8 | * there is no way to create data forwarder symbols on Unix. |
michael@0 | 9 | * |
michael@0 | 10 | * Please do not add to this file. New shared templates should be exported |
michael@0 | 11 | * from libnssutil3 only. |
michael@0 | 12 | * |
michael@0 | 13 | */ |
michael@0 | 14 | |
michael@0 | 15 | #include "utilrename.h" |
michael@0 | 16 | #include "secasn1.h" |
michael@0 | 17 | #include "secder.h" |
michael@0 | 18 | #include "secoid.h" |
michael@0 | 19 | #include "secdig.h" |
michael@0 | 20 | |
michael@0 | 21 | const SEC_ASN1Template SECOID_AlgorithmIDTemplate[] = { |
michael@0 | 22 | { SEC_ASN1_SEQUENCE, |
michael@0 | 23 | 0, NULL, sizeof(SECAlgorithmID) }, |
michael@0 | 24 | { SEC_ASN1_OBJECT_ID, |
michael@0 | 25 | offsetof(SECAlgorithmID,algorithm), }, |
michael@0 | 26 | { SEC_ASN1_OPTIONAL | SEC_ASN1_ANY, |
michael@0 | 27 | offsetof(SECAlgorithmID,parameters), }, |
michael@0 | 28 | { 0, } |
michael@0 | 29 | }; |
michael@0 | 30 | |
michael@0 | 31 | SEC_ASN1_CHOOSER_IMPLEMENT(SECOID_AlgorithmIDTemplate) |
michael@0 | 32 | |
michael@0 | 33 | const SEC_ASN1Template SEC_AnyTemplate[] = { |
michael@0 | 34 | { SEC_ASN1_ANY | SEC_ASN1_MAY_STREAM, 0, NULL, sizeof(SECItem) } |
michael@0 | 35 | }; |
michael@0 | 36 | |
michael@0 | 37 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_AnyTemplate) |
michael@0 | 38 | |
michael@0 | 39 | const SEC_ASN1Template SEC_BMPStringTemplate[] = { |
michael@0 | 40 | { SEC_ASN1_BMP_STRING | SEC_ASN1_MAY_STREAM, 0, NULL, sizeof(SECItem) } |
michael@0 | 41 | }; |
michael@0 | 42 | |
michael@0 | 43 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_BMPStringTemplate) |
michael@0 | 44 | |
michael@0 | 45 | const SEC_ASN1Template SEC_BitStringTemplate[] = { |
michael@0 | 46 | { SEC_ASN1_BIT_STRING | SEC_ASN1_MAY_STREAM, 0, NULL, sizeof(SECItem) } |
michael@0 | 47 | }; |
michael@0 | 48 | |
michael@0 | 49 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_BitStringTemplate) |
michael@0 | 50 | |
michael@0 | 51 | const SEC_ASN1Template SEC_BooleanTemplate[] = { |
michael@0 | 52 | { SEC_ASN1_BOOLEAN, 0, NULL, sizeof(SECItem) } |
michael@0 | 53 | }; |
michael@0 | 54 | |
michael@0 | 55 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_BooleanTemplate) |
michael@0 | 56 | |
michael@0 | 57 | const SEC_ASN1Template SEC_GeneralizedTimeTemplate[] = { |
michael@0 | 58 | { SEC_ASN1_GENERALIZED_TIME | SEC_ASN1_MAY_STREAM, 0, NULL, sizeof(SECItem)} |
michael@0 | 59 | }; |
michael@0 | 60 | |
michael@0 | 61 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_GeneralizedTimeTemplate) |
michael@0 | 62 | |
michael@0 | 63 | const SEC_ASN1Template SEC_IA5StringTemplate[] = { |
michael@0 | 64 | { SEC_ASN1_IA5_STRING | SEC_ASN1_MAY_STREAM, 0, NULL, sizeof(SECItem) } |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_IA5StringTemplate) |
michael@0 | 68 | |
michael@0 | 69 | const SEC_ASN1Template SEC_IntegerTemplate[] = { |
michael@0 | 70 | { SEC_ASN1_INTEGER, 0, NULL, sizeof(SECItem) } |
michael@0 | 71 | }; |
michael@0 | 72 | |
michael@0 | 73 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_IntegerTemplate) |
michael@0 | 74 | |
michael@0 | 75 | const SEC_ASN1Template SEC_NullTemplate[] = { |
michael@0 | 76 | { SEC_ASN1_NULL, 0, NULL, sizeof(SECItem) } |
michael@0 | 77 | }; |
michael@0 | 78 | |
michael@0 | 79 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_NullTemplate) |
michael@0 | 80 | |
michael@0 | 81 | const SEC_ASN1Template SEC_ObjectIDTemplate[] = { |
michael@0 | 82 | { SEC_ASN1_OBJECT_ID, 0, NULL, sizeof(SECItem) } |
michael@0 | 83 | }; |
michael@0 | 84 | |
michael@0 | 85 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_ObjectIDTemplate) |
michael@0 | 86 | |
michael@0 | 87 | const SEC_ASN1Template SEC_OctetStringTemplate[] = { |
michael@0 | 88 | { SEC_ASN1_OCTET_STRING | SEC_ASN1_MAY_STREAM, 0, NULL, sizeof(SECItem) } |
michael@0 | 89 | }; |
michael@0 | 90 | |
michael@0 | 91 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_OctetStringTemplate) |
michael@0 | 92 | |
michael@0 | 93 | const SEC_ASN1Template SEC_PointerToAnyTemplate[] = { |
michael@0 | 94 | { SEC_ASN1_POINTER, 0, SEC_AnyTemplate } |
michael@0 | 95 | }; |
michael@0 | 96 | |
michael@0 | 97 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_PointerToAnyTemplate) |
michael@0 | 98 | |
michael@0 | 99 | const SEC_ASN1Template SEC_PointerToOctetStringTemplate[] = { |
michael@0 | 100 | { SEC_ASN1_POINTER | SEC_ASN1_MAY_STREAM, 0, SEC_OctetStringTemplate } |
michael@0 | 101 | }; |
michael@0 | 102 | |
michael@0 | 103 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_PointerToOctetStringTemplate) |
michael@0 | 104 | |
michael@0 | 105 | const SEC_ASN1Template SEC_SetOfAnyTemplate[] = { |
michael@0 | 106 | { SEC_ASN1_SET_OF, 0, SEC_AnyTemplate } |
michael@0 | 107 | }; |
michael@0 | 108 | |
michael@0 | 109 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_SetOfAnyTemplate) |
michael@0 | 110 | |
michael@0 | 111 | const SEC_ASN1Template SEC_UTCTimeTemplate[] = { |
michael@0 | 112 | { SEC_ASN1_UTC_TIME | SEC_ASN1_MAY_STREAM, 0, NULL, sizeof(SECItem) } |
michael@0 | 113 | }; |
michael@0 | 114 | |
michael@0 | 115 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_UTCTimeTemplate) |
michael@0 | 116 | |
michael@0 | 117 | const SEC_ASN1Template SEC_UTF8StringTemplate[] = { |
michael@0 | 118 | { SEC_ASN1_UTF8_STRING | SEC_ASN1_MAY_STREAM, 0, NULL, sizeof(SECItem)} |
michael@0 | 119 | }; |
michael@0 | 120 | |
michael@0 | 121 | SEC_ASN1_CHOOSER_IMPLEMENT(SEC_UTF8StringTemplate) |
michael@0 | 122 | |
michael@0 | 123 | /* XXX See comment below about SGN_DecodeDigestInfo -- keep this static! */ |
michael@0 | 124 | /* XXX Changed from static -- need to change name? */ |
michael@0 | 125 | const SEC_ASN1Template sgn_DigestInfoTemplate[] = { |
michael@0 | 126 | { SEC_ASN1_SEQUENCE, |
michael@0 | 127 | 0, NULL, sizeof(SGNDigestInfo) }, |
michael@0 | 128 | { SEC_ASN1_INLINE, |
michael@0 | 129 | offsetof(SGNDigestInfo,digestAlgorithm), |
michael@0 | 130 | SECOID_AlgorithmIDTemplate }, |
michael@0 | 131 | { SEC_ASN1_OCTET_STRING, |
michael@0 | 132 | offsetof(SGNDigestInfo,digest) }, |
michael@0 | 133 | { 0 } |
michael@0 | 134 | }; |
michael@0 | 135 | |
michael@0 | 136 | SEC_ASN1_CHOOSER_IMPLEMENT(sgn_DigestInfoTemplate) |