From 4376bb91f1ab33cad1db683b8428434fbc4b67bf Mon Sep 17 00:00:00 2001 From: tb <> Date: Fri, 2 Jan 2026 08:03:02 +0000 Subject: Unexport ASN1_LONG_UNDEF This is another one of these weird magic values that nothing outside of libcrypto uses. Fix a confusing comment in long_i2c() while there. The skipping behavior is used in particular for omitting the optional length value in the non-standard OpenSSL-specific DHparam() ASN.1 encoding. ok jsing kenjiro --- src/lib/libcrypto/asn1/asn1.h | 5 +---- src/lib/libcrypto/asn1/x_long.c | 10 +++++++--- 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index 7285ad0590..2b19f58717 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1.h,v 1.94 2025/12/31 13:48:00 tb Exp $ */ +/* $OpenBSD: asn1.h,v 1.95 2026/01/02 08:03:02 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -199,9 +199,6 @@ typedef struct ASN1_ENCODING_st { int modified; /* set to 1 if 'enc' is invalid */ } ASN1_ENCODING; -/* Used with ASN1 LONG type: if a long is set to this it is omitted */ -#define ASN1_LONG_UNDEF 0x7fffffffL - /* Used by security/xca */ #define STABLE_NO_MASK 0x02 diff --git a/src/lib/libcrypto/asn1/x_long.c b/src/lib/libcrypto/asn1/x_long.c index a72411f30c..ed463bf7c5 100644 --- a/src/lib/libcrypto/asn1/x_long.c +++ b/src/lib/libcrypto/asn1/x_long.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_long.c,v 1.22 2025/05/10 05:54:38 tb Exp $ */ +/* $OpenBSD: x_long.c,v 1.23 2026/01/02 08:03:02 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -70,6 +70,9 @@ * ASN1_INTEGER and a long directly. */ +/* Used with ASN1 LONG type: if a long is set to this it is omitted */ +#define ASN1_LONG_UNDEF 0x7fffffffL + static int long_new(ASN1_VALUE **pval, const ASN1_ITEM *it); static void long_free(ASN1_VALUE **pval, const ASN1_ITEM *it); static void long_clear(ASN1_VALUE **pval, const ASN1_ITEM *it); @@ -159,8 +162,9 @@ long_i2c(ASN1_VALUE **pval, unsigned char *content, int *putype, long_get(pval, &val); /* - * The zero value for this type (stored in the overloaded it->size - * field) is considered to be invalid. + * Omit this field if it has the zero value for this type (stored + * in the overloaded it->size field) - asn1_i2d_ex_primitive() + * specifically checks for a -1 return value. */ if (val == it->size) return -1; -- cgit v1.2.3-55-g6feb