#20138: Add constified getters to trunnel ----------------------------------+--------------------- Reporter: asn | Owner: nickm Type: task | Status: new Priority: Medium | Milestone: Component: Core Tor/Trunnel | Version: Severity: Normal | Keywords: trunnel Actual Points: | Parent ID: Points: | Reviewer: Sponsor: | ----------------------------------+--------------------- Here is a feature request for trunnel. Let me know if it does not make sense.
It might be useful to introduce constified versions of getters in trunnel. As an example, consider the following getter: {{{ /** Return a pointer to the variable-length array field body of 'inp'. */ uint8_t * certs_cell_cert_getarray_body(certs_cell_cert_t *inp); }}} In that spot, we could also additionally add the following getter: {{{ /** Return a const pointer to the variable-length array field body of 'inp'. */ const uint8_t * certs_cell_cert_getarray_body_immutable(const certs_cell_cert_t *inp); }}} which would be more suitable for the following code at `channel_tls_process_certs_cell()`: {{{ ... uint8_t *cert_body = certs_cell_cert_getarray_body(c); if (cert_type > MAX_CERT_TYPE_WANTED) continue; tor_x509_cert_t *cert = tor_x509_cert_decode(cert_body, cert_len); ... }}} Basically, everytime you use a getter to get a signature/mac/cert field, you probably want it constified as you dont need to change it when verifying. This occurs quite frequently in the prop224 cells we've been implementing, hence this ticket. This feature might make some parts of the code more readable/understandable, but at the cost of increasing trunnel's complexity. -- Ticket URL: <https://trac.torproject.org/projects/tor/ticket/20138> Tor Bug Tracker & Wiki <https://trac.torproject.org/> The Tor Project: anonymity online _______________________________________________ tor-bugs mailing list tor-bugs@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs