diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/asn1t.h')
-rw-r--r-- | src/lib/libcrypto/asn1/asn1t.h | 71 |
1 files changed, 69 insertions, 2 deletions
diff --git a/src/lib/libcrypto/asn1/asn1t.h b/src/lib/libcrypto/asn1/asn1t.h index ac14f9415b..d230e4bf70 100644 --- a/src/lib/libcrypto/asn1/asn1t.h +++ b/src/lib/libcrypto/asn1/asn1t.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
5 | /* ==================================================================== | 5 | /* ==================================================================== |
6 | * Copyright (c) 2000 The OpenSSL Project. All rights reserved. | 6 | * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions |
@@ -218,6 +218,18 @@ extern "C" { | |||
218 | #stname \ | 218 | #stname \ |
219 | ASN1_ITEM_end(tname) | 219 | ASN1_ITEM_end(tname) |
220 | 220 | ||
221 | #define ASN1_NDEF_SEQUENCE_END_cb(stname, tname) \ | ||
222 | ;\ | ||
223 | ASN1_ITEM_start(tname) \ | ||
224 | ASN1_ITYPE_NDEF_SEQUENCE,\ | ||
225 | V_ASN1_SEQUENCE,\ | ||
226 | tname##_seq_tt,\ | ||
227 | sizeof(tname##_seq_tt) / sizeof(ASN1_TEMPLATE),\ | ||
228 | &tname##_aux,\ | ||
229 | sizeof(stname),\ | ||
230 | #stname \ | ||
231 | ASN1_ITEM_end(tname) | ||
232 | |||
221 | 233 | ||
222 | /* This pair helps declare a CHOICE type. We can do: | 234 | /* This pair helps declare a CHOICE type. We can do: |
223 | * | 235 | * |
@@ -651,8 +663,13 @@ typedef int ASN1_ex_i2d(ASN1_VALUE **pval, unsigned char **out, const ASN1_ITEM | |||
651 | typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); | 663 | typedef int ASN1_ex_new_func(ASN1_VALUE **pval, const ASN1_ITEM *it); |
652 | typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); | 664 | typedef void ASN1_ex_free_func(ASN1_VALUE **pval, const ASN1_ITEM *it); |
653 | 665 | ||
666 | typedef int ASN1_ex_print_func(BIO *out, ASN1_VALUE **pval, | ||
667 | int indent, const char *fname, | ||
668 | const ASN1_PCTX *pctx); | ||
669 | |||
654 | typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); | 670 | typedef int ASN1_primitive_i2c(ASN1_VALUE **pval, unsigned char *cont, int *putype, const ASN1_ITEM *it); |
655 | typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); | 671 | typedef int ASN1_primitive_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it); |
672 | typedef int ASN1_primitive_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, int indent, const ASN1_PCTX *pctx); | ||
656 | 673 | ||
657 | typedef struct ASN1_COMPAT_FUNCS_st { | 674 | typedef struct ASN1_COMPAT_FUNCS_st { |
658 | ASN1_new_func *asn1_new; | 675 | ASN1_new_func *asn1_new; |
@@ -668,6 +685,7 @@ typedef struct ASN1_EXTERN_FUNCS_st { | |||
668 | ASN1_ex_free_func *asn1_ex_clear; | 685 | ASN1_ex_free_func *asn1_ex_clear; |
669 | ASN1_ex_d2i *asn1_ex_d2i; | 686 | ASN1_ex_d2i *asn1_ex_d2i; |
670 | ASN1_ex_i2d *asn1_ex_i2d; | 687 | ASN1_ex_i2d *asn1_ex_i2d; |
688 | ASN1_ex_print_func *asn1_ex_print; | ||
671 | } ASN1_EXTERN_FUNCS; | 689 | } ASN1_EXTERN_FUNCS; |
672 | 690 | ||
673 | typedef struct ASN1_PRIMITIVE_FUNCS_st { | 691 | typedef struct ASN1_PRIMITIVE_FUNCS_st { |
@@ -678,6 +696,7 @@ typedef struct ASN1_PRIMITIVE_FUNCS_st { | |||
678 | ASN1_ex_free_func *prim_clear; | 696 | ASN1_ex_free_func *prim_clear; |
679 | ASN1_primitive_c2i *prim_c2i; | 697 | ASN1_primitive_c2i *prim_c2i; |
680 | ASN1_primitive_i2c *prim_i2c; | 698 | ASN1_primitive_i2c *prim_i2c; |
699 | ASN1_primitive_print *prim_print; | ||
681 | } ASN1_PRIMITIVE_FUNCS; | 700 | } ASN1_PRIMITIVE_FUNCS; |
682 | 701 | ||
683 | /* This is the ASN1_AUX structure: it handles various | 702 | /* This is the ASN1_AUX structure: it handles various |
@@ -697,7 +716,8 @@ typedef struct ASN1_PRIMITIVE_FUNCS_st { | |||
697 | * then an external type is more appropriate. | 716 | * then an external type is more appropriate. |
698 | */ | 717 | */ |
699 | 718 | ||
700 | typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it); | 719 | typedef int ASN1_aux_cb(int operation, ASN1_VALUE **in, const ASN1_ITEM *it, |
720 | void *exarg); | ||
701 | 721 | ||
702 | typedef struct ASN1_AUX_st { | 722 | typedef struct ASN1_AUX_st { |
703 | void *app_data; | 723 | void *app_data; |
@@ -708,6 +728,23 @@ typedef struct ASN1_AUX_st { | |||
708 | int enc_offset; /* Offset of ASN1_ENCODING structure */ | 728 | int enc_offset; /* Offset of ASN1_ENCODING structure */ |
709 | } ASN1_AUX; | 729 | } ASN1_AUX; |
710 | 730 | ||
731 | /* For print related callbacks exarg points to this structure */ | ||
732 | typedef struct ASN1_PRINT_ARG_st { | ||
733 | BIO *out; | ||
734 | int indent; | ||
735 | const ASN1_PCTX *pctx; | ||
736 | } ASN1_PRINT_ARG; | ||
737 | |||
738 | /* For streaming related callbacks exarg points to this structure */ | ||
739 | typedef struct ASN1_STREAM_ARG_st { | ||
740 | /* BIO to stream through */ | ||
741 | BIO *out; | ||
742 | /* BIO with filters appended */ | ||
743 | BIO *ndef_bio; | ||
744 | /* Streaming I/O boundary */ | ||
745 | unsigned char **boundary; | ||
746 | } ASN1_STREAM_ARG; | ||
747 | |||
711 | /* Flags in ASN1_AUX */ | 748 | /* Flags in ASN1_AUX */ |
712 | 749 | ||
713 | /* Use a reference count */ | 750 | /* Use a reference count */ |
@@ -727,6 +764,12 @@ typedef struct ASN1_AUX_st { | |||
727 | #define ASN1_OP_D2I_POST 5 | 764 | #define ASN1_OP_D2I_POST 5 |
728 | #define ASN1_OP_I2D_PRE 6 | 765 | #define ASN1_OP_I2D_PRE 6 |
729 | #define ASN1_OP_I2D_POST 7 | 766 | #define ASN1_OP_I2D_POST 7 |
767 | #define ASN1_OP_PRINT_PRE 8 | ||
768 | #define ASN1_OP_PRINT_POST 9 | ||
769 | #define ASN1_OP_STREAM_PRE 10 | ||
770 | #define ASN1_OP_STREAM_POST 11 | ||
771 | #define ASN1_OP_DETACHED_PRE 12 | ||
772 | #define ASN1_OP_DETACHED_POST 13 | ||
730 | 773 | ||
731 | /* Macro to implement a primitive type */ | 774 | /* Macro to implement a primitive type */ |
732 | #define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) | 775 | #define IMPLEMENT_ASN1_TYPE(stname) IMPLEMENT_ASN1_TYPE_ex(stname, stname, 0) |
@@ -782,9 +825,22 @@ typedef struct ASN1_AUX_st { | |||
782 | #define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ | 825 | #define IMPLEMENT_ASN1_FUNCTIONS_ENCODE_name(stname, itname) \ |
783 | IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) | 826 | IMPLEMENT_ASN1_FUNCTIONS_ENCODE_fname(stname, itname, itname) |
784 | 827 | ||
828 | #define IMPLEMENT_STATIC_ASN1_ALLOC_FUNCTIONS(stname) \ | ||
829 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(static, stname, stname, stname) | ||
830 | |||
785 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ | 831 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS(stname) \ |
786 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) | 832 | IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, stname, stname) |
787 | 833 | ||
834 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_pfname(pre, stname, itname, fname) \ | ||
835 | pre stname *fname##_new(void) \ | ||
836 | { \ | ||
837 | return (stname *)ASN1_item_new(ASN1_ITEM_rptr(itname)); \ | ||
838 | } \ | ||
839 | pre void fname##_free(stname *a) \ | ||
840 | { \ | ||
841 | ASN1_item_free((ASN1_VALUE *)a, ASN1_ITEM_rptr(itname)); \ | ||
842 | } | ||
843 | |||
788 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ | 844 | #define IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(stname, itname, fname) \ |
789 | stname *fname##_new(void) \ | 845 | stname *fname##_new(void) \ |
790 | { \ | 846 | { \ |
@@ -834,6 +890,17 @@ typedef struct ASN1_AUX_st { | |||
834 | return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ | 890 | return ASN1_item_dup(ASN1_ITEM_rptr(stname), x); \ |
835 | } | 891 | } |
836 | 892 | ||
893 | #define IMPLEMENT_ASN1_PRINT_FUNCTION(stname) \ | ||
894 | IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, stname, stname) | ||
895 | |||
896 | #define IMPLEMENT_ASN1_PRINT_FUNCTION_fname(stname, itname, fname) \ | ||
897 | int fname##_print_ctx(BIO *out, stname *x, int indent, \ | ||
898 | const ASN1_PCTX *pctx) \ | ||
899 | { \ | ||
900 | return ASN1_item_print(out, (ASN1_VALUE *)x, indent, \ | ||
901 | ASN1_ITEM_rptr(itname), pctx); \ | ||
902 | } | ||
903 | |||
837 | #define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ | 904 | #define IMPLEMENT_ASN1_FUNCTIONS_const(name) \ |
838 | IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) | 905 | IMPLEMENT_ASN1_FUNCTIONS_const_fname(name, name, name) |
839 | 906 | ||