source: trunk/dports/devel/openssl/files/fix-Apple-clang-version-detection.patch @ 145209

Last change on this file since 145209 was 145209, checked in by raimue@…, 4 years ago

devel/openssl: Update to 1.0.2f

Fixes CVE-2016-0701, CVE-2015-3197.
Adapt clang detection patch for new version.

Also revbump freeradius, tor, and tor-devel.

File size: 10.0 KB
  • ./crypto/aes/asm/aesni-mb-x86_64.pl

    Fix OpenSSL compiler version gates for older Apple clang versions
    
    OpenSSL modified the detection code for AVX and the addx instruction to support
    clang from Xcode 7. The new regexes now match and extract the "Apple" version
    numbering scheme, which is then interpreted as LLVM version number and yields
    incorrect results.
    
    Fix this by introducing separate checks for Apple's compiler versions. This is
    necessary because Apple has now dropped the "based on LLVM" string in newer
    compiler versions. Of course the best alternative would be to switch to tests
    that actually check whether the feature is present, rather than looking at the
    compiler versions, though.
    
    Signed-off-by: Clemens Lang <cal@macports.org>
    Upstream-Status: Submitted [https://github.com/openssl/openssl/issues/494]
    old new  
    6363        $avx = ($1>=10) + ($1>=11);
    6464}
    6565
    66 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
     66if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:clang|LLVM) version) ([2-9]\.[0-9]+)/) {
     67        # Apple clang versions 2.1 and 3.0 correspond to LLVM 3.0
     68        # Apple clang versions 3.1 and 4.1 correspond to LLVM 3.1
     69        # see http://trac.macports.org/wiki/XcodeVersionInfo
     70        $avx = ($2>=2.1) + ($2>=3.1);
     71}
     72
     73if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
    6774        $avx = ($2>=3.0) + ($2>3.0);
    6875}
    6976
  • ./crypto/aes/asm/aesni-sha1-x86_64.pl

    old new  
    9494$avx=1 if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
    9595           `ml64 2>&1` =~ /Version ([0-9]+)\./ &&
    9696           $1>=10);
    97 $avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/ && $2>=3.0);
     97# Apple clang 2.1 and 3.0 correspond to LLVM 3.0, see http://trac.macports.org/wiki/XcodeVersionInfo
     98$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:^clang|LLVM) version) ([2-9]\.[0-9]+)/ && $2>=2.1);
     99$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9]\.[0-9]+)/ && $2>=3.0);
    98100
    99101$shaext=1;      ### set to zero if compiling for 1.0.1
    100102
  • ./crypto/aes/asm/aesni-sha256-x86_64.pl

    old new  
    5959        $avx = ($1>=10) + ($1>=12);
    6060}
    6161
    62 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
     62if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:clang|LLVM) version) ([2-9]\.[0-9]+)/) {
     63        # Apple clang versions 2.1 and 3.0 correspond to LLVM 3.0
     64        # Apple clang versions 3.1 and 4.1 correspond to LLVM 3.1
     65        # see http://trac.macports.org/wiki/XcodeVersionInfo
     66        $avx = ($2>=2.1) + ($2>=3.1);
     67}
     68
     69if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
    6370        $avx = ($2>=3.0) + ($2>3.0);
    6471}
    6572
  • ./crypto/bn/asm/rsaz-x86_64.pl

    old new  
    113113        $addx = ($1>=12);
    114114}
    115115
    116 if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9])\.([0-9]+)/) {
     116if (!$addx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:clang|LLVM) version) ([5-9])\.([0-9]+)/) {
     117        my $ver = $2 + $3/100.0;        # 3.1->3.01, 3.10->3.10
     118        $addx = ($ver>=5.00);           # Apple LLVM version 5.0 corresponds to LLVM 3.3, see http://trac.macports.org/wiki/XcodeVersionInfo
     119}
     120
     121if (!$addx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9])\.([0-9]+)/) {
    117122        my $ver = $2 + $3/100.0;        # 3.1->3.01, 3.10->3.10
    118123        $addx = ($ver>=3.03);
    119124}
  • ./crypto/bn/asm/x86_64-mont.pl

    old new  
    6868        $addx = ($1>=12);
    6969}
    7070
    71 if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9])\.([0-9]+)/) {
     71if (!$addx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:clang|LLVM) version) ([5-9])\.([0-9]+)/) {
     72        my $ver = $2 + $3/100.0;        # 3.1->3.01, 3.10->3.10
     73        $addx = ($ver>=5.00);           # Apple LLVM version 5.0 corresponds to LLVM 3.3, see http://trac.macports.org/wiki/XcodeVersionInfo
     74}
     75
     76if (!$addx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9])\.([0-9]+)/) {
    7277        my $ver = $2 + $3/100.0;        # 3.1->3.01, 3.10->3.10
    7378        $addx = ($ver>=3.03);
    7479}
  • ./crypto/bn/asm/x86_64-mont5.pl

    old new  
    5353        $addx = ($1>=12);
    5454}
    5555
    56 if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9])\.([0-9]+)/) {
     56if (!$addx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:clang|LLVM) version) ([5-9])\.([0-9]+)/) {
     57        my $ver = $2 + $3/100.0;        # 3.1->3.01, 3.10->3.10
     58        $addx = ($ver>=5.00);           # Apple LLVM version 5.0 corresponds to LLVM 3.3, see http://trac.macports.org/wiki/XcodeVersionInfo
     59}
     60
     61if (!$addx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9])\.([0-9]+)/) {
    5762        my $ver = $2 + $3/100.0;        # 3.1->3.01, 3.10->3.10
    5863        $addx = ($ver>=3.03);
    5964}
  • ./crypto/ec/asm/ecp_nistz256-x86_64.pl

    old new  
    8181        $addx = ($1>=12);
    8282}
    8383
    84 if (!$addx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9])\.([0-9]+)/) {
     84if (!$addx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:clang|LLVM) version) ([2-9])\.([0-9]+)/) {
     85        my $ver = $2 + $3/100.0;        # 3.1->3.01, 3.10->3.10
     86        # Apple clang versions 2.1 and 3.0 correspond to LLVM 3.0
     87        # Apple clang versions 3.1 and 4.1 correspond to LLVM 3.1
     88        $avx = ($ver>=2.01) + ($ver>=3.01);
     89        # Apple LLVM version 5.0 corresponds to LLVM 3.3
     90        $addx = ($ver>=5.00);           
     91}
     92
     93if (!$addx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9])\.([0-9]+)/) {
    8594        my $ver = $2 + $3/100.0;        # 3.1->3.01, 3.10->3.10
    8695        $avx = ($ver>=3.0) + ($ver>=3.01);
    8796        $addx = ($ver>=3.03);
  • ./crypto/modes/asm/aesni-gcm-x86_64.pl

    old new  
    5656        $avx = ($1>=10) + ($1>=11);
    5757}
    5858
    59 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
     59if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:^clang|LLVM) version) ([2-9]\.[0-9]+)/) {
     60        # Apple clang versions 2.1 and 3.0 correspond to LLVM 3.0
     61        # Apple clang versions 3.1 and 4.1 correspond to LLVM 3.1
     62        $avx = ($2>=2.1) + ($2>=3.1);
     63}
     64
     65if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
    6066        $avx = ($2>=3.0) + ($2>3.0);
    6167}
    6268
  • ./crypto/modes/asm/ghash-x86_64.pl

    old new  
    105105        $avx = ($1>=10) + ($1>=11);
    106106}
    107107
    108 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
     108if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:^clang|LLVM) version) ([2-9]\.[0-9]+)/) {
     109        # Apple clang versions 2.1 and 3.0 correspond to LLVM 3.0
     110        # Apple clang versions 3.1 and 4.1 correspond to LLVM 3.1
     111        $avx = ($2>=2.1) + ($2>=3.1);
     112}
     113
     114if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
    109115        $avx = ($2>=3.0) + ($2>3.0);
    110116}
    111117
  • ./crypto/sha/asm/sha1-mb-x86_64.pl

    old new  
    5858        $avx = ($1>=10) + ($1>=11);
    5959}
    6060
    61 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
     61if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:^clang|LLVM) version) ([2-9]\.[0-9]+)/) {
     62        # Apple clang versions 2.1 and 3.0 correspond to LLVM 3.0
     63        # Apple clang versions 3.1 and 4.1 correspond to LLVM 3.1
     64        $avx = ($2>=2.1) + ($2>=3.1);
     65}
     66
     67if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
    6268        $avx = ($2>=3.0) + ($2>3.0);
    6369}
    6470
  • ./crypto/sha/asm/sha1-x86_64.pl

    old new  
    107107        $avx = ($1>=10) + ($1>=11);
    108108}
    109109
    110 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([2-9]\.[0-9]+)/) {
     110if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:^clang|LLVM) version) ([2-9]\.[0-9]+)/) {
     111        # Apple clang versions 2.1 and 3.0 correspond to LLVM 3.0
     112        # Apple clang versions 3.1 and 4.1 correspond to LLVM 3.1
     113        $avx = ($2>=2.1) + ($2>=3.1);
     114}
     115
     116if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
    111117        $avx = ($2>=3.0) + ($2>3.0);
    112118}
    113119
  • ./crypto/sha/asm/sha256-mb-x86_64.pl

    old new  
    5959        $avx = ($1>=10) + ($1>=11);
    6060}
    6161
    62 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
     62if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:^clang|LLVM) version) ([2-9]\.[0-9]+)/) {
     63        # Apple clang versions 2.1 and 3.0 correspond to LLVM 3.0
     64        # Apple clang versions 3.1 and 4.1 correspond to LLVM 3.1
     65        $avx = ($2>=2.1) + ($2>=3.1);
     66}
     67
     68if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
    6369        $avx = ($2>=3.0) + ($2>3.0);
    6470}
    6571
  • ./crypto/sha/asm/sha512-x86_64.pl

    old new  
    124124        $avx = ($1>=10) + ($1>=11);
    125125}
    126126
    127 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
     127if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^Apple (?:^clang|LLVM) version) ([2-9]\.[0-9]+)/) {
     128        # Apple clang versions 2.1 and 3.0 correspond to LLVM 3.0
     129        # Apple clang versions 3.1 and 4.1 correspond to LLVM 3.1
     130        $avx = ($2>=2.1) + ($2>=3.1);
     131}
     132
     133if (!$avx && `$ENV{CC} -v 2>&1` =~ /(^clang version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
    128134        $avx = ($2>=3.0) + ($2>3.0);
    129135}
    130136
Note: See TracBrowser for help on using the repository browser.