Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Trac
Trac
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Issue Boards

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • Legacy
  • TracTrac
  • Issues
  • #20138

Closed (moved)
Open
Opened Sep 13, 2016 by George Kadianakis@asn

Add constified getters to trunnel

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.

To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: legacy/trac#20138