-
Notifications
You must be signed in to change notification settings - Fork 7.6k
QUIC: constant initialization #243
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
Conversation
|
|
||
| static ngx_int_t ngx_quic_crypto_open(ngx_quic_secret_t *s, ngx_str_t *out, | ||
| u_char *nonce, ngx_str_t *in, ngx_str_t *ad, ngx_log_t *log); | ||
| const u_char *nonce, ngx_str_t *in, ngx_str_t *ad, ngx_log_t *log); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The const patch does feel incomplete For example, static ngx_quic_md_t key could also be const, but it's not. I feel like the complete patch could be much bigger than that. However, since it only constifies nonce, it's ok to commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike nonce, constifying ngx_quic_md_t or ngx_quic_md_t::data looks less easy & useful, because it is not directly passed to the library and breaks in various places.
OTOH, making key just static in ngx_quic_create_retry_packet() is good enough, because this eliminates few load/store instructions by moving it into the data segment.
In principle, we could leave nonce just static as well; making it also const moves from the data segment to the read-only data segment. I made it const because this can be done at no cost.
This follows OpenSSL and BoringSSL API, and gives a hint to compiler that this parameter may not be modified.
|
Rebased. |
|
Removed extra parens. |
arut
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
after #242