Opened 2 months ago

Closed 2 months ago

#28839 closed defect (implemented)

Speed up parsing RSA onion keys from microdescriptors

Reported by: nickm Owned by: nickm
Priority: Medium Milestone: Tor: 0.4.0.x-final
Component: Core Tor/Tor Version: Tor: 0.3.4.9
Severity: Normal Keywords: startup performance
Cc: Actual Points: .3
Parent ID: #28481 Points:
Reviewer: dgoulet Sponsor: Sponsor8-can

Description

The two functions crypto_pk_read_public_key_from_string() is about 9% of our startup time when we have directory information, and router_set_rsa_onion_pkey() is about 2.4%. There is a probably a good chance to save time here, in a few ways:

  • Maybe pem_decode() could be faster. Right now it seems to be eating 3.53% of the startup time, and most of its energy is going into tor_asprintf().
  • We possibly save a decode/encode cycle, since we are parsing asn1 into an RSA key, and then re-encoding that key into an asn1 string in router_set_rsa_onion_pkey().

Child Tickets

Change History (6)

comment:1 Changed 2 months ago by nickm

Owner: set to nickm
Status: newaccepted

comment:2 Changed 2 months ago by nickm

Branch is ticket28839_v2 with PR at https://github.com/torproject/tor/pull/589 .

The changes here speed up microdescriptor parsing by around 30%.

comment:3 Changed 2 months ago by nickm

Actual Points: .3
Status: acceptedneeds_review

comment:4 Changed 2 months ago by dgoulet

Reviewer: dgoulet

comment:5 Changed 2 months ago by dgoulet

Status: needs_reviewmerge_ready

lgtm;

comment:6 Changed 2 months ago by nickm

Resolution: implemented
Status: merge_readyclosed

Merged to master!

Note: See TracTickets for help on using tickets.