Skip to contentSkip to conversation

ssl.c: use arrow operator to access object member

PATCH In review Antonio Quartulli 2 participants 2 messages Jan 10, 2022 – Jan 14, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ssl.c: use arrow operator to access object member

The arrow operator exists exactly to perform a pointer dereference implicitly while accessing a member.

while at it, add whitespaces around the '-' operator on the same line.

---
 src/openvpn/ssl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/openvpn/ssl.c +2 -2
index 400b2062..ef3597af 100644
@@ -1669,9 +1669,9 @@ init_key_contexts(struct key_ctx_bi *key,
     init_key_ctx_bi(key, key2, key_direction, key_type, "Data Channel");
 
     /* Initialize implicit IVs */
-    key_ctx_update_implicit_iv(&key->encrypt, (*key2).keys[(int)server].hmac,
+    key_ctx_update_implicit_iv(&key->encrypt, key2->keys[(int)server].hmac,
                                MAX_HMAC_KEY_LENGTH);
-    key_ctx_update_implicit_iv(&key->decrypt, (*key2).keys[1-(int)server].hmac,
+    key_ctx_update_implicit_iv(&key->decrypt, key2->keys[1 - (int)server].hmac,
                                MAX_HMAC_KEY_LENGTH);
 
 }
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw

Both is technically doing the same thing, but we use -> notation in most places, so this is more consistent. Client-side tested.

(JFTR, the offending commit is 15d052432, which moved from "structure access" to "pointer access", so going from "key2." to "(*key2)." is understandable...)

Your patch has been applied to the master branch.

commit eb3e849e63e32cc015aa21c4481b232bf69c8976

Author: Antonio Quartulli
Date:   Mon Jan 10 15:45:10 2022 +0100
     ssl.c: use arrow operator to access object member

     Signed-off-by: Antonio Quartulli <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg23521.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering