diff src/blowfish.c @ 18757:c469e1930456 v8.1.2368

patch 8.1.2368: using old C style comments Commit: https://github.com/vim/vim/commit/c667da5185ce5dce914d2006d62da2be0cedb384 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 30 20:52:27 2019 +0100 patch 8.1.2368: using old C style comments Problem: Using old C style comments. Solution: Use // comments where appropriate.
author Bram Moolenaar <Bram@vim.org>
date Sat, 30 Nov 2019 21:00:04 +0100
parents ce04ebdf26b8
children 73f893d8776a
line wrap: on
line diff
--- a/src/blowfish.c
+++ b/src/blowfish.c
@@ -35,28 +35,28 @@ typedef union {
 } block8;
 
 #if defined(MSWIN)
-  /* MS-Windows is always little endian */
+  // MS-Windows is always little endian
 #else
 # ifdef HAVE_CONFIG_H
-   /* in configure.ac AC_C_BIGENDIAN() defines WORDS_BIGENDIAN when needed */
+   // in configure.ac AC_C_BIGENDIAN() defines WORDS_BIGENDIAN when needed
 # else
    error!
    Please change this code to define WORDS_BIGENDIAN for big-endian machines.
 # endif
 #endif
 
-/* The state of encryption, referenced by cryptstate_T. */
+// The state of encryption, referenced by cryptstate_T.
 typedef struct {
-    UINT32_T	pax[18];	    /* P-array */
-    UINT32_T	sbx[4][256];	    /* S-boxes */
+    UINT32_T	pax[18];	    // P-array
+    UINT32_T	sbx[4][256];	    // S-boxes
     int		randbyte_offset;
     int		update_offset;
-    char_u	cfb_buffer[BF_MAX_CFB_LEN]; /* up to 64 bytes used */
-    int		cfb_len;	    /* size of cfb_buffer actually used */
+    char_u	cfb_buffer[BF_MAX_CFB_LEN]; // up to 64 bytes used
+    int		cfb_len;	    // size of cfb_buffer actually used
 } bf_state_T;
 
 
-/* Blowfish code */
+// Blowfish code
 static UINT32_T pax_init[18] = {
     0x243f6a88u, 0x85a308d3u, 0x13198a2eu,
     0x03707344u, 0xa4093822u, 0x299f31d0u,
@@ -409,13 +409,13 @@ bf_key_init(
     char_u   *key;
     int      keylen;
 
-    /* Process the key 1001 times.
-     * See http://en.wikipedia.org/wiki/Key_strengthening. */
+    // Process the key 1001 times.
+    // See http://en.wikipedia.org/wiki/Key_strengthening.
     key = sha256_key(password, salt, salt_len);
     for (i = 0; i < 1000; i++)
 	key = sha256_key(key, salt, salt_len);
 
-    /* Convert the key from 64 hex chars to 32 binary chars. */
+    // Convert the key from 64 hex chars to 32 binary chars.
     keylen = (int)STRLEN(key) / 2;
     if (keylen == 0)
     {
@@ -428,8 +428,8 @@ bf_key_init(
 	key[i] = u;
     }
 
-    /* Use "key" to initialize the P-array ("pax") and S-boxes ("sbx") of
-     * Blowfish. */
+    // Use "key" to initialize the P-array ("pax") and S-boxes ("sbx") of
+    // Blowfish.
     mch_memmove(bfs->sbx, sbx_init, 4 * 4 * 256);
 
     for (i = 0; i < 18; ++i)
@@ -484,7 +484,7 @@ typedef struct {
     char_u   salt[9];
     char_u   plaintxt[9];
     char_u   cryptxt[9];
-    char_u   badcryptxt[9]; /* cryptxt when big/little endian is wrong */
+    char_u   badcryptxt[9]; // cryptxt when big/little endian is wrong
     UINT32_T keysum;
 } struct_bf_test_data;
 
@@ -497,9 +497,9 @@ static struct_bf_test_data bf_test_data[
       "password",
       "salt",
       "plaintxt",
-      "\xad\x3d\xfa\x7f\xe8\xea\x40\xf6", /* cryptxt */
-      "\x72\x50\x3b\x38\x10\x60\x22\xa7", /* badcryptxt */
-      0x56701b5du /* keysum */
+      "\xad\x3d\xfa\x7f\xe8\xea\x40\xf6", // cryptxt
+      "\x72\x50\x3b\x38\x10\x60\x22\xa7", // badcryptxt
+      0x56701b5du // keysum
   },
 };
 
@@ -518,8 +518,8 @@ bf_self_test(void)
     vim_memset(&state, 0, sizeof(bf_state_T));
     state.cfb_len = BF_MAX_CFB_LEN;
 
-    /* We can't simply use sizeof(UINT32_T), it would generate a compiler
-     * warning. */
+    // We can't simply use sizeof(UINT32_T), it would generate a compiler
+    // warning.
     if (ui != 0xffffffffUL || ui + 1 != 0) {
 	err++;
 	emsg(_("E820: sizeof(uint32_t) != 4"));
@@ -537,7 +537,7 @@ bf_self_test(void)
 	if (!bf_check_tables(state.pax, state.sbx, bf_test_data[i].keysum))
 	    err++;
 
-	/* Don't modify bf_test_data[i].plaintxt, self test is idempotent. */
+	// Don't modify bf_test_data[i].plaintxt, self test is idempotent.
 	memcpy(bk.uc, bf_test_data[i].plaintxt, 8);
 	bf_e_cblock(&state, bk.uc);
 	if (memcmp(bk.uc, bf_test_data[i].cryptxt, 8) != 0)
@@ -651,8 +651,8 @@ crypt_blowfish_init(
 	return FAIL;
     state->method_state = bfs;
 
-    /* "blowfish" uses a 64 byte buffer, causing it to repeat 8 byte groups 8
-     * times.  "blowfish2" uses a 8 byte buffer to avoid repeating. */
+    // "blowfish" uses a 64 byte buffer, causing it to repeat 8 byte groups 8
+    // times.  "blowfish2" uses a 8 byte buffer to avoid repeating.
     bfs->cfb_len = state->method_nr == CRYPT_M_BF ? BF_MAX_CFB_LEN : BF_BLOCK;
 
     if (blowfish_self_test() == FAIL)
@@ -684,4 +684,4 @@ blowfish_self_test(void)
     return OK;
 }
 
-#endif /* FEAT_CRYPT */
+#endif // FEAT_CRYPT