Commit Graph
29 Commits
Author SHA1 Message Date
kngako 8cacf80491 Fix for nVssCommitments declarations 2024-08-22 10:47:18 +02:00
kngako d74895079d Fix for handling ids33 in JNI 2024-08-21 21:35:27 +02:00
kngako e6cba2b505 A few JNI fixes 2024-08-21 18:35:41 +02:00
kngako 5117507f25 Full tests on native 2024-08-21 17:28:07 +02:00
kngako c39590a859 Broke the JNI now 2024-08-20 22:29:29 +02:00
kngako 83141916e8 JVM Tests hacks 2024-08-20 02:19:43 +02:00
kngako 08f0304d4c Most test cases on JNI 2024-08-20 01:05:29 +02:00
kngako af3f44f426 Tests JNI share aggregate 2024-08-20 00:09:56 +02:00
kngako b1e96f329b Increase test and fix some compiler errors on the JNI side. 2024-08-19 21:40:56 +02:00
kngako e7f074d36e Getting started with unit tests 2024-08-18 01:27:04 +02:00
Fabrice Drouin 567f411e12 Verify musig2 secret nonces (#108)
* Verify musig2 secret nonces

Trying to generate a musig2 partial signature with a secret nonce that was generated with a public key that does not match the signing key's public key will trigger secp256k1's illegal callback (which calls abort()) and crash the application.

=> Here we verify that the secret nonce matches the signing key before we call secp256k1_musig_partial_sign().
The verification method is a bit hackish (we extract the public key from the secret nonce blob) because secp256k1 does not export the methods we need to do this cleanly.
2024-04-18 09:54:51 +02:00
Fabrice Drouin bae4744bcb Add macos build targets (#104)
* Add macos build targets

* Update snapshot publishing script
2024-03-04 17:58:20 +01:00
Fabrice DrouinandBastien Teinturier 202b0c94b6 Add support for musig2 (#93)
* Use Jonas Nick's musig2 branch

* Reformat c code (no functional changes)

* Implement musig2

* Add documentation to musig2 functions (#97)

Usage of the Musig2 functions isn't intuitive at all, especially with
the key aggregation cache and session data. It's important to provide
accurate documentation to help users understand how to correctly produce
musig2 signatures.

We also change argument names to match Kotlin best practices instead of
using the same argument names as C functions.

* Add musig2 reference tests (no functional changes)

---------

Co-authored-by: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2024-02-14 13:28:22 +01:00
Fabrice Drouin 8ba5d4652e Use kotlin 1.9 (#92)
Use kotlin 1.9
2024-01-23 15:44:06 +01:00
Fabrice Drouin f242b4ffe8 Check arguments passed to secp256k1 methods (#94)
* Check arguments passed to secp256k1 methods

Illegal arguments will trigger an internal callback that prints to stderr and calls abort.
We already check arguments in our JNI and kotlin native code but had missed 2 checks (recid in ecdsaRecover, empty arrays in pubkeyCombine).

* Implement the same "tweak" checks in the native code and JNI code

The native code was missing checks on the "tweak" size (which must be 32 bytes)
2023-12-13 13:42:14 +01:00
Fabrice Drouin bf05a001fe Update Android build plugin and tools (#75) 2023-04-11 18:42:06 +02:00
Fabrice Drouin ac7d4983d5 Export Schnorr signature API (#32)
Implement Schnorr signatures (BIP 340)
2021-11-23 17:38:46 +01:00
Bastien Teinturier 2ae6abcf93 Clarify public key encoding and enrich tests (#37)
Don't throw in `seckey_verify`: it's inconsistent to have this function throw
for some invalid inputs and return false for other invalid inputs.

Document public key compression and add tests.
2021-11-05 10:45:49 +01:00
Bastien Teinturier f695e7453d Clean up and enrich tests (#35)
* Harmonize parameter names
* Document methods
* Replace pubKeyAdd with pubKeyCombine
* Clean-up tests
2021-10-26 17:16:36 +02:00
Fabrice Drouin 6955c7416a Add option to skip building and testing Android libraries (#33)
* Add otpion to skip building and testing Android libraries

Add `skip.android=true` to the local.properties files at the project's root to skip Android builds.
2021-10-25 14:27:02 +02:00
Fabrice Drouin e7644b7ddb Upgrade to kotlin 1.5 (#27)
* Upgrade to kotlin 1.5.31

* Upgrade dokka gradle plugins to 1.5.30
2021-09-22 15:22:05 +02:00
Salomon BRYS 7d22d835a5 Kotlin 1.4.31 (#13)
* Kotlin 1.4.31

* Updated CI add-path disabled command to new more secure environment file.

* Properly setting up Android in CI
2021-03-08 16:50:25 +01:00
Salomon BRYSandSalomon BRYS d702925e40 Kotlin 1.4.0 (#11)
Co-authored-by: Salomon BRYS <salomon@kodein.net>
2020-08-18 10:52:42 +02:00
Fabrice Drouin 0cc4c251f9 Fixup for #6 (native signature format detection) (#8)
* Fixup for #6

Behaviour was changed in the JNI wapper but not in Kotlin native code.

* Set version to 0.2.1-1.4-M3
2020-07-09 20:16:39 +02:00
Salomon BRYSandSalomon BRYS 6c850eb2c4 Native jni build (#5)
* Each native library is in its own jar. Got rid of cross compilation. The project is `secp256k1` and not `secp256k1-kmp`.

* Updated CI to use all 3 OS VMs

Co-authored-by: Salomon BRYS <salomon@kodein.net>
2020-07-09 14:54:34 +02:00
Salomon BRYSandSalomon BRYS c5dbc42496 Kotlin 1.4-M3, fixed CI glitches & fixed build on Mac (#4)
* Kotlin 1.4-M3, fixed CI glitches & fixed build on Mac

* Fixes https://github.com/eskatos/gradle-command-action/issues/24

* Explicit mode requirements in Android tests

Co-authored-by: Salomon BRYS <salomon@kodein.net>
2020-07-06 21:45:17 +02:00
sstone 08d1692932 Add compact2der() method 2020-07-02 21:39:33 +02:00
Fabrice DrouinandSalomon BRYS 3ee2635d93 Upgrade JNI interface (#1)
* Upgrade JNI interface

* Input signatures can be DER or compact format, output signatures are always in compact format

* Input public keys can be compressed or uncompressed, output public keys are always uncompressed

* Name and parameters match libsecp256k1's

* JNI implementation is now straightforward

  No more ByteBuffers
  Exceptions are thrown in case of failures

* Update src/nativeMain/kotlin/fr/acinq/secp256k1/Secp256k1Native.kt

* Add public key compression method

Co-authored-by: Salomon BRYS <salomon.brys@gmail.com>
2020-07-02 17:52:21 +02:00
Salomon BRYS 17dd83e476 Tests in their own module so that they can run on Android with the connectedCheck task 2020-07-02 12:19:29 +02:00