Attention is currently required from: Arne Schwabe.

Hello Arne Schwabe,

I'd like you to do a code review.
Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2166?usp=email

to review the following change.


Change subject: httpdigest: replace IN/OUT macros with plain const
......................................................................

httpdigest: replace IN/OUT macros with plain const

httpdigest.h defines IN as const, and never undefines it. This leaks
into the pkcs11-helper headers that proxy.c includes later on, which
use IN/OUT as empty annotations and only define them if not defined
yet. That changes the pkcs11-helper declarations proxy.c sees ('IN
void * const' becomes 'const void * const'), and makes clang spit out
over a hundred -Wduplicate-decl-specifier warnings.

Just use const where we used IN, and drop OUT. No functional change.

Change-Id: I2490a0780a6e7c98a270e97b415b0387093d37be
Signed-off-by: Steffan Karger <[email protected]>
---
M src/openvpn/httpdigest.c
M src/openvpn/httpdigest.h
2 files changed, 23 insertions(+), 27 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/66/2166/1

diff --git a/src/openvpn/httpdigest.c b/src/openvpn/httpdigest.c
index 52df383..9bfa074 100644
--- a/src/openvpn/httpdigest.c
+++ b/src/openvpn/httpdigest.c
@@ -32,7 +32,7 @@
 #include "httpdigest.h"

 static void
-CvtHex(IN HASH Bin, OUT HASHHEX Hex)
+CvtHex(const HASH Bin, HASHHEX Hex)
 {
     for (unsigned short i = 0; i < HASHLEN; i++)
     {
@@ -60,8 +60,8 @@
 
 /* calculate H(A1) as per spec */
 void
-DigestCalcHA1(IN char *pszAlg, IN char *pszUserName, IN char *pszRealm, IN 
char *pszPassword,
-              IN char *pszNonce, IN char *pszCNonce, OUT HASHHEX SessionKey)
+DigestCalcHA1(const char *pszAlg, const char *pszUserName, const char 
*pszRealm, const char *pszPassword,
+              const char *pszNonce, const char *pszCNonce, HASHHEX SessionKey)
 {
     HASH HA1;
     md_ctx_t *md5_ctx = md_ctx_new();
@@ -90,15 +90,15 @@

 /* calculate request-digest/response-digest as per HTTP Digest spec */
 void
-DigestCalcResponse(IN HASHHEX HA1,         /* H(A1) */
-                   IN char *pszNonce,      /* nonce from server */
-                   IN char *pszNonceCount, /* 8 hex digits */
-                   IN char *pszCNonce,     /* client nonce */
-                   IN char *pszQop,        /* qop-value: "", "auth", 
"auth-int" */
-                   IN char *pszMethod,     /* method from the request */
-                   IN char *pszDigestUri,  /* requested URL */
-                   IN HASHHEX HEntity,     /* H(entity body) if qop="auth-int" 
*/
-                   OUT HASHHEX Response    /* request-digest or 
response-digest */
+DigestCalcResponse(const HASHHEX HA1,         /* H(A1) */
+                   const char *pszNonce,      /* nonce from server */
+                   const char *pszNonceCount, /* 8 hex digits */
+                   const char *pszCNonce,     /* client nonce */
+                   const char *pszQop,        /* qop-value: "", "auth", 
"auth-int" */
+                   const char *pszMethod,     /* method from the request */
+                   const char *pszDigestUri,  /* requested URL */
+                   const HASHHEX HEntity,     /* H(entity body) if 
qop="auth-int" */
+                   HASHHEX Response           /* request-digest or 
response-digest */
 )
 {
     HASH HA2;
diff --git a/src/openvpn/httpdigest.h b/src/openvpn/httpdigest.h
index 9f3b075..37f3d98 100644
--- a/src/openvpn/httpdigest.h
+++ b/src/openvpn/httpdigest.h
@@ -26,25 +26,21 @@
 typedef unsigned char HASH[HASHLEN];
 #define HASHHEXLEN 32
 typedef unsigned char HASHHEX[HASHHEXLEN + 1];
-#undef IN
-#undef OUT
-#define IN const
-#define OUT

 /* calculate H(A1) as per HTTP Digest spec */
-void DigestCalcHA1(IN char *pszAlg, IN char *pszUserName, IN char *pszRealm, 
IN char *pszPassword,
-                   IN char *pszNonce, IN char *pszCNonce, OUT HASHHEX 
SessionKey);
+void DigestCalcHA1(const char *pszAlg, const char *pszUserName, const char 
*pszRealm, const char *pszPassword,
+                   const char *pszNonce, const char *pszCNonce, HASHHEX 
SessionKey);

 /* calculate request-digest/response-digest as per HTTP Digest spec */
-void DigestCalcResponse(IN HASHHEX HA1,         /* H(A1) */
-                        IN char *pszNonce,      /* nonce from server */
-                        IN char *pszNonceCount, /* 8 hex digits */
-                        IN char *pszCNonce,     /* client nonce */
-                        IN char *pszQop,        /* qop-value: "", "auth", 
"auth-int" */
-                        IN char *pszMethod,     /* method from the request */
-                        IN char *pszDigestUri,  /* requested URL */
-                        IN HASHHEX HEntity,     /* H(entity body) if 
qop="auth-int" */
-                        OUT HASHHEX Response    /* request-digest or 
response-digest */
+void DigestCalcResponse(const HASHHEX HA1,         /* H(A1) */
+                        const char *pszNonce,      /* nonce from server */
+                        const char *pszNonceCount, /* 8 hex digits */
+                        const char *pszCNonce,     /* client nonce */
+                        const char *pszQop,        /* qop-value: "", "auth", 
"auth-int" */
+                        const char *pszMethod,     /* method from the request 
*/
+                        const char *pszDigestUri,  /* requested URL */
+                        const HASHHEX HEntity,     /* H(entity body) if 
qop="auth-int" */
+                        HASHHEX Response           /* request-digest or 
response-digest */
 );

 #endif /* if PROXY_DIGEST_AUTH */

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2166?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2490a0780a6e7c98a270e97b415b0387093d37be
Gerrit-Change-Number: 2166
Gerrit-PatchSet: 1
Gerrit-Owner: Steffan Karger <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to