Commit Graph

49 Commits

Author SHA1 Message Date
Giovanni Petrantoni 1c4d72f5e3
Use Result construct in minasn1 (#144) 2020-04-23 14:10:20 +02:00
Jacek Sieka e8b33c64fa
secp: use upstream secp convenience api (#141)
* secp: use upstream secp convenience api
2020-04-17 12:51:13 +02:00
Jacek Sieka 2b823bde68
secp: update (#138) 2020-04-12 19:03:08 +02:00
Dmitriy Ryajov bd49a35e0a formatting 2020-04-07 12:16:59 -06:00
Giovanni Petrantoni 35a48fa560 Re-enable gossipsub internal tests when running CI
minor bonus: add a link in the comments about bearssl issue with
callbacks
2020-04-07 22:07:00 +09:00
Giovanni Petrantoni a576069305 Chachapoly new bearssl fixes 2020-04-07 17:52:19 +09:00
Giovanni Petrantoni 0a3e4a764b
Less verbose traces (#112)
* Make traces less verbose with shortHexDump utility

* Rename shortHexDump into shortLog

* Improve shortLog, add shortLog for crypto keys

* Add proper shortLog implementations in messages
2020-03-23 15:03:36 +09:00
Giovanni Petrantoni c02fca25f8
Noise (#90)
* Start ChaCha20Poly1305 integration (BearSSL)

* Add Curve25519 (BearSSL) required operations for noise

* Fix curve mulgen iterate/derive

* Fix misleading header

* Add chachapoly proper test

* Curve25519 integration tests (failing, something is wrong)

* Add few converters, finish c25519 integration tests

* Remove implicit converters

* removed internal globals

* Start noise implementation

* Fix public() using proper bear mulgen

* Noise protocol WIP

* Noise progress

* Add a quick nim version of HKDF

* Converted hkdf to iterator, useful for noise

* Noise protocol implementation progress

* Noise progress

* XX handshake almost there

* noise progress

* Noise, testing handshake with test vectors

* Noise handshake progress, still wrong somewhere!

* Noise handshake success!

* Full verified noise XX handshake completed

* Fix and rewrite test to be similar to switch one

* Start with connection upgrade

* Switch chachapoly to CT implementations

* Improve HKDF implementation

* Use a type insted of tuple for HandshakeResult

* Remove unnecessary Let

* More cosmetic fixes

* Properly check randomBytes result

* Fix chachapoly signature

* Noise full circle (altho dispatcher is nil cursed)

* Allow nil aads in chachapoly routines

* Noise implementation up to running full test

* Use bearssl HKDF as well

* Directly use bearssl rng for curve25519 keys

* Add a (disabled/no CI) noise interop test server

* WIP on fixing interop issues

* More fixes in noise implementation for interop

* bump chronos requirement (nimble)

* Add a chachapoly test for very small size payloads

* Noise, more tracing

* Add 2 properly working noise tests

* Fix payload packing, following the spec properly (and not go version but
rather rust)

* Sanity, replace discard with asyncCheck

* Small fixes and optimization

* Use stew endian2 rather then system endian module

* Update nimble deps (chronos)

* Minor cosmetic/code sanity fixes

* Noise, handle Nonce max

* Noise tests, make sure to close secured conns

* More polish, improve code readability too

* More polish and testing again which test fails

* Further polishing

* Restore noise tests

* Remove useless Future[void]

* Remove useless CipherState initializer

* add a proper read wait future in second noise test

* Remove noise generic secure implementation for now

* Few fixes to run eth2 sim

* Add more debug info in noise traces

* Merge size + payload write in sendEncryptedMessage

* Revert secure interface, add outgoing property directly in newNoise

* remove sendEncrypted and receiveEncrypted

* Use openarray in chachapoly and curve25519 helpers
2020-03-17 13:30:01 +01:00
Jacek Sieka 52cb7ced04
prefer endians2 (#98) 2020-03-10 21:40:52 +01:00
Giovanni Petrantoni cb156f3260 Fix public() using proper bear mulgen 2020-02-18 09:35:14 -06:00
Giovanni Petrantoni 93a480e6f3 removed internal globals 2020-02-18 09:35:14 -06:00
Giovanni Petrantoni e0e371994c Remove implicit converters 2020-02-18 09:35:14 -06:00
Giovanni Petrantoni f039853a19 Add few converters, finish c25519 integration tests 2020-02-18 09:35:14 -06:00
Giovanni Petrantoni 99a169b65d Curve25519 integration tests (failing, something is wrong) 2020-02-18 09:35:14 -06:00
Giovanni Petrantoni 2103aa59f3 Add chachapoly proper test 2020-02-18 09:35:14 -06:00
Giovanni Petrantoni 6ba274de27 Fix misleading header 2020-02-18 09:35:14 -06:00
Giovanni Petrantoni f47fb628f0 Fix curve mulgen iterate/derive 2020-02-18 09:35:14 -06:00
Giovanni Petrantoni 8dec368878 Add Curve25519 (BearSSL) required operations for noise 2020-02-18 09:35:14 -06:00
Giovanni Petrantoni 71998ffc67 Start ChaCha20Poly1305 integration (BearSSL) 2020-02-18 09:35:14 -06:00
cheatfate 107e71203d Fix #61. 2020-01-09 17:38:10 +02:00
Zahary Karadjov 454f658ba8
Fixes and tweaks related to the beacon node integration
* Bugfix: Dialing an already connected peer may lead to crash

* Introduced a standard_setup module allowing to instantiate
  the `Switch` object in an easier manner.

* Added `Switch.disconnect(peer)`

* Trailing space removed (sorry about polluting the diff)
2019-12-08 23:58:43 +02:00
cheatfate 833e8c9406
Fix overflow problem.
Fix compilation warnings.
2019-10-29 20:51:48 +02:00
Dmitriy Ryajov ae7b354819 unused directory 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov c98e8929bc reverting change 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 8920cd7d60 misc: pubsub/floodsub and logging 2019-10-11 08:15:24 +09:00
Dmitriy Ryajov 5d07145a0a feat: added stream abstraction and chronos wrapper 2019-10-11 08:15:24 +09:00
Yuriy Glukhov 1ecdf159bb
Extern bearssl 2019-10-08 14:41:24 +03:00
Zahary Karadjov 1018bffb3f
Add gcsafe markers to make Nim 1.0 happy 2019-09-29 22:17:10 +03:00
cheatfate 41e1479213
Add rust's TwofishCTR support. 2019-09-13 09:52:13 +03:00
cheatfate 54f9a5be7c
Fix getOrder() bug. 2019-09-12 23:11:50 +03:00
cheatfate 7138f7e94d
Add more primitives for SecIO.
Fix SIGSEGV inside of rsa.nim and ecnist.nim.
2019-09-11 19:03:39 +03:00
cheatfate f2b10776db
Add utility procedures for SECIO.
Add 2 more length encodings for protobuf.
2019-09-09 19:57:17 +03:00
cheatfate c584583678
Fix compilation error for Nim devel. 2019-09-03 16:22:55 +03:00
cheatfate 40ad427ea0
Fix mistype. 2019-09-02 21:59:32 +03:00
cheatfate 968e635746
Add secp256k1 curve support and tests for it. 2019-09-02 21:55:42 +03:00
Zahary Karadjov d5b51bcf9e Use CatchableError 2019-06-24 05:39:13 +03:00
cheatfate 44d0cc2dea
Fix undefined reference to `br_ec_c25519_m31'. 2019-03-16 00:56:10 +02:00
Ștefan Talpalaru 7cbb89c7e4
assert() -> doAssert()
and refactored the "test" task in libp2p.nimble
2019-03-14 03:55:47 +01:00
cheatfate dc2d0538ff
Fix import bugs.
Add PublicKey and Signature types to daemonapi.
Add more tests for crypto.nim
2019-03-06 13:23:12 +02:00
cheatfate b235c84bb2
Add key interface with test vectors. 2019-03-02 21:19:41 +02:00
cheatfate 14686714c0
Add raw init functions for ecnist.nim
Add ECDHE helpers for ecnist.nim
Add test vectors for ECDHE.
2019-03-01 08:34:52 +02:00
cheatfate 5e6d740ee7
Cleanup. 2019-02-28 18:17:24 +02:00
cheatfate 2a2e378ced
Fix checkScalar in ecnist.
Add ed25519 and tests.
Add some comments.
2019-02-28 14:17:39 +02:00
cheatfate cb334cc8ab
Fix inline documentation. 2019-02-25 20:03:52 +02:00
cheatfate 887795bbd2 Final RSA changes.
Add RSA tests and test vectors.
2019-02-24 02:07:13 +02:00
cheatfate 1aaf4797c9 Finish EC NIST curves implementation.
Add EC NIST curves tests and test vectors.
2019-02-22 13:32:15 +02:00
cheatfate f67a7a2a3e Add minimal ASN.1 encoding/decoding primitives.
Add ASN.1 DER serialization for EC NIST curves.
2019-02-21 06:10:21 +02:00
cheatfate 467d8e1db6 Add BearSSL submodule
Fix common.nim path to BearSSL submodule.
2019-02-20 00:24:43 +02:00
cheatfate 52f88dbd1e Initial commit, not ready yet. 2019-02-20 00:11:59 +02:00