Skip to content

Commit 042c8e7

Browse files
Whitespace only clang format changes (#978)
This update applies the .clang-format rules to the current C code base. These updates should be whitespace only in nature. Signed-off-by: Jason Katonica <[email protected]>
1 parent 8c04b4c commit 042c8e7

File tree

7 files changed

+40
-43
lines changed

7 files changed

+40
-43
lines changed

src/main/native/AESKeyWrap.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_CIPHER_1KeyWraporUnwrap(
4545
env, input, &isCopy));
4646

4747
if (NULL == inputNative) {
48-
throwOCKException(env, 0, "Input is NULL from GetPrimitiveArrayCritical!");
48+
throwOCKException(env, 0,
49+
"Input is NULL from GetPrimitiveArrayCritical!");
4950
return retOutBytes;
5051
}
5152

@@ -55,7 +56,8 @@ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_CIPHER_1KeyWraporUnwrap(
5556
if (NULL == KEKNative) {
5657
(*env)->ReleasePrimitiveArrayCritical(env, input, inputNative,
5758
JNI_ABORT);
58-
throwOCKException(env, 0, "KEK is NULL from GetPrimitiveArrayCritical!");
59+
throwOCKException(env, 0,
60+
"KEK is NULL from GetPrimitiveArrayCritical!");
5961
return retOutBytes;
6062
}
6163

@@ -82,8 +84,9 @@ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_CIPHER_1KeyWraporUnwrap(
8284
(unsigned char *)((*env)->GetPrimitiveArrayCritical(
8385
env, outBytes, &isCopy));
8486
if (outBytesNative == NULL) {
85-
throwOCKException(env, 0,
86-
"Output is NULL from GetPrimitiveArrayCritical");
87+
throwOCKException(
88+
env, 0,
89+
"Output is NULL from GetPrimitiveArrayCritical");
8790
} else {
8891
memcpy(outBytesNative, outputLocal, outputlen);
8992
retOutBytes = outBytes;

src/main/native/CCM.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ void handleIV_CCM(int ivLength, int keyLen, int blockSize, int J0Offset,
145145
}
146146

147147
// Appending IV.length
148-
putLongtoByteArray_CCM(ivLengthOG * 8, (char*)&lastIV,
149-
lastIVLen - 8);
148+
putLongtoByteArray_CCM(ivLengthOG * 8, (char*)&lastIV, lastIVLen - 8);
150149
z_kimd_native_CCM((signed char*)&lastIV, lastIVLen, 0,
151150
(signed char*)&ghashParamBlock, 65);
152151

src/main/native/GCM.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -963,8 +963,7 @@ void handleIV(int ivLength, int keyLen, int blockSize, int J0Offset, char* iv,
963963
}
964964

965965
// Appending IV.length
966-
putLongtoByteArray(ivLengthOG * 8, (char*)&lastIV,
967-
lastIVLen - 8);
966+
putLongtoByteArray(ivLengthOG * 8, (char*)&lastIV, lastIVLen - 8);
968967
z_kimd_native((signed char*)&lastIV, lastIVLen, 0,
969968
(signed char*)&ghashParamBlock, 65);
970969

@@ -1693,8 +1692,8 @@ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_create_1GCM_1context(
16931692
gslogMessage("ICC_AES_GCM_CTX_new failed to create a new context.");
16941693
}
16951694
#endif
1696-
throwOCKException(env, 0,
1697-
"ICC_AES_GCM_CTX_new failed to create a new context.");
1695+
throwOCKException(
1696+
env, 0, "ICC_AES_GCM_CTX_new failed to create a new context.");
16981697
}
16991698
if (debug) {
17001699
gslogFunctionExit(functionName);

src/main/native/KEM.c

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@ JNIEXPORT void JNICALL
2828
Java_com_ibm_crypto_plus_provider_ock_NativeInterface_KEM_1encapsulate(
2929
JNIEnv *env, jclass thisObj, jlong ockContextId, jlong ockPKeyId,
3030
jbyteArray wrappedKey, jbyteArray randomKey) {
31+
ICC_CTX *ockCtx = (ICC_CTX *)((intptr_t)ockContextId);
32+
ICC_EVP_PKEY_CTX *evp_pk = NULL;
33+
ICC_EVP_PKEY *pa = (ICC_EVP_PKEY *)((intptr_t)ockPKeyId);
34+
size_t wrappedkeylen = 0;
35+
size_t genkeylen = 0;
36+
unsigned char *wrappedKeyLocal = NULL;
37+
unsigned char *genkeylocal = NULL;
3138

32-
ICC_CTX *ockCtx = (ICC_CTX *)((intptr_t)ockContextId);
33-
ICC_EVP_PKEY_CTX *evp_pk = NULL;
34-
ICC_EVP_PKEY *pa = (ICC_EVP_PKEY *)((intptr_t)ockPKeyId);
35-
size_t wrappedkeylen = 0;
36-
size_t genkeylen = 0;
37-
unsigned char *wrappedKeyLocal = NULL;
38-
unsigned char *genkeylocal = NULL;
39-
4039
evp_pk = ICC_EVP_PKEY_CTX_new_from_pkey(ockCtx, NULL, pa, NULL);
4140
if (!evp_pk) {
4241
throwOCKException(env, 0, "ICC_EVP_PKEY_CTX_new_from_pkey failed");
@@ -117,19 +116,18 @@ JNIEXPORT jbyteArray JNICALL
117116
Java_com_ibm_crypto_plus_provider_ock_NativeInterface_KEM_1decapsulate(
118117
JNIEnv *env, jclass thisObj, jlong ockContextId, jlong ockPKeyId,
119118
jbyteArray wrappedKey) {
120-
121-
ICC_CTX *ockCtx = (ICC_CTX *)((intptr_t)ockContextId);
122-
ICC_EVP_PKEY *ockPKey = (ICC_EVP_PKEY *)((intptr_t)ockPKeyId);
123-
ICC_EVP_PKEY_CTX *evp_pk = NULL;
124-
int rc = -1;
125-
jboolean isCopy = 0;
126-
jbyteArray randomKey = NULL;
127-
jbyteArray retRndKeyBytes = NULL;
128-
size_t wrappedkeylen = 0;
129-
size_t genkeylen = 0;
130-
unsigned char *wrappedKeyNative = NULL;
131-
unsigned char *genkeylocal = NULL;
132-
unsigned char *genKeyNative = NULL;
119+
ICC_CTX *ockCtx = (ICC_CTX *)((intptr_t)ockContextId);
120+
ICC_EVP_PKEY *ockPKey = (ICC_EVP_PKEY *)((intptr_t)ockPKeyId);
121+
ICC_EVP_PKEY_CTX *evp_pk = NULL;
122+
int rc = -1;
123+
jboolean isCopy = 0;
124+
jbyteArray randomKey = NULL;
125+
jbyteArray retRndKeyBytes = NULL;
126+
size_t wrappedkeylen = 0;
127+
size_t genkeylen = 0;
128+
unsigned char *wrappedKeyNative = NULL;
129+
unsigned char *genkeylocal = NULL;
130+
unsigned char *genKeyNative = NULL;
133131

134132
evp_pk = ICC_EVP_PKEY_CTX_new(ockCtx, ockPKey, NULL);
135133
if (!evp_pk) {

src/main/native/MLKey.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_MLKEY_1generate(
7070
gslogMessage("ICC_OBJ_txt2nid failed- %s", algoChars);
7171
}
7272
#endif
73-
throwOCKException(env, 0,
74-
"Key generation failed - ICC_OBJ_txt2nid");
73+
throwOCKException(env, 0, "Key generation failed - ICC_OBJ_txt2nid");
7574
(*env)->ReleaseStringUTFChars(env, cipherName, algoChars);
7675
return 0;
7776
}
@@ -142,15 +141,15 @@ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_MLKEY_1generate(
142141
throwOCKException(env, 0,
143142
"ICC_i2d_PublicKey failure. Unable to get public key "
144143
"length for encoding");
145-
144+
146145
if (evp_sp) {
147146
ICC_EVP_PKEY_CTX_free(ockCtx, evp_sp);
148147
}
149148
if (pa) {
150149
ICC_EVP_PKEY_free(ockCtx, pa);
151150
}
152151
(*env)->ReleaseStringUTFChars(env, cipherName, algoChars);
153-
152+
154153
return mlkeyId;
155154
}
156155

@@ -218,7 +217,7 @@ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_MLKEY_1generate(
218217

219218
/* public */
220219
const unsigned char *cpp = pubdata;
221-
len = publen;
220+
len = publen;
222221

223222
/* Reconstruct public key from encoding and type */
224223
npa = ICC_d2i_PublicKey(ockCtx, nid, &npa, &cpp, len);
@@ -276,7 +275,7 @@ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_MLKEY_1generate(
276275
npa = NULL;
277276

278277
/* private */
279-
cpp = privData;
278+
cpp = privData;
280279
len = privlen;
281280
npa = ICC_d2i_PrivateKey(ockCtx, nid, &npa, &cpp, len);
282281
if (!npa) {
@@ -308,7 +307,7 @@ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_MLKEY_1generate(
308307
gslogMessage("warning - key size mismatch %d != %d\n",
309308
(int)keylen, (int)kl);
310309
}
311-
#endif
310+
#endif
312311
if (evp_sp) {
313312
ICC_EVP_PKEY_CTX_free(ockCtx, evp_sp);
314313
}
@@ -492,7 +491,7 @@ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_MLKEY_1createPublicKey(
492491
}
493492

494493
(*env)->ReleaseStringUTFChars(env, cipherName, algoChars);
495-
494+
496495
if (keyBytesNative != NULL) {
497496
(*env)->ReleasePrimitiveArrayCritical(env, publicKeyBytes,
498497
keyBytesNative, JNI_ABORT);

src/main/native/SignaturePQC.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ JNIEXPORT jbyteArray JNICALL
2626
Java_com_ibm_crypto_plus_provider_ock_NativeInterface_PQC_1SIGNATURE_1sign(
2727
JNIEnv *env, jclass thisObj, jlong ockContextId, jlong ockPKeyId,
2828
jbyteArray data) {
29-
3029
ICC_CTX *ockCtx = (ICC_CTX *)((intptr_t)ockContextId);
3130
ICC_EVP_PKEY *ockPKey = (ICC_EVP_PKEY *)((intptr_t)ockPKeyId);
3231
ICC_EVP_PKEY_CTX *skc = NULL;
@@ -149,7 +148,6 @@ JNIEXPORT jboolean JNICALL
149148
Java_com_ibm_crypto_plus_provider_ock_NativeInterface_PQC_1SIGNATURE_1verify(
150149
JNIEnv *env, jclass thisObj, jlong ockContextId, jlong ockPKeyId,
151150
jbyteArray sigBytes, jbyteArray data) {
152-
153151
ICC_CTX *ockCtx = (ICC_CTX *)((intptr_t)ockContextId);
154152
ICC_EVP_PKEY *ockPKey = (ICC_EVP_PKEY *)((intptr_t)ockPKeyId);
155153
ICC_EVP_PKEY_CTX *evp_pk = NULL;
@@ -179,7 +177,8 @@ Java_com_ibm_crypto_plus_provider_ock_NativeInterface_PQC_1SIGNATURE_1verify(
179177
env, data, &isCopy));
180178

181179
if (dataNative == NULL) {
182-
(*env)->ReleasePrimitiveArrayCritical(env, data, dataNative, JNI_ABORT);
180+
(*env)->ReleasePrimitiveArrayCritical(env, data, dataNative,
181+
JNI_ABORT);
183182
throwOCKException(env, 0, "GetPrimitiveArrayCritical failed");
184183
return verified;
185184
}

src/main/native/Utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void com_ibm_crypto_plus_provider_initialize(void) {
2828
#if DEBUG
2929
/*if( getenv("JICC.debug") != NULL ) {*/
3030
debug = 1; // FIXME;
31-
/*}*/
31+
/*}*/
3232
#endif
3333
initialized = 1;
3434
}

0 commit comments

Comments
 (0)