Deprecate XXXerr() macros
authorRich Salz <rsalz@akamai.com>
Tue, 30 Jul 2019 19:40:23 +0000 (15:40 -0400)
committerRich Salz <rsalz@akamai.com>
Thu, 19 Sep 2019 13:27:38 +0000 (09:27 -0400)
Actually, for transition, they're not really deprecated.  Remove the
"1 ||" from the ifdef line (in include/openssl/err.h) when ready to
do this in production/"for real"

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9441)

include/openssl/err.h
util/err-to-raise

index d7427898c8eea8663da79e85726c9132e3815fc3..5c647831b5203f7138ff2d7ea15be96c5ad16179 100644 (file)
@@ -108,48 +108,49 @@ struct err_state_st {
 
 # define ERR_LIB_USER            128
 
-# if ! OPENSSL_API_3
-#  define SYSerr(f,r)  ERR_raise(ERR_LIB_SYS,(r))
+# if 1 || !OPENSSL_API_3
+#  define ASN1err(f, r) ERR_raise_data(ERR_LIB_ASN1, (r), NULL)
+#  define ASYNCerr(f, r) ERR_raise_data(ERR_LIB_ASYNC, (r), NULL)
+#  define BIOerr(f, r) ERR_raise_data(ERR_LIB_BIO, (r), NULL)
+#  define BNerr(f, r)  ERR_raise_data(ERR_LIB_BN, (r), NULL)
+#  define BUFerr(f, r) ERR_raise_data(ERR_LIB_BUF, (r), NULL)
+#  define CMPerr(f, r) ERR_raise_data(ERR_LIB_CMP, (r), NULL)
+#  define CMSerr(f, r) ERR_raise_data(ERR_LIB_CMS, (r), NULL)
+#  define COMPerr(f, r) ERR_raise_data(ERR_LIB_COMP, (r), NULL)
+#  define CONFerr(f, r) ERR_raise_data(ERR_LIB_CONF, (r), NULL)
+#  define CRMFerr(f, r) ERR_raise_data(ERR_LIB_CRMF, (r), NULL)
+#  define CRYPTOerr(f, r) ERR_raise_data(ERR_LIB_CRYPTO, (r), NULL)
+#  define CTerr(f, r) ERR_raise_data(ERR_LIB_CT, (r), NULL)
+#  define DHerr(f, r)  ERR_raise_data(ERR_LIB_DH, (r), NULL)
+#  define DSAerr(f, r) ERR_raise_data(ERR_LIB_DSA, (r), NULL)
+#  define DSOerr(f, r) ERR_raise_data(ERR_LIB_DSO, (r), NULL)
+#  define ECDHerr(f, r) ERR_raise_data(ERR_LIB_ECDH, (r), NULL)
+#  define ECDSAerr(f, r) ERR_raise_data(ERR_LIB_ECDSA, (r), NULL)
+#  define ECerr(f, r)  ERR_raise_data(ERR_LIB_EC, (r), NULL)
+#  define ENGINEerr(f, r) ERR_raise_data(ERR_LIB_ENGINE, (r), NULL)
+#  define ESSerr(f, r) ERR_raise_data(ERR_LIB_ESS, (r), NULL)
+#  define EVPerr(f, r) ERR_raise_data(ERR_LIB_EVP, (r), NULL)
+#  define FIPSerr(f, r) ERR_raise_data(ERR_LIB_FIPS, (r), NULL)
+#  define HMACerr(f, r) ERR_raise_data(ERR_LIB_HMAC, (r), NULL)
+#  define KDFerr(f, r) ERR_raise_data(ERR_LIB_KDF, (r), NULL)
+#  define OBJerr(f, r) ERR_raise_data(ERR_LIB_OBJ, (r), NULL)
+#  define OCSPerr(f, r) ERR_raise_data(ERR_LIB_OCSP, (r), NULL)
+#  define OSSL_STOREerr(f, r) ERR_raise_data(ERR_LIB_OSSL_STORE, (r), NULL)
+#  define PEMerr(f, r) ERR_raise_data(ERR_LIB_PEM, (r), NULL)
+#  define PKCS12err(f, r) ERR_raise_data(ERR_LIB_PKCS12, (r), NULL)
+#  define PKCS7err(f, r) ERR_raise_data(ERR_LIB_PKCS7, (r), NULL)
+#  define PROPerr(f, r) ERR_raise_data(ERR_LIB_PROP, (r), NULL)
+#  define PROVerr(f, r) ERR_raise_data(ERR_LIB_PROV, (r), NULL)
+#  define RANDerr(f, r) ERR_raise_data(ERR_LIB_RAND, (r), NULL)
+#  define RSAerr(f, r) ERR_raise_data(ERR_LIB_RSA, (r), NULL)
+#  define SM2err(f, r) ERR_raise_data(ERR_LIB_SM2, (r), NULL)
+#  define SSLerr(f, r) ERR_raise_data(ERR_LIB_SSL, (r), NULL)
+#  define SYSerr(f, r) ERR_raise_data(ERR_LIB_SYS, (r), NULL)
+#  define TSerr(f, r) ERR_raise_data(ERR_LIB_TS, (r), NULL)
+#  define UIerr(f, r) ERR_raise_data(ERR_LIB_UI, (r), NULL)
+#  define X509V3err(f, r) ERR_raise_data(ERR_LIB_X509V3, (r), NULL)
+#  define X509err(f, r) ERR_raise_data(ERR_LIB_X509, (r), NULL)
 # endif
-# define BNerr(f,r)   ERR_raise(ERR_LIB_BN,(r))
-# define RSAerr(f,r)  ERR_raise(ERR_LIB_RSA,(r))
-# define DHerr(f,r)   ERR_raise(ERR_LIB_DH,(r))
-# define EVPerr(f,r)  ERR_raise(ERR_LIB_EVP,(r))
-# define BUFerr(f,r)  ERR_raise(ERR_LIB_BUF,(r))
-# define OBJerr(f,r)  ERR_raise(ERR_LIB_OBJ,(r))
-# define PEMerr(f,r)  ERR_raise(ERR_LIB_PEM,(r))
-# define DSAerr(f,r)  ERR_raise(ERR_LIB_DSA,(r))
-# define X509err(f,r) ERR_raise(ERR_LIB_X509,(r))
-# define ASN1err(f,r) ERR_raise(ERR_LIB_ASN1,(r))
-# define CONFerr(f,r) ERR_raise(ERR_LIB_CONF,(r))
-# define CRYPTOerr(f,r) ERR_raise(ERR_LIB_CRYPTO,(r))
-# define ECerr(f,r)   ERR_raise(ERR_LIB_EC,(r))
-# define SSLerr(f,r)  ERR_raise(ERR_LIB_SSL,(r))
-# define BIOerr(f,r)  ERR_raise(ERR_LIB_BIO,(r))
-# define PKCS7err(f,r) ERR_raise(ERR_LIB_PKCS7,(r))
-# define X509V3err(f,r) ERR_raise(ERR_LIB_X509V3,(r))
-# define PKCS12err(f,r) ERR_raise(ERR_LIB_PKCS12,(r))
-# define RANDerr(f,r) ERR_raise(ERR_LIB_RAND,(r))
-# define DSOerr(f,r) ERR_raise(ERR_LIB_DSO,(r))
-# define ENGINEerr(f,r) ERR_raise(ERR_LIB_ENGINE,(r))
-# define OCSPerr(f,r) ERR_raise(ERR_LIB_OCSP,(r))
-# define UIerr(f,r) ERR_raise(ERR_LIB_UI,(r))
-# define COMPerr(f,r) ERR_raise(ERR_LIB_COMP,(r))
-# define ECDSAerr(f,r)  ERR_raise(ERR_LIB_ECDSA,(r))
-# define ECDHerr(f,r)  ERR_raise(ERR_LIB_ECDH,(r))
-# define OSSL_STOREerr(f,r) ERR_raise(ERR_LIB_OSSL_STORE,(r))
-# define FIPSerr(f,r) ERR_raise(ERR_LIB_FIPS,(r))
-# define CMSerr(f,r) ERR_raise(ERR_LIB_CMS,(r))
-# define CRMFerr(f,r) ERR_raise(ERR_LIB_CRMF,(r))
-# define CMPerr(f,r) ERR_raise(ERR_LIB_CMP,(r))
-# define TSerr(f,r) ERR_raise(ERR_LIB_TS,(r))
-# define HMACerr(f,r) ERR_raise(ERR_LIB_HMAC,(r))
-# define CTerr(f,r) ERR_raise(ERR_LIB_CT,(r))
-# define ASYNCerr(f,r) ERR_raise(ERR_LIB_ASYNC,(r))
-# define SM2err(f,r) ERR_raise(ERR_LIB_SM2,(r))
-# define ESSerr(f,r) ERR_raise(ERR_LIB_ESS,(r))
-# define PROPerr(f,r) ERR_raise(ERR_LIB_PROP,(r))
-# define PROVerr(f,r) ERR_raise(ERR_LIB_PROV,(r))
 
 # define ERR_PACK(l,f,r) ( \
         (((unsigned int)(l) & 0x0FF) << 24L) | \
index e26268eae9b20f55e2394a9f7568e5e0c27afe67..125269fee5a96a1cf65bbfda958462751be8b43a 100755 (executable)
 #       perl -pi util/err-to-error files...
 # or
 #       git ls-files | grep '\.c$' | xargs perl -pi util/err-to-raise
+
 # There will be some hand-edits necessary, when the second arg was on a
-# separate line.
+# separate line.  This command will find them:
+#       git grep -E '[A-Z0-9_]+err\('
+# There are about 500 such lines. Another script looks for such things
+# and tries to merge lines.
+
+# Also, what to do about the engines files?  This includes:
+#       AFALGerr, CAPIerr, DASYNC, OSSLTEST
+# There are about 70 such lines.
 
 use strict;
 use warnings;
 
-s/ASN1err\([0-9A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_ASN1, $1)/;
-s/ASYNCerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_ASYNC, $1)/;
-s/BIOerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_BIO, $1)/;
-s/BNerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_BN, $1)/;
-s/BUFerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_BUF, $1)/;
-s/CMPerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_CMP, $1)/;
-s/CMSerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_CMS, $1)/;
-s/COMPerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_COMP, $1)/;
-s/CONFerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_CONF, $1)/;
-s/CRMFerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_CRMF, $1)/;
-s/CRYPTOerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_CRYPTO, $1)/;
-s/CTerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_CT, $1)/;
-s/DHerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_DH, $1)/;
-s/DSAerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_DSA, $1)/;
-s/DSOerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_DSO, $1)/;
-s/ECDHerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_ECDH, $1)/;
-s/ECDSAerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_ECDSA, $1)/;
-s/ECerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_EC, $1)/;
-s/ENGINEerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_ENGINE, $1)/;
-s/ESSerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_ESS, $1)/;
-s/EVPerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_EVP, $1)/;
-s/FIPSerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_FIPS, $1)/;
-s/KDFerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_KDF, $1)/;
-s/OBJerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_OBJ, $1)/;
-s/OCSPerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_OCSP, $1)/;
-s/OSSL_STOREerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_OSSL_STORE, $1)/;
-s/PEMerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_PEM, $1)/;
-s/PKCS12err\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_PKCS12, $1)/;
-s/PKCS7err\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_PKCS7, $1)/;
-s/PROPerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_PROP, $1)/;
-s/PROVerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_PROV, $1)/;
-s/RANDerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_RAND, $1)/;
-s/RSAerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_RSA, $1)/;
-s/SM2err\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_SM2, $1)/;
-s/SSLerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_SSL, $1)/;
-s/SYSerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_SYS, $1)/;
-s/TSerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_TS, $1)/;
-s/UIerr\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_UI, $1)/;
-s/X509V3err\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_X509V3, $1)/;
-s/X509err\([A-Z_]+, *([0-9A-Z_]+)\)/ERR_raise(ERR_LIB_X509, $1)/;
+s/ASN1err\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_ASN1, $1)/;
+s/([^D])ASYNCerr\(\w+, *(\w+)\)/$1ERR_raise(ERR_LIB_ASYNC, $2)/;
+s/BIOerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_BIO, $1)/;
+s/BNerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_BN, $1)/;
+s/BUFerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_BUF, $1)/;
+s/CMPerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_CMP, $1)/;
+s/CMSerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_CMS, $1)/;
+s/COMPerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_COMP, $1)/;
+s/CONFerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_CONF, $1)/;
+s/CRMFerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_CRMF, $1)/;
+s/CRYPTOerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_CRYPTO, $1)/;
+s/CTerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_CT, $1)/;
+s/DHerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_DH, $1)/;
+s/DSAerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_DSA, $1)/;
+s/DSOerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_DSO, $1)/;
+s/ECDHerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_ECDH, $1)/;
+s/ECDSAerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_ECDSA, $1)/;
+s/ECerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_EC, $1)/;
+s/ENGINEerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_ENGINE, $1)/;
+s/ESSerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_ESS, $1)/;
+s/EVPerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_EVP, $1)/;
+s/FIPSerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_FIPS, $1)/;
+s/KDFerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_KDF, $1)/;
+s/OBJerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_OBJ, $1)/;
+s/OCSPerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_OCSP, $1)/;
+s/OSSL_STOREerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_OSSL_STORE, $1)/;
+s/PEMerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_PEM, $1)/;
+s/PKCS12err\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_PKCS12, $1)/;
+s/PKCS7err\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_PKCS7, $1)/;
+s/PROPerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_PROP, $1)/;
+s/PROVerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_PROV, $1)/;
+s/RANDerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_RAND, $1)/;
+s/RSAerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_RSA, $1)/;
+s/SM2err\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_SM2, $1)/;
+s/SSLerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_SSL, $1)/;
+s/SYSerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_SYS, $1)/;
+s/TSerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_TS, $1)/;
+s/UIerr\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_UI, $1)/;
+s/X509V3err\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_X509V3, $1)/;
+s/X509err\(\w+, *(\w+)\)/ERR_raise(ERR_LIB_X509, $1)/;