Unroll IMPLEMENT_ASN1_FUNCTIONS()
authorjob <job@openbsd.org>
Thu, 2 Sep 2021 14:11:20 +0000 (14:11 +0000)
committerjob <job@openbsd.org>
Thu, 2 Sep 2021 14:11:20 +0000 (14:11 +0000)
OK jsing@

lib/libcrypto/x509/x509_addr.c
lib/libcrypto/x509/x509_asid.c

index 4258dbc..5aff270 100644 (file)
@@ -54,10 +54,105 @@ ASN1_ITEM_TEMPLATE(IPAddrBlocks) =
                         IPAddrBlocks, IPAddressFamily)
 static_ASN1_ITEM_TEMPLATE_END(IPAddrBlocks)
 
-IMPLEMENT_ASN1_FUNCTIONS(IPAddressRange)
-IMPLEMENT_ASN1_FUNCTIONS(IPAddressOrRange)
-IMPLEMENT_ASN1_FUNCTIONS(IPAddressChoice)
-IMPLEMENT_ASN1_FUNCTIONS(IPAddressFamily)
+IPAddressRange *
+d2i_IPAddressRange(IPAddressRange **a, const unsigned char **in, long len)
+{
+       return (IPAddressRange *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+           (&(IPAddressRange_it)));
+}
+
+int
+i2d_IPAddressRange(IPAddressRange *a, unsigned char **out)
+{
+       return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(IPAddressRange_it)));
+}
+
+IPAddressRange *
+IPAddressRange_new(void)
+{
+       return (IPAddressRange *)ASN1_item_new((&(IPAddressRange_it)));
+}
+
+void
+IPAddressRange_free(IPAddressRange *a)
+{
+       ASN1_item_free((ASN1_VALUE *)a, (&(IPAddressRange_it)));
+}
+
+IPAddressOrRange *
+d2i_IPAddressOrRange(IPAddressOrRange **a, const unsigned char **in, long len)
+{
+       return (IPAddressOrRange *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+           (&(IPAddressOrRange_it)));
+}
+
+int
+i2d_IPAddressOrRange(IPAddressOrRange *a, unsigned char ** out)
+{
+       return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(IPAddressOrRange_it)));
+}
+
+IPAddressOrRange *
+IPAddressOrRange_new(void)
+{
+       return (IPAddressOrRange *)ASN1_item_new((&(IPAddressOrRange_it)));
+}
+
+void
+IPAddressOrRange_free(IPAddressOrRange *a) {
+       ASN1_item_free((ASN1_VALUE *)a, (&(IPAddressOrRange_it)));
+}
+
+IPAddressChoice *
+d2i_IPAddressChoice(IPAddressChoice **a, const unsigned char **in, long len)
+{
+       return (IPAddressChoice *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+           (&(IPAddressChoice_it)));
+}
+
+int
+i2d_IPAddressChoice(IPAddressChoice *a, unsigned char **out)
+{
+       return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(IPAddressChoice_it)));
+}
+
+IPAddressChoice *
+IPAddressChoice_new(void)
+{
+       return (IPAddressChoice *)ASN1_item_new((&(IPAddressChoice_it)));
+
+}
+
+void
+IPAddressChoice_free(IPAddressChoice *a)
+{
+       ASN1_item_free((ASN1_VALUE *)a, (&(IPAddressChoice_it)));
+}
+
+IPAddressFamily *
+d2i_IPAddressFamily(IPAddressFamily **a, const unsigned char **in, long len)
+{
+       return (IPAddressFamily *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+           (&(IPAddressFamily_it)));
+}
+
+int
+i2d_IPAddressFamily(IPAddressFamily *a, unsigned char **out)
+{
+       return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(IPAddressFamily_it)));
+}
+
+IPAddressFamily *
+IPAddressFamily_new(void)
+{
+       return (IPAddressFamily *)ASN1_item_new((&(IPAddressFamily_it)));
+}
+
+void
+IPAddressFamily_free(IPAddressFamily *a)
+{
+       ASN1_item_free((ASN1_VALUE *)a, (&(IPAddressFamily_it)));
+}
 
 /*
  * How much buffer space do we need for a raw address?
index ac68572..a9a13ff 100644 (file)
@@ -50,10 +50,104 @@ ASN1_SEQUENCE(ASIdentifiers) = {
   ASN1_EXP_OPT(ASIdentifiers, rdi,   ASIdentifierChoice, 1)
 } ASN1_SEQUENCE_END(ASIdentifiers)
 
-IMPLEMENT_ASN1_FUNCTIONS(ASRange)
-IMPLEMENT_ASN1_FUNCTIONS(ASIdOrRange)
-IMPLEMENT_ASN1_FUNCTIONS(ASIdentifierChoice)
-IMPLEMENT_ASN1_FUNCTIONS(ASIdentifiers)
+ASRange *
+d2i_ASRange(ASRange **a, const unsigned char **in, long len)
+{
+       return (ASRange *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+           (&(ASRange_it)));
+}
+
+int
+i2d_ASRange(ASRange *a, unsigned char **out)
+{
+       return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASRange_it)));
+}
+
+ASRange *
+ASRange_new(void)
+{
+       return (ASRange *)ASN1_item_new((&(ASRange_it)));
+}
+
+void
+ASRange_free(ASRange *a)
+{
+       ASN1_item_free((ASN1_VALUE *)a, (&(ASRange_it)));
+}
+
+ASIdOrRange *
+d2i_ASIdOrRange(ASIdOrRange **a, const unsigned char **in, long len)
+{
+       return (ASIdOrRange *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+           (&(ASIdOrRange_it)));
+}
+
+int
+i2d_ASIdOrRange(ASIdOrRange *a, unsigned char **out)
+{
+       return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASIdOrRange_it)));
+}
+
+ASIdOrRange *
+ASIdOrRange_new(void)
+{
+       return (ASIdOrRange *)ASN1_item_new((&(ASIdOrRange_it)));
+}
+
+void
+ASIdOrRange_free(ASIdOrRange *a)
+{
+       ASN1_item_free((ASN1_VALUE *)a, (&(ASIdOrRange_it)));
+}
+
+ASIdentifierChoice *
+d2i_ASIdentifierChoice(ASIdentifierChoice **a, const unsigned char **in, long len)
+{
+       return (ASIdentifierChoice *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+           (&(ASIdentifierChoice_it)));
+}
+
+int
+i2d_ASIdentifierChoice(ASIdentifierChoice *a, unsigned char **out)
+{
+       return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASIdentifierChoice_it)));
+
+}
+
+ASIdentifierChoice *
+ASIdentifierChoice_new(void)
+{
+       return (ASIdentifierChoice *)ASN1_item_new((&(ASIdentifierChoice_it)));
+}
+
+void
+ASIdentifierChoice_free(ASIdentifierChoice *a)
+{
+       ASN1_item_free((ASN1_VALUE *)a, (&(ASIdentifierChoice_it)));
+}
+
+ASIdentifiers *
+d2i_ASIdentifiers(ASIdentifiers **a, const unsigned char **in, long len)
+{
+       return (ASIdentifiers *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+           (&(ASIdentifiers_it)));
+}
+
+int
+i2d_ASIdentifiers(ASIdentifiers *a, unsigned char **out)
+{
+       return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ASIdentifiers_it)));
+}
+
+ASIdentifiers *ASIdentifiers_new(void)
+{
+       return (ASIdentifiers *)ASN1_item_new((&(ASIdentifiers_it)));
+}
+
+void ASIdentifiers_free(ASIdentifiers *a)
+{
+       ASN1_item_free((ASN1_VALUE *)a, (&(ASIdentifiers_it)));
+}
 
 /*
  * i2r method for an ASIdentifierChoice.