summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorjsing <>2015-09-30 19:13:13 +0000
committerjsing <>2015-09-30 19:13:13 +0000
commit7d6f4a12ac5b7dc7f80591c2e74ac77a6f543194 (patch)
tree4a00ca24dae501f025bc50a9d23fb18fc569df5a /src/lib
parent45f7117344413dc2b1ebbdcd203978ad63cb317d (diff)
downloadopenbsd-7d6f4a12ac5b7dc7f80591c2e74ac77a6f543194.tar.gz
openbsd-7d6f4a12ac5b7dc7f80591c2e74ac77a6f543194.tar.bz2
openbsd-7d6f4a12ac5b7dc7f80591c2e74ac77a6f543194.zip
Place all of the ASN1 M_ macros under #ifndef LIBRESSL_INTERNAL.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/asn1/asn1.h67
-rw-r--r--src/lib/libssl/src/crypto/asn1/asn1.h67
2 files changed, 74 insertions, 60 deletions
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h
index 5ec89db3f0..3fb4b8fbf1 100644
--- a/src/lib/libcrypto/asn1/asn1.h
+++ b/src/lib/libcrypto/asn1/asn1.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1.h,v 1.29 2015/01/28 04:14:31 beck Exp $ */ 1/* $OpenBSD: asn1.h,v 1.30 2015/09/30 19:13:13 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -535,6 +535,7 @@ typedef struct BIT_STRING_BITNAME_st {
535 const char *sname; 535 const char *sname;
536} BIT_STRING_BITNAME; 536} BIT_STRING_BITNAME;
537 537
538#ifndef LIBRESSL_INTERNAL
538 539
539#define M_ASN1_STRING_length(x) ((x)->length) 540#define M_ASN1_STRING_length(x) ((x)->length)
540#define M_ASN1_STRING_length_set(x, n) ((x)->length = (n)) 541#define M_ASN1_STRING_length_set(x, n) ((x)->length = (n))
@@ -580,35 +581,6 @@ typedef struct BIT_STRING_BITNAME_st {
580 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\ 581 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\
581 V_ASN1_UNIVERSAL) 582 V_ASN1_UNIVERSAL)
582 583
583#define B_ASN1_TIME \
584 B_ASN1_UTCTIME | \
585 B_ASN1_GENERALIZEDTIME
586
587#define B_ASN1_PRINTABLE \
588 B_ASN1_NUMERICSTRING| \
589 B_ASN1_PRINTABLESTRING| \
590 B_ASN1_T61STRING| \
591 B_ASN1_IA5STRING| \
592 B_ASN1_BIT_STRING| \
593 B_ASN1_UNIVERSALSTRING|\
594 B_ASN1_BMPSTRING|\
595 B_ASN1_UTF8STRING|\
596 B_ASN1_SEQUENCE|\
597 B_ASN1_UNKNOWN
598
599#define B_ASN1_DIRECTORYSTRING \
600 B_ASN1_PRINTABLESTRING| \
601 B_ASN1_TELETEXSTRING|\
602 B_ASN1_BMPSTRING|\
603 B_ASN1_UNIVERSALSTRING|\
604 B_ASN1_UTF8STRING
605
606#define B_ASN1_DISPLAYTEXT \
607 B_ASN1_IA5STRING| \
608 B_ASN1_VISIBLESTRING| \
609 B_ASN1_BMPSTRING|\
610 B_ASN1_UTF8STRING
611
612#define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING) 584#define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING)
613#define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a) 585#define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a)
614#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ 586#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
@@ -733,6 +705,37 @@ typedef struct BIT_STRING_BITNAME_st {
733 (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\ 705 (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\
734 ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING) 706 ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)
735 707
708#endif
709
710#define B_ASN1_TIME \
711 B_ASN1_UTCTIME | \
712 B_ASN1_GENERALIZEDTIME
713
714#define B_ASN1_PRINTABLE \
715 B_ASN1_NUMERICSTRING| \
716 B_ASN1_PRINTABLESTRING| \
717 B_ASN1_T61STRING| \
718 B_ASN1_IA5STRING| \
719 B_ASN1_BIT_STRING| \
720 B_ASN1_UNIVERSALSTRING|\
721 B_ASN1_BMPSTRING|\
722 B_ASN1_UTF8STRING|\
723 B_ASN1_SEQUENCE|\
724 B_ASN1_UNKNOWN
725
726#define B_ASN1_DIRECTORYSTRING \
727 B_ASN1_PRINTABLESTRING| \
728 B_ASN1_TELETEXSTRING|\
729 B_ASN1_BMPSTRING|\
730 B_ASN1_UNIVERSALSTRING|\
731 B_ASN1_UTF8STRING
732
733#define B_ASN1_DISPLAYTEXT \
734 B_ASN1_IA5STRING| \
735 B_ASN1_VISIBLESTRING| \
736 B_ASN1_BMPSTRING|\
737 B_ASN1_UTF8STRING
738
736/* for the is_set parameter to i2d_ASN1_SET */ 739/* for the is_set parameter to i2d_ASN1_SET */
737#define IS_SEQUENCE 0 740#define IS_SEQUENCE 0
738#define IS_SET 1 741#define IS_SET 1
@@ -925,12 +928,16 @@ void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x);
925 928
926void *ASN1_item_dup(const ASN1_ITEM *it, void *x); 929void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
927 930
931#ifndef LIBRESSL_INTERNAL
932
928/* ASN1 alloc/free macros for when a type is only used internally */ 933/* ASN1 alloc/free macros for when a type is only used internally */
929 934
930#define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) 935#define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type))
931#define M_ASN1_free_of(x, type) \ 936#define M_ASN1_free_of(x, type) \
932 ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) 937 ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))
933 938
939#endif
940
934void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x); 941void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
935 942
936#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ 943#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
diff --git a/src/lib/libssl/src/crypto/asn1/asn1.h b/src/lib/libssl/src/crypto/asn1/asn1.h
index 5ec89db3f0..3fb4b8fbf1 100644
--- a/src/lib/libssl/src/crypto/asn1/asn1.h
+++ b/src/lib/libssl/src/crypto/asn1/asn1.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1.h,v 1.29 2015/01/28 04:14:31 beck Exp $ */ 1/* $OpenBSD: asn1.h,v 1.30 2015/09/30 19:13:13 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -535,6 +535,7 @@ typedef struct BIT_STRING_BITNAME_st {
535 const char *sname; 535 const char *sname;
536} BIT_STRING_BITNAME; 536} BIT_STRING_BITNAME;
537 537
538#ifndef LIBRESSL_INTERNAL
538 539
539#define M_ASN1_STRING_length(x) ((x)->length) 540#define M_ASN1_STRING_length(x) ((x)->length)
540#define M_ASN1_STRING_length_set(x, n) ((x)->length = (n)) 541#define M_ASN1_STRING_length_set(x, n) ((x)->length = (n))
@@ -580,35 +581,6 @@ typedef struct BIT_STRING_BITNAME_st {
580 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\ 581 i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\
581 V_ASN1_UNIVERSAL) 582 V_ASN1_UNIVERSAL)
582 583
583#define B_ASN1_TIME \
584 B_ASN1_UTCTIME | \
585 B_ASN1_GENERALIZEDTIME
586
587#define B_ASN1_PRINTABLE \
588 B_ASN1_NUMERICSTRING| \
589 B_ASN1_PRINTABLESTRING| \
590 B_ASN1_T61STRING| \
591 B_ASN1_IA5STRING| \
592 B_ASN1_BIT_STRING| \
593 B_ASN1_UNIVERSALSTRING|\
594 B_ASN1_BMPSTRING|\
595 B_ASN1_UTF8STRING|\
596 B_ASN1_SEQUENCE|\
597 B_ASN1_UNKNOWN
598
599#define B_ASN1_DIRECTORYSTRING \
600 B_ASN1_PRINTABLESTRING| \
601 B_ASN1_TELETEXSTRING|\
602 B_ASN1_BMPSTRING|\
603 B_ASN1_UNIVERSALSTRING|\
604 B_ASN1_UTF8STRING
605
606#define B_ASN1_DISPLAYTEXT \
607 B_ASN1_IA5STRING| \
608 B_ASN1_VISIBLESTRING| \
609 B_ASN1_BMPSTRING|\
610 B_ASN1_UTF8STRING
611
612#define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING) 584#define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING)
613#define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a) 585#define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a)
614#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\ 586#define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
@@ -733,6 +705,37 @@ typedef struct BIT_STRING_BITNAME_st {
733 (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\ 705 (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\
734 ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING) 706 ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)
735 707
708#endif
709
710#define B_ASN1_TIME \
711 B_ASN1_UTCTIME | \
712 B_ASN1_GENERALIZEDTIME
713
714#define B_ASN1_PRINTABLE \
715 B_ASN1_NUMERICSTRING| \
716 B_ASN1_PRINTABLESTRING| \
717 B_ASN1_T61STRING| \
718 B_ASN1_IA5STRING| \
719 B_ASN1_BIT_STRING| \
720 B_ASN1_UNIVERSALSTRING|\
721 B_ASN1_BMPSTRING|\
722 B_ASN1_UTF8STRING|\
723 B_ASN1_SEQUENCE|\
724 B_ASN1_UNKNOWN
725
726#define B_ASN1_DIRECTORYSTRING \
727 B_ASN1_PRINTABLESTRING| \
728 B_ASN1_TELETEXSTRING|\
729 B_ASN1_BMPSTRING|\
730 B_ASN1_UNIVERSALSTRING|\
731 B_ASN1_UTF8STRING
732
733#define B_ASN1_DISPLAYTEXT \
734 B_ASN1_IA5STRING| \
735 B_ASN1_VISIBLESTRING| \
736 B_ASN1_BMPSTRING|\
737 B_ASN1_UTF8STRING
738
736/* for the is_set parameter to i2d_ASN1_SET */ 739/* for the is_set parameter to i2d_ASN1_SET */
737#define IS_SEQUENCE 0 740#define IS_SEQUENCE 0
738#define IS_SET 1 741#define IS_SET 1
@@ -925,12 +928,16 @@ void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x);
925 928
926void *ASN1_item_dup(const ASN1_ITEM *it, void *x); 929void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
927 930
931#ifndef LIBRESSL_INTERNAL
932
928/* ASN1 alloc/free macros for when a type is only used internally */ 933/* ASN1 alloc/free macros for when a type is only used internally */
929 934
930#define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type)) 935#define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type))
931#define M_ASN1_free_of(x, type) \ 936#define M_ASN1_free_of(x, type) \
932 ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type)) 937 ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))
933 938
939#endif
940
934void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x); 941void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
935 942
936#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \ 943#define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \