-/* $OpenBSD: a_bitstr.c,v 1.32 2021/12/25 07:48:09 jsing Exp $ */
+/* $OpenBSD: a_bitstr.c,v 1.33 2021/12/25 08:52:44 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <string.h>
#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
#include <openssl/conf.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>
+const ASN1_ITEM ASN1_BIT_STRING_it = {
+ .itype = ASN1_ITYPE_PRIMITIVE,
+ .utype = V_ASN1_BIT_STRING,
+ .sname = "ASN1_BIT_STRING",
+};
+
+ASN1_BIT_STRING *
+ASN1_BIT_STRING_new(void)
+{
+ return (ASN1_BIT_STRING *)ASN1_item_new(&ASN1_BIT_STRING_it);
+}
+
+void
+ASN1_BIT_STRING_free(ASN1_BIT_STRING *a)
+{
+ ASN1_item_free((ASN1_VALUE *)a, &ASN1_BIT_STRING_it);
+}
+
int
ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
{
return (NULL);
}
+
+int
+i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **out)
+{
+ return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_BIT_STRING_it);
+}
+
+ASN1_BIT_STRING *
+d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **in, long len)
+{
+ return (ASN1_BIT_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+ &ASN1_BIT_STRING_it);
+}
-/* $OpenBSD: a_enum.c,v 1.21 2021/12/15 18:00:31 jsing Exp $ */
+/* $OpenBSD: a_enum.c,v 1.22 2021/12/25 08:52:44 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <stdio.h>
#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
#include <openssl/bn.h>
#include <openssl/buffer.h>
#include <openssl/err.h>
* for comments on encoding see a_int.c
*/
+const ASN1_ITEM ASN1_ENUMERATED_it = {
+ .itype = ASN1_ITYPE_PRIMITIVE,
+ .utype = V_ASN1_ENUMERATED,
+ .sname = "ASN1_ENUMERATED",
+};
+
+ASN1_ENUMERATED *
+ASN1_ENUMERATED_new(void)
+{
+ return (ASN1_ENUMERATED *)ASN1_item_new(&ASN1_ENUMERATED_it);
+}
+
+void
+ASN1_ENUMERATED_free(ASN1_ENUMERATED *a)
+{
+ ASN1_item_free((ASN1_VALUE *)a, &ASN1_ENUMERATED_it);
+}
+
int
ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v)
{
free(s);
return (ret);
}
+
+int
+i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out)
+{
+ return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ENUMERATED_it);
+}
+
+ASN1_ENUMERATED *
+d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, const unsigned char **in, long len)
+{
+ return (ASN1_ENUMERATED *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+ &ASN1_ENUMERATED_it);
+}
-/* $OpenBSD: a_int.c,v 1.36 2021/12/25 07:48:09 jsing Exp $ */
+/* $OpenBSD: a_int.c,v 1.37 2021/12/25 08:52:44 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <string.h>
#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
#include <openssl/bn.h>
#include <openssl/buffer.h>
#include <openssl/err.h>
+const ASN1_ITEM ASN1_INTEGER_it = {
+ .itype = ASN1_ITYPE_PRIMITIVE,
+ .utype = V_ASN1_INTEGER,
+ .sname = "ASN1_INTEGER",
+};
+
+ASN1_INTEGER *
+ASN1_INTEGER_new(void)
+{
+ return (ASN1_INTEGER *)ASN1_item_new(&ASN1_INTEGER_it);
+}
+
+void
+ASN1_INTEGER_free(ASN1_INTEGER *a)
+{
+ ASN1_item_free((ASN1_VALUE *)a, &ASN1_INTEGER_it);
+}
+
static int
ASN1_INTEGER_valid(const ASN1_INTEGER *a)
{
return (NULL);
}
+int
+i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **out)
+{
+ return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_INTEGER_it);
+}
+
+ASN1_INTEGER *
+d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len)
+{
+ return (ASN1_INTEGER *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+ &ASN1_INTEGER_it);
+}
/* This is a version of d2i_ASN1_INTEGER that ignores the sign bit of
* ASN1 integers: some broken software can encode a positive INTEGER
-/* $OpenBSD: a_object.c,v 1.34 2021/12/25 07:48:09 jsing Exp $ */
+/* $OpenBSD: a_object.c,v 1.35 2021/12/25 08:52:44 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <string.h>
#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
#include <openssl/bn.h>
#include <openssl/err.h>
#include <openssl/buffer.h>
#include <openssl/objects.h>
+const ASN1_ITEM ASN1_OBJECT_it = {
+ .itype = ASN1_ITYPE_PRIMITIVE,
+ .utype = V_ASN1_OBJECT,
+ .sname = "ASN1_OBJECT",
+};
+
ASN1_OBJECT *
ASN1_OBJECT_new(void)
{
-/* $OpenBSD: a_octet.c,v 1.10 2015/07/29 14:58:34 jsing Exp $ */
+/* $OpenBSD: a_octet.c,v 1.11 2021/12/25 08:52:44 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <stdio.h>
#include <openssl/asn1.h>
+#include <openssl/asn1t.h>
+
+const ASN1_ITEM ASN1_OCTET_STRING_it = {
+ .itype = ASN1_ITYPE_PRIMITIVE,
+ .utype = V_ASN1_OCTET_STRING,
+ .sname = "ASN1_OCTET_STRING",
+};
+
+ASN1_OCTET_STRING *
+ASN1_OCTET_STRING_new(void)
+{
+ return (ASN1_OCTET_STRING *)ASN1_item_new(&ASN1_OCTET_STRING_it);
+}
+
+void
+ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *a)
+{
+ ASN1_item_free((ASN1_VALUE *)a, &ASN1_OCTET_STRING_it);
+}
+
ASN1_OCTET_STRING *
ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *x)
{
return ASN1_STRING_set(x, d, len);
}
+
+int
+i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a, unsigned char **out)
+{
+ return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_OCTET_STRING_it);
+}
+
+ASN1_OCTET_STRING *
+d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a, const unsigned char **in, long len)
+{
+ return (ASN1_OCTET_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+ &ASN1_OCTET_STRING_it);
+}
-/* $OpenBSD: a_type.c,v 1.21 2019/10/24 16:36:10 jsing Exp $ */
+/* $OpenBSD: a_type.c,v 1.22 2021/12/25 08:52:44 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <openssl/asn1t.h>
#include <openssl/objects.h>
+ASN1_TYPE *
+ASN1_TYPE_new(void)
+{
+ return (ASN1_TYPE *)ASN1_item_new(&ASN1_ANY_it);
+}
+
+void
+ASN1_TYPE_free(ASN1_TYPE *a)
+{
+ ASN1_item_free((ASN1_VALUE *)a, &ASN1_ANY_it);
+}
+
int
ASN1_TYPE_get(const ASN1_TYPE *a)
{
return NULL;
return ASN1_item_unpack(t->value.sequence, it);
}
+
+int
+i2d_ASN1_TYPE(ASN1_TYPE *a, unsigned char **out)
+{
+ return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ANY_it);
+}
+
+ASN1_TYPE *
+d2i_ASN1_TYPE(ASN1_TYPE **a, const unsigned char **in, long len)
+{
+ return (ASN1_TYPE *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
+ &ASN1_ANY_it);
+}
-/* $OpenBSD: tasn_typ.c,v 1.15 2021/12/23 18:04:41 tb Exp $ */
+/* $OpenBSD: tasn_typ.c,v 1.16 2021/12/25 08:52:44 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
/* Declarations for string types */
-const ASN1_ITEM ASN1_INTEGER_it = {
- .itype = ASN1_ITYPE_PRIMITIVE,
- .utype = V_ASN1_INTEGER,
- .sname = "ASN1_INTEGER",
-};
-
-ASN1_INTEGER *
-d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len)
-{
- return (ASN1_INTEGER *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
- &ASN1_INTEGER_it);
-}
-
-int
-i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **out)
-{
- return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_INTEGER_it);
-}
-
-ASN1_INTEGER *
-ASN1_INTEGER_new(void)
-{
- return (ASN1_INTEGER *)ASN1_item_new(&ASN1_INTEGER_it);
-}
-
-void
-ASN1_INTEGER_free(ASN1_INTEGER *a)
-{
- ASN1_item_free((ASN1_VALUE *)a, &ASN1_INTEGER_it);
-}
-
-
-const ASN1_ITEM ASN1_ENUMERATED_it = {
- .itype = ASN1_ITYPE_PRIMITIVE,
- .utype = V_ASN1_ENUMERATED,
- .sname = "ASN1_ENUMERATED",
-};
-
-ASN1_ENUMERATED *
-d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, const unsigned char **in, long len)
-{
- return (ASN1_ENUMERATED *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
- &ASN1_ENUMERATED_it);
-}
-
-int
-i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out)
-{
- return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ENUMERATED_it);
-}
-
-ASN1_ENUMERATED *
-ASN1_ENUMERATED_new(void)
-{
- return (ASN1_ENUMERATED *)ASN1_item_new(&ASN1_ENUMERATED_it);
-}
-
-void
-ASN1_ENUMERATED_free(ASN1_ENUMERATED *a)
-{
- ASN1_item_free((ASN1_VALUE *)a, &ASN1_ENUMERATED_it);
-}
-
-
-const ASN1_ITEM ASN1_BIT_STRING_it = {
- .itype = ASN1_ITYPE_PRIMITIVE,
- .utype = V_ASN1_BIT_STRING,
- .sname = "ASN1_BIT_STRING",
-};
-
-ASN1_BIT_STRING *
-d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **in, long len)
-{
- return (ASN1_BIT_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
- &ASN1_BIT_STRING_it);
-}
-
-int
-i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **out)
-{
- return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_BIT_STRING_it);
-}
-
-ASN1_BIT_STRING *
-ASN1_BIT_STRING_new(void)
-{
- return (ASN1_BIT_STRING *)ASN1_item_new(&ASN1_BIT_STRING_it);
-}
-
-void
-ASN1_BIT_STRING_free(ASN1_BIT_STRING *a)
-{
- ASN1_item_free((ASN1_VALUE *)a, &ASN1_BIT_STRING_it);
-}
-
-
-const ASN1_ITEM ASN1_OCTET_STRING_it = {
- .itype = ASN1_ITYPE_PRIMITIVE,
- .utype = V_ASN1_OCTET_STRING,
- .sname = "ASN1_OCTET_STRING",
-};
-
-ASN1_OCTET_STRING *
-d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a, const unsigned char **in, long len)
-{
- return (ASN1_OCTET_STRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
- &ASN1_OCTET_STRING_it);
-}
-
-int
-i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a, unsigned char **out)
-{
- return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_OCTET_STRING_it);
-}
-
-ASN1_OCTET_STRING *
-ASN1_OCTET_STRING_new(void)
-{
- return (ASN1_OCTET_STRING *)ASN1_item_new(&ASN1_OCTET_STRING_it);
-}
-
-void
-ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *a)
-{
- ASN1_item_free((ASN1_VALUE *)a, &ASN1_OCTET_STRING_it);
-}
-
-
const ASN1_ITEM ASN1_NULL_it = {
.itype = ASN1_ITYPE_PRIMITIVE,
.utype = V_ASN1_NULL,
}
-const ASN1_ITEM ASN1_OBJECT_it = {
- .itype = ASN1_ITYPE_PRIMITIVE,
- .utype = V_ASN1_OBJECT,
- .sname = "ASN1_OBJECT",
-};
-
-
const ASN1_ITEM ASN1_UTF8STRING_it = {
.itype = ASN1_ITYPE_PRIMITIVE,
.utype = V_ASN1_UTF8STRING,
ASN1_item_free((ASN1_VALUE *)a, &ASN1_BMPSTRING_it);
}
-
const ASN1_ITEM ASN1_ANY_it = {
.itype = ASN1_ITYPE_PRIMITIVE,
.utype = V_ASN1_ANY,
.sname = "ASN1_ANY",
};
+
/* Just swallow an ASN1_SEQUENCE in an ASN1_STRING */
const ASN1_ITEM ASN1_SEQUENCE_it = {
};
-ASN1_TYPE *
-d2i_ASN1_TYPE(ASN1_TYPE **a, const unsigned char **in, long len)
-{
- return (ASN1_TYPE *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
- &ASN1_ANY_it);
-}
-
-int
-i2d_ASN1_TYPE(ASN1_TYPE *a, unsigned char **out)
-{
- return ASN1_item_i2d((ASN1_VALUE *)a, out, &ASN1_ANY_it);
-}
-
-ASN1_TYPE *
-ASN1_TYPE_new(void)
-{
- return (ASN1_TYPE *)ASN1_item_new(&ASN1_ANY_it);
-}
-
-void
-ASN1_TYPE_free(ASN1_TYPE *a)
-{
- ASN1_item_free((ASN1_VALUE *)a, &ASN1_ANY_it);
-}
-
/* Multistring types */