OpenSSL版本号
程序员文章站
2022-07-08 16:45:21
...
如何兼容历史版本OpenSSL-1.0.2分支
OpenSSL的1.1.0版调整了API接口, 与1.0.2版相比, 删除了成员变量o->data
和o->length
。
参考:
- https://www.openssl.org/docs/man1.1.0/crypto/OPENSSL_VERSION_NUMBER.html
- https://wiki.openssl.org/index.php/OpenSSL_1.1.0_Changes
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define OBJ_get0_data(o) ((o)->data)
#define OBJ_length(o) ((o)->length)
#endif
注意:
OPENSSL_VERSION_NUMBER 的格式应该是0xM-NNFFPPS
最后一个数字S取值0代表dev开发版, 0x1-0xE代表rc1-rc14, 0xF代表release版
- 1.1.0a dev ==0x10100010
- 1.1.0a release==0x1010001f
- 1.0.2g release==0x1000207f
/*-
* Numeric release version identifier:
* MNNFFPPS: major minor fix patch status
* The status nibble has one of the values 0 for development, 1 to e for betas
* 1 to 14, and f for release. The patch level is exactly that.
* For example:
* 0.9.3-dev 0x00903000
* 0.9.3-beta1 0x00903001
* 0.9.3-beta2-dev 0x00903002
* 0.9.3-beta2 0x00903002 (same as ...beta2-dev)
* 0.9.3 0x0090300f
* 0.9.3a 0x0090301f
* 0.9.4 0x0090400f
* 1.2.3z 0x102031af
*
* For continuity reasons (because 0.9.5 is already out, and is coded
* 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level
* part is slightly different, by setting the highest bit. This means
* that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start
* with 0x0090600S...
*
* (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.)
* (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
* major minor fix final patch/beta)
*/
# define OPENSSL_VERSION_NUMBER 0x1010004fL
# ifdef OPENSSL_FIPS
# define OPENSSL_VERSION_TEXT "GmSSL 2.3.1 - OpenSSL 1.1.0d-fips 30 Mar 2018"
# else
# define OPENSSL_VERSION_TEXT "GmSSL 2.3.1 - OpenSSL 1.1.0d 30 Mar 2018"
# endif
ressl
BSD版的libressl目前只提供1.0.x分支的OpenSSL接口, 不支持OBJ_get0_data(o)
等新API