[Openvpn-devel,v1] Improve auth token related comments

Message ID 20260916203425.21448-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v1] Improve auth token related comments |

Commit Message

Gert Doering Sept. 16, 2026, 8:34 p.m. UTC
  From: Arne Schwabe <arne@rfc2549.org>

Change-Id: Ibf7238bade2aed81ac7fe4fda2af58e091dc8cd0
Signed-off-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Razvan Cojocaru <razvanc@mailbox.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1918
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1918
This mail reflects revision 1 of this Change.

Signed-off-by line for the author was added as per our policy.

Acked-by according to Gerrit (reflected above):
Razvan Cojocaru <razvanc@mailbox.org>
  

Patch

diff --git a/src/openvpn/auth_token.c b/src/openvpn/auth_token.c
index f928a41..b457b6f 100644
--- a/src/openvpn/auth_token.c
+++ b/src/openvpn/auth_token.c
@@ -22,7 +22,7 @@ 
 #define AUTH_TOKEN_SESSION_ID_BASE64_LEN (OPENVPN_BASE64_LENGTH(AUTH_TOKEN_SESSION_ID_LEN))
 
 /* We want our token to be a multiple of 3 bytes to avoid the base64 padding */
-static_assert(AUTH_TOKEN_SESSION_ID_LEN % 3 == 0, "AUTH_TOKEN_SESSION_ID_LEN needs to be multiple a 3");
+static_assert(AUTH_TOKEN_SESSION_ID_LEN % 3 == 0, "AUTH_TOKEN_SESSION_ID_LEN must be multiple of 3");
 
 #define AUTH_TOKEN_HMAC_LEN   SHA256_DIGEST_LENGTH
 /* Size of the data of the token (not b64 encoded and without prefix) */
@@ -34,7 +34,7 @@ 
 
 /* Ensure that TOKEN_DATA_LEN is a multiple of 3 so the we avoid the base64
  * padding */
-static_assert(TOKEN_DATA_LEN % 3 == 0, "TOKEN_DATA_BASE64_LEN is not a multiple of 3");
+static_assert(TOKEN_DATA_LEN % 3 == 0, "TOKEN_DATA_LEN is not a multiple of 3");
 
 bool
 is_auth_token(const char *password)
diff --git a/src/openvpn/auth_token.h b/src/openvpn/auth_token.h
index fd8317d..62ac012 100644
--- a/src/openvpn/auth_token.h
+++ b/src/openvpn/auth_token.h
@@ -109,16 +109,14 @@ 
 #define SESSION_ID_PREFIX "SESS_ID_AT_"
 
 /**
- * Return if the password string has the format of a password.
+ * Return if the password string has the format of an auth token.
  *
- * This function will always read as many bytes as SESSION_ID_PREFIX is longer
- * the caller needs ensure that password memory is at least that long (true for
- * calling with struct user_pass)
  * @param password
  * @return whether the password string starts with the session token prefix
  */
 bool
 is_auth_token(const char *password);
+
 /**
  * Checks if a client should be sent a new auth token to update its
  * current auth-token