mirror of
https://github.com/curl/curl.git
synced 2025-01-18 14:04:30 +08:00
openssl: remove #ifdefs for < 0.9.5 support
We only support >= 0.9.7
This commit is contained in:
parent
431ba85829
commit
53b13d0c71
@ -2950,72 +2950,41 @@ size_t Curl_ossl_version(char *buffer, size_t size)
|
||||
#ifdef OPENSSL_IS_BORINGSSL
|
||||
return snprintf(buffer, size, "BoringSSL");
|
||||
#else /* OPENSSL_IS_BORINGSSL */
|
||||
|
||||
#if(OPENSSL_VERSION_NUMBER >= 0x905000)
|
||||
{
|
||||
char sub[3];
|
||||
unsigned long ssleay_value;
|
||||
sub[2]='\0';
|
||||
sub[1]='\0';
|
||||
ssleay_value=SSLeay();
|
||||
if(ssleay_value < 0x906000) {
|
||||
ssleay_value=SSLEAY_VERSION_NUMBER;
|
||||
sub[0]='\0';
|
||||
}
|
||||
else {
|
||||
if(ssleay_value&0xff0) {
|
||||
int minor_ver = (ssleay_value >> 4) & 0xff;
|
||||
if(minor_ver > 26) {
|
||||
/* handle extended version introduced for 0.9.8za */
|
||||
sub[1] = (char) ((minor_ver - 1) % 26 + 'a' + 1);
|
||||
sub[0] = 'z';
|
||||
}
|
||||
else {
|
||||
sub[0]=(char)(((ssleay_value>>4)&0xff) + 'a' -1);
|
||||
}
|
||||
}
|
||||
else
|
||||
sub[0]='\0';
|
||||
}
|
||||
|
||||
return snprintf(buffer, size, "%s/%lx.%lx.%lx%s",
|
||||
#ifdef LIBRESSL_VERSION_NUMBER
|
||||
"LibreSSL"
|
||||
#else
|
||||
"OpenSSL"
|
||||
#endif
|
||||
, (ssleay_value>>28)&0xf,
|
||||
(ssleay_value>>20)&0xff,
|
||||
(ssleay_value>>12)&0xff,
|
||||
sub);
|
||||
char sub[3];
|
||||
unsigned long ssleay_value;
|
||||
sub[2]='\0';
|
||||
sub[1]='\0';
|
||||
ssleay_value=SSLeay();
|
||||
if(ssleay_value < 0x906000) {
|
||||
ssleay_value=SSLEAY_VERSION_NUMBER;
|
||||
sub[0]='\0';
|
||||
}
|
||||
|
||||
#else /* OPENSSL_VERSION_NUMBER is less than 0.9.5 */
|
||||
|
||||
#if(OPENSSL_VERSION_NUMBER >= 0x900000)
|
||||
return snprintf(buffer, size, "OpenSSL/%lx.%lx.%lx",
|
||||
(OPENSSL_VERSION_NUMBER>>28)&0xff,
|
||||
(OPENSSL_VERSION_NUMBER>>20)&0xff,
|
||||
(OPENSSL_VERSION_NUMBER>>12)&0xf);
|
||||
|
||||
#else /* (OPENSSL_VERSION_NUMBER >= 0x900000) */
|
||||
{
|
||||
char sub[2];
|
||||
sub[1]='\0';
|
||||
if(OPENSSL_VERSION_NUMBER&0x0f) {
|
||||
sub[0]=(OPENSSL_VERSION_NUMBER&0x0f) + 'a' -1;
|
||||
else {
|
||||
if(ssleay_value&0xff0) {
|
||||
int minor_ver = (ssleay_value >> 4) & 0xff;
|
||||
if(minor_ver > 26) {
|
||||
/* handle extended version introduced for 0.9.8za */
|
||||
sub[1] = (char) ((minor_ver - 1) % 26 + 'a' + 1);
|
||||
sub[0] = 'z';
|
||||
}
|
||||
else {
|
||||
sub[0]=(char)(((ssleay_value>>4)&0xff) + 'a' -1);
|
||||
}
|
||||
}
|
||||
else
|
||||
sub[0]='\0';
|
||||
|
||||
return snprintf(buffer, size, "SSL/%x.%x.%x%s",
|
||||
(OPENSSL_VERSION_NUMBER>>12)&0xff,
|
||||
(OPENSSL_VERSION_NUMBER>>8)&0xf,
|
||||
(OPENSSL_VERSION_NUMBER>>4)&0xf, sub);
|
||||
}
|
||||
#endif /* (OPENSSL_VERSION_NUMBER >= 0x900000) */
|
||||
#endif /* OPENSSL_VERSION_NUMBER is less than 0.9.5 */
|
||||
|
||||
return snprintf(buffer, size, "%s/%lx.%lx.%lx%s",
|
||||
#ifdef LIBRESSL_VERSION_NUMBER
|
||||
"LibreSSL"
|
||||
#else
|
||||
"OpenSSL"
|
||||
#endif
|
||||
, (ssleay_value>>28)&0xf,
|
||||
(ssleay_value>>20)&0xff,
|
||||
(ssleay_value>>12)&0xff,
|
||||
sub);
|
||||
#endif /* OPENSSL_IS_BORINGSSL */
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user