aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMathias Raoul <mathias.raoul@gmail.com>2021-01-27 15:35:54 +0000
committerDave Wallace <dwallacelf@gmail.com>2021-02-01 19:40:06 +0000
commit33a4649733e5cdfc61af33363552c4bfb11f1cd3 (patch)
tree6af0637df10b95a9ddbb9e71f9be4de2818cdbd6 /src/plugins
parentfc116e9ff71bbc82120a2d545df30ecc4db4b02f (diff)
quic: clean setup_cipher function
Type: fix Change-Id: I02e473440a8732ddfb1a13ad6552779adaa67f60 Signed-off-by: Mathias Raoul <mathias.raoul@gmail.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/quic/quic_crypto.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/plugins/quic/quic_crypto.c b/src/plugins/quic/quic_crypto.c
index 5e90563885e..15e5f0d52fb 100644
--- a/src/plugins/quic/quic_crypto.c
+++ b/src/plugins/quic/quic_crypto.c
@@ -55,18 +55,18 @@ quic_crypto_setup_cipher (quicly_crypto_engine_t *engine, quicly_conn_t *conn,
int ret;
*packet_protect_ctx = NULL;
-
/* generate new header protection key */
if (header_protect_ctx != NULL)
{
*header_protect_ctx = NULL;
- if ((ret = ptls_hkdf_expand_label (
- hash, hpkey, aead->ctr_cipher->key_size,
- ptls_iovec_init (secret, hash->digest_size), "quic hp",
- ptls_iovec_init (NULL, 0), NULL)) != 0)
+ ret =
+ ptls_hkdf_expand_label (hash, hpkey, aead->ctr_cipher->key_size,
+ ptls_iovec_init (secret, hash->digest_size),
+ "quic hp", ptls_iovec_init (NULL, 0), NULL);
+ if (ret)
goto Exit;
- if ((*header_protect_ctx =
- ptls_cipher_new (aead->ctr_cipher, is_enc, hpkey)) == NULL)
+ *header_protect_ctx = ptls_cipher_new (aead->ctr_cipher, is_enc, hpkey);
+ if (NULL == *header_protect_ctx)
{
ret = PTLS_ERROR_NO_MEMORY;
goto Exit;
@@ -74,8 +74,9 @@ quic_crypto_setup_cipher (quicly_crypto_engine_t *engine, quicly_conn_t *conn,
}
/* generate new AEAD context */
- if ((*packet_protect_ctx = ptls_aead_new (aead, hash, is_enc, secret,
- QUICLY_AEAD_BASE_LABEL)) == NULL)
+ *packet_protect_ctx =
+ ptls_aead_new (aead, hash, is_enc, secret, QUICLY_AEAD_BASE_LABEL);
+ if (NULL == *packet_protect_ctx)
{
ret = PTLS_ERROR_NO_MEMORY;
goto Exit;
@@ -97,7 +98,7 @@ quic_crypto_setup_cipher (quicly_crypto_engine_t *engine, quicly_conn_t *conn,
Exit:
if (ret)
{
- if (packet_protect_ctx && *packet_protect_ctx != NULL)
+ if (*packet_protect_ctx != NULL)
{
ptls_aead_free (*packet_protect_ctx);
*packet_protect_ctx = NULL;