36 Commits

Author SHA1 Message Date
kngako
64e15574db Fix for handling nonce processing 2024-08-21 22:28:30 +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
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
f5ab7fdeb7 Improve JNI handling of frost share gen 2024-08-20 01:39:22 +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
6e578d43d7 More logic for the JNI stuff 2024-08-19 22:14:27 +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
kngako
32ee077995 Improve pointer handling logic 2024-08-14 09:14:34 +02:00
kngako
41ddd40691 Return byteArray instead of array of byteArrays 2024-08-13 01:41:45 +02:00
kngako
45c713d56e Conditional checks 2024-08-12 23:02:56 +02:00
kngako
8b56662685 Correct use of whitespace 2024-08-12 22:15:17 +02:00
kngako
28d255daca Knock out some todos 2024-08-12 02:55:41 +02:00
kngako
1b29cfa2d7 JNI implementations continued 2024-08-12 02:16:54 +02:00
kngako
b439181376 JNI implementations 2024-08-11 03:43:30 +02:00
kngako
5c4186770f Fix comments on secp256k1_frost_partial_sig_agg 2024-08-07 03:09:20 +02:00
kngako
86d7d9835f Handle inputs/outputs and nulls correctly. 2024-08-07 02:48:25 +02:00
kngako
e7ec7b7478 Update Secp256k1CFunctions.h 2024-08-06 02:13:12 +02:00
kngako
3c01a2aad4 Use frost in Secp256k1 native logic 2024-08-04 23:53:28 +02:00
Kgothatso
099dcccf49 Make use of libsecp256k1 for musig+frost functions 2024-08-01 02:45:16 +02:00
Fabrice Drouin
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
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
3706a546a2
Use secp256k1 0.4.0 (#85) 2023-09-18 14:05:36 +02:00
Fabrice Drouin
118c72064c
Update secp256k1 sources (#52)
We're now at 8746600eec5e7fcd35dabd480839a3a4bdfee87b, same as bitcoin core at 747cdf1d652d8587e9f2e3d4436c3ecdbf56d0a5
2022-04-11 13:34:59 +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
b544b24cc3
Fix memory leak in pubkeyCreate() (#20) 2021-06-22 16:16:08 +02:00
Fabrice Drouin
5af1807f38
Fix signature format detection (#6)
64 bytes means compact, less is invalid, other try DER and let the library handle the actual check.
2020-07-09 15:59:07 +02:00
Salomon 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
sstone
08d1692932 Add compact2der() method 2020-07-02 21:39:33 +02:00
Fabrice Drouin
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
3b3d67a4fe JNI built in JNI 2020-07-01 18:26:24 +02:00