Bug #119800 An error occurred in ssl.cmake reading version information from opensslv.h, causing HAVE_TLSv13 to fail to compile.
Submitted: 28 Jan 8:53 Modified: 28 Jan 10:28
Reporter: 宋 song Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:8.4 OS:Any
Assigned to: CPU Architecture:Any

[28 Jan 8:53] 宋 song
Description:
hello:

An error occurred in ssl.cmake reading version information from opensslv.h, causing HAVE_TLSv13 to fail to compile.

How to repeat:
1. For example, in opensslv.h, `#define OPENSSL_VERSION_NUMBER 0x1010117fL` corresponds to OpenSSL version 1.1.1w.

2. Directly using `STRING_APPEND(OPENSSL_MAJOR_MINOR_FIX_VERSION ".${OPENSSL_VERSION_MINOR}")` in ssl.cmake causes the final version `OPENSSL_MAJOR_MINOR_FIX_VERSION` to become 1.01.01.

3. This causes the following conditional statement to fail: `ADD_DEFINITIONS(-DHAVE_TLSv13)`

`IF("${OPENSSL_MAJOR_MINOR_FIX_VERSION}" VERSION_GREATER "1.1.0")`

`ADD_DEFINITIONS(-DHAVE_TLSv13)`

`ENDIF()`

Suggested fix:
You can perform number base conversion before using it.

`math(EXPR OPENSSL_VERSION_MINOR_DEC "0x${OPENSSL_VERSION_MINOR}")`

`math(EXPR OPENSSL_FIX_VERSION_DEC "0x${OPENSSL_FIX_VERSION}")`

`STRING_APPEND(OPENSSL_MAJOR_MINOR_FIX_VERSION ".${OPENSSL_VERSION_MINOR_DEC}")`

`STRING_APPEND(OPENSSL_MAJOR_MINOR_FIX_VERSION ".${OPENSSL_FIX_VERSION_DEC}")`
[28 Jan 10:28] 宋 song
Sorry, ignore this submission.
The expression `IF("${OPENSSL_MAJOR_MINOR_FIX_VERSION}" VERSION_GREATER "1.1.0")` can be compared.