1 /* $OpenBSD: asn1.h,v 1.54 2020/12/08 15:06:42 tb Exp $ */ 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * 9 * This library is free for commercial and non-commercial use as core.stdc.config.c_long as 10 * the following conditions are aheared to. The following conditions 11 * apply to all code found in this distribution, be it the RC4, RSA, 12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation 13 * included with this distribution is covered by the same copyright terms 14 * except that the holder is Tim Hudson (tjh@cryptsoft.com). 15 * 16 * Copyright remains Eric Young's, and as such any Copyright notices in 17 * the code are not to be removed. 18 * If this package is used in a product, Eric Young should be given attribution 19 * as the author of the parts of the library used. 20 * This can be in the form of a textual message at program startup or 21 * in documentation (online or textual) provided with the package. 22 * 23 * Redistribution and use in source and binary forms, with or without 24 * modification, are permitted provided that the following conditions 25 * are met: 26 * 1. Redistributions of source code must retain the copyright 27 * notice, this list of conditions and the following disclaimer. 28 * 2. Redistributions in binary form must reproduce the above copyright 29 * notice, this list of conditions and the following disclaimer in the 30 * documentation and/or other materials provided with the distribution. 31 * 3. All advertising materials mentioning features or use of this software 32 * must display the following acknowledgement: 33 * "This product includes cryptographic software written by 34 * Eric Young (eay@cryptsoft.com)" 35 * The word 'cryptographic' can be left out if the rouines from the library 36 * being used are not cryptographic related :-). 37 * 4. If you include any Windows specific code (or a derivative thereof) from 38 * the apps directory (application code) you must include an acknowledgement: 39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 40 * 41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 51 * SUCH DAMAGE. 52 * 53 * The licence and distribution terms for any publically available version or 54 * derivative of this code cannot be changed. i.e. this code cannot simply be 55 * copied and put under another distribution licence 56 * [including the GNU Public Licence.] 57 */ 58 module libressl_d.openssl.asn1; 59 60 61 private static import core.stdc.config; 62 private static import libressl_d.compat.stdio; 63 private static import libressl_d.openssl.asn1t; 64 public import libressl_d.compat.time; 65 public import libressl_d.openssl.bio; 66 public import libressl_d.openssl.opensslconf; 67 public import libressl_d.openssl.ossl_typ; 68 public import libressl_d.openssl.safestack; 69 public import libressl_d.openssl.stack; 70 71 version (OPENSSL_NO_BIO) { 72 } else { 73 public import libressl_d.openssl.bio; 74 } 75 76 version (OPENSSL_NO_DEPRECATED) { 77 } else { 78 public import libressl_d.openssl.bn; 79 } 80 81 extern (C): 82 nothrow @nogc: 83 84 enum V_ASN1_UNIVERSAL = 0x00; 85 enum V_ASN1_APPLICATION = 0x40; 86 enum V_ASN1_CONTEXT_SPECIFIC = 0x80; 87 enum V_ASN1_PRIVATE = 0xC0; 88 89 enum V_ASN1_CONSTRUCTED = 0x20; 90 enum V_ASN1_PRIMITIVE_TAG = 0x1F; 91 enum V_ASN1_PRIMATIVE_TAG = 0x1F; 92 93 /** 94 * let the recipient choose 95 */ 96 enum V_ASN1_APP_CHOOSE = -2; 97 98 /** 99 * used in ASN1_TYPE 100 */ 101 enum V_ASN1_OTHER = -3; 102 103 /** 104 * used in ASN1 template code 105 */ 106 enum V_ASN1_ANY = -4; 107 108 /** 109 * negative flag 110 */ 111 enum V_ASN1_NEG = 0x0100; 112 113 enum V_ASN1_UNDEF = -1; 114 enum V_ASN1_EOC = 0; 115 116 /* 117 * 118 */ 119 enum V_ASN1_BOOLEAN = 1; 120 121 enum V_ASN1_INTEGER = 2; 122 enum V_ASN1_NEG_INTEGER = 2 | .V_ASN1_NEG; 123 enum V_ASN1_BIT_STRING = 3; 124 enum V_ASN1_OCTET_STRING = 4; 125 enum V_ASN1_NULL = 5; 126 enum V_ASN1_OBJECT = 6; 127 enum V_ASN1_OBJECT_DESCRIPTOR = 7; 128 enum V_ASN1_EXTERNAL = 8; 129 enum V_ASN1_REAL = 9; 130 enum V_ASN1_ENUMERATED = 10; 131 enum V_ASN1_NEG_ENUMERATED = 10 | .V_ASN1_NEG; 132 enum V_ASN1_UTF8STRING = 12; 133 enum V_ASN1_SEQUENCE = 16; 134 enum V_ASN1_SET = 17; 135 136 /* 137 * 138 */ 139 enum V_ASN1_NUMERICSTRING = 18; 140 141 enum V_ASN1_PRINTABLESTRING = 19; 142 enum V_ASN1_T61STRING = 20; 143 144 /** 145 * alias 146 */ 147 enum V_ASN1_TELETEXSTRING = 20; 148 149 /* 150 * 151 */ 152 enum V_ASN1_VIDEOTEXSTRING = 21; 153 154 enum V_ASN1_IA5STRING = 22; 155 enum V_ASN1_UTCTIME = 23; 156 157 /* 158 * 159 */ 160 enum V_ASN1_GENERALIZEDTIME = 24; 161 162 /* 163 * 164 */ 165 enum V_ASN1_GRAPHICSTRING = 25; 166 167 /* 168 * 169 */ 170 enum V_ASN1_ISO64STRING = 26; 171 172 /** 173 * alias 174 */ 175 enum V_ASN1_VISIBLESTRING = 26; 176 177 /* 178 * 179 */ 180 enum V_ASN1_GENERALSTRING = 27; 181 182 /* 183 * 184 */ 185 enum V_ASN1_UNIVERSALSTRING = 28; 186 187 enum V_ASN1_BMPSTRING = 30; 188 189 enum B_ASN1_NUMERICSTRING = 0x0001; 190 enum B_ASN1_PRINTABLESTRING = 0x0002; 191 enum B_ASN1_T61STRING = 0x0004; 192 enum B_ASN1_TELETEXSTRING = 0x0004; 193 enum B_ASN1_VIDEOTEXSTRING = 0x0008; 194 enum B_ASN1_IA5STRING = 0x0010; 195 enum B_ASN1_GRAPHICSTRING = 0x0020; 196 enum B_ASN1_ISO64STRING = 0x0040; 197 enum B_ASN1_VISIBLESTRING = 0x0040; 198 enum B_ASN1_GENERALSTRING = 0x0080; 199 enum B_ASN1_UNIVERSALSTRING = 0x0100; 200 enum B_ASN1_OCTET_STRING = 0x0200; 201 enum B_ASN1_BIT_STRING = 0x0400; 202 enum B_ASN1_BMPSTRING = 0x0800; 203 enum B_ASN1_UNKNOWN = 0x1000; 204 enum B_ASN1_UTF8STRING = 0x2000; 205 enum B_ASN1_UTCTIME = 0x4000; 206 enum B_ASN1_GENERALIZEDTIME = 0x8000; 207 enum B_ASN1_SEQUENCE = 0x010000; 208 209 /* For use with ASN1_mbstring_copy() */ 210 enum MBSTRING_FLAG = 0x1000; 211 enum MBSTRING_UTF8 = .MBSTRING_FLAG; 212 enum MBSTRING_ASC = .MBSTRING_FLAG | 1; 213 enum MBSTRING_BMP = .MBSTRING_FLAG | 2; 214 enum MBSTRING_UNIV = .MBSTRING_FLAG | 4; 215 216 enum SMIME_OLDMIME = 0x0400; 217 enum SMIME_CRLFEOL = 0x0800; 218 enum SMIME_STREAM = 0x1000; 219 220 //DECLARE_STACK_OF(X509_ALGOR) 221 struct stack_st_X509_ALGOR 222 { 223 libressl_d.openssl.stack._STACK stack; 224 } 225 226 //#define DECLARE_ASN1_SET_OF(type) /* filled in by mkstack.pl */ 227 //#define IMPLEMENT_ASN1_SET_OF(type) /* nothing, no longer needed */ 228 229 /** 230 * We MUST make sure that, except for constness, asn1_ctx_st and 231 * asn1_const_ctx are exactly the same. Fortunately, as soon as 232 * the old ASN1 parsing macros are gone, we can throw this away 233 * as well... 234 */ 235 struct asn1_ctx_st 236 { 237 /** 238 * work char pointer 239 */ 240 ubyte* p; 241 242 /** 243 * end of sequence read for indefinite encoding 244 */ 245 int eos; 246 247 /** 248 * error code to use when returning an error 249 */ 250 int error; 251 252 /** 253 * constructed if 0x20, indefinite is 0x21 254 */ 255 int inf; 256 257 /** 258 * tag from last 'get object' 259 */ 260 int tag; 261 262 /** 263 * class from last 'get object' 264 */ 265 int xclass; 266 267 /** 268 * length of last 'get object' 269 */ 270 core.stdc.config.c_long slen; 271 272 /** 273 * largest value of p allowed 274 */ 275 ubyte* max; 276 277 /** 278 * temporary variable 279 */ 280 ubyte* q; 281 282 /** 283 * variable 284 */ 285 ubyte** pp; 286 287 /** 288 * used in error processing 289 */ 290 int line; 291 } 292 293 alias ASN1_CTX = .asn1_ctx_st; 294 295 struct asn1_const_ctx_st 296 { 297 /** 298 * work char pointer 299 */ 300 const (ubyte)* p; 301 302 /** 303 * end of sequence read for indefinite encoding 304 */ 305 int eos; 306 307 /** 308 * error code to use when returning an error 309 */ 310 int error; 311 312 /** 313 * constructed if 0x20, indefinite is 0x21 314 */ 315 int inf; 316 317 /** 318 * tag from last 'get object' 319 */ 320 int tag; 321 322 /** 323 * class from last 'get object' 324 */ 325 int xclass; 326 327 /** 328 * length of last 'get object' 329 */ 330 core.stdc.config.c_long slen; 331 332 /** 333 * largest value of p allowed 334 */ 335 const (ubyte)* max; 336 337 /** 338 * temporary variable 339 */ 340 const (ubyte)* q; 341 342 /** 343 * variable 344 */ 345 const (ubyte)** pp; 346 347 /** 348 * used in error processing 349 */ 350 int line; 351 } 352 353 alias ASN1_const_CTX = .asn1_const_ctx_st; 354 355 /* 356 * These are used internally in the ASN1_OBJECT to keep track of 357 * whether the names and data need to be free()ed 358 */ 359 360 /** 361 * internal use 362 */ 363 enum ASN1_OBJECT_FLAG_DYNAMIC = 0x01; 364 365 /** 366 * critical x509v3 object id 367 */ 368 enum ASN1_OBJECT_FLAG_CRITICAL = 0x02; 369 370 /** 371 * internal use 372 */ 373 enum ASN1_OBJECT_FLAG_DYNAMIC_STRINGS = 0x04; 374 375 ///Ditto 376 enum ASN1_OBJECT_FLAG_DYNAMIC_DATA = 0x08; 377 378 struct asn1_object_st 379 { 380 const (char)* sn; 381 const (char)* ln; 382 383 int nid; 384 int length_; 385 386 /** 387 * data remains const after init 388 */ 389 const (ubyte)* data; 390 391 /** 392 * Should we free this one 393 */ 394 int flags; 395 } 396 397 alias ASN1_OBJECT = .asn1_object_st; 398 399 /** 400 * Set if 0x07 has bits left value 401 */ 402 enum ASN1_STRING_FLAG_BITS_LEFT = 0x08; 403 404 /** 405 * This indicates that the ASN1_STRING is not a real value but just a place 406 * holder for the location where indefinite length constructed data should 407 * be inserted in the memory buffer 408 */ 409 enum ASN1_STRING_FLAG_NDEF = 0x0010; 410 411 /** 412 * This flag is used by the CMS code to indicate that a string is not 413 * complete and is a place holder for content when it had all been 414 * accessed. The flag will be reset when content has been written to it. 415 */ 416 enum ASN1_STRING_FLAG_CONT = 0x0020; 417 418 /** 419 * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING 420 * type. 421 */ 422 enum ASN1_STRING_FLAG_MSTRING = 0x0040; 423 424 /** 425 * This is the base type that holds just about everything :-\) 426 */ 427 struct asn1_string_st 428 { 429 int length_; 430 int type; 431 ubyte* data; 432 433 /** 434 * The value of the following field depends on the type being 435 * held. It is mostly being used for BIT_STRING so if the 436 * input data has a non-zero 'unused bits' value, it will be 437 * handled correctly 438 */ 439 core.stdc.config.c_long flags; 440 } 441 442 /** 443 * ASN1_ENCODING structure: this is used to save the received 444 * encoding of an ASN1 type. This is useful to get round 445 * problems with invalid encodings which can break signatures. 446 */ 447 struct ASN1_ENCODING_st 448 { 449 /** 450 * DER encoding 451 */ 452 ubyte* enc; 453 454 /** 455 * Length of encoding 456 */ 457 core.stdc.config.c_long len; 458 459 /** 460 * set to 1 if 'enc' is invalid 461 */ 462 int modified; 463 } 464 465 alias ASN1_ENCODING = .ASN1_ENCODING_st; 466 467 /** 468 * Used with ASN1 LONG type: if a core.stdc.config.c_long is set to this it is omitted 469 */ 470 enum ASN1_LONG_UNDEF = 0x7FFFFFFFL; 471 472 enum STABLE_FLAGS_MALLOC = 0x01; 473 enum STABLE_NO_MASK = 0x02; 474 enum DIRSTRING_TYPE = .B_ASN1_PRINTABLESTRING | .B_ASN1_T61STRING | .B_ASN1_BMPSTRING | .B_ASN1_UTF8STRING; 475 enum PKCS9STRING_TYPE = .DIRSTRING_TYPE | .B_ASN1_IA5STRING; 476 477 struct asn1_string_table_st 478 { 479 int nid; 480 core.stdc.config.c_long minsize; 481 core.stdc.config.c_long maxsize; 482 core.stdc.config.c_ulong mask; 483 core.stdc.config.c_ulong flags; 484 } 485 486 alias ASN1_STRING_TABLE = .asn1_string_table_st; 487 488 //DECLARE_STACK_OF(ASN1_STRING_TABLE) 489 struct stack_st_ASN1_STRING_TABLE 490 { 491 libressl_d.openssl.stack._STACK stack; 492 } 493 494 /* size limits: this stuff is taken straight from RFC2459 */ 495 496 enum ub_name = 32768; 497 enum ub_common_name = 64; 498 enum ub_locality_name = 128; 499 enum ub_state_name = 128; 500 enum ub_organization_name = 64; 501 enum ub_organization_unit_name = 64; 502 enum ub_title = 64; 503 enum ub_email_address = 128; 504 505 /* 506 * Declarations for template structures: for full definitions 507 * see asn1t.h 508 */ 509 alias ASN1_TEMPLATE = libressl_d.openssl.asn1t.ASN1_TEMPLATE_st; 510 alias ASN1_TLC = libressl_d.openssl.asn1t.ASN1_TLC_st; 511 /* This is just an opaque pointer */ 512 struct ASN1_VALUE_st; 513 alias ASN1_VALUE = .ASN1_VALUE_st; 514 515 version (LIBRESSL_INTERNAL) { 516 } else { 517 /* Declare ASN1 functions: the implement macro in in asn1t.h */ 518 519 //#define DECLARE_ASN1_FUNCTIONS(type) .DECLARE_ASN1_FUNCTIONS_name(type, type) 520 521 //#define DECLARE_ASN1_ALLOC_FUNCTIONS(type) .DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type) 522 523 //#define DECLARE_ASN1_FUNCTIONS_name(type, name) .DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) .DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name) 524 525 //#define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) .DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) .DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) 526 527 //#define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) type* d2i_##name(type** a, const (ubyte)** in_, core.stdc.config.c_long len); int i2d_##name(type* a, ubyte** out_); .DECLARE_ASN1_ITEM(itname) 528 529 //#define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) type* d2i_##name(type** a, const (ubyte)** in_, core.stdc.config.c_long len); int i2d_##name(const (type)* a, ubyte** out_); .DECLARE_ASN1_ITEM(name) 530 531 //#define DECLARE_ASN1_NDEF_FUNCTION(name) int i2d_##name##_NDEF(name* a, ubyte** out_); 532 533 //#define DECLARE_ASN1_FUNCTIONS_const(name) .DECLARE_ASN1_ALLOC_FUNCTIONS(name) .DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name) 534 535 //#define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) type* name##_new(); void name##_free(type* a); 536 537 //#define DECLARE_ASN1_PRINT_FUNCTION(stname) .DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname) 538 539 //#define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) int fname##_print_ctx(libressl_d.openssl.bio.BIO* out_, stname* x, int indent, const (libressl_d.openssl.ossl_typ.ASN1_PCTX)* pctx); 540 } 541 542 //#define D2I_OF(type) type* (*) (type**, const (ubyte)**, core.stdc.config.c_long) 543 //#define I2D_OF(type) int (*)(type*, ubyte**) 544 //#define I2D_OF_const(type) int (*)(const (type)*, ubyte**) 545 546 //#define CHECKED_D2I_OF(type, d2i) ((d2i_of_void*) ((1) ? (d2i) : ((.D2I_OF(type)) 0))) 547 //#define CHECKED_I2D_OF(type, i2d) ((i2d_of_void*) ((1) ? (i2d) : ((.I2D_OF(type)) 0))) 548 //#define CHECKED_NEW_OF(type, xnew) ((void* (*) (void) )((1) ? (xnew) : ((type * (*) (void) ) 0))) 549 //#define CHECKED_PTR_OF(type, p) ((void*) ((1) ? (p) : (cast(type*)(0)))) 550 //#define CHECKED_PPTR_OF(type, p) ((void**) ((1) ? (p) : (cast(type**)(0)))) 551 552 //#define TYPEDEF_D2I_OF(type) typedef type* d2i_of_##type(type**, const (ubyte)**, core.stdc.config.c_long) 553 //#define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type*, ubyte**) 554 //#define TYPEDEF_D2I2D_OF(type) .TYPEDEF_D2I_OF(type); .TYPEDEF_I2D_OF(type) 555 556 //TYPEDEF_D2I2D_OF(); 557 558 /* 559 * The following macros and typedefs allow an ASN1_ITEM 560 * to be embedded in a structure and referenced. Since 561 * the ASN1_ITEM pointers need to be globally accessible 562 * (possibly from shared libraries) they may exist in 563 * different forms. On platforms that support it the 564 * libressl_d.openssl.ossl_typ.ASN1_ITEM structure itself will be globally exported. 565 * Other platforms will export a function that returns 566 * an ASN1_ITEM pointer. 567 * 568 * To handle both cases transparently the macros below 569 * should be used instead of hard coding an ASN1_ITEM 570 * pointer in a structure. 571 * 572 * The structure will look like this: 573 * 574 * typedef struct SOMETHING_st { 575 * ... 576 * ASN1_ITEM_EXP* ptr; 577 * ... 578 * } SOMETHING; 579 * 580 * It would be initialised as e.g.: 581 * 582 * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...}; 583 * 584 * and the actual pointer extracted with: 585 * 586 * const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it = ASN1_ITEM_ptr(somevar.iptr); 587 * 588 * Finally an ASN1_ITEM pointer can be extracted from an 589 * appropriate reference with: ASN1_ITEM_rptr(X509). This 590 * would be used when a function takes an ASN1_ITEM * argument. 591 * 592 */ 593 594 /** 595 * ASN1_ITEM pointer exported type 596 */ 597 alias ASN1_ITEM_EXP = const libressl_d.openssl.ossl_typ.ASN1_ITEM; 598 599 version (LIBRESSL_INTERNAL) { 600 } else { 601 /* 602 * Macro to obtain ASN1_ITEM pointer from exported type 603 */ 604 //#define ASN1_ITEM_ptr(iptr) (iptr) 605 606 /* 607 * Macro to include ASN1_ITEM pointer from base type 608 */ 609 //#define ASN1_ITEM_ref(iptr) (&(iptr##_it)) 610 611 //#define ASN1_ITEM_rptr(ref_) (&(ref##_it)) 612 613 //#define DECLARE_ASN1_ITEM(name) extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM name##_it; 614 } 615 616 /* Parameters used by ASN1_STRING_print_ex() */ 617 618 /* 619 * These determine which characters to escape: 620 * RFC2253 special characters, control characters and 621 * MSB set characters 622 */ 623 624 enum ASN1_STRFLGS_ESC_2253 = 1; 625 enum ASN1_STRFLGS_ESC_CTRL = 2; 626 enum ASN1_STRFLGS_ESC_MSB = 4; 627 628 /** 629 * This flag determines how we do escaping: normally 630 * RC2253 backslash only, set this to use backslash and 631 * quote. 632 */ 633 enum ASN1_STRFLGS_ESC_QUOTE = 8; 634 635 /* These three flags are internal use only. */ 636 637 /** 638 * Character is a valid PrintableString character 639 */ 640 enum CHARTYPE_PRINTABLESTRING = 0x10; 641 642 /** 643 * Character needs escaping if it is the first character 644 */ 645 enum CHARTYPE_FIRST_ESC_2253 = 0x20; 646 647 /** 648 * Character needs escaping if it is the last character 649 */ 650 enum CHARTYPE_LAST_ESC_2253 = 0x40; 651 652 /* 653 * NB the internal flags are safely reused below by flags 654 * handled at the top level. 655 */ 656 657 /** 658 * If this is set we convert all character strings 659 * to UTF8 first 660 */ 661 enum ASN1_STRFLGS_UTF8_CONVERT = 0x10; 662 663 /** 664 * If this is set we don't attempt to interpret content: 665 * just assume all strings are 1 byte per character. This 666 * will produce some pretty odd looking output! 667 */ 668 enum ASN1_STRFLGS_IGNORE_TYPE = 0x20; 669 670 /** 671 * If this is set we include the string type in the output 672 */ 673 enum ASN1_STRFLGS_SHOW_TYPE = 0x40; 674 675 /* 676 * This determines which strings to display and which to 677 * 'dump' (hex dump of content octets or DER encoding). We can 678 * only dump non character strings or everything. If we 679 * don't dump 'unknown' they are interpreted as character 680 * strings with 1 octet per character and are subject to 681 * the usual escaping options. 682 */ 683 enum ASN1_STRFLGS_DUMP_ALL = 0x80; 684 enum ASN1_STRFLGS_DUMP_UNKNOWN = 0x0100; 685 686 /* 687 * These determine what 'dumping' does, we can dump the 688 * content octets or the DER encoding: both use the 689 * RFC2253 #NNNNN notation. 690 */ 691 enum ASN1_STRFLGS_DUMP_DER = 0x0200; 692 693 /** 694 * All the string flags consistent with RFC2253, 695 * escaping control characters isn't essential in 696 * RFC2253 but it is advisable anyway. 697 */ 698 enum ASN1_STRFLGS_RFC2253 = .ASN1_STRFLGS_ESC_2253 | .ASN1_STRFLGS_ESC_CTRL | .ASN1_STRFLGS_ESC_MSB | .ASN1_STRFLGS_UTF8_CONVERT | .ASN1_STRFLGS_DUMP_UNKNOWN | .ASN1_STRFLGS_DUMP_DER; 699 700 //DECLARE_STACK_OF(ASN1_INTEGER) 701 struct stack_st_ASN1_INTEGER 702 { 703 libressl_d.openssl.stack._STACK stack; 704 } 705 706 //DECLARE_STACK_OF(ASN1_GENERALSTRING) 707 struct stack_st_ASN1_GENERALSTRING 708 { 709 libressl_d.openssl.stack._STACK stack; 710 } 711 712 struct asn1_type_st 713 { 714 int type; 715 716 union value_ 717 { 718 char* ptr_; 719 libressl_d.openssl.ossl_typ.ASN1_BOOLEAN boolean; 720 libressl_d.openssl.ossl_typ.ASN1_STRING* asn1_string; 721 .ASN1_OBJECT* object; 722 libressl_d.openssl.ossl_typ.ASN1_INTEGER* integer; 723 libressl_d.openssl.ossl_typ.ASN1_ENUMERATED* enumerated; 724 libressl_d.openssl.ossl_typ.ASN1_BIT_STRING* bit_string; 725 libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* octet_string; 726 libressl_d.openssl.ossl_typ.ASN1_PRINTABLESTRING* printablestring; 727 libressl_d.openssl.ossl_typ.ASN1_T61STRING* t61string; 728 libressl_d.openssl.ossl_typ.ASN1_IA5STRING* ia5string; 729 libressl_d.openssl.ossl_typ.ASN1_GENERALSTRING* generalstring; 730 libressl_d.openssl.ossl_typ.ASN1_BMPSTRING* bmpstring; 731 libressl_d.openssl.ossl_typ.ASN1_UNIVERSALSTRING* universalstring; 732 libressl_d.openssl.ossl_typ.ASN1_UTCTIME* utctime; 733 libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME* generalizedtime; 734 libressl_d.openssl.ossl_typ.ASN1_VISIBLESTRING* visiblestring; 735 libressl_d.openssl.ossl_typ.ASN1_UTF8STRING* utf8string; 736 /* 737 * set and sequence are left complete and still 738 * contain the set or sequence bytes 739 */ 740 libressl_d.openssl.ossl_typ.ASN1_STRING* set; 741 libressl_d.openssl.ossl_typ.ASN1_STRING* sequence; 742 .ASN1_VALUE* asn1_value; 743 } 744 745 value_ value; 746 } 747 748 alias ASN1_TYPE = .asn1_type_st; 749 750 //DECLARE_STACK_OF(ASN1_TYPE) 751 struct stack_st_ASN1_TYPE 752 { 753 libressl_d.openssl.stack._STACK stack; 754 } 755 756 alias ASN1_SEQUENCE_ANY = .stack_st_ASN1_TYPE; 757 758 .ASN1_SEQUENCE_ANY* d2i_ASN1_SEQUENCE_ANY(.ASN1_SEQUENCE_ANY** a, const (ubyte)** in_, core.stdc.config.c_long len); 759 int i2d_ASN1_SEQUENCE_ANY(const (.ASN1_SEQUENCE_ANY)* a, ubyte** out_); 760 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_SEQUENCE_ANY_it; 761 .ASN1_SEQUENCE_ANY* d2i_ASN1_SET_ANY(.ASN1_SEQUENCE_ANY** a, const (ubyte)** in_, core.stdc.config.c_long len); 762 int i2d_ASN1_SET_ANY(const (.ASN1_SEQUENCE_ANY)* a, ubyte** out_); 763 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_SET_ANY_it; 764 765 struct NETSCAPE_X509_st 766 { 767 libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* header; 768 libressl_d.openssl.ossl_typ.X509* cert; 769 } 770 771 alias NETSCAPE_X509 = .NETSCAPE_X509_st; 772 773 /** 774 * This is used to contain a list of bit names 775 */ 776 struct BIT_STRING_BITNAME_st 777 { 778 int bitnum; 779 const (char)* lname; 780 const (char)* sname; 781 } 782 783 alias BIT_STRING_BITNAME = .BIT_STRING_BITNAME_st; 784 785 enum B_ASN1_TIME = .B_ASN1_UTCTIME | .B_ASN1_GENERALIZEDTIME; 786 787 enum B_ASN1_PRINTABLE = .B_ASN1_NUMERICSTRING | .B_ASN1_PRINTABLESTRING | .B_ASN1_T61STRING | .B_ASN1_IA5STRING | .B_ASN1_BIT_STRING | .B_ASN1_UNIVERSALSTRING | .B_ASN1_BMPSTRING | .B_ASN1_UTF8STRING | .B_ASN1_SEQUENCE | .B_ASN1_UNKNOWN; 788 789 enum B_ASN1_DIRECTORYSTRING = .B_ASN1_PRINTABLESTRING | .B_ASN1_TELETEXSTRING | .B_ASN1_BMPSTRING | .B_ASN1_UNIVERSALSTRING | .B_ASN1_UTF8STRING; 790 791 enum B_ASN1_DISPLAYTEXT = .B_ASN1_IA5STRING | .B_ASN1_VISIBLESTRING | .B_ASN1_BMPSTRING | .B_ASN1_UTF8STRING; 792 793 version (LIBRESSL_INTERNAL) { 794 } else { 795 alias M_ASN1_IA5STRING_new = .ASN1_IA5STRING_new; 796 797 alias M_ASN1_INTEGER_free = .ASN1_INTEGER_free; 798 alias M_ASN1_ENUMERATED_free = .ASN1_ENUMERATED_free; 799 alias M_ASN1_OCTET_STRING_free = .ASN1_OCTET_STRING_free; 800 801 alias M_ASN1_OCTET_STRING_print = .ASN1_STRING_print; 802 803 alias M_ASN1_STRING_data = .ASN1_STRING_data; 804 alias M_ASN1_STRING_length = .ASN1_STRING_length; 805 } 806 807 .ASN1_TYPE* ASN1_TYPE_new(); 808 void ASN1_TYPE_free(.ASN1_TYPE* a); 809 .ASN1_TYPE* d2i_ASN1_TYPE(.ASN1_TYPE** a, const (ubyte)** in_, core.stdc.config.c_long len); 810 int i2d_ASN1_TYPE(.ASN1_TYPE* a, ubyte** out_); 811 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_ANY_it; 812 813 int ASN1_TYPE_get(const (.ASN1_TYPE)* a); 814 void ASN1_TYPE_set(.ASN1_TYPE* a, int type, void* value); 815 int ASN1_TYPE_set1(.ASN1_TYPE* a, int type, const (void)* value); 816 int ASN1_TYPE_cmp(const (.ASN1_TYPE)* a, const (.ASN1_TYPE)* b); 817 818 .ASN1_OBJECT* ASN1_OBJECT_new(); 819 void ASN1_OBJECT_free(.ASN1_OBJECT* a); 820 int i2d_ASN1_OBJECT(const (.ASN1_OBJECT)* a, ubyte** pp); 821 .ASN1_OBJECT* c2i_ASN1_OBJECT(.ASN1_OBJECT** a, const (ubyte)** pp, core.stdc.config.c_long length_); 822 .ASN1_OBJECT* d2i_ASN1_OBJECT(.ASN1_OBJECT** a, const (ubyte)** pp, core.stdc.config.c_long length_); 823 824 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_OBJECT_it; 825 826 //DECLARE_STACK_OF(ASN1_OBJECT) 827 struct stack_st_ASN1_OBJECT 828 { 829 libressl_d.openssl.stack._STACK stack; 830 } 831 832 libressl_d.openssl.ossl_typ.ASN1_STRING* ASN1_STRING_new(); 833 void ASN1_STRING_free(libressl_d.openssl.ossl_typ.ASN1_STRING* a); 834 int ASN1_STRING_copy(libressl_d.openssl.ossl_typ.ASN1_STRING* dst, const (libressl_d.openssl.ossl_typ.ASN1_STRING)* str); 835 libressl_d.openssl.ossl_typ.ASN1_STRING* ASN1_STRING_dup(const (libressl_d.openssl.ossl_typ.ASN1_STRING)* a); 836 libressl_d.openssl.ossl_typ.ASN1_STRING* ASN1_STRING_type_new(int type); 837 int ASN1_STRING_cmp(const (libressl_d.openssl.ossl_typ.ASN1_STRING)* a, const (libressl_d.openssl.ossl_typ.ASN1_STRING)* b); 838 /* 839 * Since this is used to store all sorts of things, via macros, for now, make 840 * its data void* 841 */ 842 int ASN1_STRING_set(libressl_d.openssl.ossl_typ.ASN1_STRING* str, const (void)* data, int len); 843 void ASN1_STRING_set0(libressl_d.openssl.ossl_typ.ASN1_STRING* str, void* data, int len); 844 int ASN1_STRING_length(const (libressl_d.openssl.ossl_typ.ASN1_STRING)* x); 845 void ASN1_STRING_length_set(libressl_d.openssl.ossl_typ.ASN1_STRING* x, int n); 846 int ASN1_STRING_type(const (libressl_d.openssl.ossl_typ.ASN1_STRING)* x); 847 ubyte* ASN1_STRING_data(libressl_d.openssl.ossl_typ.ASN1_STRING* x); 848 const (ubyte)* ASN1_STRING_get0_data(const (libressl_d.openssl.ossl_typ.ASN1_STRING)* x); 849 850 libressl_d.openssl.ossl_typ.ASN1_BIT_STRING* ASN1_BIT_STRING_new(); 851 void ASN1_BIT_STRING_free(libressl_d.openssl.ossl_typ.ASN1_BIT_STRING* a); 852 libressl_d.openssl.ossl_typ.ASN1_BIT_STRING* d2i_ASN1_BIT_STRING(libressl_d.openssl.ossl_typ.ASN1_BIT_STRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 853 int i2d_ASN1_BIT_STRING(libressl_d.openssl.ossl_typ.ASN1_BIT_STRING* a, ubyte** out_); 854 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_BIT_STRING_it; 855 int i2c_ASN1_BIT_STRING(libressl_d.openssl.ossl_typ.ASN1_BIT_STRING* a, ubyte** pp); 856 libressl_d.openssl.ossl_typ.ASN1_BIT_STRING* c2i_ASN1_BIT_STRING(libressl_d.openssl.ossl_typ.ASN1_BIT_STRING** a, const (ubyte)** pp, core.stdc.config.c_long length_); 857 int ASN1_BIT_STRING_set(libressl_d.openssl.ossl_typ.ASN1_BIT_STRING* a, ubyte* d, int length_); 858 int ASN1_BIT_STRING_set_bit(libressl_d.openssl.ossl_typ.ASN1_BIT_STRING* a, int n, int value); 859 int ASN1_BIT_STRING_get_bit(const (libressl_d.openssl.ossl_typ.ASN1_BIT_STRING)* a, int n); 860 int ASN1_BIT_STRING_check(const (libressl_d.openssl.ossl_typ.ASN1_BIT_STRING)* a, const (ubyte)* flags, int flags_len); 861 862 version (OPENSSL_NO_BIO) { 863 } else { 864 int ASN1_BIT_STRING_name_print(libressl_d.openssl.bio.BIO* out_, libressl_d.openssl.ossl_typ.ASN1_BIT_STRING* bs, .BIT_STRING_BITNAME* tbl, int indent); 865 } 866 867 int ASN1_BIT_STRING_num_asc(const (char)* name, .BIT_STRING_BITNAME* tbl); 868 int ASN1_BIT_STRING_set_asc(libressl_d.openssl.ossl_typ.ASN1_BIT_STRING* bs, const (char)* name, int value, .BIT_STRING_BITNAME* tbl); 869 870 int i2d_ASN1_BOOLEAN(int a, ubyte** pp); 871 int d2i_ASN1_BOOLEAN(int* a, const (ubyte)** pp, core.stdc.config.c_long length_); 872 873 libressl_d.openssl.ossl_typ.ASN1_INTEGER* ASN1_INTEGER_new(); 874 void ASN1_INTEGER_free(libressl_d.openssl.ossl_typ.ASN1_INTEGER* a); 875 libressl_d.openssl.ossl_typ.ASN1_INTEGER* d2i_ASN1_INTEGER(libressl_d.openssl.ossl_typ.ASN1_INTEGER** a, const (ubyte)** in_, core.stdc.config.c_long len); 876 int i2d_ASN1_INTEGER(libressl_d.openssl.ossl_typ.ASN1_INTEGER* a, ubyte** out_); 877 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_INTEGER_it; 878 int i2c_ASN1_INTEGER(libressl_d.openssl.ossl_typ.ASN1_INTEGER* a, ubyte** pp); 879 libressl_d.openssl.ossl_typ.ASN1_INTEGER* c2i_ASN1_INTEGER(libressl_d.openssl.ossl_typ.ASN1_INTEGER** a, const (ubyte)** pp, core.stdc.config.c_long length_); 880 libressl_d.openssl.ossl_typ.ASN1_INTEGER* d2i_ASN1_UINTEGER(libressl_d.openssl.ossl_typ.ASN1_INTEGER** a, const (ubyte)** pp, core.stdc.config.c_long length_); 881 libressl_d.openssl.ossl_typ.ASN1_INTEGER* ASN1_INTEGER_dup(const (libressl_d.openssl.ossl_typ.ASN1_INTEGER)* x); 882 int ASN1_INTEGER_cmp(const (libressl_d.openssl.ossl_typ.ASN1_INTEGER)* x, const (libressl_d.openssl.ossl_typ.ASN1_INTEGER)* y); 883 884 libressl_d.openssl.ossl_typ.ASN1_ENUMERATED* ASN1_ENUMERATED_new(); 885 void ASN1_ENUMERATED_free(libressl_d.openssl.ossl_typ.ASN1_ENUMERATED* a); 886 libressl_d.openssl.ossl_typ.ASN1_ENUMERATED* d2i_ASN1_ENUMERATED(libressl_d.openssl.ossl_typ.ASN1_ENUMERATED** a, const (ubyte)** in_, core.stdc.config.c_long len); 887 int i2d_ASN1_ENUMERATED(libressl_d.openssl.ossl_typ.ASN1_ENUMERATED* a, ubyte** out_); 888 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_ENUMERATED_it; 889 890 int ASN1_UTCTIME_check(const (libressl_d.openssl.ossl_typ.ASN1_UTCTIME)* a); 891 libressl_d.openssl.ossl_typ.ASN1_UTCTIME* ASN1_UTCTIME_set(libressl_d.openssl.ossl_typ.ASN1_UTCTIME* s, libressl_d.compat.time.time_t t); 892 libressl_d.openssl.ossl_typ.ASN1_UTCTIME* ASN1_UTCTIME_adj(libressl_d.openssl.ossl_typ.ASN1_UTCTIME* s, libressl_d.compat.time.time_t t, int offset_day, core.stdc.config.c_long offset_sec); 893 int ASN1_UTCTIME_set_string(libressl_d.openssl.ossl_typ.ASN1_UTCTIME* s, const (char)* str); 894 895 version (LIBRESSL_INTERNAL) { 896 } else { 897 int ASN1_UTCTIME_cmp_time_t(const (libressl_d.openssl.ossl_typ.ASN1_UTCTIME)* s, libressl_d.compat.time.time_t t); 898 } 899 900 int ASN1_GENERALIZEDTIME_check(const (libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME)* a); 901 libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME* ASN1_GENERALIZEDTIME_set(libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME* s, libressl_d.compat.time.time_t t); 902 libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME* ASN1_GENERALIZEDTIME_adj(libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME* s, libressl_d.compat.time.time_t t, int offset_day, core.stdc.config.c_long offset_sec); 903 int ASN1_GENERALIZEDTIME_set_string(libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME* s, const (char)* str); 904 905 libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* ASN1_OCTET_STRING_new(); 906 void ASN1_OCTET_STRING_free(libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* a); 907 libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* d2i_ASN1_OCTET_STRING(libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 908 int i2d_ASN1_OCTET_STRING(libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* a, ubyte** out_); 909 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_OCTET_STRING_it; 910 libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* ASN1_OCTET_STRING_dup(const (libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING)* a); 911 int ASN1_OCTET_STRING_cmp(const (libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING)* a, const (libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING)* b); 912 int ASN1_OCTET_STRING_set(libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING* str, const (ubyte)* data, int len); 913 914 libressl_d.openssl.ossl_typ.ASN1_VISIBLESTRING* ASN1_VISIBLESTRING_new(); 915 void ASN1_VISIBLESTRING_free(libressl_d.openssl.ossl_typ.ASN1_VISIBLESTRING* a); 916 libressl_d.openssl.ossl_typ.ASN1_VISIBLESTRING* d2i_ASN1_VISIBLESTRING(libressl_d.openssl.ossl_typ.ASN1_VISIBLESTRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 917 int i2d_ASN1_VISIBLESTRING(libressl_d.openssl.ossl_typ.ASN1_VISIBLESTRING* a, ubyte** out_); 918 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_VISIBLESTRING_it; 919 libressl_d.openssl.ossl_typ.ASN1_UNIVERSALSTRING* ASN1_UNIVERSALSTRING_new(); 920 void ASN1_UNIVERSALSTRING_free(libressl_d.openssl.ossl_typ.ASN1_UNIVERSALSTRING* a); 921 libressl_d.openssl.ossl_typ.ASN1_UNIVERSALSTRING* d2i_ASN1_UNIVERSALSTRING(libressl_d.openssl.ossl_typ.ASN1_UNIVERSALSTRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 922 int i2d_ASN1_UNIVERSALSTRING(libressl_d.openssl.ossl_typ.ASN1_UNIVERSALSTRING* a, ubyte** out_); 923 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_UNIVERSALSTRING_it; 924 libressl_d.openssl.ossl_typ.ASN1_UTF8STRING* ASN1_UTF8STRING_new(); 925 void ASN1_UTF8STRING_free(libressl_d.openssl.ossl_typ.ASN1_UTF8STRING* a); 926 libressl_d.openssl.ossl_typ.ASN1_UTF8STRING* d2i_ASN1_UTF8STRING(libressl_d.openssl.ossl_typ.ASN1_UTF8STRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 927 int i2d_ASN1_UTF8STRING(libressl_d.openssl.ossl_typ.ASN1_UTF8STRING* a, ubyte** out_); 928 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_UTF8STRING_it; 929 libressl_d.openssl.ossl_typ.ASN1_NULL* ASN1_NULL_new(); 930 void ASN1_NULL_free(libressl_d.openssl.ossl_typ.ASN1_NULL* a); 931 libressl_d.openssl.ossl_typ.ASN1_NULL* d2i_ASN1_NULL(libressl_d.openssl.ossl_typ.ASN1_NULL** a, const (ubyte)** in_, core.stdc.config.c_long len); 932 int i2d_ASN1_NULL(libressl_d.openssl.ossl_typ.ASN1_NULL* a, ubyte** out_); 933 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_NULL_it; 934 libressl_d.openssl.ossl_typ.ASN1_BMPSTRING* ASN1_BMPSTRING_new(); 935 void ASN1_BMPSTRING_free(libressl_d.openssl.ossl_typ.ASN1_BMPSTRING* a); 936 libressl_d.openssl.ossl_typ.ASN1_BMPSTRING* d2i_ASN1_BMPSTRING(libressl_d.openssl.ossl_typ.ASN1_BMPSTRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 937 int i2d_ASN1_BMPSTRING(libressl_d.openssl.ossl_typ.ASN1_BMPSTRING* a, ubyte** out_); 938 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_BMPSTRING_it; 939 940 libressl_d.openssl.ossl_typ.ASN1_STRING* ASN1_PRINTABLE_new(); 941 void ASN1_PRINTABLE_free(libressl_d.openssl.ossl_typ.ASN1_STRING* a); 942 libressl_d.openssl.ossl_typ.ASN1_STRING* d2i_ASN1_PRINTABLE(libressl_d.openssl.ossl_typ.ASN1_STRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 943 int i2d_ASN1_PRINTABLE(libressl_d.openssl.ossl_typ.ASN1_STRING* a, ubyte** out_); 944 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_PRINTABLE_it; 945 946 libressl_d.openssl.ossl_typ.ASN1_STRING* DIRECTORYSTRING_new(); 947 void DIRECTORYSTRING_free(libressl_d.openssl.ossl_typ.ASN1_STRING* a); 948 libressl_d.openssl.ossl_typ.ASN1_STRING* d2i_DIRECTORYSTRING(libressl_d.openssl.ossl_typ.ASN1_STRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 949 int i2d_DIRECTORYSTRING(libressl_d.openssl.ossl_typ.ASN1_STRING* a, ubyte** out_); 950 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM DIRECTORYSTRING_it; 951 libressl_d.openssl.ossl_typ.ASN1_STRING* DISPLAYTEXT_new(); 952 void DISPLAYTEXT_free(libressl_d.openssl.ossl_typ.ASN1_STRING* a); 953 libressl_d.openssl.ossl_typ.ASN1_STRING* d2i_DISPLAYTEXT(libressl_d.openssl.ossl_typ.ASN1_STRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 954 int i2d_DISPLAYTEXT(libressl_d.openssl.ossl_typ.ASN1_STRING* a, ubyte** out_); 955 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM DISPLAYTEXT_it; 956 libressl_d.openssl.ossl_typ.ASN1_PRINTABLESTRING* ASN1_PRINTABLESTRING_new(); 957 void ASN1_PRINTABLESTRING_free(libressl_d.openssl.ossl_typ.ASN1_PRINTABLESTRING* a); 958 libressl_d.openssl.ossl_typ.ASN1_PRINTABLESTRING* d2i_ASN1_PRINTABLESTRING(libressl_d.openssl.ossl_typ.ASN1_PRINTABLESTRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 959 int i2d_ASN1_PRINTABLESTRING(libressl_d.openssl.ossl_typ.ASN1_PRINTABLESTRING* a, ubyte** out_); 960 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_PRINTABLESTRING_it; 961 libressl_d.openssl.ossl_typ.ASN1_T61STRING* ASN1_T61STRING_new(); 962 void ASN1_T61STRING_free(libressl_d.openssl.ossl_typ.ASN1_T61STRING* a); 963 libressl_d.openssl.ossl_typ.ASN1_T61STRING* d2i_ASN1_T61STRING(libressl_d.openssl.ossl_typ.ASN1_T61STRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 964 int i2d_ASN1_T61STRING(libressl_d.openssl.ossl_typ.ASN1_T61STRING* a, ubyte** out_); 965 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_T61STRING_it; 966 libressl_d.openssl.ossl_typ.ASN1_IA5STRING* ASN1_IA5STRING_new(); 967 void ASN1_IA5STRING_free(libressl_d.openssl.ossl_typ.ASN1_IA5STRING* a); 968 libressl_d.openssl.ossl_typ.ASN1_IA5STRING* d2i_ASN1_IA5STRING(libressl_d.openssl.ossl_typ.ASN1_IA5STRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 969 int i2d_ASN1_IA5STRING(libressl_d.openssl.ossl_typ.ASN1_IA5STRING* a, ubyte** out_); 970 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_IA5STRING_it; 971 libressl_d.openssl.ossl_typ.ASN1_GENERALSTRING* ASN1_GENERALSTRING_new(); 972 void ASN1_GENERALSTRING_free(libressl_d.openssl.ossl_typ.ASN1_GENERALSTRING* a); 973 libressl_d.openssl.ossl_typ.ASN1_GENERALSTRING* d2i_ASN1_GENERALSTRING(libressl_d.openssl.ossl_typ.ASN1_GENERALSTRING** a, const (ubyte)** in_, core.stdc.config.c_long len); 974 int i2d_ASN1_GENERALSTRING(libressl_d.openssl.ossl_typ.ASN1_GENERALSTRING* a, ubyte** out_); 975 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_GENERALSTRING_it; 976 libressl_d.openssl.ossl_typ.ASN1_UTCTIME* ASN1_UTCTIME_new(); 977 void ASN1_UTCTIME_free(libressl_d.openssl.ossl_typ.ASN1_UTCTIME* a); 978 libressl_d.openssl.ossl_typ.ASN1_UTCTIME* d2i_ASN1_UTCTIME(libressl_d.openssl.ossl_typ.ASN1_UTCTIME** a, const (ubyte)** in_, core.stdc.config.c_long len); 979 int i2d_ASN1_UTCTIME(libressl_d.openssl.ossl_typ.ASN1_UTCTIME* a, ubyte** out_); 980 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_UTCTIME_it; 981 libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME* ASN1_GENERALIZEDTIME_new(); 982 void ASN1_GENERALIZEDTIME_free(libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME* a); 983 libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME* d2i_ASN1_GENERALIZEDTIME(libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME** a, const (ubyte)** in_, core.stdc.config.c_long len); 984 int i2d_ASN1_GENERALIZEDTIME(libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME* a, ubyte** out_); 985 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_GENERALIZEDTIME_it; 986 libressl_d.openssl.ossl_typ.ASN1_TIME* ASN1_TIME_new(); 987 void ASN1_TIME_free(libressl_d.openssl.ossl_typ.ASN1_TIME* a); 988 libressl_d.openssl.ossl_typ.ASN1_TIME* d2i_ASN1_TIME(libressl_d.openssl.ossl_typ.ASN1_TIME** a, const (ubyte)** in_, core.stdc.config.c_long len); 989 int i2d_ASN1_TIME(libressl_d.openssl.ossl_typ.ASN1_TIME* a, ubyte** out_); 990 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_TIME_it; 991 992 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM ASN1_OCTET_STRING_NDEF_it; 993 994 libressl_d.openssl.ossl_typ.ASN1_TIME* ASN1_TIME_set(libressl_d.openssl.ossl_typ.ASN1_TIME* s, libressl_d.compat.time.time_t t); 995 libressl_d.openssl.ossl_typ.ASN1_TIME* ASN1_TIME_set_tm(libressl_d.openssl.ossl_typ.ASN1_TIME* s, libressl_d.compat.time.tm* tm); 996 libressl_d.openssl.ossl_typ.ASN1_TIME* ASN1_TIME_adj(libressl_d.openssl.ossl_typ.ASN1_TIME* s, libressl_d.compat.time.time_t t, int offset_day, core.stdc.config.c_long offset_sec); 997 int ASN1_TIME_check(const (libressl_d.openssl.ossl_typ.ASN1_TIME)* t); 998 libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME* ASN1_TIME_to_generalizedtime(const (libressl_d.openssl.ossl_typ.ASN1_TIME)* t, libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME** out_); 999 int ASN1_TIME_set_string(libressl_d.openssl.ossl_typ.ASN1_TIME* s, const (char)* str); 1000 1001 version (OPENSSL_NO_BIO) { 1002 } else { 1003 int i2a_ASN1_INTEGER(libressl_d.openssl.bio.BIO* bp, const (libressl_d.openssl.ossl_typ.ASN1_INTEGER)* a); 1004 int a2i_ASN1_INTEGER(libressl_d.openssl.bio.BIO* bp, libressl_d.openssl.ossl_typ.ASN1_INTEGER* bs, char* buf, int size); 1005 int i2a_ASN1_ENUMERATED(libressl_d.openssl.bio.BIO* bp, const (libressl_d.openssl.ossl_typ.ASN1_ENUMERATED)* a); 1006 int a2i_ASN1_ENUMERATED(libressl_d.openssl.bio.BIO* bp, libressl_d.openssl.ossl_typ.ASN1_ENUMERATED* bs, char* buf, int size); 1007 int i2a_ASN1_OBJECT(libressl_d.openssl.bio.BIO* bp, const (.ASN1_OBJECT)* a); 1008 int a2i_ASN1_STRING(libressl_d.openssl.bio.BIO* bp, libressl_d.openssl.ossl_typ.ASN1_STRING* bs, char* buf, int size); 1009 int i2a_ASN1_STRING(libressl_d.openssl.bio.BIO* bp, const (libressl_d.openssl.ossl_typ.ASN1_STRING)* a, int type); 1010 } 1011 1012 int i2t_ASN1_OBJECT(char* buf, int buf_len, const (.ASN1_OBJECT)* a); 1013 1014 int a2d_ASN1_OBJECT(ubyte* out_, int olen, const (char)* buf, int num); 1015 .ASN1_OBJECT* ASN1_OBJECT_create(int nid, ubyte* data, int len, const (char)* sn, const (char)* ln); 1016 1017 int ASN1_INTEGER_set(libressl_d.openssl.ossl_typ.ASN1_INTEGER* a, core.stdc.config.c_long v); 1018 core.stdc.config.c_long ASN1_INTEGER_get(const (libressl_d.openssl.ossl_typ.ASN1_INTEGER)* a); 1019 libressl_d.openssl.ossl_typ.ASN1_INTEGER* BN_to_ASN1_INTEGER(const (libressl_d.openssl.ossl_typ.BIGNUM)* bn, libressl_d.openssl.ossl_typ.ASN1_INTEGER* ai); 1020 libressl_d.openssl.ossl_typ.BIGNUM* ASN1_INTEGER_to_BN(const (libressl_d.openssl.ossl_typ.ASN1_INTEGER)* ai, libressl_d.openssl.ossl_typ.BIGNUM* bn); 1021 1022 int ASN1_ENUMERATED_set(libressl_d.openssl.ossl_typ.ASN1_ENUMERATED* a, core.stdc.config.c_long v); 1023 core.stdc.config.c_long ASN1_ENUMERATED_get(const (libressl_d.openssl.ossl_typ.ASN1_ENUMERATED)* a); 1024 libressl_d.openssl.ossl_typ.ASN1_ENUMERATED* BN_to_ASN1_ENUMERATED(const (libressl_d.openssl.ossl_typ.BIGNUM)* bn, libressl_d.openssl.ossl_typ.ASN1_ENUMERATED* ai); 1025 libressl_d.openssl.ossl_typ.BIGNUM* ASN1_ENUMERATED_to_BN(const (libressl_d.openssl.ossl_typ.ASN1_ENUMERATED)* ai, libressl_d.openssl.ossl_typ.BIGNUM* bn); 1026 1027 /* General */ 1028 /** 1029 * given a string, return the correct type, max is the maximum length 1030 */ 1031 int ASN1_PRINTABLE_type(const (ubyte)* s, int max); 1032 1033 /* SPECIALS */ 1034 int ASN1_get_object(const (ubyte)** pp, core.stdc.config.c_long* plength, int* ptag, int* pclass, core.stdc.config.c_long omax); 1035 int ASN1_check_infinite_end(ubyte** p, core.stdc.config.c_long len); 1036 int ASN1_const_check_infinite_end(const (ubyte)** p, core.stdc.config.c_long len); 1037 void ASN1_put_object(ubyte** pp, int constructed, int length_, int tag, int xclass); 1038 int ASN1_put_eoc(ubyte** pp); 1039 int ASN1_object_size(int constructed, int length_, int tag); 1040 1041 void* ASN1_item_dup(const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it, void* x); 1042 1043 package alias d2i_of_void = void; 1044 package alias i2d_of_void = void; 1045 1046 version (LIBRESSL_INTERNAL) { 1047 } else { 1048 void* ASN1_dup(i2d_of_void* i2d, d2i_of_void* d2i, void* x); 1049 } 1050 1051 void* ASN1_d2i_fp(void* function() xnew, d2i_of_void* d2i, libressl_d.compat.stdio.FILE* in_, void** x); 1052 1053 //#define ASN1_d2i_fp_of(type, xnew, d2i, in_, x) ((type*) .ASN1_d2i_fp(.CHECKED_NEW_OF(type, xnew), .CHECKED_D2I_OF(type, d2i), in_, .CHECKED_PPTR_OF(type, x))) 1054 1055 void* ASN1_item_d2i_fp(const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it, libressl_d.compat.stdio.FILE* in_, void* x); 1056 int ASN1_i2d_fp(i2d_of_void* i2d, libressl_d.compat.stdio.FILE* out_, void* x); 1057 1058 //#define ASN1_i2d_fp_of(type, i2d, out_, x) (.ASN1_i2d_fp(.CHECKED_I2D_OF(type, i2d), out_, .CHECKED_PTR_OF(type, x))) 1059 1060 //#define ASN1_i2d_fp_of_const(type, i2d, out_, x) (.ASN1_i2d_fp(.CHECKED_I2D_OF(const type, i2d), out_, .CHECKED_PTR_OF(const type, x))) 1061 1062 int ASN1_item_i2d_fp(const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it, libressl_d.compat.stdio.FILE* out_, void* x); 1063 int ASN1_STRING_print_ex_fp(libressl_d.compat.stdio.FILE* fp, const (libressl_d.openssl.ossl_typ.ASN1_STRING)* str, core.stdc.config.c_ulong flags); 1064 1065 int ASN1_STRING_to_UTF8(ubyte** out_, const (libressl_d.openssl.ossl_typ.ASN1_STRING)* in_); 1066 1067 version (OPENSSL_NO_BIO) { 1068 } else { 1069 void* ASN1_d2i_bio(void* function() xnew, d2i_of_void* d2i, libressl_d.openssl.bio.BIO* in_, void** x); 1070 1071 //#define ASN1_d2i_bio_of(type, xnew, d2i, in_, x) ((type*) .ASN1_d2i_bio(.CHECKED_NEW_OF(type, xnew), .CHECKED_D2I_OF(type, d2i), in_, .CHECKED_PPTR_OF(type, x))) 1072 1073 void* ASN1_item_d2i_bio(const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it, libressl_d.openssl.bio.BIO* in_, void* x); 1074 int ASN1_i2d_bio(i2d_of_void* i2d, libressl_d.openssl.bio.BIO* out_, ubyte* x); 1075 1076 //#define ASN1_i2d_bio_of(type, i2d, out_, x) (.ASN1_i2d_bio(.CHECKED_I2D_OF(type, i2d), out_, .CHECKED_PTR_OF(type, x))) 1077 1078 //#define ASN1_i2d_bio_of_const(type, i2d, out_, x) (.ASN1_i2d_bio(.CHECKED_I2D_OF(const type, i2d), out_, .CHECKED_PTR_OF(const type, x))) 1079 1080 int ASN1_item_i2d_bio(const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it, libressl_d.openssl.bio.BIO* out_, void* x); 1081 int ASN1_UTCTIME_print(libressl_d.openssl.bio.BIO* fp, const (libressl_d.openssl.ossl_typ.ASN1_UTCTIME)* a); 1082 int ASN1_GENERALIZEDTIME_print(libressl_d.openssl.bio.BIO* fp, const (libressl_d.openssl.ossl_typ.ASN1_GENERALIZEDTIME)* a); 1083 int ASN1_TIME_print(libressl_d.openssl.bio.BIO* fp, const (libressl_d.openssl.ossl_typ.ASN1_TIME)* a); 1084 int ASN1_STRING_print(libressl_d.openssl.bio.BIO* bp, const (libressl_d.openssl.ossl_typ.ASN1_STRING)* v); 1085 int ASN1_STRING_print_ex(libressl_d.openssl.bio.BIO* out_, const (libressl_d.openssl.ossl_typ.ASN1_STRING)* str, core.stdc.config.c_ulong flags); 1086 int ASN1_bn_print(libressl_d.openssl.bio.BIO* bp, const (char)* number, const (libressl_d.openssl.ossl_typ.BIGNUM)* num, ubyte* buf, int off); 1087 int ASN1_parse(libressl_d.openssl.bio.BIO* bp, const (ubyte)* pp, core.stdc.config.c_long len, int indent); 1088 int ASN1_parse_dump(libressl_d.openssl.bio.BIO* bp, const (ubyte)* pp, core.stdc.config.c_long len, int indent, int dump); 1089 } 1090 1091 core.stdc.config.c_ulong ASN1_tag2bit(int tag); 1092 const (char)* ASN1_tag2str(int tag); 1093 1094 /* Used to load and write netscape format cert */ 1095 1096 .NETSCAPE_X509* NETSCAPE_X509_new(); 1097 void NETSCAPE_X509_free(.NETSCAPE_X509* a); 1098 .NETSCAPE_X509* d2i_NETSCAPE_X509(.NETSCAPE_X509** a, const (ubyte)** in_, core.stdc.config.c_long len); 1099 int i2d_NETSCAPE_X509(.NETSCAPE_X509* a, ubyte** out_); 1100 extern __gshared const libressl_d.openssl.ossl_typ.ASN1_ITEM NETSCAPE_X509_it; 1101 1102 int ASN1_UNIVERSALSTRING_to_string(libressl_d.openssl.ossl_typ.ASN1_UNIVERSALSTRING* s); 1103 1104 int ASN1_TYPE_set_octetstring(.ASN1_TYPE* a, const (ubyte)* data, int len); 1105 int ASN1_TYPE_get_octetstring(const (.ASN1_TYPE)* a, ubyte* data, int max_len); 1106 int ASN1_TYPE_set_int_octetstring(.ASN1_TYPE* a, core.stdc.config.c_long num, const (ubyte)* data, int len); 1107 int ASN1_TYPE_get_int_octetstring(const (.ASN1_TYPE)* a, core.stdc.config.c_long* num, ubyte* data, int max_len); 1108 1109 libressl_d.openssl.ossl_typ.ASN1_STRING* ASN1_item_pack(void* obj, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it, libressl_d.openssl.ossl_typ.ASN1_OCTET_STRING** oct); 1110 void* ASN1_item_unpack(const (libressl_d.openssl.ossl_typ.ASN1_STRING)* oct, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it); 1111 1112 void ASN1_STRING_set_default_mask(core.stdc.config.c_ulong mask); 1113 int ASN1_STRING_set_default_mask_asc(const (char)* p); 1114 core.stdc.config.c_ulong ASN1_STRING_get_default_mask(); 1115 int ASN1_mbstring_copy(libressl_d.openssl.ossl_typ.ASN1_STRING** out_, const (ubyte)* in_, int len, int inform, core.stdc.config.c_ulong mask); 1116 int ASN1_mbstring_ncopy(libressl_d.openssl.ossl_typ.ASN1_STRING** out_, const (ubyte)* in_, int len, int inform, core.stdc.config.c_ulong mask, core.stdc.config.c_long minsize, core.stdc.config.c_long maxsize); 1117 1118 libressl_d.openssl.ossl_typ.ASN1_STRING* ASN1_STRING_set_by_NID(libressl_d.openssl.ossl_typ.ASN1_STRING** out_, const (ubyte)* in_, int inlen, int inform, int nid); 1119 .ASN1_STRING_TABLE* ASN1_STRING_TABLE_get(int nid); 1120 int ASN1_STRING_TABLE_add(int, core.stdc.config.c_long, core.stdc.config.c_long, core.stdc.config.c_ulong, core.stdc.config.c_ulong); 1121 void ASN1_STRING_TABLE_cleanup(); 1122 1123 /* ASN1 template functions */ 1124 1125 /* Old API compatible functions */ 1126 .ASN1_VALUE* ASN1_item_new(const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it); 1127 void ASN1_item_free(.ASN1_VALUE* val, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it); 1128 .ASN1_VALUE* ASN1_item_d2i(.ASN1_VALUE** val, const (ubyte)** in_, core.stdc.config.c_long len, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it); 1129 int ASN1_item_i2d(.ASN1_VALUE* val, ubyte** out_, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it); 1130 int ASN1_item_ndef_i2d(.ASN1_VALUE* val, ubyte** out_, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it); 1131 1132 void ASN1_add_oid_module(); 1133 1134 .ASN1_TYPE* ASN1_generate_nconf(const (char)* str, libressl_d.openssl.ossl_typ.CONF* nconf); 1135 .ASN1_TYPE* ASN1_generate_v3(const (char)* str, libressl_d.openssl.ossl_typ.X509V3_CTX* cnf); 1136 1137 /* ASN1 Print flags */ 1138 1139 /** 1140 * Indicate missing OPTIONAL fields 1141 */ 1142 enum ASN1_PCTX_FLAGS_SHOW_ABSENT = 0x0001; 1143 1144 /** 1145 * Mark start and end of SEQUENCE 1146 */ 1147 enum ASN1_PCTX_FLAGS_SHOW_SEQUENCE = 0x0002; 1148 1149 /** 1150 * Mark start and end of SEQUENCE/SET OF 1151 */ 1152 enum ASN1_PCTX_FLAGS_SHOW_SSOF = 0x0004; 1153 1154 /** 1155 * Show the ASN1 type of primitives 1156 */ 1157 enum ASN1_PCTX_FLAGS_SHOW_TYPE = 0x0008; 1158 1159 /** 1160 * Don't show ASN1 type of ANY 1161 */ 1162 enum ASN1_PCTX_FLAGS_NO_ANY_TYPE = 0x0010; 1163 1164 /** 1165 * Don't show ASN1 type of MSTRINGs 1166 */ 1167 enum ASN1_PCTX_FLAGS_NO_MSTRING_TYPE = 0x0020; 1168 1169 /** 1170 * Don't show field names in SEQUENCE 1171 */ 1172 enum ASN1_PCTX_FLAGS_NO_FIELD_NAME = 0x0040; 1173 1174 /** 1175 * Show structure names of each SEQUENCE field 1176 */ 1177 enum ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME = 0x0080; 1178 1179 /** 1180 * Don't show structure name even at top level 1181 */ 1182 enum ASN1_PCTX_FLAGS_NO_STRUCT_NAME = 0x0100; 1183 1184 int ASN1_item_print(libressl_d.openssl.bio.BIO* out_, .ASN1_VALUE* ifld, int indent, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it, const (libressl_d.openssl.ossl_typ.ASN1_PCTX)* pctx); 1185 libressl_d.openssl.ossl_typ.ASN1_PCTX* ASN1_PCTX_new(); 1186 void ASN1_PCTX_free(libressl_d.openssl.ossl_typ.ASN1_PCTX* p); 1187 core.stdc.config.c_ulong ASN1_PCTX_get_flags(const (libressl_d.openssl.ossl_typ.ASN1_PCTX)* p); 1188 void ASN1_PCTX_set_flags(libressl_d.openssl.ossl_typ.ASN1_PCTX* p, core.stdc.config.c_ulong flags); 1189 core.stdc.config.c_ulong ASN1_PCTX_get_nm_flags(const (libressl_d.openssl.ossl_typ.ASN1_PCTX)* p); 1190 void ASN1_PCTX_set_nm_flags(libressl_d.openssl.ossl_typ.ASN1_PCTX* p, core.stdc.config.c_ulong flags); 1191 core.stdc.config.c_ulong ASN1_PCTX_get_cert_flags(const (libressl_d.openssl.ossl_typ.ASN1_PCTX)* p); 1192 void ASN1_PCTX_set_cert_flags(libressl_d.openssl.ossl_typ.ASN1_PCTX* p, core.stdc.config.c_ulong flags); 1193 core.stdc.config.c_ulong ASN1_PCTX_get_oid_flags(const (libressl_d.openssl.ossl_typ.ASN1_PCTX)* p); 1194 void ASN1_PCTX_set_oid_flags(libressl_d.openssl.ossl_typ.ASN1_PCTX* p, core.stdc.config.c_ulong flags); 1195 core.stdc.config.c_ulong ASN1_PCTX_get_str_flags(const (libressl_d.openssl.ossl_typ.ASN1_PCTX)* p); 1196 void ASN1_PCTX_set_str_flags(libressl_d.openssl.ossl_typ.ASN1_PCTX* p, core.stdc.config.c_ulong flags); 1197 1198 const (libressl_d.openssl.bio.BIO_METHOD)* BIO_f_asn1(); 1199 1200 libressl_d.openssl.bio.BIO* BIO_new_NDEF(libressl_d.openssl.bio.BIO* out_, .ASN1_VALUE* val, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it); 1201 1202 int i2d_ASN1_bio_stream(libressl_d.openssl.bio.BIO* out_, .ASN1_VALUE* val, libressl_d.openssl.bio.BIO* in_, int flags, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it); 1203 int PEM_write_bio_ASN1_stream(libressl_d.openssl.bio.BIO* out_, .ASN1_VALUE* val, libressl_d.openssl.bio.BIO* in_, int flags, const (char)* hdr, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it); 1204 int SMIME_write_ASN1(libressl_d.openssl.bio.BIO* bio, .ASN1_VALUE* val, libressl_d.openssl.bio.BIO* data, int flags, int ctype_nid, int econt_nid, .stack_st_X509_ALGOR * mdalgs, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it); 1205 .ASN1_VALUE* SMIME_read_ASN1(libressl_d.openssl.bio.BIO* bio, libressl_d.openssl.bio.BIO** bcont, const (libressl_d.openssl.ossl_typ.ASN1_ITEM)* it); 1206 int SMIME_crlf_copy(libressl_d.openssl.bio.BIO* in_, libressl_d.openssl.bio.BIO* out_, int flags); 1207 int SMIME_text(libressl_d.openssl.bio.BIO* in_, libressl_d.openssl.bio.BIO* out_); 1208 1209 /* BEGIN ERROR CODES */ 1210 /** 1211 * The following lines are auto generated by the script mkerr.pl. Any changes 1212 * made after this point may be overwritten when the script is next run. 1213 */ 1214 void ERR_load_ASN1_strings(); 1215 1216 /* Error codes for the ASN1 functions. */ 1217 1218 /* Function codes. */ 1219 enum ASN1_F_A2D_ASN1_OBJECT = 100; 1220 enum ASN1_F_A2I_ASN1_ENUMERATED = 101; 1221 enum ASN1_F_A2I_ASN1_INTEGER = 102; 1222 enum ASN1_F_A2I_ASN1_STRING = 103; 1223 enum ASN1_F_APPEND_EXP = 176; 1224 enum ASN1_F_ASN1_BIT_STRING_SET_BIT = 183; 1225 enum ASN1_F_ASN1_CB = 177; 1226 enum ASN1_F_ASN1_CHECK_TLEN = 104; 1227 enum ASN1_F_ASN1_COLLATE_PRIMITIVE = 105; 1228 enum ASN1_F_ASN1_COLLECT = 106; 1229 enum ASN1_F_ASN1_D2I_EX_PRIMITIVE = 108; 1230 enum ASN1_F_ASN1_D2I_FP = 109; 1231 enum ASN1_F_ASN1_D2I_READ_BIO = 107; 1232 enum ASN1_F_ASN1_DIGEST = 184; 1233 enum ASN1_F_ASN1_DO_ADB = 110; 1234 enum ASN1_F_ASN1_DUP = 111; 1235 enum ASN1_F_ASN1_ENUMERATED_SET = 112; 1236 enum ASN1_F_ASN1_ENUMERATED_TO_BN = 113; 1237 enum ASN1_F_ASN1_EX_C2I = 204; 1238 enum ASN1_F_ASN1_FIND_END = 190; 1239 enum ASN1_F_ASN1_GENERALIZEDTIME_ADJ = 216; 1240 enum ASN1_F_ASN1_GENERALIZEDTIME_SET = 185; 1241 enum ASN1_F_ASN1_GENERATE_V3 = 178; 1242 enum ASN1_F_ASN1_GET_OBJECT = 114; 1243 enum ASN1_F_ASN1_HEADER_NEW = 115; 1244 enum ASN1_F_ASN1_I2D_BIO = 116; 1245 enum ASN1_F_ASN1_I2D_FP = 117; 1246 enum ASN1_F_ASN1_INTEGER_SET = 118; 1247 enum ASN1_F_ASN1_INTEGER_TO_BN = 119; 1248 enum ASN1_F_ASN1_ITEM_D2I_FP = 206; 1249 enum ASN1_F_ASN1_ITEM_DUP = 191; 1250 enum ASN1_F_ASN1_ITEM_EX_COMBINE_NEW = 121; 1251 enum ASN1_F_ASN1_ITEM_EX_D2I = 120; 1252 enum ASN1_F_ASN1_ITEM_I2D_BIO = 192; 1253 enum ASN1_F_ASN1_ITEM_I2D_FP = 193; 1254 enum ASN1_F_ASN1_ITEM_PACK = 198; 1255 enum ASN1_F_ASN1_ITEM_SIGN = 195; 1256 enum ASN1_F_ASN1_ITEM_SIGN_CTX = 220; 1257 enum ASN1_F_ASN1_ITEM_UNPACK = 199; 1258 enum ASN1_F_ASN1_ITEM_VERIFY = 197; 1259 enum ASN1_F_ASN1_MBSTRING_NCOPY = 122; 1260 enum ASN1_F_ASN1_OBJECT_NEW = 123; 1261 enum ASN1_F_ASN1_OUTPUT_DATA = 214; 1262 enum ASN1_F_ASN1_PACK_STRING = 124; 1263 enum ASN1_F_ASN1_PCTX_NEW = 205; 1264 enum ASN1_F_ASN1_PKCS5_PBE_SET = 125; 1265 enum ASN1_F_ASN1_SEQ_PACK = 126; 1266 enum ASN1_F_ASN1_SEQ_UNPACK = 127; 1267 enum ASN1_F_ASN1_SIGN = 128; 1268 enum ASN1_F_ASN1_STR2TYPE = 179; 1269 enum ASN1_F_ASN1_STRING_SET = 186; 1270 enum ASN1_F_ASN1_STRING_TABLE_ADD = 129; 1271 enum ASN1_F_ASN1_STRING_TYPE_NEW = 130; 1272 enum ASN1_F_ASN1_TEMPLATE_EX_D2I = 132; 1273 enum ASN1_F_ASN1_TEMPLATE_NEW = 133; 1274 enum ASN1_F_ASN1_TEMPLATE_NOEXP_D2I = 131; 1275 enum ASN1_F_ASN1_TIME_ADJ = 217; 1276 enum ASN1_F_ASN1_TIME_SET = 175; 1277 enum ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING = 134; 1278 enum ASN1_F_ASN1_TYPE_GET_OCTETSTRING = 135; 1279 enum ASN1_F_ASN1_UNPACK_STRING = 136; 1280 enum ASN1_F_ASN1_UTCTIME_ADJ = 218; 1281 enum ASN1_F_ASN1_UTCTIME_SET = 187; 1282 enum ASN1_F_ASN1_VERIFY = 137; 1283 enum ASN1_F_B64_READ_ASN1 = 209; 1284 enum ASN1_F_B64_WRITE_ASN1 = 210; 1285 enum ASN1_F_BIO_NEW_NDEF = 208; 1286 enum ASN1_F_BITSTR_CB = 180; 1287 enum ASN1_F_BN_TO_ASN1_ENUMERATED = 138; 1288 enum ASN1_F_BN_TO_ASN1_INTEGER = 139; 1289 enum ASN1_F_C2I_ASN1_BIT_STRING = 189; 1290 enum ASN1_F_C2I_ASN1_INTEGER = 194; 1291 enum ASN1_F_C2I_ASN1_OBJECT = 196; 1292 enum ASN1_F_COLLECT_DATA = 140; 1293 enum ASN1_F_D2I_ASN1_BIT_STRING = 141; 1294 enum ASN1_F_D2I_ASN1_BOOLEAN = 142; 1295 enum ASN1_F_D2I_ASN1_BYTES = 143; 1296 enum ASN1_F_D2I_ASN1_GENERALIZEDTIME = 144; 1297 enum ASN1_F_D2I_ASN1_HEADER = 145; 1298 enum ASN1_F_D2I_ASN1_INTEGER = 146; 1299 enum ASN1_F_D2I_ASN1_OBJECT = 147; 1300 enum ASN1_F_D2I_ASN1_SET = 148; 1301 enum ASN1_F_D2I_ASN1_TYPE_BYTES = 149; 1302 enum ASN1_F_D2I_ASN1_UINTEGER = 150; 1303 enum ASN1_F_D2I_ASN1_UTCTIME = 151; 1304 enum ASN1_F_D2I_AUTOPRIVATEKEY = 207; 1305 enum ASN1_F_D2I_NETSCAPE_RSA = 152; 1306 enum ASN1_F_D2I_NETSCAPE_RSA_2 = 153; 1307 enum ASN1_F_D2I_PRIVATEKEY = 154; 1308 enum ASN1_F_D2I_PUBLICKEY = 155; 1309 enum ASN1_F_D2I_RSA_NET = 200; 1310 enum ASN1_F_D2I_RSA_NET_2 = 201; 1311 enum ASN1_F_D2I_X509 = 156; 1312 enum ASN1_F_D2I_X509_CINF = 157; 1313 enum ASN1_F_D2I_X509_PKEY = 159; 1314 enum ASN1_F_I2D_ASN1_BIO_STREAM = 211; 1315 enum ASN1_F_I2D_ASN1_SET = 188; 1316 enum ASN1_F_I2D_ASN1_TIME = 160; 1317 enum ASN1_F_I2D_DSA_PUBKEY = 161; 1318 enum ASN1_F_I2D_EC_PUBKEY = 181; 1319 enum ASN1_F_I2D_PRIVATEKEY = 163; 1320 enum ASN1_F_I2D_PUBLICKEY = 164; 1321 enum ASN1_F_I2D_RSA_NET = 162; 1322 enum ASN1_F_I2D_RSA_PUBKEY = 165; 1323 enum ASN1_F_LONG_C2I = 166; 1324 enum ASN1_F_OID_MODULE_INIT = 174; 1325 enum ASN1_F_PARSE_TAGGING = 182; 1326 enum ASN1_F_PKCS5_PBE2_SET_IV = 167; 1327 enum ASN1_F_PKCS5_PBE_SET = 202; 1328 enum ASN1_F_PKCS5_PBE_SET0_ALGOR = 215; 1329 enum ASN1_F_PKCS5_PBKDF2_SET = 219; 1330 enum ASN1_F_SMIME_READ_ASN1 = 212; 1331 enum ASN1_F_SMIME_TEXT = 213; 1332 enum ASN1_F_X509_CINF_NEW = 168; 1333 enum ASN1_F_X509_CRL_ADD0_REVOKED = 169; 1334 enum ASN1_F_X509_INFO_NEW = 170; 1335 enum ASN1_F_X509_NAME_ENCODE = 203; 1336 enum ASN1_F_X509_NAME_EX_D2I = 158; 1337 enum ASN1_F_X509_NAME_EX_NEW = 171; 1338 enum ASN1_F_X509_NEW = 172; 1339 enum ASN1_F_X509_PKEY_NEW = 173; 1340 1341 /* Reason codes. */ 1342 enum ASN1_R_ADDING_OBJECT = 171; 1343 enum ASN1_R_ASN1_PARSE_ERROR = 203; 1344 enum ASN1_R_ASN1_SIG_PARSE_ERROR = 204; 1345 enum ASN1_R_AUX_ERROR = 100; 1346 enum ASN1_R_BAD_CLASS = 101; 1347 enum ASN1_R_BAD_OBJECT_HEADER = 102; 1348 enum ASN1_R_BAD_PASSWORD_READ = 103; 1349 enum ASN1_R_BAD_TAG = 104; 1350 enum ASN1_R_BAD_TEMPLATE = 230; 1351 enum ASN1_R_BMPSTRING_IS_WRONG_LENGTH = 214; 1352 enum ASN1_R_BN_LIB = 105; 1353 enum ASN1_R_BOOLEAN_IS_WRONG_LENGTH = 106; 1354 enum ASN1_R_BUFFER_TOO_SMALL = 107; 1355 enum ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER = 108; 1356 enum ASN1_R_CONTEXT_NOT_INITIALISED = 217; 1357 enum ASN1_R_DATA_IS_WRONG = 109; 1358 enum ASN1_R_DECODE_ERROR = 110; 1359 enum ASN1_R_DECODING_ERROR = 111; 1360 enum ASN1_R_DEPTH_EXCEEDED = 174; 1361 enum ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED = 198; 1362 enum ASN1_R_ENCODE_ERROR = 112; 1363 enum ASN1_R_ERROR_GETTING_TIME = 173; 1364 enum ASN1_R_ERROR_LOADING_SECTION = 172; 1365 enum ASN1_R_ERROR_PARSING_SET_ELEMENT = 113; 1366 enum ASN1_R_ERROR_SETTING_CIPHER_PARAMS = 114; 1367 enum ASN1_R_EXPECTING_AN_INTEGER = 115; 1368 enum ASN1_R_EXPECTING_AN_OBJECT = 116; 1369 enum ASN1_R_EXPECTING_A_BOOLEAN = 117; 1370 enum ASN1_R_EXPECTING_A_TIME = 118; 1371 enum ASN1_R_EXPLICIT_LENGTH_MISMATCH = 119; 1372 enum ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED = 120; 1373 enum ASN1_R_FIELD_MISSING = 121; 1374 enum ASN1_R_FIRST_NUM_TOO_LARGE = 122; 1375 enum ASN1_R_HEADER_TOO_LONG = 123; 1376 enum ASN1_R_ILLEGAL_BITSTRING_FORMAT = 175; 1377 enum ASN1_R_ILLEGAL_BOOLEAN = 176; 1378 enum ASN1_R_ILLEGAL_CHARACTERS = 124; 1379 enum ASN1_R_ILLEGAL_FORMAT = 177; 1380 enum ASN1_R_ILLEGAL_HEX = 178; 1381 enum ASN1_R_ILLEGAL_IMPLICIT_TAG = 179; 1382 enum ASN1_R_ILLEGAL_INTEGER = 180; 1383 enum ASN1_R_ILLEGAL_NESTED_TAGGING = 181; 1384 enum ASN1_R_ILLEGAL_NULL = 125; 1385 enum ASN1_R_ILLEGAL_NULL_VALUE = 182; 1386 enum ASN1_R_ILLEGAL_OBJECT = 183; 1387 enum ASN1_R_ILLEGAL_OPTIONAL_ANY = 126; 1388 enum ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE = 170; 1389 enum ASN1_R_ILLEGAL_TAGGED_ANY = 127; 1390 enum ASN1_R_ILLEGAL_TIME_VALUE = 184; 1391 enum ASN1_R_INTEGER_NOT_ASCII_FORMAT = 185; 1392 enum ASN1_R_INTEGER_TOO_LARGE_FOR_LONG = 128; 1393 enum ASN1_R_INVALID_BIT_STRING_BITS_LEFT = 220; 1394 enum ASN1_R_INVALID_BMPSTRING_LENGTH = 129; 1395 enum ASN1_R_INVALID_DIGIT = 130; 1396 enum ASN1_R_INVALID_MIME_TYPE = 205; 1397 enum ASN1_R_INVALID_MODIFIER = 186; 1398 enum ASN1_R_INVALID_NUMBER = 187; 1399 enum ASN1_R_INVALID_OBJECT_ENCODING = 216; 1400 enum ASN1_R_INVALID_SEPARATOR = 131; 1401 enum ASN1_R_INVALID_TIME_FORMAT = 132; 1402 enum ASN1_R_INVALID_UNIVERSALSTRING_LENGTH = 133; 1403 enum ASN1_R_INVALID_UTF8STRING = 134; 1404 enum ASN1_R_IV_TOO_LARGE = 135; 1405 enum ASN1_R_LENGTH_ERROR = 136; 1406 enum ASN1_R_LIST_ERROR = 188; 1407 enum ASN1_R_MIME_NO_CONTENT_TYPE = 206; 1408 enum ASN1_R_MIME_PARSE_ERROR = 207; 1409 enum ASN1_R_MIME_SIG_PARSE_ERROR = 208; 1410 enum ASN1_R_MISSING_EOC = 137; 1411 enum ASN1_R_MISSING_SECOND_NUMBER = 138; 1412 enum ASN1_R_MISSING_VALUE = 189; 1413 enum ASN1_R_MSTRING_NOT_UNIVERSAL = 139; 1414 enum ASN1_R_MSTRING_WRONG_TAG = 140; 1415 enum ASN1_R_NESTED_ASN1_STRING = 197; 1416 enum ASN1_R_NESTED_TOO_DEEP = 219; 1417 enum ASN1_R_NON_HEX_CHARACTERS = 141; 1418 enum ASN1_R_NOT_ASCII_FORMAT = 190; 1419 enum ASN1_R_NOT_ENOUGH_DATA = 142; 1420 enum ASN1_R_NO_CONTENT_TYPE = 209; 1421 enum ASN1_R_NO_DEFAULT_DIGEST = 201; 1422 enum ASN1_R_NO_MATCHING_CHOICE_TYPE = 143; 1423 enum ASN1_R_NO_MULTIPART_BODY_FAILURE = 210; 1424 enum ASN1_R_NO_MULTIPART_BOUNDARY = 211; 1425 enum ASN1_R_NO_SIG_CONTENT_TYPE = 212; 1426 enum ASN1_R_NULL_IS_WRONG_LENGTH = 144; 1427 enum ASN1_R_OBJECT_NOT_ASCII_FORMAT = 191; 1428 enum ASN1_R_ODD_NUMBER_OF_CHARS = 145; 1429 enum ASN1_R_PRIVATE_KEY_HEADER_MISSING = 146; 1430 enum ASN1_R_SECOND_NUMBER_TOO_LARGE = 147; 1431 enum ASN1_R_SEQUENCE_LENGTH_MISMATCH = 148; 1432 enum ASN1_R_SEQUENCE_NOT_CONSTRUCTED = 149; 1433 enum ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG = 192; 1434 enum ASN1_R_SHORT_LINE = 150; 1435 enum ASN1_R_SIG_INVALID_MIME_TYPE = 213; 1436 enum ASN1_R_STREAMING_NOT_SUPPORTED = 202; 1437 enum ASN1_R_STRING_TOO_LONG = 151; 1438 enum ASN1_R_STRING_TOO_SHORT = 152; 1439 enum ASN1_R_TAG_VALUE_TOO_HIGH = 153; 1440 enum ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD = 154; 1441 enum ASN1_R_TIME_NOT_ASCII_FORMAT = 193; 1442 enum ASN1_R_TOO_LONG = 155; 1443 enum ASN1_R_TYPE_NOT_CONSTRUCTED = 156; 1444 enum ASN1_R_UNABLE_TO_DECODE_RSA_KEY = 157; 1445 enum ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY = 158; 1446 enum ASN1_R_UNEXPECTED_EOC = 159; 1447 enum ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH = 215; 1448 enum ASN1_R_UNKNOWN_FORMAT = 160; 1449 enum ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM = 161; 1450 enum ASN1_R_UNKNOWN_OBJECT_TYPE = 162; 1451 enum ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE = 163; 1452 enum ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM = 199; 1453 enum ASN1_R_UNKNOWN_TAG = 194; 1454 enum ASN1_R_UNKOWN_FORMAT = 195; 1455 enum ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE = 164; 1456 enum ASN1_R_UNSUPPORTED_CIPHER = 165; 1457 enum ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM = 166; 1458 enum ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE = 167; 1459 enum ASN1_R_UNSUPPORTED_TYPE = 196; 1460 enum ASN1_R_WRONG_PUBLIC_KEY_TYPE = 200; 1461 enum ASN1_R_WRONG_TAG = 168; 1462 enum ASN1_R_WRONG_TYPE = 169; 1463 1464 int ASN1_time_parse(const (char)* _bytes, size_t _len, libressl_d.compat.time.tm* _tm, int _mode); 1465 int ASN1_time_tm_cmp(libressl_d.compat.time.tm* _tm1, libressl_d.compat.time.tm* _tm2);