From: Richard Levitte Date: Wed, 5 Apr 2017 10:09:21 +0000 (+0200) Subject: Discourage the use of LONG and ZLONG, and deprecate it in the future X-Git-Tag: OpenSSL_1_1_1-pre1~1827 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=7eb4c1eb50785c0b32f52e8a5bf20328b6baca34;ds=sidebyside Discourage the use of LONG and ZLONG, and deprecate it in the future Reviewed-by: Matt Caswell Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/3126) --- diff --git a/crypto/asn1/x_long.c b/crypto/asn1/x_long.c index 5895345f9f..4bb66114ba 100644 --- a/crypto/asn1/x_long.c +++ b/crypto/asn1/x_long.c @@ -11,6 +11,9 @@ #include "internal/cryptlib.h" #include +#if !(OPENSSL_API_COMPAT < 0x10200000L) +NON_EMPTY_TRANSLATION_UNIT +#else /* * Custom primitive type for long handling. This converts between an * ASN1_INTEGER and a long directly. @@ -194,3 +197,4 @@ static int long_print(BIO *out, ASN1_VALUE **pval, const ASN1_ITEM *it, { return BIO_printf(out, "%ld\n", *(long *)pval); } +#endif diff --git a/include/openssl/asn1t.h b/include/openssl/asn1t.h index 5d2ed43c22..a73d4a8e65 100644 --- a/include/openssl/asn1t.h +++ b/include/openssl/asn1t.h @@ -909,8 +909,16 @@ DECLARE_ASN1_ITEM(INT64) DECLARE_ASN1_ITEM(ZINT64) DECLARE_ASN1_ITEM(UINT64) DECLARE_ASN1_ITEM(ZUINT64) + +# if OPENSSL_API_COMPAT < 0x10200000L +/* + * LONG and ZLONG are strongly discouraged for use as stored data, as the + * underlying C type (long) differs in size depending on the architecture. + * They are designed with 32-bit longs in mind. + */ DECLARE_ASN1_ITEM(LONG) DECLARE_ASN1_ITEM(ZLONG) +# endif DEFINE_STACK_OF(ASN1_VALUE)