diff options
author | Andris Mednis <Andris.Mednis@zabbix.com> | 2022-02-22 11:45:41 +0300 |
---|---|---|
committer | Andris Mednis <Andris.Mednis@zabbix.com> | 2022-02-22 11:45:41 +0300 |
commit | da1733666201318455b0d4fec7feecb101f8f456 (patch) | |
tree | 398f8a43256a7f9ab6f7ca525c2928f2339e01f9 /m4 | |
parent | d2853df0dfb190769840bd90a1c9f975bdeb5b38 (diff) |
...G...PS. [ZBXNEXT-7120] added detection of OpenSSL 3.0 to libopenssl.m4 script
Diffstat (limited to 'm4')
-rw-r--r-- | m4/libopenssl.m4 | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/m4/libopenssl.m4 b/m4/libopenssl.m4 index f5d1e8c5423..7f9698911d0 100644 --- a/m4/libopenssl.m4 +++ b/m4/libopenssl.m4 @@ -53,20 +53,32 @@ found_openssl_with_psk="yes",) AC_DEFUN([LIBOPENSSL_ACCEPT_VERSION], [ # Zabbix minimal supported version of OpenSSL. - # Version numbering scheme is described in /usr/include/openssl/opensslv.h. Specify version number without the - # last byte (status). E.g., version 1.0.1 is 0x1000100f, but without the last byte it is 0x1000100. - minimal_openssl_version=0x1000100 + # Version numbering scheme is described in /usr/include/openssl/opensslv.h. - # get version - found_openssl_version=`grep OPENSSL_VERSION_NUMBER "$1"` - found_openssl_version=`expr "$found_openssl_version" : '.*\(0x[[0-f]][[0-f]][[0-f]][[0-f]][[0-f]][[0-f]][[0-f]]\).*'` + # Is it OpenSSL 3? Test OPENSSL_VERSION_MAJOR - it is defined only in OpenSSL 3.0. + found_openssl_version=`grep OPENSSL_VERSION_MAJOR "$1" | head -n 1` + found_openssl_version=`expr "$found_openssl_version" : '^#.*define.*OPENSSL_VERSION_MAJOR.*\(3\)$'` - # compare versions lexicographically - openssl_version_check=`expr $found_openssl_version \>\= $minimal_openssl_version` - if test "$openssl_version_check" = "1"; then + if test "$found_openssl_version" = "3"; then + # OpenSSL 3.x found accept_openssl_version="yes" - else - accept_openssl_version="no" + else # Is it OpenSSL 1.0.1 - 1.1.1 or LibreSSL? + # These versions use similar version numbering scheme: + # specify version number without the last byte (status). E.g., version 1.0.1 is 0x1000100f, but without the + # last byte it is 0x1000100. + minimal_openssl_version=0x1000100 + + found_openssl_version=`grep OPENSSL_VERSION_NUMBER "$1"` + found_openssl_version=`expr "$found_openssl_version" : '.*\(0x[[0-f]][[0-f]][[0-f]][[0-f]][[0-f]][[0-f]][[0-f]]\).*'` + + # compare versions lexicographically + openssl_version_check=`expr $found_openssl_version \>\= $minimal_openssl_version` + + if test "$openssl_version_check" = "1"; then + accept_openssl_version="yes" + else + accept_openssl_version="no" + fi; fi; ])dnl |