Newer
Older
#else /* (OPENSSL_VERSION_NUMBER >= 0x900000) */
Daniel Stenberg
committed
{
char sub[2];
sub[1]='\0';
if(OPENSSL_VERSION_NUMBER&0x0f) {
sub[0]=(OPENSSL_VERSION_NUMBER&0x0f) + 'a' -1;
Daniel Stenberg
committed
}
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);
Daniel Stenberg
committed
}
#endif /* (OPENSSL_VERSION_NUMBER >= 0x900000) */
#endif /* OPENSSL_VERSION_NUMBER is less than 0.9.5 */
Daniel Stenberg
committed
Daniel Stenberg
committed
}
/* can be called with data == NULL */
int Curl_ossl_random(struct SessionHandle *data, unsigned char *entropy,
size_t length)
Curl_ossl_seed(data); /* Initiate the seed if not already done */
RAND_bytes(entropy, curlx_uztosi(length));
return 0; /* 0 as in no problem */
}
void Curl_ossl_md5sum(unsigned char *tmp, /* input */
size_t tmplen,
unsigned char *md5sum /* output */,
size_t unused)
{
MD5_CTX MD5pw;
(void)unused;
MD5_Init(&MD5pw);
MD5_Update(&MD5pw, tmp, tmplen);
MD5_Final(md5sum, &MD5pw);
}
#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL) && !defined(OPENSSL_NO_SHA256)
void Curl_ossl_sha256sum(const unsigned char *tmp, /* input */
size_t tmplen,
unsigned char *sha256sum /* output */,
size_t unused)
{
SHA256_CTX SHA256pw;
(void)unused;
SHA256_Init(&SHA256pw);
SHA256_Update(&SHA256pw, tmp, tmplen);
SHA256_Final(sha256sum, &SHA256pw);
}
bool Curl_ossl_cert_status_request(void)
{
#if (OPENSSL_VERSION_NUMBER >= 0x0090808fL) && !defined(OPENSSL_NO_TLSEXT) && \
!defined(OPENSSL_IS_BORINGSSL)
return TRUE;
#else
return FALSE;
#endif
}