summaryrefslogtreecommitdiffstats
path: root/src/blowfish.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-30 20:52:27 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-30 20:52:27 +0100
commitc667da5185ce5dce914d2006d62da2be0cedb384 (patch)
treecd06b08e9fb7d701653850cd33524d3f1f5acaaf /src/blowfish.c
parent71136db1bfbc67c2e55f8070cdf0a241c643e45b (diff)
patch 8.1.2368: using old C style commentsv8.1.2368
Problem: Using old C style comments. Solution: Use // comments where appropriate.
Diffstat (limited to 'src/blowfish.c')
-rw-r--r--src/blowfish.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/blowfish.c b/src/blowfish.c
index 65f89327ed..a73b3b6c55 100644
--- 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