Skip to content

Commit

Permalink
Fix test 17 error on build
Browse files Browse the repository at this point in the history
With the nss update to >= 3.101 the nss context gets initialised after
the CryptoManager instance is retrieved so this step is added before
the test.

Additional, the ssl option test for get and set has been modified to
enable/disable ssl cache since the ssl3 option is policy dependent and do not
always work.
  • Loading branch information
fmarco76 committed Jun 26, 2024
1 parent 0da84f4 commit 1f26f74
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions base/src/test/java/org/mozilla/jss/tests/TestRawSSL.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.mozilla.jss.tests;

import org.mozilla.jss.CryptoManager;
import org.mozilla.jss.nss.PR;
import org.mozilla.jss.nss.PRFDProxy;
import org.mozilla.jss.nss.SSL;
Expand Down Expand Up @@ -27,15 +28,15 @@ public static void TestSSLOptions() throws Exception {
SSLFDProxy ssl_fd = SSL.ImportFD(null, fd);
assert(ssl_fd != null);

// 8 == SSL_ENABLE_SSL3; disable it
assert(SSL.OptionSet(ssl_fd, 8, 0) == SSL.SECSuccess);
// 9 == SSL_NO_CACHE; disable it
assert(SSL.OptionSet(ssl_fd, 9, 0) == SSL.SECSuccess);

// Validate that the set worked.
assert(SSL.OptionGet(ssl_fd, 8) == SSL.SECSuccess);
assert(SSL.OptionGet(ssl_fd, 9) == SSL.SECSuccess);

// Renable SSL_ENABLE_SSL3 and validate it worked
assert(SSL.OptionSet(ssl_fd, 8, 1) == SSL.SECSuccess);
assert(SSL.OptionGet(ssl_fd, 8) == 1);
// Renable SSL_NO_CACHE and validate it worked
assert(SSL.OptionSet(ssl_fd, 9, 1) == SSL.SECSuccess);
assert(SSL.OptionGet(ssl_fd, 9) == 1);

// Ensure that setting an invalid option fails
assert(SSL.OptionSet(ssl_fd, 799999, 0) != SSL.SECSuccess);
Expand Down Expand Up @@ -160,7 +161,7 @@ public static void main(String[] args) throws Exception {
System.out.println("Usage: TestRawSSL /path/to/nssdb");
System.exit(1);
}

CryptoManager cm = CryptoManager.getInstance();
System.out.println("Calling TestSSLImportFD()...");
TestSSLImportFD();

Expand Down

0 comments on commit 1f26f74

Please sign in to comment.