Commit Graph

17 Commits (273270916ea33b096753c5ad316f46a8268761bd)

Author SHA1 Message Date
Stephen Shelton 273270916e
The Great Wall of Blame
This commit reflects changes to clang-format rules. Unfortunately,
these rule changes create a massive change to the codebase, which
causes an apparent rewrite of git history.

Git blame's --ignore-rev flag can be used to ignore this commit when
attempting to `git blame` some code.
4 years ago
Jason Rhinelander f1171ed7a2 make format 😠 🤮 4 years ago
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.
4 years ago
Jason Rhinelander f7cd10a82e Fix Recalculate()
Recalculate did what should have been the right thing but wasn't because
of libsodium's mislabelling the "seed" as the secret key.
4 years ago
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.
4 years ago
Jeff Becker 0f13591802
does not work 4 years ago
Jeff Becker 99eb7726ff
initial dht key blinding 4 years ago
Jeff Becker 4e355327d8
Merge remote-tracking branch 'origin/master' into ipv6-tun 5 years ago
Jeff Becker 6c1a04e804
reset errno and make unit tests pass 5 years ago
Jeff Becker bf3212820b
finish up issue 17 5 years ago
Jeff Becker 38d5a4855a
finish up issue 17 5 years ago
Jeff Becker ee283547b5
change signature scheme and fucking hope that the rest of the code doesn't fug itself over ;~; 5 years ago
Michael f3b0af9d2f
Create CopyableBuffer type 5 years ago
Jeff Becker d89e58199a
add initial identity key seed stuff
add more kubernetes stuff

make shared library installed if built
5 years ago
Michael 9094e2dcf0
Fix bug(?) with LoadFromFile 5 years ago
Michael fec75125f4
Add tests for crypto/types 5 years ago
Michael 79157414f3
Split crypto.hpp into 3 different files 5 years ago