diff options
author | David Goulet <dgoulet@torproject.org> | 2018-08-23 14:05:42 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-08-29 15:01:38 -0400 |
commit | 2f6bc74914d60b62b8e61904aae16c84c2b1181d (patch) | |
tree | 0bd9202dfefab689c9a3b7657ba197ae5a35ccdf /src/test/test_hs_service.c | |
parent | ac44e70ffc047941d196596dd651019c054b7faf (diff) | |
download | tor-2f6bc74914d60b62b8e61904aae16c84c2b1181d.tar.gz tor-2f6bc74914d60b62b8e61904aae16c84c2b1181d.zip |
router: Keep RSA onion public key in ASN.1 format
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>
Diffstat (limited to 'src/test/test_hs_service.c')
-rw-r--r-- | src/test/test_hs_service.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c index ad0b3ab342..f8a465629a 100644 --- a/src/test/test_hs_service.c +++ b/src/test/test_hs_service.c @@ -1238,7 +1238,7 @@ test_build_update_descriptors(void *arg) tt_int_op(ret, OP_EQ, 0); ri.onion_curve25519_pkey = tor_malloc_zero(sizeof(curve25519_public_key_t)); - ri.onion_pkey = crypto_pk_new(); + ri.onion_pkey = tor_malloc_zero(140); curve25519_public_key_generate(ri.onion_curve25519_pkey, &curve25519_secret_key); memset(ri.cache_info.identity_digest, 'A', DIGEST_LEN); @@ -1264,7 +1264,7 @@ test_build_update_descriptors(void *arg) update_all_descriptors(now); tor_free(node->ri->onion_curve25519_pkey); /* Avoid memleak. */ tor_free(node->ri->cache_info.signing_key_cert); - crypto_pk_free(node->ri->onion_pkey); + tor_free(node->ri->onion_pkey); expect_log_msg_containing("just picked 1 intro points and wanted 3 for next " "descriptor. It currently has 0 intro points. " "Launching ESTABLISH_INTRO circuit shortly."); |