Fix Windows build warnings, update WindowsConfig.bat, ALPN bytes test in WolfSSLSession
parent
56c4fe0573
commit
6229224d5d
|
@ -74,52 +74,52 @@
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug FIPS|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug FIPS|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release FIPS|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release FIPS|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug FIPS|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Debug FIPS|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release FIPS|x64'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DLL Release FIPS|x64'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
:: included by other example .bat files.
|
:: included by other example .bat files.
|
||||||
|
|
||||||
:: wolfSSL Normal non-FIPS (DLL Debug x64)
|
:: 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
|
SET WOLFSSLJNI_DLL_DIR=..\..\IDE\WIN\DLL Debug\x64
|
||||||
|
|
||||||
:: wolfSSL Normal non-FIPS (DLL Release x64)
|
:: wolfSSL Normal non-FIPS (DLL Release x64)
|
||||||
|
|
|
@ -5476,7 +5476,7 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLContext_useSupportedCurve
|
||||||
JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLContext_setGroups
|
JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLContext_setGroups
|
||||||
(JNIEnv* jenv, jobject jcl, jlong ctxPtr, jintArray groups)
|
(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 ret = WOLFSSL_FAILURE;
|
||||||
int groupsSz = 0;
|
int groupsSz = 0;
|
||||||
int* jniGroups = NULL;
|
int* jniGroups = NULL;
|
||||||
|
|
|
@ -4146,6 +4146,18 @@ JNIEXPORT jint JNICALL Java_com_wolfssl_WolfSSLSession_sslSetAlpnProtos
|
||||||
|
|
||||||
if (buff != NULL && buffSz > 0) {
|
if (buff != NULL && buffSz > 0) {
|
||||||
ret = wolfSSL_set_alpn_protos(ssl, buff, buffSz);
|
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,
|
(*jenv)->ReleaseByteArrayElements(jenv, alpnProtos,
|
||||||
|
@ -4279,7 +4291,7 @@ int NativeALPNSelectCb(WOLFSSL *ssl, const unsigned char **out,
|
||||||
jmethodID alpnSelectMethodId; /* internalAlpnSelectCallback ID */
|
jmethodID alpnSelectMethodId; /* internalAlpnSelectCallback ID */
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int idx = 0;
|
unsigned int idx = 0;
|
||||||
int peerProtoCount = 0;
|
int peerProtoCount = 0;
|
||||||
char* peerProtos = NULL;
|
char* peerProtos = NULL;
|
||||||
char* peerProtosCopy = NULL;
|
char* peerProtosCopy = NULL;
|
||||||
|
@ -4533,7 +4545,7 @@ int NativeALPNSelectCb(WOLFSSL *ssl, const unsigned char **out,
|
||||||
/* get char* from jstring */
|
/* get char* from jstring */
|
||||||
selectedProtoCharArr = (*jenv)->GetStringUTFChars(jenv,
|
selectedProtoCharArr = (*jenv)->GetStringUTFChars(jenv,
|
||||||
selectedProto, 0);
|
selectedProto, 0);
|
||||||
selectedProtoCharArrSz = XSTRLEN(selectedProtoCharArr);
|
selectedProtoCharArrSz = (int)XSTRLEN(selectedProtoCharArr);
|
||||||
|
|
||||||
/* see if selected ALPN protocol is in original sent list */
|
/* see if selected ALPN protocol is in original sent list */
|
||||||
if (selectedProtoCharArr != NULL) {
|
if (selectedProtoCharArr != NULL) {
|
||||||
|
|
|
@ -268,6 +268,7 @@ public class WolfSSLSessionTest {
|
||||||
if (!e.getMessage().equals("wolfSSL not compiled with PSK " +
|
if (!e.getMessage().equals("wolfSSL not compiled with PSK " +
|
||||||
"support")) {
|
"support")) {
|
||||||
System.out.println("\t\t... failed");
|
System.out.println("\t\t... failed");
|
||||||
|
fail("Failed setPskClientCb test");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -303,6 +304,7 @@ public class WolfSSLSessionTest {
|
||||||
if (!e.getMessage().equals("wolfSSL not compiled with PSK " +
|
if (!e.getMessage().equals("wolfSSL not compiled with PSK " +
|
||||||
"support")) {
|
"support")) {
|
||||||
System.out.println("\t\t... failed");
|
System.out.println("\t\t... failed");
|
||||||
|
fail("Failed setPskServerCb test");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,6 +322,7 @@ public class WolfSSLSessionTest {
|
||||||
}
|
}
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
System.out.println("\t\t... failed");
|
System.out.println("\t\t... failed");
|
||||||
|
fail("Failed usePskIdentityHint test");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
System.out.println("\t\t... passed");
|
System.out.println("\t\t... passed");
|
||||||
|
@ -335,6 +338,7 @@ public class WolfSSLSessionTest {
|
||||||
}
|
}
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
System.out.println("\t\t... failed");
|
System.out.println("\t\t... failed");
|
||||||
|
fail("Failed getPskIdentityHint test");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
System.out.println("\t\t... passed");
|
System.out.println("\t\t... passed");
|
||||||
|
@ -362,6 +366,7 @@ public class WolfSSLSessionTest {
|
||||||
String identity = ssl.getPskIdentity();
|
String identity = ssl.getPskIdentity();
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
System.out.println("\t\t... failed");
|
System.out.println("\t\t... failed");
|
||||||
|
fail("Failed getPskIdentity test");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
System.out.println("\t\t... passed");
|
System.out.println("\t\t... passed");
|
||||||
|
@ -373,6 +378,7 @@ public class WolfSSLSessionTest {
|
||||||
ssl.setTimeout(5);
|
ssl.setTimeout(5);
|
||||||
if (ssl.getTimeout() != 5) {
|
if (ssl.getTimeout() != 5) {
|
||||||
System.out.println("\t\t\t... failed");
|
System.out.println("\t\t\t... failed");
|
||||||
|
fail("Failed timeout test");
|
||||||
}
|
}
|
||||||
System.out.println("\t\t\t... passed");
|
System.out.println("\t\t\t... passed");
|
||||||
}
|
}
|
||||||
|
@ -382,6 +388,7 @@ public class WolfSSLSessionTest {
|
||||||
System.out.print("\tstatus()");
|
System.out.print("\tstatus()");
|
||||||
if (ssl.handshakeDone() == true) {
|
if (ssl.handshakeDone() == true) {
|
||||||
System.out.println("\t\t\t... failed");
|
System.out.println("\t\t\t... failed");
|
||||||
|
fail("Failed status test");
|
||||||
}
|
}
|
||||||
System.out.println("\t\t\t... passed");
|
System.out.println("\t\t\t... passed");
|
||||||
}
|
}
|
||||||
|
@ -397,6 +404,7 @@ public class WolfSSLSessionTest {
|
||||||
System.out.println("\t\t\t... skipped");
|
System.out.println("\t\t\t... skipped");
|
||||||
} else if (ret != WolfSSL.SSL_SUCCESS) {
|
} else if (ret != WolfSSL.SSL_SUCCESS) {
|
||||||
System.out.println("\t\t\t... failed");
|
System.out.println("\t\t\t... failed");
|
||||||
|
fail("Failed useSNI test");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("\t\t\t... passed");
|
System.out.println("\t\t\t... passed");
|
||||||
}
|
}
|
||||||
|
@ -408,7 +416,9 @@ public class WolfSSLSessionTest {
|
||||||
String[] alpnProtos = new String[] {
|
String[] alpnProtos = new String[] {
|
||||||
"h2", "http/1.1"
|
"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()");
|
System.out.print("\tuseALPN()");
|
||||||
|
|
||||||
|
@ -447,7 +457,12 @@ public class WolfSSLSessionTest {
|
||||||
|
|
||||||
/* Testing useALPN(byte[]) */
|
/* Testing useALPN(byte[]) */
|
||||||
if (ret == WolfSSL.SSL_SUCCESS) {
|
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) {
|
if (ret == WolfSSL.SSL_SUCCESS) {
|
||||||
|
@ -462,6 +477,7 @@ public class WolfSSLSessionTest {
|
||||||
System.out.println("\t\t\t... skipped");
|
System.out.println("\t\t\t... skipped");
|
||||||
} else if (ret != WolfSSL.SSL_SUCCESS) {
|
} else if (ret != WolfSSL.SSL_SUCCESS) {
|
||||||
System.out.println("\t\t\t... failed");
|
System.out.println("\t\t\t... failed");
|
||||||
|
fail("Failed useALPN test");
|
||||||
} else {
|
} else {
|
||||||
System.out.println("\t\t\t... passed");
|
System.out.println("\t\t\t... passed");
|
||||||
}
|
}
|
||||||
|
@ -475,6 +491,7 @@ public class WolfSSLSessionTest {
|
||||||
ssl.freeSSL();
|
ssl.freeSSL();
|
||||||
} catch (WolfSSLJNIException e) {
|
} catch (WolfSSLJNIException e) {
|
||||||
System.out.println("\t\t\t... failed");
|
System.out.println("\t\t\t... failed");
|
||||||
|
fail("Failed freeSSL test");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
System.out.println("\t\t\t... passed");
|
System.out.println("\t\t\t... passed");
|
||||||
|
@ -530,6 +547,7 @@ public class WolfSSLSessionTest {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("\t\t... failed");
|
System.out.println("\t\t... failed");
|
||||||
|
fail("Failed UseAfterFree test");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -542,6 +560,7 @@ public class WolfSSLSessionTest {
|
||||||
return;
|
return;
|
||||||
} catch (SocketTimeoutException | SocketException e) {
|
} catch (SocketTimeoutException | SocketException e) {
|
||||||
System.out.println("\t\t... failed");
|
System.out.println("\t\t... failed");
|
||||||
|
fail("Failed UseAfterFree test");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -619,6 +638,7 @@ public class WolfSSLSessionTest {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("\t\t... failed");
|
System.out.println("\t\t... failed");
|
||||||
|
fail("Failed getSessionID test");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -649,6 +669,7 @@ public class WolfSSLSessionTest {
|
||||||
ret = ssl.useSecureRenegotiation();
|
ret = ssl.useSecureRenegotiation();
|
||||||
if (ret != WolfSSL.SSL_SUCCESS && ret != WolfSSL.NOT_COMPILED_IN) {
|
if (ret != WolfSSL.SSL_SUCCESS && ret != WolfSSL.NOT_COMPILED_IN) {
|
||||||
System.out.println("... failed");
|
System.out.println("... failed");
|
||||||
|
fail("Failed useSecureRenegotiation test");
|
||||||
ssl.freeSSL();
|
ssl.freeSSL();
|
||||||
sslCtx.free();
|
sslCtx.free();
|
||||||
return;
|
return;
|
||||||
|
@ -659,6 +680,7 @@ public class WolfSSLSessionTest {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("... failed");
|
System.out.println("... failed");
|
||||||
|
fail("Failed useSecureRenegotiation test");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue