Browse code

Fix compilation in pedantic mode

Replace C++ style comments, which are not allowed in ISO C90 standard,
with C style comments

Signed-off-by: Lev Stipakov <lstipakov@gmail.com>
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1475613736-1529-1-git-send-email-lstipakov@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg12600.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Lev Stipakov authored on 2016/10/05 05:42:16
Showing 4 changed files
... ...
@@ -278,13 +278,13 @@ crypto_init_dmalloc (void)
278 278
 
279 279
 const char *
280 280
 translate_cipher_name_from_openvpn (const char *cipher_name) {
281
-  // OpenSSL doesn't require any translation
281
+  /* OpenSSL doesn't require any translation */
282 282
   return cipher_name;
283 283
 }
284 284
 
285 285
 const char *
286 286
 translate_cipher_name_to_openvpn (const char *cipher_name) {
287
-  // OpenSSL doesn't require any translation
287
+  /* OpenSSL doesn't require any translation */
288 288
   return cipher_name;
289 289
 }
290 290
 
... ...
@@ -267,7 +267,7 @@ tls_get_cipher_name_pair (const char * cipher_name, size_t len) {
267 267
       pair++;
268 268
   }
269 269
 
270
-  // No entry found, return NULL
270
+  /* No entry found, return NULL */
271 271
   return NULL;
272 272
 }
273 273
 
... ...
@@ -294,7 +294,7 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)
294 294
 
295 295
   ASSERT(NULL != ctx);
296 296
 
297
-  // Translate IANA cipher suite names to OpenSSL names
297
+  /* Translate IANA cipher suite names to OpenSSL names */
298 298
   begin_of_cipher = end_of_cipher = 0;
299 299
   for (; begin_of_cipher < strlen(ciphers); begin_of_cipher = end_of_cipher) {
300 300
       end_of_cipher += strcspn(&ciphers[begin_of_cipher], ":");
... ...
@@ -302,31 +302,32 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)
302 302
 
303 303
       if (NULL == cipher_pair)
304 304
         {
305
-          // No translation found, use original
306
-          current_cipher = &ciphers[begin_of_cipher];
307
-          current_cipher_len = end_of_cipher - begin_of_cipher;
308
-
309
-          // Issue warning on missing translation
310
-          // %.*s format specifier expects length of type int, so guarantee
311
-          // that length is small enough and cast to int.
312
-          msg (M_WARN, "No valid translation found for TLS cipher '%.*s'",
313
-              (int) MIN(current_cipher_len, 256), current_cipher);
305
+	  /* No translation found, use original */
306
+	  current_cipher = &ciphers[begin_of_cipher];
307
+	  current_cipher_len = end_of_cipher - begin_of_cipher;
308
+
309
+	  /* Issue warning on missing translation
310
+	   * %.*s format specifier expects length of type int, so guarantee
311
+	   * that length is small enough and cast to int.
312
+	   */
313
+	  msg (M_WARN, "No valid translation found for TLS cipher '%.*s'",
314
+	      (int) MIN(current_cipher_len, 256), current_cipher);
314 315
         }
315 316
       else
316 317
 	{
317
-	  // Use OpenSSL name
318
-          current_cipher = cipher_pair->openssl_name;
319
-          current_cipher_len = strlen(current_cipher);
318
+	  /* Use OpenSSL name */
319
+	  current_cipher = cipher_pair->openssl_name;
320
+	  current_cipher_len = strlen(current_cipher);
320 321
 
321 322
 	  if (end_of_cipher - begin_of_cipher == current_cipher_len &&
322 323
 	      0 == memcmp (&ciphers[begin_of_cipher], cipher_pair->openssl_name, end_of_cipher - begin_of_cipher))
323 324
 	    {
324
-	      // Non-IANA name used, show warning
325
+	      /* Non-IANA name used, show warning */
325 326
 	      msg (M_WARN, "Deprecated TLS cipher name '%s', please use IANA name '%s'", cipher_pair->openssl_name, cipher_pair->iana_name);
326 327
 	    }
327 328
 	}
328 329
 
329
-      // Make sure new cipher name fits in cipher string
330
+      /* Make sure new cipher name fits in cipher string */
330 331
       if (((sizeof(openssl_ciphers)-1) - openssl_ciphers_len) < current_cipher_len)
331 332
 	{
332 333
 	  msg (M_FATAL,
... ...
@@ -334,7 +335,7 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)
334 334
 	      (int)sizeof(openssl_ciphers)-1);
335 335
 	}
336 336
 
337
-      // Concatenate cipher name to OpenSSL cipher string
337
+      /* Concatenate cipher name to OpenSSL cipher string */
338 338
       memcpy(&openssl_ciphers[openssl_ciphers_len], current_cipher, current_cipher_len);
339 339
       openssl_ciphers_len += current_cipher_len;
340 340
       openssl_ciphers[openssl_ciphers_len] = ':';
... ...
@@ -346,7 +347,7 @@ tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers)
346 346
   if (openssl_ciphers_len > 0)
347 347
     openssl_ciphers[openssl_ciphers_len-1] = '\0';
348 348
 
349
-  // Set OpenSSL cipher list
349
+  /* Set OpenSSL cipher list */
350 350
   if(!SSL_CTX_set_cipher_list(ctx->ctx, openssl_ciphers))
351 351
     crypto_msg (M_FATAL, "Failed to set restricted TLS cipher list: %s", openssl_ciphers);
352 352
 }
... ...
@@ -1407,7 +1408,7 @@ show_available_tls_ciphers (const char *cipher_list)
1407 1407
       pair = tls_get_cipher_name_pair(cipher_name, strlen(cipher_name));
1408 1408
 
1409 1409
       if (NULL == pair) {
1410
-          // No translation found, print warning
1410
+          /* No translation found, print warning */
1411 1411
 	  printf ("%s (No IANA name known to OpenVPN, use OpenSSL name.)\n", cipher_name);
1412 1412
       } else {
1413 1413
 	  printf ("%s\n", pair->iana_name);
... ...
@@ -59,7 +59,7 @@ searchandreplace(const char *tosearch, const char *searchfor, const char *replac
59 59
        return NULL;
60 60
   }
61 61
 
62
-  // state: all parameters are valid
62
+  /* state: all parameters are valid */
63 63
 
64 64
   const char *searching=tosearch;
65 65
   char *scratch;