Commit Graph

71 Commits

Author SHA1 Message Date
Jason Rhinelander
ebd2142114 Don't use std::optional::value() because f u macos
This replaces all use of std::optional's `opt.value()` with `*opt`
because macOS is great and the ghost of Steve Jobs says that actually
supporting std::optional's value() method is not for chumps before macOS
10.14.  So don't use it because Apple is great.

Pretty much all of our use of it actually is done better with operator*
anyway (since operator* doesn't do a check that the optional has a
value).

Also replaced *most* of the `has_value()` calls with direct bool
context, except for one in the config section which looked really
confusing at a glance without a has_value().
2020-05-20 19:18:28 -03:00
Jason Rhinelander
e03dfc751c Remove crypto_noop
It isn't used anywhere, and has bitrotted (it is marked final, but is
missing some required abstract method instances).
2020-05-17 17:08:11 -03:00
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.
2020-04-07 12:38:56 -06:00
Jason Rhinelander
870062e8cc Remove absl optimization
This was being used to get at gcc/clang's __builtin_expect, but we don't
really need that: we can just avoid the check entirely when not in debug
mode which should be even faster.
2020-02-24 14:27:44 -04:00
Jason Rhinelander
f84ce61d66 Removed empty cpp files
These aren't needed: CMake already knows how to follow #includes and
rebuild when headers change as long as the headers are included
*somewhere*.  The extra .cpp files here just require building a bunch of
.cpp files with just header content that we just end up throw away
during linking (since the same things will also be compiled in whatever
other compilation units include the same headers).
2020-02-21 23:39:11 -04:00
Jason Rhinelander
8cd95c01b3 Abstract signing hash data location
This makes the interface a little cleaner by not requiring the class
user to know how we laid out the data in the object.
2020-02-02 16:38:48 -04:00
Jason Rhinelander
739ce92aeb Remove unused ristretto includes 2020-02-01 12:44:31 -04:00
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
Thomas Winget
afd87eedb4 NO CLAMPS YOU IDIOT!!! 2020-01-31 12:05:27 -04:00
Thomas Winget
a487982c49 initial implementation of blinded sign -- not working yet 2020-01-31 12:05:20 -04:00
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.
2020-01-30 12:38:39 -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
0f13591802
does not work 2020-01-28 16:55:36 -05:00
Jeff Becker
99eb7726ff
initial dht key blinding 2020-01-27 16:30:41 -05:00
Jeff Becker
f29083f765 more travis fixes 2019-12-10 11:49:32 -07:00
Jeff Becker
098915bb8e
add check for identity key validity 2019-11-26 20:40:55 -05:00
Jeff Becker
065b022427
std::move 2019-11-22 16:23:20 -05:00
Jeff Becker
b8f773eb73
use lambda 2019-11-22 16:23:20 -05:00
Jeff Becker
250cfea1e9
remove use of void * in godawful old code from a time before happyness 2019-11-22 16:23:20 -05:00
Jason Rhinelander
b0ab703c45 Silence unused variable warnings in release build 2019-11-04 15:21:32 -04:00
Jeff Becker
01c4a9c287
revert a few things 2019-10-28 10:16:00 -04:00
jeff
aedcaf3c43 make it compile 2019-10-23 08:48:10 -04:00
jeff
1cdd9ba13a add unit test for identity_keygen 2019-10-23 08:43:37 -04:00
jeff
ff8c167362 make it compile on windows 2019-10-22 11:58:34 -04:00
jeff
0e2fb6abd5 revert to ed25519 for signing, this breaks everything (again). 2019-10-14 09:47:06 -04:00
Michael
edd0ec398f
Move thread stuff to subdirectory 2019-09-03 20:52:28 +01:00
Michael
1aec0dfa2b
Move logging to subdirectory 2019-09-03 20:52:27 +01:00
Michael
16cdfbd5f0
clang-tidy modernize pass 2019-08-12 16:52:58 +01:00
Thomas Winget
38fd0552d3 Adds Link-Relay Status Messages
Success case:
  - the path endpoint creates and sends a LR_StatusMessage upon
    successful path creation

Failure case:
  - an intermediate hop creates and sends a LR_StatusMessage upon
    failure to forward the path to the next hop for any reason

Both cases:
  - transit hops receive LR_StatusMessages and add a frame
    to them reflecting their "status" with respect to that path
  - the path creator receives LR_StatusMessages and decrypts/parses
    the LR_StatusRecord frames from the path hops.  If all is good,
    the Path does as it would when receiving a PathConfirmMessage.
    If not, the Path marks the new path as failed.

LR_StatusMessage is now used/sent in place of PathConfirmMessage
2019-07-25 17:46:56 -04:00
Michael
5fdd68fa44
exceptions BE GONE 2019-07-21 16:57:11 +01:00
Jeff Becker
b9bcc2b775
make threadpool consice 2019-07-09 09:47:24 -04:00
Jeff Becker
4e355327d8
Merge remote-tracking branch 'origin/master' into ipv6-tun 2019-06-26 09:12:19 -04:00
Jeff Becker
6c1a04e804
reset errno and make unit tests pass 2019-06-24 13:36:25 -04:00
Jeff Becker
bf3212820b
finish up issue 17 2019-06-24 12:48:55 -04:00
Jeff Becker
38d5a4855a
finish up issue 17 2019-06-24 12:26:15 -04:00
Jeff Becker
0808060a61
fix previous commit 2019-05-31 06:59:47 -04:00
Jeff Becker
a51f4c8328
make debian stable happy 2019-05-29 08:41:00 -04:00
Michael
8323725509
Initial No-Op Crypto implementation 2019-05-29 09:46:34 +01:00
Michael
a62655d501
Move tests to use top-level LlarpTest 2019-05-28 20:45:09 +01:00
Michael
491fee206b
Port code to use CryptoManager over passing Crypto pointers 2019-05-28 20:45:08 +01:00
Michael
aea0e32efc
Add CryptoManager class to provide a guard-style class to manage the current Crypto instance 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
Jeff Becker
d50b18d7b0
try fixing leak also make format 2019-04-30 08:22:15 -04:00
Jeff
f8679b6405 fix size 2019-04-29 14:06:16 -04: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
94eb37d490
bundle RC in build record to improve build success rates. 2019-04-17 15:05:54 -04:00
Jeff Becker
5399b93270
make format and readd win32 console color logging 2019-04-11 11:36:20 -04:00
Jeff Becker
230e84c742
make signing work 2019-03-28 15:15:20 -04:00
Jeff
ff18ba229a
Merge pull request #411 from majestrate/staging
change signing algo
2019-03-20 10:56:44 -04:00