-
Notifications
You must be signed in to change notification settings - Fork 84
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
tls/http: add certificate chain setters #1125
tls/http: add certificate chain setters #1125
Conversation
17fe5ad
to
4cc622b
Compare
@@ -169,6 +169,9 @@ int http_client_set_cert(struct http_cli *cli, const char *path); | |||
int http_client_set_certpem(struct http_cli *cli, const char *pem); | |||
int http_client_set_key(struct http_cli *cli, const char *path); | |||
int http_client_set_keypem(struct http_cli *cli, const char *pem); | |||
int http_client_use_chain(struct http_cli *cli, const char *path); | |||
int http_client_use_chainpem(struct http_cli *cli, const char *chain, | |||
int len_chain); |
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.
Please use size_t len_chain
which is consistant with the API ...
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.
I wanted to prevent the cast from size_t
to int
when calling BIO_new_mem_buf
, but consistency makes sense. Done.
src/http/client.c
Outdated
if (!cli || !cli->tls) | ||
return EINVAL; | ||
|
||
err = tls_set_certificate_chain_pem(cli->tls, chain, len_chain); |
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.
use C99 style declare and assign here ... int err = ...
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.
Done.
src/tls/openssl/tls.c
Outdated
X509 *cert = NULL; | ||
X509 *leaf_cert = NULL; | ||
int err = ENOMEM; | ||
long ok = 0; |
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.
Is it possible to move the declaration of some of these variables further down, to the assignment ?
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.
Done.
In general it looks good. some minor comments ... |
4cc622b
to
fcbb412
Compare
Thank you for the review! @alfredh |
The current setters (e.g.
tls_set_certificate
) only allow single certificates to be set. Now the whole chain can be set.