-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
198 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,196 @@ | ||
Subject: [PATCH] K/N workaround | ||
--- | ||
Index: cryptography-providers/openssl3/test/src/commonMain/kotlin/LibCrypto3Test.kt | ||
IDEA additional info: | ||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | ||
<+>UTF-8 | ||
=================================================================== | ||
diff --git a/cryptography-providers/openssl3/test/src/commonMain/kotlin/LibCrypto3Test.kt b/cryptography-providers/openssl3/test/src/commonMain/kotlin/LibCrypto3Test.kt | ||
--- a/cryptography-providers/openssl3/test/src/commonMain/kotlin/LibCrypto3Test.kt (revision 199489bf741d9253973ca9b66b378e0054b9af6d) | ||
+++ b/cryptography-providers/openssl3/test/src/commonMain/kotlin/LibCrypto3Test.kt (date 1684264012203) | ||
@@ -7,7 +7,6 @@ | ||
import dev.whyoleg.cryptography.openssl3.internal.cinterop.* | ||
import kotlinx.cinterop.* | ||
import platform.posix.* | ||
-import kotlin.random.* | ||
import kotlin.test.* | ||
|
||
abstract class LibCrypto3Test { | ||
@@ -57,7 +56,7 @@ | ||
key = key.asUByteArray().refTo(0), | ||
keylen = key.size.convert(), | ||
params = OSSL_PARAM_array( | ||
- OSSL_PARAM_construct_utf8_string("digest".cstr.ptr, hashAlgorithm.cstr.ptr, 0) | ||
+ OSSL_PARAM_construct_utf8_string("digest".cstr.ptr, hashAlgorithm.cstr.ptr, 0U) | ||
) | ||
) | ||
) | ||
@@ -85,7 +84,7 @@ | ||
checkError( | ||
EVP_PKEY_CTX_set_params( | ||
context, OSSL_PARAM_array( | ||
- OSSL_PARAM_construct_utf8_string("group".cstr.ptr, "P-521".cstr.ptr, 0) | ||
+ OSSL_PARAM_construct_utf8_string("group".cstr.ptr, "P-521".cstr.ptr, 0U) | ||
) | ||
) | ||
) | ||
Index: cryptography-random/src/mingwMain/kotlin/CryptographyRandom.mingw.kt | ||
IDEA additional info: | ||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | ||
<+>UTF-8 | ||
=================================================================== | ||
diff --git a/cryptography-random/src/mingwMain/kotlin/CryptographyRandom.mingw.kt b/cryptography-random/src/mingwMain/kotlin/CryptographyRandom.mingw.kt | ||
--- a/cryptography-random/src/mingwMain/kotlin/CryptographyRandom.mingw.kt (revision 199489bf741d9253973ca9b66b378e0054b9af6d) | ||
+++ b/cryptography-random/src/mingwMain/kotlin/CryptographyRandom.mingw.kt (date 1684263708443) | ||
@@ -17,7 +17,7 @@ | ||
hAlgorithm = null, | ||
pbBuffer = pinned.addressOf(0), | ||
cbBuffer = pinned.get().size.convert(), | ||
- dwFlags = BCRYPT_USE_SYSTEM_PREFERRED_RNG | ||
+ dwFlags = BCRYPT_USE_SYSTEM_PREFERRED_RNG.toUInt() | ||
) | ||
} | ||
if (status != 0) error("BCryptGenRandom failed: $status") | ||
Index: cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3Ecdsa.kt | ||
IDEA additional info: | ||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | ||
<+>UTF-8 | ||
=================================================================== | ||
diff --git a/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3Ecdsa.kt b/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3Ecdsa.kt | ||
--- a/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3Ecdsa.kt (revision 199489bf741d9253973ca9b66b378e0054b9af6d) | ||
+++ b/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3Ecdsa.kt (date 1684263708405) | ||
@@ -60,7 +60,7 @@ | ||
ppkey = pkeyVar.ptr, | ||
selection = EVP_PKEY_PUBLIC_KEY, | ||
param = OSSL_PARAM_array( | ||
- OSSL_PARAM_construct_utf8_string("group".cstr.ptr, curve.name.cstr.ptr, 0), | ||
+ OSSL_PARAM_construct_utf8_string("group".cstr.ptr, curve.name.cstr.ptr, 0U), | ||
OSSL_PARAM_construct_octet_string("pub".cstr.ptr, input.safeRefToU(0), input.size.convert()) | ||
) | ||
) | ||
@@ -84,7 +84,7 @@ | ||
private val curve: EC.Curve, | ||
) : Openssl3KeyPairGenerator<ECDSA.KeyPair>("EC") { | ||
override fun MemScope.createParams(): CValuesRef<OSSL_PARAM> = OSSL_PARAM_array( | ||
- OSSL_PARAM_construct_utf8_string("group".cstr.ptr, curve.name.cstr.ptr, 0) | ||
+ OSSL_PARAM_construct_utf8_string("group".cstr.ptr, curve.name.cstr.ptr, 0U) | ||
) | ||
|
||
override fun wrapKeyPair(keyPair: CPointer<EVP_PKEY>): ECDSA.KeyPair = EcKeyPair( | ||
@@ -129,7 +129,7 @@ | ||
override fun encodeToBlocking(format: EC.PublicKey.Format): ByteArray = when (format) { | ||
EC.PublicKey.Format.RAW -> memScoped { | ||
val outVar = alloc<size_tVar>() | ||
- checkError(EVP_PKEY_get_octet_string_param(key, "encoded-pub-key", null, 0, outVar.ptr)) | ||
+ checkError(EVP_PKEY_get_octet_string_param(key, "encoded-pub-key", null, 0U, outVar.ptr)) | ||
val output = ByteArray(outVar.value.convert()) | ||
checkError(EVP_PKEY_get_octet_string_param(key, "encoded-pub-key", output.safeRefToU(0), output.size.convert(), outVar.ptr)) | ||
output.ensureSizeExactly(outVar.value.convert()) | ||
@@ -152,7 +152,7 @@ | ||
val expectedGroup = checkError( | ||
EC_GROUP_new_from_params( | ||
OSSL_PARAM_array( | ||
- OSSL_PARAM_construct_utf8_string("group".cstr.ptr, expectedCurve.name.cstr.ptr, 0) | ||
+ OSSL_PARAM_construct_utf8_string("group".cstr.ptr, expectedCurve.name.cstr.ptr, 0U) | ||
), null, null | ||
) | ||
) | ||
@@ -161,7 +161,7 @@ | ||
val expectedGroupName = checkError(OSSL_EC_curve_nid2name(expectedGroupNid)).toKString() | ||
|
||
val keyGroupName = allocArray<ByteVar>(256).also { | ||
- checkError(EVP_PKEY_get_utf8_string_param(key, "group", it, 256, null)) | ||
+ checkError(EVP_PKEY_get_utf8_string_param(key, "group", it, 256U, null)) | ||
}.toKString() | ||
|
||
check(expectedGroupName == keyGroupName) { | ||
Index: cryptography-random/src/linuxMain/kotlin/URandom.kt | ||
IDEA additional info: | ||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | ||
<+>UTF-8 | ||
=================================================================== | ||
diff --git a/cryptography-random/src/linuxMain/kotlin/URandom.kt b/cryptography-random/src/linuxMain/kotlin/URandom.kt | ||
--- a/cryptography-random/src/linuxMain/kotlin/URandom.kt (revision 199489bf741d9253973ca9b66b378e0054b9af6d) | ||
+++ b/cryptography-random/src/linuxMain/kotlin/URandom.kt (date 1684263615757) | ||
@@ -32,7 +32,7 @@ | ||
} | ||
|
||
while (true) { | ||
- if (poll(pollFd.ptr, 1, -1) >= 0) break | ||
+ if (poll(pollFd.ptr, 1U, -1) >= 0) break | ||
|
||
when (errno) { | ||
EINTR, EAGAIN -> continue | ||
Index: cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3RsaOaep.kt | ||
IDEA additional info: | ||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | ||
<+>UTF-8 | ||
=================================================================== | ||
diff --git a/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3RsaOaep.kt b/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3RsaOaep.kt | ||
--- a/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3RsaOaep.kt (revision 199489bf741d9253973ca9b66b378e0054b9af6d) | ||
+++ b/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3RsaOaep.kt (date 1684263708421) | ||
@@ -58,8 +58,8 @@ | ||
EVP_PKEY_encrypt_init_ex( | ||
ctx = context, | ||
params = OSSL_PARAM_arrayNotNull( | ||
- OSSL_PARAM_construct_utf8_string("pad-mode".cstr.ptr, "oaep".cstr.ptr, 0), | ||
- OSSL_PARAM_construct_utf8_string("digest".cstr.ptr, hashAlgorithm.cstr.ptr, 0), | ||
+ OSSL_PARAM_construct_utf8_string("pad-mode".cstr.ptr, "oaep".cstr.ptr, 0U), | ||
+ OSSL_PARAM_construct_utf8_string("digest".cstr.ptr, hashAlgorithm.cstr.ptr, 0U), | ||
associatedData?.let { OSSL_PARAM_construct_octet_string("oaep-label".cstr.ptr, it.safeRefTo(0), it.size.convert()) } | ||
) | ||
) | ||
@@ -105,8 +105,8 @@ | ||
EVP_PKEY_decrypt_init_ex( | ||
ctx = context, | ||
params = OSSL_PARAM_arrayNotNull( | ||
- OSSL_PARAM_construct_utf8_string("pad-mode".cstr.ptr, "oaep".cstr.ptr, 0), | ||
- OSSL_PARAM_construct_utf8_string("digest".cstr.ptr, hashAlgorithm.cstr.ptr, 0), | ||
+ OSSL_PARAM_construct_utf8_string("pad-mode".cstr.ptr, "oaep".cstr.ptr, 0U), | ||
+ OSSL_PARAM_construct_utf8_string("digest".cstr.ptr, hashAlgorithm.cstr.ptr, 0U), | ||
associatedData?.let { OSSL_PARAM_construct_octet_string("oaep-label".cstr.ptr, it.safeRefTo(0), it.size.convert()) } | ||
) | ||
) | ||
Index: cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3Hmac.kt | ||
IDEA additional info: | ||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | ||
<+>UTF-8 | ||
=================================================================== | ||
diff --git a/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3Hmac.kt b/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3Hmac.kt | ||
--- a/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3Hmac.kt (revision 199489bf741d9253973ca9b66b378e0054b9af6d) | ||
+++ b/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3Hmac.kt (date 1684263708434) | ||
@@ -84,7 +84,7 @@ | ||
key = key.refToU(0), | ||
keylen = key.size.convert(), | ||
params = OSSL_PARAM_array( | ||
- OSSL_PARAM_construct_utf8_string("digest".cstr.ptr, hashAlgorithm.cstr.ptr, 0) | ||
+ OSSL_PARAM_construct_utf8_string("digest".cstr.ptr, hashAlgorithm.cstr.ptr, 0U) | ||
) | ||
) | ||
) | ||
Index: cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3RsaPss.kt | ||
IDEA additional info: | ||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | ||
<+>UTF-8 | ||
=================================================================== | ||
diff --git a/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3RsaPss.kt b/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3RsaPss.kt | ||
--- a/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3RsaPss.kt (revision 199489bf741d9253973ca9b66b378e0054b9af6d) | ||
+++ b/cryptography-providers/openssl3/api/src/commonMain/kotlin/algorithms/Openssl3RsaPss.kt (date 1684263708430) | ||
@@ -52,7 +52,7 @@ | ||
private val saltLengthBytes: Int, | ||
) : Openssl3DigestSignatureGenerator(privateKey, hashAlgorithm) { | ||
override fun MemScope.createParams(): CValuesRef<OSSL_PARAM> = OSSL_PARAM_array( | ||
- OSSL_PARAM_construct_utf8_string("pad-mode".cstr.ptr, "pss".cstr.ptr, 0), | ||
+ OSSL_PARAM_construct_utf8_string("pad-mode".cstr.ptr, "pss".cstr.ptr, 0U), | ||
OSSL_PARAM_construct_int("saltlen".cstr.ptr, alloc(saltLengthBytes).ptr), | ||
) | ||
} | ||
@@ -63,7 +63,7 @@ | ||
private val saltLengthBytes: Int, | ||
) : Openssl3DigestSignatureVerifier(publicKey, hashAlgorithm) { | ||
override fun MemScope.createParams(): CValuesRef<OSSL_PARAM> = OSSL_PARAM_array( | ||
- OSSL_PARAM_construct_utf8_string("pad-mode".cstr.ptr, "pss".cstr.ptr, 0), | ||
+ OSSL_PARAM_construct_utf8_string("pad-mode".cstr.ptr, "pss".cstr.ptr, 0U), | ||
OSSL_PARAM_construct_int("saltlen".cstr.ptr, alloc(saltLengthBytes).ptr), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters