summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2020-09-11 09:47:41 +0200
committerFlorin Coras <florin.coras@gmail.com>2020-09-11 15:13:39 +0000
commit8847749269ffd591c7fb6c290b4a311f186fb7c5 (patch)
tree7f16315303611390218d7ed39a47c789dbb42171 /src
parentb418c397dc8c870c6561ea1d7565067333db9df4 (diff)
quic: Clean quic_crypto_setup_cipher
Type: fix Change-Id: I4c19636c2be8a577c6cba272708cb04bcc24785b Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/quic/quic_crypto.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/plugins/quic/quic_crypto.c b/src/plugins/quic/quic_crypto.c
index daf39e87032..35dddf63c71 100644
--- a/src/plugins/quic/quic_crypto.c
+++ b/src/plugins/quic/quic_crypto.c
@@ -161,20 +161,19 @@ quic_crypto_setup_cipher (quicly_crypto_engine_t * engine,
int ret;
*aead_ctx = NULL;
-
/* generate new header protection key */
if (hp_ctx != NULL)
{
*hp_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 ((*hp_ctx =
- ptls_cipher_new (aead->ctr_cipher, is_enc, hpkey)) == NULL)
+ *hp_ctx = ptls_cipher_new (aead->ctr_cipher, is_enc, hpkey);
+ if (NULL == *hp_ctx)
{
ret = PTLS_ERROR_NO_MEMORY;
goto Exit;
@@ -182,9 +181,9 @@ quic_crypto_setup_cipher (quicly_crypto_engine_t * engine,
}
/* generate new AEAD context */
- if ((*aead_ctx =
- ptls_aead_new (aead, hash, is_enc, secret,
- QUICLY_AEAD_BASE_LABEL)) == NULL)
+ *aead_ctx = ptls_aead_new (aead, hash, is_enc, secret,
+ QUICLY_AEAD_BASE_LABEL);
+ if (NULL == *aead_ctx)
{
ret = PTLS_ERROR_NO_MEMORY;
goto Exit;
@@ -194,9 +193,7 @@ quic_crypto_setup_cipher (quicly_crypto_engine_t * engine,
{
quic_ctx_t *qctx = quic_get_conn_ctx (conn);
if (qctx->ingress_keys.aead_ctx != NULL)
- {
- qctx->key_phase_ingress++;
- }
+ qctx->key_phase_ingress++;
qctx->ingress_keys.aead_ctx = *aead_ctx;
if (hp_ctx != NULL)
@@ -206,7 +203,7 @@ quic_crypto_setup_cipher (quicly_crypto_engine_t * engine,
ret = 0;
Exit:
- if (ret != 0)
+ if (ret)
{
if (*aead_ctx != NULL)
{