Description of problem: We, an NSS application, have many places to log or return an SSL version string in the human readable manner, e.g., "SSL3", "TLS1.3, and so on. Currently, we are generating the string in our code, which may become obsolete or invalid any time if NSS change the value of the following macros. Instead of assuming these values, we'd like to have the official API to get the SSL version string. + * nss3/sslproto.h + * #define SSL_LIBRARY_VERSION_2 0x0002 + * #define SSL_LIBRARY_VERSION_3_0 0x0300 + * #define SSL_LIBRARY_VERSION_TLS_1_0 0x0301 + * #define SSL_LIBRARY_VERSION_TLS_1_1 0x0302 + * #define SSL_LIBRARY_VERSION_TLS_1_2 0x0303 + * #define SSL_LIBRARY_VERSION_TLS_1_3 0x0304
FYI: We "temporarily" implemented this get SSL version string helper function in the Directory Server code (slapd/ssl.c). We'd like to replace this function with the official API provided by NSS. /* * If non NULL buf and positive bufsize is given, * the memory is used to store the version string. * Otherwise, the memory for the string is allocated. * The latter case, caller is responsible to free it. */ char * slapi_getSSLVersion_str(PRUint16 vnum, char *buf, size_t bufsize) { char *vstr = buf; if (vnum >= SSL_LIBRARY_VERSION_3_0) { if (vnum == SSL_LIBRARY_VERSION_3_0) { /* SSL3 */ if (buf && bufsize) { PR_snprintf(buf, bufsize, "SSL3"); } else { vstr = slapi_ch_smprintf("SSL3"); } } else { /* TLS v X.Y */ const char *TLSFMT = "TLS%d.%d"; int minor_offset = 0; /* e.g. 0x0401 -> TLS v 2.1, not 2.0 */ if ((vnum & SSL_LIBRARY_VERSION_3_0) == SSL_LIBRARY_VERSION_3_0) { minor_offset = 1; /* e.g. 0x0301 -> TLS v 1.0, not 1.1 */ } if (buf && bufsize) { PR_snprintf(buf, bufsize, TLSFMT, (vnum >> 8) - 2, (vnum & 0xff) - minor_offset); } else { vstr = slapi_ch_smprintf(TLSFMT, (vnum >> 8) - 2, (vnum & 0xff) - minor_offset); } } } else if (vnum == SSL_LIBRARY_VERSION_2) { /* SSL2 */ if (buf && bufsize) { PR_snprintf(buf, bufsize, "SSL2"); } else { vstr = slapi_ch_smprintf("SSL2"); } } else { if (buf && bufsize) { PR_snprintf(buf, bufsize, "Unknown SSL version: 0x%x", vnum); } else { vstr = slapi_ch_smprintf("Unknown SSL version: 0x%x", vnum); } } return vstr; }
This message is a reminder that Fedora 20 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 20. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '20'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 20 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed.
Still an issue in Fedora rawhide.
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
NSSUTIL_GetVersion NSS_GetVersion NSSSSL_GetVersion NSSSMIME_GetVersion PR_GetVersion These functions have been available since NSPR 4.8.9 and NSS 3.13
(In reply to Kai Engert (:kaie) from comment #6) > NSSUTIL_GetVersion > NSS_GetVersion > NSSSSL_GetVersion > NSSSMIME_GetVersion > PR_GetVersion > > These functions have been available since NSPR 4.8.9 and NSS 3.13 How are the above functions related to the problem described in comment #0 and comment #1 (translation of SSL version enumeration constants to strings)?
I misinterpreted the request, I thought you'd like a version string for the NSS library version. Feature enhancement requests liks this should be reported upstream, where the software development takes place (not in Fedora where we're mostly doing packaging).
still haven't been requested upstream.
(In reply to Kai Engert (:kaie) from comment #9) > still haven't been requested upstream. I believe this was requested 9 years ago: https://bugzilla.mozilla.org/480174
I thought that mozilla bug was for fedora bug 917134. Is this bug a duplicate of bug 917134 ?
Sorry, fedora bug 917133
Not really a duplicate but very similar (one is about cipher-suite names and one about SSL versions). Anyway, I do not think that creating additional upstream requests is going to help us much...
I doubt such API is really useful. As those codepoints are standardized in TLS, applications can safely rely on it. Also the format of version numvers depends on application: some might want "SSL3" and the others might want "ssl3.0". I'd rather leave this choice to applications.