Skip to content

Commit 74ede69

Browse files
committed
Updates per PR.
1 parent 24093b1 commit 74ede69

3 files changed

Lines changed: 22 additions & 13 deletions

File tree

android/wolfssljni-ndk-gradle/app/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ if("${WOLFSSL_CRYPTOCB_TYPE}" MATCHES "ccb_vaultic")
296296
#-DCCBVAULTIC_NO_RSA
297297
-DCCBVAULTIC_NO_SHA
298298
#-DCCBVAULTIC_DEBUG
299-
-DCCBVAULTIC_DEBUG_TIMING
299+
#-DCCBVAULTIC_DEBUG_TIMING
300300
)
301301

302302
set(VAULTIC_DIR ${cryptocb_DIR}/VaultIC-TLS_420/vaultic_tls-4xx)

android/wolfssljni-ndk-gradle/app/src/main/java/com/wolfssl/wolfssljni_ndk_gradle/MainActivity.java

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ private void appendDisplayText(String s)
8686
/* Enable wolfJSSE debug messages */
8787
System.setProperty("wolfjsse.debug", "true");
8888

89+
/* Select The devId which will be registered and used on every other invocation */
90+
/* Unique devId's are compiled into wolfssljni */
91+
//int devId = 0x56490420; /* VaultIC 420 */
92+
int devId = WolfSSL.INVALID_DEVID; /* No hardware offload */
93+
94+
/* Select if the cipher suites and protocols will be limited */
95+
boolean limitCipherProtocol = false;
96+
8997
long[] ts = new long[10];
9098

9199
ts[0] = System.currentTimeMillis();
@@ -95,9 +103,8 @@ private void appendDisplayText(String s)
95103

96104
ts[1] = System.currentTimeMillis();
97105
connectCount++;
98-
/* Unique devId's are compiled into wolfssljni */
99-
int devId = 0x56490420;
100-
if ((connectCount % 2) == 0) {
106+
107+
if (((connectCount % 2) == 0) && (devId != WolfSSL.INVALID_DEVID)) {
101108
appendDisplayText("B. Using hardware offload\n");
102109
wolfProv.registerDevId(devId);
103110
wolfProv.setDevId(devId);
@@ -117,11 +124,13 @@ private void appendDisplayText(String s)
117124
SSLSocketFactory sf = ctx.getSocketFactory();
118125
SSLSocket sock = (SSLSocket) sf.createSocket(host, port);
119126

120-
/* Limit cipherSuites and protocol */
121-
String[] cipherSuites = new String[] {"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"};
122-
sock.setEnabledCipherSuites(cipherSuites);
123-
String[] protocols = new String[]{"TLSv1.2"};
124-
sock.setEnabledProtocols(protocols);
127+
if (limitCipherProtocol) {
128+
/* Limit cipherSuites and protocol */
129+
String[] cipherSuites = new String[]{"TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"};
130+
sock.setEnabledCipherSuites(cipherSuites);
131+
String[] protocols = new String[]{"TLSv1.2"};
132+
sock.setEnabledProtocols(protocols);
133+
}
125134

126135
ts[3] = System.currentTimeMillis();
127136
appendDisplayText("D. Starting Handshake\n");
@@ -153,7 +162,7 @@ private void appendDisplayText(String s)
153162
sock.close();
154163

155164
ts[7] = System.currentTimeMillis();
156-
if ((connectCount % 2) == 0) {
165+
if (((connectCount % 2) == 0) && (devId != WolfSSL.INVALID_DEVID)) {
157166
appendDisplayText("H. Disabling hardware offload\n");
158167
wolfProv.setDevId(WolfSSL.INVALID_DEVID);
159168
wolfProv.unRegisterDevId(devId);
@@ -175,9 +184,9 @@ private void appendDisplayText(String s)
175184
" C:" + (ts[3] - ts[2]) +
176185
" D:" + (ts[4] - ts[3]) +
177186
" E:" + (ts[5] - ts[4]) +
178-
", " + getCmd.length() * 1000 / (ts[5] - ts[4]) + "Bps" +
187+
", " + getCmd.length() * 1000 / (ts[5] - ts[4] + 1) + "Bps" +
179188
" F:" + (ts[6] - ts[5]) +
180-
", " + totalRead * 1000 / (ts[6] - ts[5]) + "Bps" +
189+
", " + totalRead * 1000 / (ts[6] - ts[5] + 1) + "Bps" +
181190
" G:" + (ts[7] - ts[6]) +
182191
" H:" + (ts[8] - ts[7]) +
183192
" I:" + (ts[9] - ts[8]) +

ccb_vaultic/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ AR=${NDK_AR}
66
LD=${NDK_LD}
77

88
# Relative path to wolfSSL source
9-
WOLFSSL_DIR?=../../bill_wolfssl
9+
WOLFSSL_DIR?=../../wolfssl
1010

1111
# Relative path to VaultIC dev kit source
1212
VAULTIC_DIR?=VaultIC-TLS_420/vaultic_tls-4xx

0 commit comments

Comments
 (0)