diff --git a/IDE/WIN/wolfssljni.vcxproj b/IDE/WIN/wolfssljni.vcxproj
index 349e037..b1f0858 100644
--- a/IDE/WIN/wolfssljni.vcxproj
+++ b/IDE/WIN/wolfssljni.vcxproj
@@ -74,52 +74,52 @@
DynamicLibrary
true
- v142
+ v143
Unicode
DynamicLibrary
true
- v142
+ v143
Unicode
DynamicLibrary
false
- v142
+ v143
true
Unicode
DynamicLibrary
false
- v142
+ v143
true
Unicode
DynamicLibrary
true
- v142
+ v143
Unicode
DynamicLibrary
true
- v142
+ v143
Unicode
DynamicLibrary
false
- v142
+ v143
true
Unicode
DynamicLibrary
false
- v142
+ v143
true
Unicode
@@ -432,4 +432,4 @@ ant
-
+
\ No newline at end of file
diff --git a/examples/WindowsConfig.bat b/examples/WindowsConfig.bat
index a093e2a..8d7d4d8 100644
--- a/examples/WindowsConfig.bat
+++ b/examples/WindowsConfig.bat
@@ -9,7 +9,7 @@
:: included by other example .bat files.
:: wolfSSL Normal non-FIPS (DLL Debug x64)
-SET WOLFSSL_DLL_DIR=..\..\..\wolfssl\IDE\WIN10\DLL Debug\x64
+SET WOLFSSL_DLL_DIR=..\..\..\wolfssl\DLL Debug\x64
SET WOLFSSLJNI_DLL_DIR=..\..\IDE\WIN\DLL Debug\x64
:: wolfSSL Normal non-FIPS (DLL Release x64)
diff --git a/native/com_wolfssl_WolfSSLContext.c b/native/com_wolfssl_WolfSSLContext.c
index caa9854..a54a7de 100644
--- a/native/com_wolfssl_WolfSSLContext.c
+++ b/native/com_wolfssl_WolfSSLContext.c
@@ -5476,7 +5476,7 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLContext_useSupportedCurve
JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLContext_setGroups
(JNIEnv* jenv, jobject jcl, jlong ctxPtr, jintArray groups)
{
-#ifdef HAVE_SUPPORTED_CURVES
+#if defined(HAVE_TLS13) && defined(HAVE_SUPPORTED_CURVES)
int ret = WOLFSSL_FAILURE;
int groupsSz = 0;
int* jniGroups = NULL;
diff --git a/native/com_wolfssl_WolfSSLSession.c b/native/com_wolfssl_WolfSSLSession.c
index a41c9d0..70028a9 100644
--- a/native/com_wolfssl_WolfSSLSession.c
+++ b/native/com_wolfssl_WolfSSLSession.c
@@ -4146,6 +4146,18 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLSession_sslSetAlpnProtos
if (buff != NULL && buffSz > 0) {
ret = wolfSSL_set_alpn_protos(ssl, buff, buffSz);
+#ifdef WOLFSSL_ERROR_CODE_OPENSSL
+ if (ret == 0) {
+ /* wolfSSL_set_alpn_protos() returns 0 on success if
+ * WOLFSSL_ERROR_CODE_OPENSSL is defined, to match behavior of
+ * OpenSSL for compatibility layer. We translate back to
+ * a consistent SSL_SUCCESS here */
+ ret = SSL_SUCCESS;
+ }
+ else {
+ ret = SSL_FAILURE;
+ }
+#endif
}
(*jenv)->ReleaseByteArrayElements(jenv, alpnProtos,
@@ -4279,7 +4291,7 @@ int NativeALPNSelectCb(WOLFSSL *ssl, const unsigned char **out,
jmethodID alpnSelectMethodId; /* internalAlpnSelectCallback ID */
int ret = 0;
- int idx = 0;
+ unsigned int idx = 0;
int peerProtoCount = 0;
char* peerProtos = NULL;
char* peerProtosCopy = NULL;
@@ -4533,7 +4545,7 @@ int NativeALPNSelectCb(WOLFSSL *ssl, const unsigned char **out,
/* get char* from jstring */
selectedProtoCharArr = (*jenv)->GetStringUTFChars(jenv,
selectedProto, 0);
- selectedProtoCharArrSz = XSTRLEN(selectedProtoCharArr);
+ selectedProtoCharArrSz = (int)XSTRLEN(selectedProtoCharArr);
/* see if selected ALPN protocol is in original sent list */
if (selectedProtoCharArr != NULL) {
diff --git a/src/test/com/wolfssl/test/WolfSSLSessionTest.java b/src/test/com/wolfssl/test/WolfSSLSessionTest.java
index 40de89a..bd79818 100644
--- a/src/test/com/wolfssl/test/WolfSSLSessionTest.java
+++ b/src/test/com/wolfssl/test/WolfSSLSessionTest.java
@@ -268,6 +268,7 @@ public class WolfSSLSessionTest {
if (!e.getMessage().equals("wolfSSL not compiled with PSK " +
"support")) {
System.out.println("\t\t... failed");
+ fail("Failed setPskClientCb test");
e.printStackTrace();
}
}
@@ -303,6 +304,7 @@ public class WolfSSLSessionTest {
if (!e.getMessage().equals("wolfSSL not compiled with PSK " +
"support")) {
System.out.println("\t\t... failed");
+ fail("Failed setPskServerCb test");
e.printStackTrace();
}
}
@@ -320,6 +322,7 @@ public class WolfSSLSessionTest {
}
} catch (IllegalStateException e) {
System.out.println("\t\t... failed");
+ fail("Failed usePskIdentityHint test");
e.printStackTrace();
}
System.out.println("\t\t... passed");
@@ -335,6 +338,7 @@ public class WolfSSLSessionTest {
}
} catch (IllegalStateException e) {
System.out.println("\t\t... failed");
+ fail("Failed getPskIdentityHint test");
e.printStackTrace();
}
System.out.println("\t\t... passed");
@@ -362,6 +366,7 @@ public class WolfSSLSessionTest {
String identity = ssl.getPskIdentity();
} catch (IllegalStateException e) {
System.out.println("\t\t... failed");
+ fail("Failed getPskIdentity test");
e.printStackTrace();
}
System.out.println("\t\t... passed");
@@ -373,6 +378,7 @@ public class WolfSSLSessionTest {
ssl.setTimeout(5);
if (ssl.getTimeout() != 5) {
System.out.println("\t\t\t... failed");
+ fail("Failed timeout test");
}
System.out.println("\t\t\t... passed");
}
@@ -382,6 +388,7 @@ public class WolfSSLSessionTest {
System.out.print("\tstatus()");
if (ssl.handshakeDone() == true) {
System.out.println("\t\t\t... failed");
+ fail("Failed status test");
}
System.out.println("\t\t\t... passed");
}
@@ -397,6 +404,7 @@ public class WolfSSLSessionTest {
System.out.println("\t\t\t... skipped");
} else if (ret != WolfSSL.SSL_SUCCESS) {
System.out.println("\t\t\t... failed");
+ fail("Failed useSNI test");
} else {
System.out.println("\t\t\t... passed");
}
@@ -408,7 +416,9 @@ public class WolfSSLSessionTest {
String[] alpnProtos = new String[] {
"h2", "http/1.1"
};
- byte[] alpnProtoBytes = "http/1.1".getBytes();
+ String http11Alpn = "http/1.1";
+ byte[] alpnProtoBytes = http11Alpn.getBytes();
+ byte[] alpnProtoBytesPacked = new byte[1 + alpnProtoBytes.length];
System.out.print("\tuseALPN()");
@@ -447,7 +457,12 @@ public class WolfSSLSessionTest {
/* Testing useALPN(byte[]) */
if (ret == WolfSSL.SSL_SUCCESS) {
- ret = ssl.useALPN(alpnProtoBytes);
+
+ alpnProtoBytesPacked[0] = (byte)http11Alpn.length();
+ System.arraycopy(alpnProtoBytes, 0, alpnProtoBytesPacked, 1,
+ alpnProtoBytes.length);
+
+ ret = ssl.useALPN(alpnProtoBytesPacked);
}
if (ret == WolfSSL.SSL_SUCCESS) {
@@ -462,6 +477,7 @@ public class WolfSSLSessionTest {
System.out.println("\t\t\t... skipped");
} else if (ret != WolfSSL.SSL_SUCCESS) {
System.out.println("\t\t\t... failed");
+ fail("Failed useALPN test");
} else {
System.out.println("\t\t\t... passed");
}
@@ -475,6 +491,7 @@ public class WolfSSLSessionTest {
ssl.freeSSL();
} catch (WolfSSLJNIException e) {
System.out.println("\t\t\t... failed");
+ fail("Failed freeSSL test");
e.printStackTrace();
}
System.out.println("\t\t\t... passed");
@@ -530,6 +547,7 @@ public class WolfSSLSessionTest {
} catch (Exception e) {
System.out.println("\t\t... failed");
+ fail("Failed UseAfterFree test");
e.printStackTrace();
return;
}
@@ -542,6 +560,7 @@ public class WolfSSLSessionTest {
return;
} catch (SocketTimeoutException | SocketException e) {
System.out.println("\t\t... failed");
+ fail("Failed UseAfterFree test");
e.printStackTrace();
return;
}
@@ -619,6 +638,7 @@ public class WolfSSLSessionTest {
} catch (Exception e) {
System.out.println("\t\t... failed");
+ fail("Failed getSessionID test");
e.printStackTrace();
return;
}
@@ -649,6 +669,7 @@ public class WolfSSLSessionTest {
ret = ssl.useSecureRenegotiation();
if (ret != WolfSSL.SSL_SUCCESS && ret != WolfSSL.NOT_COMPILED_IN) {
System.out.println("... failed");
+ fail("Failed useSecureRenegotiation test");
ssl.freeSSL();
sslCtx.free();
return;
@@ -659,6 +680,7 @@ public class WolfSSLSessionTest {
} catch (Exception e) {
System.out.println("... failed");
+ fail("Failed useSecureRenegotiation test");
e.printStackTrace();
return;
}