Skip to content

Commit 28787ca

Browse files
authored
Merge pull request #161 from cconlon/dhAlgorithmParams
Add DH AlgorithmParameters, AlgorithmParameterGenerator, KeyFactory, and related fixes
2 parents a64bbc4 + 9dab027 commit 28787ca

27 files changed

+7140
-56
lines changed

.github/workflows/windows-vs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ jobs:
274274
$content = Get-Content $userSettingsPath -Raw
275275
Write-Output "Original file size: $($content.Length) characters"
276276
277-
$newDefines = "#define WOLFSSL_KEY_GEN`n#define HAVE_CRL`n#define OPENSSL_ALL`n#define WOLFSSL_SHA224`n`n"
277+
$newDefines = "#define WOLFSSL_KEY_GEN`n#define HAVE_CRL`n#define OPENSSL_ALL`n#define WOLFSSL_SHA224`n#define HAVE_FFDHE_2048`n#define HAVE_FFDHE_3072`n#define HAVE_FFDHE_4096`n#define HAVE_FFDHE_Q`n#define WOLFSSL_VALIDATE_FFC_IMPORT`n`n"
278278
279279
# Try multiple possible insertion points
280280
$insertPoints = @(

CLAUDE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
- Keep lines under 80 characters maximum length
1212
- MUST only use multi-line comments, no "//" style ones
1313
- MUST remove all trailing white space
14-
- Use 4 spaces for one tab, no hard tabs
14+
- MUST use 4 spaces for one tab, no hard tabs
15+
- MUST use XMALLOC/XFREE for memory allocation instead of malloc/free
16+
- MUST cast XMALLOC back to type being allocated
1517

1618
# Source Code Organization
1719
- The source code is organized into the following directories:

IDE/Android/app/src/main/cpp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ if ("${WOLFSSL_PKG_TYPE}" MATCHES "normal")
6565
-DWOLFSSL_AKID_NAME -DHAVE_CTS -DNO_DES3 -DGCM_TABLE_4BIT
6666
-DTFM_TIMING_RESISTANT -DECC_TIMING_RESISTANT
6767
-DHAVE_AESGCM -DSIZEOF_LONG=4 -DSIZEOF_LONG_LONG=8
68+
-DWOLFSSL_KEY_GEN
6869
-DWOLFSSL_CUSTOM_CONFIG
6970

7071
# For gethostbyname()

README_JCE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ The JCE provider currently supports the following algorithms:
185185

186186
KeyFactory
187187
EC
188+
DH (aliases: DiffieHellman, 1.2.840.113549.1.3.1)
188189

189190
CertPathValidator Class
190191
PKIX
@@ -205,9 +206,13 @@ The JCE provider currently supports the following algorithms:
205206

206207
AlgorithmParameters
207208
AES
209+
DH
208210
GCM
209211
RSASSA-PSS
210212

213+
AlgorithmParameterGenerator
214+
DH
215+
211216
### SecureRandom.getInstanceStrong()
212217

213218
When registered as the highest priority security provider, wolfJCE will provide

jni/include/com_wolfssl_wolfcrypt_Dh.h

Lines changed: 90 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jni/jni_aesccm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_wolfssl_wolfcrypt_AesCcm_wc_1AesCcmEncrypt
194194

195195
/* in can be NULL if inLen is 0 - case with only AAD to gen tag */
196196
if ((inLen != 0 && in == NULL) || nonce == NULL || authTag == NULL ||
197-
nonceSz < 7 || nonceSz > 13 || authTagSz > WC_AES_BLOCK_SIZE) {
197+
nonceSz < 7 || nonceSz > 13 || authTagSz > AES_BLOCK_SIZE) {
198198
ret = BAD_FUNC_ARG;
199199
}
200200

@@ -327,7 +327,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_wolfssl_wolfcrypt_AesCcm_wc_1AesCcmDecrypt
327327

328328
/* in can be NULL if inLen is 0 - case with only AAD to verify tag */
329329
if ((inLen != 0 && in == NULL) || nonce == NULL || authTag == NULL ||
330-
nonceSz < 7 || nonceSz > 13 || authTagSz > WC_AES_BLOCK_SIZE) {
330+
nonceSz < 7 || nonceSz > 13 || authTagSz > AES_BLOCK_SIZE) {
331331
ret = BAD_FUNC_ARG;
332332
}
333333

jni/jni_aesgcm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_wolfssl_wolfcrypt_AesGcm_wc_1AesGcmEncrypt
193193
}
194194

195195
/* in may be null, users might only pass in AAD to generate tag */
196-
if (authTagSz > WC_AES_BLOCK_SIZE || iv == NULL || ivSz == 0 ||
196+
if (authTagSz > AES_BLOCK_SIZE || iv == NULL || ivSz == 0 ||
197197
((authTagSz > 0) && (authTag == NULL)) ||
198198
((authInSz > 0) && (authIn == NULL))) {
199199
ret = BAD_FUNC_ARG;
@@ -329,7 +329,7 @@ JNIEXPORT jbyteArray JNICALL Java_com_wolfssl_wolfcrypt_AesGcm_wc_1AesGcmDecrypt
329329
/* If inLen is non-zero, both in and out must be set. If inLen is 0,
330330
* in and out are don't cares, as this is the GMAC case */
331331
if (iv == NULL || ivSz == 0 || (inLen != 0 && in == NULL) ||
332-
authTag == NULL || (authTagSz > WC_AES_BLOCK_SIZE) || authTagSz == 0) {
332+
authTag == NULL || (authTagSz > AES_BLOCK_SIZE) || authTagSz == 0) {
333333
ret = BAD_FUNC_ARG;
334334
}
335335

0 commit comments

Comments
 (0)