Commit Graph

93 Commits

Author SHA1 Message Date
Jacek Sieka 5fd8135783
move back to pure upstream version (#50) 2023-04-28 13:20:18 +03:00
Jacek Sieka e123cf38ed
bump to v0.3.1 (#45)
* simplify build system thanks to upstream changes
* add secp version to library version, bump to 0.6
* bump upstream to 0.3.1 ([`git diff
6138d73be471ece4717af8e7f419dde0a414568e..346a053d4c442e08191f075c3932d03140579d47`](6138d73be4..346a053d4c))
2023-04-26 17:23:30 +03:00
jangko f05e7b0f48
fix typo: rename SkEdchSecretSize to SkEcdhSecretSize 2023-04-21 11:43:43 +07:00
jangko b3f38e2795
keep using doAssert in ecdh with default hash function and add some documentation for both ecdh functions 2023-04-20 15:00:51 +07:00
jangko 206e5360b8
Get rid of ecdhRaw and export ecdh with custom hash func 2023-04-20 10:31:00 +07:00
jangko 05b4bde6d0
Remove appveyor and travis scripts 2023-04-20 06:56:12 +07:00
tersec 708a739d35
test with Nim 2.0 in CI (#46) 2023-04-13 23:09:33 +00:00
Gruruya 6e18455a63
Enable and expose Schnorrsig (#44)
* Enable Schnorrsig module in wrapper

The extrakeys module is a dependency for Schnorrsig, so that's enabled as well.

* Add {.bycopy.} pragma

* Add Schnorrsig interface to `abi.nim`

Multikey interface is a dependency the for schnorrsig, so it was added
as well.

* Add tests for Schnorr signing

* Fix schnorr magic const declaration on 1.6 and below

* Remove unnecessary {.bycopy.} pragmas

Done under the impression that {.bycopy.} is not necessary when only
passing the object to C via ptr.

* Make SkKeyPair a wrapper around secp256k1_keypair

* Add more helper procs for new SkKeyPair

* Small fixes

* Re-order

* Rework patch. Implement Schnorr signing and undo breaking changes.

* Reduce code duplication

* Fix type

* Remove accidental extra indentation

* Add `default` {.error.} proc for SkSchnorrSignature

* Remove extra test

* Add from/to raw/hex

* Comments

* Add low-level test for `secp256k1_keypair`

* Fix errors on Nim 1.2

* Comment

* Allow passing a `Rng`/`FoolproofRng` to `signSchnorr` for improved security

* Comments

* Correct `noncefp` to be a pointer in `extraparams` object

* Remove unneeded {.bycopy.}

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>

* Don't check the RNG for Schnorr sig using private key requirements.

* Add comment detailing that `signSchnorr` without an `rng` is discouraged

* Remove non-`rng` signSchnorr variant from tests

* Rename `signSchnorr` without `rng` to `signSchnorrUnsafe`

* Unify `schnorrSig` implementations and add `array[32, bytes]` variant

* Fix on Nim 1.2

* Make `signSchnorr` accept `Opt[array[32, byte]]` rather than `[array[32,byte]]`

* Remove unused template param

* Inline `signSchnorr Rng` procs

* Remove `nimble.lock`, was breaking tests on Nim >1.6

Was causing
`Error: cannot open file: stew/byteutils`

* Correct template parameter naming

* Consistently apply {.noinit.} pragma

* `{.noinit.}` random byte array

* Revert "`{.noinit.}` random byte array"

This reverts commit a3f99817d9.

* Correct template pragmas

* Explicitly declare `noncefp` as `nil`

* Create and export `xonly_pubkey` wrapping type

* Complete implementation of `SkXOnlyPublicKey`

* Correct comment

* Add tests for 'SkXOnlyPublicKey`

* Correct conversion proc name

* Correct conversion proc name cont.

---------

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>
2023-04-11 10:17:03 +02:00
jangko 4c41c5029f
ci: workaround for nim 1.6 and nim devel 2023-02-23 12:49:23 +07:00
jangko 169ad82cea
reduce compiler warnings 2023-02-23 12:08:51 +07:00
Jacek Sieka fd173fdff8
enable x86_64 assembly on x86_64 only (#42) 2022-12-05 14:54:12 +01:00
Jakub Sokołowski 72a9c4dd56
ci: add Jenkinsfile for running tests on macos
Also adds a `Makefile` to seaprate out the building of compiler.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-12-05 12:39:05 +01:00
Jacek Sieka eb5868e069
bump upstream, fix cuchar warnings (#39) 2022-11-24 16:20:13 +02:00
Jacek Sieka 88b2702fea
bump checkout, avoid redundant PR builds 2022-11-23 09:03:37 +01:00
Jacek Sieka 8e1d11c799
update ci/nimble (#40)
* update flag parsing
* fix mac CI
2022-11-19 16:50:01 +01:00
Kim De Mey c7f1a37d9b
Merge pull request from GHSA-q3x5-92cp-3pjr 2022-08-19 17:22:43 +02:00
Ivan Yonchovski ab99e2de33
Add setup files (#38) 2022-07-25 22:08:33 +03:00
Miran e625f47423
move -d:nimRawSetjmp to nim.cfg (#37)
Refs https://github.com/status-im/nimbus-build-system/issues/44
2022-07-25 21:57:38 +03: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
Ștefan Talpalaru e092373a5c
CI: test with multiple Nim versions (#35) 2022-01-11 18:28:34 +01:00
Tanguy 153ec71a34
Fix for styleCheck:usages (#34) 2021-12-27 11:27:55 +01:00
Ștefan Talpalaru d790c42206
CI: refactor Nim compiler caching (#33) 2021-06-03 02:08:23 +02:00
Ștefan Talpalaru 67ebdfa801 enable cross-compilation 2021-02-03 21:36:46 +02:00
andri lim ac96054870
Merge pull request #30 from status-im/github_action
add github action script
2021-01-08 12:05:55 +07:00
jangko f85ed3651e
add github action script 2021-01-07 18:04:16 +07: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 e8fa92a0c6
more installdirs 2020-04-17 08:05:26 +02:00
Jacek Sieka 6dce6c22ea
add installdir 2020-04-17 07:57:30 +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
Ștefan Talpalaru 85b2620a6e
CI: update script path 2019-08-24 05:03:42 +02:00
Ștefan Talpalaru a41d4432a1
Merge branch 'buildnim' 2019-06-18 21:56:25 +02:00
Ștefan Talpalaru ac89b63ba7
build_nim.sh 2019-06-18 21:39:16 +02:00
Ștefan Talpalaru 53baf442f2 add "--threads:on" to tests 2019-01-15 17:30:41 +02:00
Bruno Škvorc 9b21ca7e14
Update README.md 2019-01-02 15:00:18 +01:00
Yuriy Glukhov 024cc57eb5 Fixed nimble file 2018-09-18 17:30:58 +03:00
mratsim 1b65bb7607 re-add submodule, fix windows CI regression 53b5b9388c (diff-11c909939117928998b102a1fff7d363L45) 2018-09-10 18:22:38 +02:00
mratsim 09c67ca580 Nim now uses global user cache 2018-09-10 18:08:04 +02:00
Jacek Sieka c8324b690b
appveyor: fix version check 2018-09-06 12:09:01 -06:00