]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
nss: do not directly access SSL_ImplementedCiphers[]
authorKamil Dudka <kdudka@redhat.com>
Fri, 4 Sep 2015 12:35:36 +0000 (14:35 +0200)
committerKamil Dudka <kdudka@redhat.com>
Fri, 4 Sep 2015 12:35:36 +0000 (14:35 +0200)
It causes dynamic linking issues at run-time after an update of NSS.

Bug: https://lists.fedoraproject.org/pipermail/devel/2015-September/214117.html

lib/vtls/nss.c

index 91727c7c336f3c48ac7100b531ddb61585ded28e..c66c60b5617b4bfd720de2de1ef36380de3b4cc4 100644 (file)
@@ -211,16 +211,22 @@ static SECStatus set_ciphers(struct SessionHandle *data, PRFileDesc * model,
   PRBool found;
   char *cipher;
 
+  /* use accessors to avoid dynamic linking issues after an update of NSS */
+  const PRUint16 num_implemented_ciphers = SSL_GetNumImplementedCiphers();
+  const PRUint16 *implemented_ciphers = SSL_GetImplementedCiphers();
+  if(!implemented_ciphers)
+    return SECFailure;
+
   /* First disable all ciphers. This uses a different max value in case
    * NSS adds more ciphers later we don't want them available by
    * accident
    */
-  for(i=0; i<SSL_NumImplementedCiphers; i++) {
-    SSL_CipherPrefSet(model, SSL_ImplementedCiphers[i], PR_FALSE);
+  for(i = 0; i < num_implemented_ciphers; i++) {
+    SSL_CipherPrefSet(model, implemented_ciphers[i], PR_FALSE);
   }
 
   /* Set every entry in our list to false */
-  for(i=0; i<NUM_OF_CIPHERS; i++) {
+  for(i = 0; i < NUM_OF_CIPHERS; i++) {
     cipher_state[i] = PR_FALSE;
   }