Commit Graph

53 Commits

Author SHA1 Message Date
Gruruya 340606cb8c Consistently apply {.noinit.} pragma 2023-04-05 17:54:06 -04:00
Gruruya 78a0f867a2 Correct template parameter naming 2023-04-05 17:49:48 -04:00
Gruruya f50180d1e5 Inline `signSchnorr Rng` procs 2023-04-04 20:55:05 -04:00
Gruruya 87bd737715 Remove unused template param 2023-04-04 20:41:52 -04:00
Gruruya 0fe89981c6 Make `signSchnorr` accept `Opt[array[32, byte]]` rather than `[array[32,byte]]` 2023-04-04 19:49:09 -04:00
Gruruya f2518c6282 Fix on Nim 1.2 2023-04-04 19:32:22 -04:00
Gruruya 059e007469 Unify `schnorrSig` implementations and add `array[32, bytes]` variant 2023-04-04 19:25:24 -04:00
Gruruya 0ae96c588e Rename `signSchnorr` without `rng` to `signSchnorrUnsafe` 2023-04-04 16:40:15 -04:00
Gruruya b35f4556f6 Add comment detailing that `signSchnorr` without an `rng` is discouraged 2023-04-04 15:32:05 -04:00
Gruruya 8d8fa3864c Don't check the RNG for Schnorr sig using private key requirements. 2023-04-04 15:22:34 -04:00
Gruruya 37ec59be9e Comments 2023-04-04 03:33:36 -04:00
Gruruya 3c80efbeee Allow passing a `Rng`/`FoolproofRng` to `signSchnorr` for improved security 2023-04-04 03:08:15 -04:00
Gruruya 978d4fdee0 Comment 2023-04-04 01:09:45 -04:00
Gruruya 552031cceb Fix errors on Nim 1.2 2023-04-04 01:05:53 -04:00
Gruruya 6465acd0e6 Comments 2023-04-04 00:43:22 -04:00
Gruruya a2a6e9ea49 Add from/to raw/hex 2023-04-04 00:37:43 -04:00
Gruruya f32bef8d60 Add `default` {.error.} proc for SkSchnorrSignature 2023-04-04 00:11:37 -04:00
Gruruya 5c02a843fe Remove accidental extra indentation 2023-04-03 23:52:03 -04:00
Gruruya c749e86971 Fix type 2023-04-03 23:51:14 -04:00
Gruruya 51420c40bd Reduce code duplication 2023-04-03 23:50:16 -04:00
Gruruya e75a1e2c82 Rework patch. Implement Schnorr signing and undo breaking changes. 2023-04-03 23:42:03 -04:00
Gruruya 7a36c249f8 Re-order 2023-04-03 22:43:37 -04:00
Gruruya 289e60fcd3 Small fixes 2023-04-03 19:50:43 -04:00
Gruruya 8e2e9cf762 Add more helper procs for new SkKeyPair 2023-04-03 19:11:27 -04:00
Gruruya 858d6ca3d6 Make SkKeyPair a wrapper around secp256k1_keypair 2023-04-03 18:25:51 -04:00
jangko 169ad82cea
reduce compiler warnings 2023-02-23 12:08:51 +07:00
Jacek Sieka eb5868e069
bump upstream, fix cuchar warnings (#39) 2022-11-24 16:20:13 +02:00
Kim De Mey c7f1a37d9b
Merge pull request from GHSA-q3x5-92cp-3pjr 2022-08-19 17:22:43 +02:00
zah 5340cf1881
Restructure the project to allow nimble check to pass (#36)
* Restructure the project to allow nimble check to pass

* Add a lock file
2022-06-20 14:31:15 +03:00
Tanguy 153ec71a34
Fix for styleCheck:usages (#34) 2021-12-27 11:27:55 +01:00
Jacek Sieka 23bf71889d
remove unnecessary data in callbacks (and weird cast) (#29) 2021-01-07 10:32:46 +01:00
Jacek Sieka af9611c187
avoid finalizer, may destabilize the GC (#28)
forgot about https://github.com/nim-lang/Nim/issues/4851 when writing it

generally, will only be a problem if threads are created and destroyed
often
2020-12-16 15:00:21 +01:00
Zahary Karadjov a9d5cba699 More localized noSideEffect overrides 2020-11-16 14:49:32 +02:00
Richard Ramos f1bdb572f4 fix: code review 2020-11-14 18:35:46 +02:00
Richard Ramos ef264648fc fix: code review 2020-11-14 18:35:46 +02:00
Richard Ramos 9387bd8b2d Expose privkey_tweak_add 2020-11-14 18:35:46 +02:00
Eugene Kabanov fb9699702b
Perform constant time comparison of keys and signatures. (#24)
Bump version to 0.5.1.
2020-07-30 16:48:40 +02:00
Jacek Sieka bf6cc94a3c
use external rng instead of nimcrypto (#23)
* use external rng instead of nimcrypto

allows passing in different RNG's to generate keys

* pass in array of random data to random keygen function

* back to a proc

* docs

* gcsafe rng callback needed

* introduce foolproofrng that can't fail

* silence compiler warning

* hint at random not being good enough in defect
2020-07-06 15:07:29 +02:00
Jacek Sieka be98963599
fromHex needs to be public after all 2020-06-22 16:59:37 +02:00
Jacek Sieka 5701a60143
use requiredInit (#22)
* use requiredInit

Use requiredInit on keys - this simplifies error handling by providing
more compile-time guarantees through type.

Loophole: `clear` will leave an invalid key type in memory, not
guaranteed by type - it requires an explicit action to produce, so it's
somewhat better than the current situation where by default, keys are
invalid, but it's not watertight.

something like a `sink` would be needed which would have to guarantee
that `clear` is the last use of the instance.

* close requiresinit loophole

* remove clear for public stuff

* fix side effects

`secp256k1_context_no_precomp` is constant actually

* document nosideeffect

* document nosideeffect

* document fix
2020-06-22 16:08:21 +02:00
Jacek Sieka 306289244c
add convenience api (#21)
fixes #19
2020-04-17 07:43:30 +02:00
Jacek Sieka 5af866754b
upstream: update (#18) 2020-04-11 16:38:24 +02:00
cheatfate 16b3cd84b6
Fix #17.
Bump version to 0.1.2.
2020-03-08 22:22:50 +02:00
cheatfate 25b04816a0
Fix path handling for compile targets.
Bump version to 0.1.1.
2020-03-08 20:26:54 +02:00
cheatfate 3a39aa0892 Add wrapper for secp256k1_ecdh_raw() 2018-03-21 11:42:07 +02:00
cheatfate bbb83bab0f Added secp256k1_ecdsa_recoverable_signature_parse_compact(). 2018-03-19 16:47:21 +02:00
cheatfate ee348dace4 Changing `stdcall` to `cdecl`. 2018-03-16 18:39:06 +02:00
cheatfate f7b46707e5 Callback functions must not have default {.nimcall.} calling convention. 2018-03-16 17:20:36 +02:00
cheatfate 2c4c49fd3d Added secp256k1_ecdh(). 2018-03-16 11:17:10 +02:00
Yuriy Glukhov 2c3571598b Enable ECDH + some minor fixes 2018-03-15 20:34:55 +02:00