Commit Graph

16 Commits

Author SHA1 Message Date
Jason Rhinelander
f1171ed7a2 make format 😠 🤮 2020-01-31 17:05:50 -04:00
Jason Rhinelander
cd8f26deff Use hash instead of random for signing hash data
This makes PrivateKey store both the key followed by the hash.  For
PrivateKeys based on SecretKeys this just means the second half of the
SHA-512 of the seed, and makes a PrivateKey constructed from a SecretKey
give an identical signature to signing directly with sodium.

For derived keys we use a ShortHash of the root key's signing hash
concatenated with the publicly known hash value, so that our derived key
signing hash will be different from the root signing hash and also
different for different derivation parameters.

This also changed one of the asserts in crypto_noop, but upon closer
inspection the copying of the secret key into the signature seems really
wrong, so just changed them to fill with 0s.
2020-01-31 16:47:25 -04:00
Jason Rhinelander
860c5efd47 Derived key fixes
The reason things weren't working here is because libsodium does
something completely unintuitive and called the seed the "secret key"
when it isn't, it's the seed.

This adds a new PrivateKey class (alongside the existing SecretKey and
PubKey) that holds just a private key value but no seed -- which we need
to do because there is no way we can get a seed after calculating a
derived keypair.

With these changes, we now generate exactly the same keys and subkeys as
Tor (and a new test case uses values generated in Tor to verify this).

This is incomplete -- the subkey signing code is still not implemented;
it has to be adapted to create a signature from a PrivateKey rather than
a SecretKey which will probably requiring working around/reimplementing
some of what libsodium does for creating a signature since it expects
"secret keys" i.e. the seed.
2020-01-30 12:34:05 -04:00
Jeff Becker
99eb7726ff
initial dht key blinding 2020-01-27 16:30:41 -05:00
Michael
491fee206b
Port code to use CryptoManager over passing Crypto pointers 2019-05-28 20:45:08 +01:00
Michael
dd8a93a400
Apply rule of zero to code base 2019-05-19 23:11:07 +01:00
Michael
4143472a17
Add cmake module to target a library as 'system', and fix a few warnings 2019-04-25 00:27:31 +01:00
Jeff Becker
5399b93270
make format and readd win32 console color logging 2019-04-11 11:36:20 -04:00
Jeff
ff18ba229a
Merge pull request #411 from majestrate/staging
change signing algo
2019-03-20 10:56:44 -04:00
Jeff Becker
ee283547b5
change signature scheme and fucking hope that the rest of the code doesn't fug itself over ;~; 2019-03-20 10:51:10 -04:00
Ryan Tharp
823f276280 allow blocked output of identitySecret 2019-03-20 03:17:04 +00:00
Michael
e4cf1f245c
Convert most of llarp to use Printer 2019-02-24 23:46:44 +00:00
Michael
048fa83c39
Finish replacement of Router with AbstractRouter 2019-02-14 22:31:31 +00:00
Michael
1f95f1e78f
More unit tests of dht internals 2019-01-26 00:40:40 +00:00
Jeff Becker
d89e58199a
add initial identity key seed stuff
add more kubernetes stuff

make shared library installed if built
2019-01-21 10:45:18 -05:00
Michael
79157414f3
Split crypto.hpp into 3 different files 2019-01-13 16:32:51 +00:00