Skip to content

Commit 2b2844a

Browse files
committed
fix uninitialized variable used for output buffer size
1 parent 9d4cf0f commit 2b2844a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/wh_test_crypto.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,7 @@ static int whTest_KeyCache(whClientContext* ctx, int devId, WC_RNG* rng)
964964
}
965965
else {
966966
/* Verify the cached key is the big key by exporting it */
967+
exportedKeySize = sizeof(exportedKey);
967968
ret = wh_Client_KeyExport(ctx, keyId, exportedLabel,
968969
sizeof(exportedLabel), exportedKey,
969970
&exportedKeySize);
@@ -1037,6 +1038,7 @@ static int whTest_KeyCache(whClientContext* ctx, int devId, WC_RNG* rng)
10371038
}
10381039
else {
10391040
/* Verify the cached key is the small key by exporting it */
1041+
exportedKeySize = sizeof(exportedKey);
10401042
ret = wh_Client_KeyExport(ctx, keyId, exportedLabel,
10411043
sizeof(exportedLabel),
10421044
exportedKey, &exportedKeySize);
@@ -1162,8 +1164,8 @@ static int whTest_KeyCache(whClientContext* ctx, int devId, WC_RNG* rng)
11621164
/* Verify the cached key is the big key by exporting it */
11631165
exportedKeySize = bigKeySize;
11641166
ret = wh_Client_KeyExportDma(
1165-
ctx, keyId, exportedKey, exportedKeySize, exportedLabel,
1166-
sizeof(exportedLabel), &exportedKeySize);
1167+
ctx, keyId, exportedKey, exportedKeySize, exportedLabel,
1168+
sizeof(exportedLabel), &exportedKeySize);
11671169
if (ret != 0) {
11681170
WH_ERROR_PRINT("Failed to export key after cache: %d\n",
11691171
ret);
@@ -1238,8 +1240,8 @@ static int whTest_KeyCache(whClientContext* ctx, int devId, WC_RNG* rng)
12381240
/* Verify the cached key is the small key by exporting it */
12391241
exportedKeySize = smallKeySize;
12401242
ret = wh_Client_KeyExportDma(
1241-
ctx, keyId, exportedKey, exportedKeySize, exportedLabel,
1242-
sizeof(exportedLabel), &exportedKeySize);
1243+
ctx, keyId, exportedKey, exportedKeySize, exportedLabel,
1244+
sizeof(exportedLabel), &exportedKeySize);
12431245
if (ret != 0) {
12441246
WH_ERROR_PRINT(
12451247
"Failed to export key after cache: %d\n", ret);

0 commit comments

Comments
 (0)