diff --git a/CHANGES.md b/CHANGES.md

index c061234..0943ac7 100644

--- a/CHANGES.md

+++ b/CHANGES.md

@@ -3,6 +3,7 @@

1.6 - Unreleased

+* TlsRequest: Added a method to query the SSL library name (OpenSSL/LibreSSL).



1.5 - 2022-11-25

diff --git a/include/the_Foundation/tlsrequest.h b/include/the_Foundation/tlsrequest.h

index d0e4d06..9880db0 100644

--- a/include/the_Foundation/tlsrequest.h

+++ b/include/the_Foundation/tlsrequest.h

@@ -148,5 +148,6 @@ typedef iBool (*iTlsRequestVerifyFunc)(iTlsRequest *, const iTlsCertificate *, i

void setCACertificates_TlsRequest(const iString *caFile, const iString *caPath);

void setCiphers_TlsRequest (const char *cipherList);

void setVerifyFunc_TlsRequest (iTlsRequestVerifyFunc verifyFunc);

+const char libraryName_TlsRequest (void); / "OpenSSL" or "LibreSSL", for example */



iEndPublic

diff --git a/src/tlsrequest.c b/src/tlsrequest.c

index 745a34f..a5e897f 100644

--- a/src/tlsrequest.c

+++ b/src/tlsrequest.c

@@ -124,6 +124,7 @@ static void reuse_CachedSession(const iCachedSession *d, SSL *ssl) {

}



struct Impl_Context {

+ iString libraryName;

 SSL_CTX *             ctx;

 X509_STORE *          certStore;

 iTlsRequestVerifyFunc userVerifyFunc;

@@ -230,6 +231,12 @@ static int verifyCallback_Context_(int preverifyOk, X509_STORE_CTX *storeCtx) {

}



void init_Context(iContext *d) {

+ init_String(&d->libraryName);

+#if defined (LIBRESSL_VERSION_TEXT)

+ setCStr_String(&d->libraryName, "LibreSSL");

+#else

+ setCStr_String(&d->libraryName, "OpenSSL");

+#endif

 d->tssKeyCurrentRequest = 0;

 tss_create(&d->tssKeyCurrentRequest, NULL);

#if OPENSSL_API_COMPAT >= 0x10100000L

@@ -263,6 +270,7 @@ void deinit_Context(iContext *d) {

 deinit_Mutex(&d->cacheMutex);

 SSL_CTX_free(d->ctx);

 tss_delete(d->tssKeyCurrentRequest);

+ deinit_String(&d->libraryName);

}



iBool isValid_Context(iContext *d) {

@@ -826,6 +834,11 @@ void setCiphers_TlsRequest(const char *cipherList) {

 SSL_CTX_set_cipher_list(context_->ctx, cipherList);

}



+const char *libraryName_TlsRequest(void) {

+ initContext_();

+ return cstr_String(&context_->libraryName);

+}

+

void init_TlsRequest(iTlsRequest *d) {

 initContext_();

 init_Mutex(&d->mtx);

Proxy Information
Original URL
gemini://git.skyjake.fi/the_Foundation/main/pcdiff/8b08a406c82dd118053bb08eb87e1291ae1f70d7
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
27.075399 milliseconds
Gemini-to-HTML Time
1.308973 milliseconds

This content has been proxied by September (ba2dc).