torproject / tor Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
router: Keep RSA onion public key in ASN.1 format #292
Closed
Conversation
The OpenSSL "RSA" object is currently 408 bytes compares to the ASN.1 encoding which is 140 for a 1024 RSA key. We save 268 bytes per descriptor (routerinfo_t) *and* microdescriptor (microdesc_t). Scaling this to 6000 relays, and considering client usually only have microdescriptors, we save 1.608 MB of RAM which is considerable for mobile client. This commit makes it that we keep the RSA onion public key (used for TAP handshake) in ASN.1 format instead of an OpenSSL RSA object. Changes is done in both routerinfo_t and microdesc_t. Closes #27246 Signed-off-by: David Goulet <dgoulet@torproject.org>
nmathewson
reviewed
Aug 28, 2018
src/feature/nodelist/microdesc.c
Outdated
| * | ||
| * Return NULL if md or the md's onion pkey is NULL or malformed. */ | ||
| crypto_pk_t * | ||
| microdesc_get_rsa_onion_pkey(const microdesc_t *md) |
These two functions seem redundant with their routerinfo_t equivalent. Do you think it's reasonable to combine them -- especially the "set" one, since it's longer?
Agrree. I merge them together and put the helper functions in router.c. Hope this is fine. See fixup commit: 61bdbe4
src/feature/nodelist/routerlist.c
Outdated
| @@ -5498,7 +5498,7 @@ router_differences_are_cosmetic(const routerinfo_t *r1, const routerinfo_t *r2) | |||
| r1->ipv6_orport != r2->ipv6_orport || | |||
| r1->dir_port != r2->dir_port || | |||
| r1->purpose != r2->purpose || | |||
| !crypto_pk_eq_keys(r1->onion_pkey, r2->onion_pkey) || | |||
| !tor_memeq(r1->onion_pkey, r2->onion_pkey, r1->onion_pkey_len) || | |||
Bug here: you need to check that the lengths are equal first!
src/feature/nodelist/microdesc.c
Outdated
| goto done; | ||
| } | ||
|
|
||
| md->onion_pkey = tor_malloc_zero(len); |
|
This was squashed and merged. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
The OpenSSL "RSA" object is currently 408 bytes compares to the ASN.1 encoding
which is 140 for a 1024 RSA key.
We save 268 bytes per descriptor (routerinfo_t) and microdescriptor
(microdesc_t). Scaling this to 6000 relays, and considering client usually
only have microdescriptors, we save 1.608 MB of RAM which is considerable for
mobile client.
This commit makes it that we keep the RSA onion public key (used for TAP
handshake) in ASN.1 format instead of an OpenSSL RSA object.
Changes is done in both routerinfo_t and microdesc_t.
Closes #27246
Signed-off-by: David Goulet dgoulet@torproject.org
The text was updated successfully, but these errors were encountered: