| 1 |
/* Generated from ./crmf.asn1 */ |
| 2 |
/* Do not edit */ |
| 3 |
|
| 4 |
#ifndef __crmf_asn1_h__ |
| 5 |
#define __crmf_asn1_h__ |
| 6 |
|
| 7 |
#include <stddef.h> |
| 8 |
#include <time.h> |
| 9 |
|
| 10 |
#ifndef __asn1_common_definitions__ |
| 11 |
#define __asn1_common_definitions__ |
| 12 |
|
| 13 |
#ifndef __HEIM_BASE_DATA__ |
| 14 |
#define __HEIM_BASE_DATA__ 1 |
| 15 |
struct heim_base_data { |
| 16 |
size_t length; |
| 17 |
void *data; |
| 18 |
}; |
| 19 |
typedef struct heim_base_data heim_octet_string; |
| 20 |
#endif |
| 21 |
|
| 22 |
typedef struct heim_integer { |
| 23 |
size_t length; |
| 24 |
void *data; |
| 25 |
int negative; |
| 26 |
} heim_integer; |
| 27 |
|
| 28 |
typedef char *heim_general_string; |
| 29 |
|
| 30 |
typedef char *heim_utf8_string; |
| 31 |
|
| 32 |
typedef struct heim_base_data heim_printable_string; |
| 33 |
|
| 34 |
typedef struct heim_base_data heim_ia5_string; |
| 35 |
|
| 36 |
typedef struct heim_bmp_string { |
| 37 |
size_t length; |
| 38 |
uint16_t *data; |
| 39 |
} heim_bmp_string; |
| 40 |
|
| 41 |
typedef struct heim_universal_string { |
| 42 |
size_t length; |
| 43 |
uint32_t *data; |
| 44 |
} heim_universal_string; |
| 45 |
|
| 46 |
typedef char *heim_visible_string; |
| 47 |
|
| 48 |
typedef struct heim_oid { |
| 49 |
size_t length; |
| 50 |
unsigned *components; |
| 51 |
} heim_oid; |
| 52 |
|
| 53 |
typedef struct heim_bit_string { |
| 54 |
size_t length; |
| 55 |
void *data; |
| 56 |
} heim_bit_string; |
| 57 |
|
| 58 |
typedef struct heim_base_data heim_any; |
| 59 |
typedef struct heim_base_data heim_any_set; |
| 60 |
|
| 61 |
#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \ |
| 62 |
do { \ |
| 63 |
(BL) = length_##T((S)); \ |
| 64 |
(B) = malloc((BL)); \ |
| 65 |
if((B) == NULL) { \ |
| 66 |
(R) = ENOMEM; \ |
| 67 |
} else { \ |
| 68 |
(R) = encode_##T(((unsigned char*)(B)) + (BL) - 1, (BL), \ |
| 69 |
(S), (L)); \ |
| 70 |
if((R) != 0) { \ |
| 71 |
free((B)); \ |
| 72 |
(B) = NULL; \ |
| 73 |
} \ |
| 74 |
} \ |
| 75 |
} while (0) |
| 76 |
|
| 77 |
#ifdef _WIN32 |
| 78 |
#ifndef ASN1_LIB |
| 79 |
#define ASN1EXP __declspec(dllimport) |
| 80 |
#else |
| 81 |
#define ASN1EXP |
| 82 |
#endif |
| 83 |
#define ASN1CALL __stdcall |
| 84 |
#else |
| 85 |
#define ASN1EXP |
| 86 |
#define ASN1CALL |
| 87 |
#endif |
| 88 |
struct units; |
| 89 |
|
| 90 |
#endif |
| 91 |
|
| 92 |
#include <rfc2459_asn1.h> |
| 93 |
#include <heim_asn1.h> |
| 94 |
/* |
| 95 |
CRMFRDNSequence ::= SEQUENCE OF RelativeDistinguishedName |
| 96 |
*/ |
| 97 |
|
| 98 |
typedef struct CRMFRDNSequence { |
| 99 |
unsigned int len; |
| 100 |
RelativeDistinguishedName *val; |
| 101 |
} CRMFRDNSequence; |
| 102 |
|
| 103 |
ASN1EXP int ASN1CALL decode_CRMFRDNSequence(const unsigned char *, size_t, CRMFRDNSequence *, size_t *); |
| 104 |
ASN1EXP int ASN1CALL encode_CRMFRDNSequence(unsigned char *, size_t, const CRMFRDNSequence *, size_t *); |
| 105 |
ASN1EXP size_t ASN1CALL length_CRMFRDNSequence(const CRMFRDNSequence *); |
| 106 |
ASN1EXP int ASN1CALL copy_CRMFRDNSequence (const CRMFRDNSequence *, CRMFRDNSequence *); |
| 107 |
ASN1EXP void ASN1CALL free_CRMFRDNSequence (CRMFRDNSequence *); |
| 108 |
|
| 109 |
|
| 110 |
/* |
| 111 |
Controls ::= SEQUENCE OF AttributeTypeAndValue |
| 112 |
*/ |
| 113 |
|
| 114 |
typedef struct Controls { |
| 115 |
unsigned int len; |
| 116 |
AttributeTypeAndValue *val; |
| 117 |
} Controls; |
| 118 |
|
| 119 |
ASN1EXP int ASN1CALL decode_Controls(const unsigned char *, size_t, Controls *, size_t *); |
| 120 |
ASN1EXP int ASN1CALL encode_Controls(unsigned char *, size_t, const Controls *, size_t *); |
| 121 |
ASN1EXP size_t ASN1CALL length_Controls(const Controls *); |
| 122 |
ASN1EXP int ASN1CALL copy_Controls (const Controls *, Controls *); |
| 123 |
ASN1EXP void ASN1CALL free_Controls (Controls *); |
| 124 |
|
| 125 |
|
| 126 |
/* |
| 127 |
POPOSigningKey ::= SEQUENCE { |
| 128 |
poposkInput [0] IMPLICIT POPOSigningKeyInput OPTIONAL, |
| 129 |
algorithmIdentifier AlgorithmIdentifier, |
| 130 |
signature BIT STRING { |
| 131 |
}, |
| 132 |
} |
| 133 |
*/ |
| 134 |
|
| 135 |
typedef struct POPOSigningKey { |
| 136 |
POPOSigningKeyInput *poposkInput; |
| 137 |
AlgorithmIdentifier algorithmIdentifier; |
| 138 |
heim_bit_string signature; |
| 139 |
} POPOSigningKey; |
| 140 |
|
| 141 |
ASN1EXP int ASN1CALL decode_POPOSigningKey(const unsigned char *, size_t, POPOSigningKey *, size_t *); |
| 142 |
ASN1EXP int ASN1CALL encode_POPOSigningKey(unsigned char *, size_t, const POPOSigningKey *, size_t *); |
| 143 |
ASN1EXP size_t ASN1CALL length_POPOSigningKey(const POPOSigningKey *); |
| 144 |
ASN1EXP int ASN1CALL copy_POPOSigningKey (const POPOSigningKey *, POPOSigningKey *); |
| 145 |
ASN1EXP void ASN1CALL free_POPOSigningKey (POPOSigningKey *); |
| 146 |
|
| 147 |
|
| 148 |
/* |
| 149 |
PKMACValue ::= SEQUENCE { |
| 150 |
algId AlgorithmIdentifier, |
| 151 |
value BIT STRING { |
| 152 |
}, |
| 153 |
} |
| 154 |
*/ |
| 155 |
|
| 156 |
typedef struct PKMACValue { |
| 157 |
AlgorithmIdentifier algId; |
| 158 |
heim_bit_string value; |
| 159 |
} PKMACValue; |
| 160 |
|
| 161 |
ASN1EXP int ASN1CALL decode_PKMACValue(const unsigned char *, size_t, PKMACValue *, size_t *); |
| 162 |
ASN1EXP int ASN1CALL encode_PKMACValue(unsigned char *, size_t, const PKMACValue *, size_t *); |
| 163 |
ASN1EXP size_t ASN1CALL length_PKMACValue(const PKMACValue *); |
| 164 |
ASN1EXP int ASN1CALL copy_PKMACValue (const PKMACValue *, PKMACValue *); |
| 165 |
ASN1EXP void ASN1CALL free_PKMACValue (PKMACValue *); |
| 166 |
|
| 167 |
|
| 168 |
/* |
| 169 |
POPOSigningKeyInput ::= SEQUENCE { |
| 170 |
authInfo CHOICE { |
| 171 |
sender [0] IMPLICIT GeneralName, |
| 172 |
publicKeyMAC PKMACValue, |
| 173 |
}, |
| 174 |
publicKey SubjectPublicKeyInfo, |
| 175 |
} |
| 176 |
*/ |
| 177 |
|
| 178 |
typedef struct POPOSigningKeyInput { |
| 179 |
struct POPOSigningKeyInput_authInfo { |
| 180 |
enum POPOSigningKeyInput_authInfo_enum { |
| 181 |
choice_POPOSigningKeyInput_authInfo_sender = 1, |
| 182 |
choice_POPOSigningKeyInput_authInfo_publicKeyMAC |
| 183 |
} element; |
| 184 |
union { |
| 185 |
GeneralName sender; |
| 186 |
PKMACValue publicKeyMAC; |
| 187 |
} u; |
| 188 |
} authInfo; |
| 189 |
SubjectPublicKeyInfo publicKey; |
| 190 |
} POPOSigningKeyInput; |
| 191 |
|
| 192 |
ASN1EXP int ASN1CALL decode_POPOSigningKeyInput(const unsigned char *, size_t, POPOSigningKeyInput *, size_t *); |
| 193 |
ASN1EXP int ASN1CALL encode_POPOSigningKeyInput(unsigned char *, size_t, const POPOSigningKeyInput *, size_t *); |
| 194 |
ASN1EXP size_t ASN1CALL length_POPOSigningKeyInput(const POPOSigningKeyInput *); |
| 195 |
ASN1EXP int ASN1CALL copy_POPOSigningKeyInput (const POPOSigningKeyInput *, POPOSigningKeyInput *); |
| 196 |
ASN1EXP void ASN1CALL free_POPOSigningKeyInput (POPOSigningKeyInput *); |
| 197 |
|
| 198 |
|
| 199 |
/* |
| 200 |
PBMParameter ::= SEQUENCE { |
| 201 |
salt OCTET STRING, |
| 202 |
owf AlgorithmIdentifier, |
| 203 |
iterationCount INTEGER, |
| 204 |
mac AlgorithmIdentifier, |
| 205 |
} |
| 206 |
*/ |
| 207 |
|
| 208 |
typedef struct PBMParameter { |
| 209 |
heim_octet_string salt; |
| 210 |
AlgorithmIdentifier owf; |
| 211 |
heim_integer iterationCount; |
| 212 |
AlgorithmIdentifier mac; |
| 213 |
} PBMParameter; |
| 214 |
|
| 215 |
ASN1EXP int ASN1CALL decode_PBMParameter(const unsigned char *, size_t, PBMParameter *, size_t *); |
| 216 |
ASN1EXP int ASN1CALL encode_PBMParameter(unsigned char *, size_t, const PBMParameter *, size_t *); |
| 217 |
ASN1EXP size_t ASN1CALL length_PBMParameter(const PBMParameter *); |
| 218 |
ASN1EXP int ASN1CALL copy_PBMParameter (const PBMParameter *, PBMParameter *); |
| 219 |
ASN1EXP void ASN1CALL free_PBMParameter (PBMParameter *); |
| 220 |
|
| 221 |
|
| 222 |
/* |
| 223 |
SubsequentMessage ::= INTEGER { |
| 224 |
encrCert(0), |
| 225 |
challengeResp(1) |
| 226 |
} |
| 227 |
*/ |
| 228 |
|
| 229 |
typedef enum SubsequentMessage { |
| 230 |
encrCert = 0, |
| 231 |
challengeResp = 1 |
| 232 |
} SubsequentMessage; |
| 233 |
|
| 234 |
ASN1EXP int ASN1CALL decode_SubsequentMessage(const unsigned char *, size_t, SubsequentMessage *, size_t *); |
| 235 |
ASN1EXP int ASN1CALL encode_SubsequentMessage(unsigned char *, size_t, const SubsequentMessage *, size_t *); |
| 236 |
ASN1EXP size_t ASN1CALL length_SubsequentMessage(const SubsequentMessage *); |
| 237 |
ASN1EXP int ASN1CALL copy_SubsequentMessage (const SubsequentMessage *, SubsequentMessage *); |
| 238 |
ASN1EXP void ASN1CALL free_SubsequentMessage (SubsequentMessage *); |
| 239 |
|
| 240 |
|
| 241 |
/* |
| 242 |
POPOPrivKey ::= CHOICE { |
| 243 |
thisMessage [0] BIT STRING { |
| 244 |
}, |
| 245 |
subsequentMessage [1] IMPLICIT SubsequentMessage, |
| 246 |
dhMAC [2] BIT STRING { |
| 247 |
}, |
| 248 |
agreeMAC [3] IMPLICIT PKMACValue, |
| 249 |
encryptedKey [4] heim_any, |
| 250 |
} |
| 251 |
*/ |
| 252 |
|
| 253 |
typedef struct POPOPrivKey { |
| 254 |
enum POPOPrivKey_enum { |
| 255 |
choice_POPOPrivKey_thisMessage = 1, |
| 256 |
choice_POPOPrivKey_subsequentMessage, |
| 257 |
choice_POPOPrivKey_dhMAC, |
| 258 |
choice_POPOPrivKey_agreeMAC, |
| 259 |
choice_POPOPrivKey_encryptedKey |
| 260 |
} element; |
| 261 |
union { |
| 262 |
heim_bit_string thisMessage; |
| 263 |
SubsequentMessage subsequentMessage; |
| 264 |
heim_bit_string dhMAC; |
| 265 |
PKMACValue agreeMAC; |
| 266 |
heim_any encryptedKey; |
| 267 |
} u; |
| 268 |
} POPOPrivKey; |
| 269 |
|
| 270 |
ASN1EXP int ASN1CALL decode_POPOPrivKey(const unsigned char *, size_t, POPOPrivKey *, size_t *); |
| 271 |
ASN1EXP int ASN1CALL encode_POPOPrivKey(unsigned char *, size_t, const POPOPrivKey *, size_t *); |
| 272 |
ASN1EXP size_t ASN1CALL length_POPOPrivKey(const POPOPrivKey *); |
| 273 |
ASN1EXP int ASN1CALL copy_POPOPrivKey (const POPOPrivKey *, POPOPrivKey *); |
| 274 |
ASN1EXP void ASN1CALL free_POPOPrivKey (POPOPrivKey *); |
| 275 |
|
| 276 |
|
| 277 |
/* |
| 278 |
ProofOfPossession ::= CHOICE { |
| 279 |
raVerified [0] NULL, |
| 280 |
signature [1] POPOSigningKey, |
| 281 |
keyEncipherment [2] POPOPrivKey, |
| 282 |
keyAgreement [3] POPOPrivKey, |
| 283 |
} |
| 284 |
*/ |
| 285 |
|
| 286 |
typedef struct ProofOfPossession { |
| 287 |
enum ProofOfPossession_enum { |
| 288 |
choice_ProofOfPossession_raVerified = 1, |
| 289 |
choice_ProofOfPossession_signature, |
| 290 |
choice_ProofOfPossession_keyEncipherment, |
| 291 |
choice_ProofOfPossession_keyAgreement |
| 292 |
} element; |
| 293 |
union { |
| 294 |
int raVerified; |
| 295 |
POPOSigningKey signature; |
| 296 |
POPOPrivKey keyEncipherment; |
| 297 |
POPOPrivKey keyAgreement; |
| 298 |
} u; |
| 299 |
} ProofOfPossession; |
| 300 |
|
| 301 |
ASN1EXP int ASN1CALL decode_ProofOfPossession(const unsigned char *, size_t, ProofOfPossession *, size_t *); |
| 302 |
ASN1EXP int ASN1CALL encode_ProofOfPossession(unsigned char *, size_t, const ProofOfPossession *, size_t *); |
| 303 |
ASN1EXP size_t ASN1CALL length_ProofOfPossession(const ProofOfPossession *); |
| 304 |
ASN1EXP int ASN1CALL copy_ProofOfPossession (const ProofOfPossession *, ProofOfPossession *); |
| 305 |
ASN1EXP void ASN1CALL free_ProofOfPossession (ProofOfPossession *); |
| 306 |
|
| 307 |
|
| 308 |
/* |
| 309 |
CertTemplate ::= SEQUENCE { |
| 310 |
version [0] INTEGER OPTIONAL, |
| 311 |
serialNumber [1] INTEGER OPTIONAL, |
| 312 |
signingAlg [2] SEQUENCE { |
| 313 |
algorithm OBJECT IDENTIFIER, |
| 314 |
parameters heim_any OPTIONAL, |
| 315 |
} OPTIONAL, |
| 316 |
issuer [3] IMPLICIT CHOICE { |
| 317 |
rdnSequence CRMFRDNSequence, |
| 318 |
} OPTIONAL, |
| 319 |
validity [4] SEQUENCE { |
| 320 |
notBefore [0] Time OPTIONAL, |
| 321 |
notAfter [1] Time OPTIONAL, |
| 322 |
} OPTIONAL, |
| 323 |
subject [5] IMPLICIT CHOICE { |
| 324 |
rdnSequence CRMFRDNSequence, |
| 325 |
} OPTIONAL, |
| 326 |
publicKey [6] IMPLICIT SEQUENCE { |
| 327 |
algorithm AlgorithmIdentifier, |
| 328 |
subjectPublicKey BIT STRING { |
| 329 |
} OPTIONAL, |
| 330 |
} OPTIONAL, |
| 331 |
issuerUID [7] IMPLICIT BIT STRING { |
| 332 |
} OPTIONAL, |
| 333 |
subjectUID [8] IMPLICIT BIT STRING { |
| 334 |
} OPTIONAL, |
| 335 |
extensions [9] IMPLICIT SEQUENCE OF Extension OPTIONAL, |
| 336 |
} |
| 337 |
*/ |
| 338 |
|
| 339 |
typedef struct CertTemplate { |
| 340 |
heim_integer *version; |
| 341 |
heim_integer *serialNumber; |
| 342 |
struct CertTemplate_signingAlg { |
| 343 |
heim_oid algorithm; |
| 344 |
heim_any *parameters; |
| 345 |
} *signingAlg; |
| 346 |
struct CertTemplate_issuer { |
| 347 |
enum CertTemplate_issuer_enum { |
| 348 |
choice_CertTemplate_issuer_rdnSequence = 1 |
| 349 |
} element; |
| 350 |
union { |
| 351 |
CRMFRDNSequence rdnSequence; |
| 352 |
} u; |
| 353 |
} *issuer; |
| 354 |
struct CertTemplate_validity { |
| 355 |
Time *notBefore; |
| 356 |
Time *notAfter; |
| 357 |
} *validity; |
| 358 |
struct CertTemplate_subject { |
| 359 |
enum CertTemplate_subject_enum { |
| 360 |
choice_CertTemplate_subject_rdnSequence = 1 |
| 361 |
} element; |
| 362 |
union { |
| 363 |
CRMFRDNSequence rdnSequence; |
| 364 |
} u; |
| 365 |
} *subject; |
| 366 |
struct CertTemplate_publicKey { |
| 367 |
AlgorithmIdentifier algorithm; |
| 368 |
heim_bit_string *subjectPublicKey; |
| 369 |
} *publicKey; |
| 370 |
heim_bit_string *issuerUID; |
| 371 |
heim_bit_string *subjectUID; |
| 372 |
struct CertTemplate_extensions { |
| 373 |
unsigned int len; |
| 374 |
Extension *val; |
| 375 |
} *extensions; |
| 376 |
} CertTemplate; |
| 377 |
|
| 378 |
ASN1EXP int ASN1CALL decode_CertTemplate(const unsigned char *, size_t, CertTemplate *, size_t *); |
| 379 |
ASN1EXP int ASN1CALL encode_CertTemplate(unsigned char *, size_t, const CertTemplate *, size_t *); |
| 380 |
ASN1EXP size_t ASN1CALL length_CertTemplate(const CertTemplate *); |
| 381 |
ASN1EXP int ASN1CALL copy_CertTemplate (const CertTemplate *, CertTemplate *); |
| 382 |
ASN1EXP void ASN1CALL free_CertTemplate (CertTemplate *); |
| 383 |
|
| 384 |
|
| 385 |
/* |
| 386 |
CertRequest ::= SEQUENCE { |
| 387 |
certReqId INTEGER, |
| 388 |
certTemplate CertTemplate, |
| 389 |
controls Controls OPTIONAL, |
| 390 |
} |
| 391 |
*/ |
| 392 |
|
| 393 |
typedef struct CertRequest { |
| 394 |
heim_integer certReqId; |
| 395 |
CertTemplate certTemplate; |
| 396 |
Controls *controls; |
| 397 |
} CertRequest; |
| 398 |
|
| 399 |
ASN1EXP int ASN1CALL decode_CertRequest(const unsigned char *, size_t, CertRequest *, size_t *); |
| 400 |
ASN1EXP int ASN1CALL encode_CertRequest(unsigned char *, size_t, const CertRequest *, size_t *); |
| 401 |
ASN1EXP size_t ASN1CALL length_CertRequest(const CertRequest *); |
| 402 |
ASN1EXP int ASN1CALL copy_CertRequest (const CertRequest *, CertRequest *); |
| 403 |
ASN1EXP void ASN1CALL free_CertRequest (CertRequest *); |
| 404 |
|
| 405 |
|
| 406 |
/* |
| 407 |
CertReqMsg ::= SEQUENCE { |
| 408 |
certReq CertRequest, |
| 409 |
popo ProofOfPossession OPTIONAL, |
| 410 |
regInfo SEQUENCE OF AttributeTypeAndValue OPTIONAL, |
| 411 |
} |
| 412 |
*/ |
| 413 |
|
| 414 |
typedef struct CertReqMsg { |
| 415 |
CertRequest certReq; |
| 416 |
ProofOfPossession *popo; |
| 417 |
struct CertReqMsg_regInfo { |
| 418 |
unsigned int len; |
| 419 |
AttributeTypeAndValue *val; |
| 420 |
} *regInfo; |
| 421 |
} CertReqMsg; |
| 422 |
|
| 423 |
ASN1EXP int ASN1CALL decode_CertReqMsg(const unsigned char *, size_t, CertReqMsg *, size_t *); |
| 424 |
ASN1EXP int ASN1CALL encode_CertReqMsg(unsigned char *, size_t, const CertReqMsg *, size_t *); |
| 425 |
ASN1EXP size_t ASN1CALL length_CertReqMsg(const CertReqMsg *); |
| 426 |
ASN1EXP int ASN1CALL copy_CertReqMsg (const CertReqMsg *, CertReqMsg *); |
| 427 |
ASN1EXP void ASN1CALL free_CertReqMsg (CertReqMsg *); |
| 428 |
|
| 429 |
|
| 430 |
/* |
| 431 |
CertReqMessages ::= SEQUENCE OF CertReqMsg |
| 432 |
*/ |
| 433 |
|
| 434 |
typedef struct CertReqMessages { |
| 435 |
unsigned int len; |
| 436 |
CertReqMsg *val; |
| 437 |
} CertReqMessages; |
| 438 |
|
| 439 |
ASN1EXP int ASN1CALL decode_CertReqMessages(const unsigned char *, size_t, CertReqMessages *, size_t *); |
| 440 |
ASN1EXP int ASN1CALL encode_CertReqMessages(unsigned char *, size_t, const CertReqMessages *, size_t *); |
| 441 |
ASN1EXP size_t ASN1CALL length_CertReqMessages(const CertReqMessages *); |
| 442 |
ASN1EXP int ASN1CALL copy_CertReqMessages (const CertReqMessages *, CertReqMessages *); |
| 443 |
ASN1EXP void ASN1CALL free_CertReqMessages (CertReqMessages *); |
| 444 |
|
| 445 |
|
| 446 |
#endif /* __crmf_asn1_h__ */ |