From 676cc3a67faf8170be910c2149d65616697cb126 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 5 Apr 2017 17:06:01 +0200 Subject: [PATCH] Act on deprecation of LONG and ZLONG, step 3 Teach util/mkdef.pl to recognise these lines: #if OPENSSL_API_COMPAT < 0xXXXXXXXXL #if OPENSSL_API_COMPAT >= 0xXXXXXXXXL and add corresponding markers in util/*.num A final 'make update' sets those markers right for LONG and ZLONG. Reviewed-by: Matt Caswell Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/3126) --- util/libcrypto.num | 8 ++++---- util/mkdef.pl | 22 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/util/libcrypto.num b/util/libcrypto.num index 4df542200b..1a19273eab 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -1768,8 +1768,8 @@ ASYNC_init_thread 1755 1_1_0 EXIST::FUNCTION: OCSP_BASICRESP_get_ext_by_OBJ 1756 1_1_0 EXIST::FUNCTION:OCSP X509_reject_clear 1757 1_1_0 EXIST::FUNCTION: DH_security_bits 1758 1_1_0 EXIST::FUNCTION:DH -LONG_it 1759 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: -LONG_it 1759 1_1_0 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +LONG_it 1759 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DEPRECATEDIN_1_2_0 +LONG_it 1759 1_1_0 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DEPRECATEDIN_1_2_0 ASN1_dup 1760 1_1_0 EXIST::FUNCTION: TS_RESP_new 1761 1_1_0 EXIST::FUNCTION:TS i2d_PKCS8PrivateKeyInfo_fp 1762 1_1_0 EXIST::FUNCTION:STDIO @@ -1834,8 +1834,8 @@ X509V3_EXT_add_list 1821 1_1_0 EXIST::FUNCTION: CMS_compress 1822 1_1_0 EXIST::FUNCTION:CMS X509_get_ext_by_critical 1823 1_1_0 EXIST::FUNCTION: ASYNC_WAIT_CTX_clear_fd 1824 1_1_0 EXIST::FUNCTION: -ZLONG_it 1825 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE: -ZLONG_it 1825 1_1_0 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION: +ZLONG_it 1825 1_1_0 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:DEPRECATEDIN_1_2_0 +ZLONG_it 1825 1_1_0 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:DEPRECATEDIN_1_2_0 OPENSSL_sk_find_ex 1826 1_1_0 EXIST::FUNCTION: ASN1_ENUMERATED_to_BN 1827 1_1_0 EXIST::FUNCTION: X509_CRL_get_ext_d2i 1828 1_1_0 EXIST::FUNCTION: diff --git a/util/mkdef.pl b/util/mkdef.pl index 6bc23b1e8e..41992f57c2 100755 --- a/util/mkdef.pl +++ b/util/mkdef.pl @@ -114,6 +114,7 @@ my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", "DEPRECATEDIN_0_9_8", "DEPRECATEDIN_1_0_0", "DEPRECATEDIN_1_1_0", + "DEPRECATEDIN_1_2_0", # SCTP "SCTP", # SRTP @@ -394,6 +395,7 @@ sub do_defs (map { "OPENSSL_SYS_".$_ => 0 } @known_ossl_platforms), (map { "OPENSSL_NO_".$_ => 0 } @known_algorithms), (map { "OPENSSL_USE_".$_ => 0 } @known_algorithms), + (grep /^DEPRECATED_/, @known_algorithms), NOPROTO => 0, PERL5 => 0, _WINDLL => 0, @@ -506,7 +508,22 @@ sub do_defs s/{[^{}]*}//gs; # ignore {} blocks print STDERR "DEBUG: \$def=\"$def\"\n" if $debug && $def ne ""; print STDERR "DEBUG: \$_=\"$_\"\n" if $debug; - if (/^\#\s*ifndef\s+(.*)/) { + if (/^\#\s*if\s+OPENSSL_API_COMPAT\s*(\S)\s*(0x[0-9a-fA-F]{8})L\s*$/) { + my $op = $1; + my $v = hex($2); + if ($op ne '<' && $op ne '>=') { + die "$file unacceptable operator $op: $_\n"; + } + my ($one, $major, $minor) = + ( ($v >> 28) & 0xf, + ($v >> 20) & 0xff, + ($v >> 12) & 0xff ); + my $t = "DEPRECATEDIN_${one}_${major}_${minor}"; + push(@tag,"-"); + push(@tag,$t); + $tag{$t}=($op eq '<' ? 1 : -1); + print STDERR "DEBUG: $file: found tag $t = $tag{$t}\n" if $debug; + } elsif (/^\#\s*ifndef\s+(.*)/) { push(@tag,"-"); push(@tag,$1); $tag{$1}=-1; @@ -637,6 +654,9 @@ sub do_defs , grep(!/^$/, map { $tag{"OPENSSL_USE_".$_} == 1 ? $_ : "" } @known_algorithms); + push @current_algorithms, + grep { /^DEPRECATEDIN_/ && $tag{$_} == 1 } + @known_algorithms; $def .= "#INFO:" .join(',',@current_platforms).":" -- GitLab