diff --git a/include/libssh2.h b/include/libssh2.h index b0ca65a4..42aff4b4 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -71,8 +71,7 @@ This 6-digit (24 bits) hexadecimal number does not show pre-release number, and it is always a greater number in a more recent release. It makes - comparisons with greater than and less than work. -*/ + comparisons with greater than and less than work. */ #define LIBSSH2_VERSION_NUM 0x010b01 /* diff --git a/os400/libssh2_config.h b/os400/libssh2_config.h index 5ec5109a..3dfbaa93 100644 --- a/os400/libssh2_config.h +++ b/os400/libssh2_config.h @@ -45,8 +45,8 @@ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP - systems. This function is required for `alloca.c' support on those systems. -*/ + systems. This function is required for `alloca.c' support on those + systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ diff --git a/src/chacha.c b/src/chacha.c index 99e0acc8..392d030f 100644 --- a/src/chacha.c +++ b/src/chacha.c @@ -4,6 +4,8 @@ * Public domain. * Copyright not intended 2024. * + * Source: https://github.com/openssh/openssh-portable/blob/master/chacha.c + * * SPDX-License-Identifier: SAX-PD-2.0 */ diff --git a/src/kex.c b/src/kex.c index 96ebbd8d..d33a15bd 100644 --- a/src/kex.c +++ b/src/kex.c @@ -256,7 +256,7 @@ static int process_host_key(LIBSSH2_SESSION *session, fingerprint)); } #endif /* LIBSSH2DEBUG */ -#endif /* ! LIBSSH2_MD5 */ +#endif /* !LIBSSH2_MD5 */ { ssh2_sha1_ctx fingerprint_ctx; diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index 5e00c88b..975ef51b 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -65,8 +65,7 @@ those names in libssh2.h, so we need to include the AIX headers first, to make sure all code is compiled with consistent names of these fields. While arguable the best would to change libssh2.h to use other names, that - would break backwards compatibility. -*/ + would break backwards compatibility. */ #ifdef HAVE_POLL #include #elif defined(HAVE_SELECT) && defined(HAVE_SYS_SELECT_H) @@ -763,10 +762,10 @@ struct _LIBSSH2_SESSION { /* Whether to use the OpenSSH Strict KEX extension */ int kex_strict; - /* (remote as source of data -- packet_read ) */ + /* (remote as source of data -- packet_read) */ struct endpoint_data remote; - /* (local as source of data -- packet_write ) */ + /* (local as source of data -- packet_write) */ struct endpoint_data local; /* Inbound Data linked list -- Sometimes the packet that comes in is not diff --git a/src/mbedtls.c b/src/mbedtls.c index ea84bf32..68a67540 100644 --- a/src/mbedtls.c +++ b/src/mbedtls.c @@ -328,7 +328,7 @@ static int mbed_bn_random(ssh2_bn *bn, int bits, int top, int bottom) return -1; /* Zero unused bits above the most significant bit */ - for(i = len * 8 - 1; (size_t)bits <= i; --i) { + for(i = (len * 8) - 1; (size_t)bits <= i; --i) { err = mbedtls_mpi_set_bit(bn, i, 0); if(err) return -1; @@ -835,7 +835,7 @@ int ssh2_mbed_dh_key_pair(ssh2_dh_ctx *dhctx, ssh2_bn *pub, ssh2_bn *g, ssh2_bn *p, int group_order) { /* Generate x and e */ - mbed_bn_random(*dhctx, group_order * 8 - 1, 0, -1); + mbed_bn_random(*dhctx, (group_order * 8) - 1, 0, -1); mbedtls_mpi_exp_mod(pub, g, *dhctx, p, NULL); return 0; } diff --git a/src/openssl.c b/src/openssl.c index 4eae75db..eda81bd8 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -435,7 +435,7 @@ int ssh2_rsa_sha1_verify(ssh2_rsa_ctx *rsactx, m_len); } #endif -#endif /* LIBSSH_RSA */ +#endif /* LIBSSH2_RSA */ #if LIBSSH2_DSA int ssh2_dsa_new(ssh2_dsa_ctx **dsactx, @@ -616,7 +616,7 @@ int ssh2_dsa_sha1_verify(ssh2_dsa_ctx *dsactx, return (ret == 1) ? 0 : -1; } -#endif /* LIBSSH_DSA */ +#endif /* LIBSSH2_DSA */ #if LIBSSH2_ECDSA @@ -1698,7 +1698,7 @@ int ssh2_dsa_new_private(ssh2_dsa_ctx **dsa, return rc; } -#endif /* LIBSSH_DSA */ +#endif /* LIBSSH2_DSA */ #if LIBSSH2_ECDSA int ssh2_ecdsa_new_private_frommemory(ssh2_ecdsa_ctx **ec_ctx, @@ -2674,7 +2674,7 @@ int ssh2_dsa_sha1_sign(ssh2_dsa_ctx *dsactx, return 0; } -#endif /* LIBSSH_DSA */ +#endif /* LIBSSH2_DSA */ #if LIBSSH2_ECDSA diff --git a/src/os400qc3.c b/src/os400qc3.c index 690c4387..37ba742c 100644 --- a/src/os400qc3.c +++ b/src/os400qc3.c @@ -1006,7 +1006,6 @@ int ssh2_hmac_ctx_init(ssh2_hmac_ctx *ctx) #if LIBSSH2_MD5 int ssh2_hmac_md5_init(ssh2_hmac_ctx *ctx, void *key, size_t keylen) - void *key, size_t keylen) { return os400qc3_hmac_init(ctx, Qc3_MD5, SSH2_MD5_DIG_LEN, key, keylen); diff --git a/src/publickey.c b/src/publickey.c index 3a6dd116..c534a4a8 100644 --- a/src/publickey.c +++ b/src/publickey.c @@ -755,7 +755,7 @@ int libssh2_publickey_remove_ex(LIBSSH2_PUBLICKEY *pkey, } /* - * Fetch a list of supported public key from a server + * Fetch a list of supported public keys from a server */ int libssh2_publickey_list_fetch(LIBSSH2_PUBLICKEY *pkey, unsigned long *num_keys, diff --git a/src/scp.c b/src/scp.c index 2557b711..0ff158d2 100644 --- a/src/scp.c +++ b/src/scp.c @@ -56,80 +56,79 @@ /* Max. length of a quoted string after shell_quotearg() processing */ #define shell_quotedsize(s) (3 * strlen(s) + 2) -/* - This function quotes a string in a way suitable to be used with a - shell, e.g. the filename - one two - becomes - 'one two' +/* This function quotes a string in a way suitable to be used with a + shell, e.g. the filename + one two + becomes + 'one two' - The resulting output string is crafted in a way that makes it usable - with the two most common shell types: Bourne Shell derived shells - (sh, ksh, ksh93, bash, zsh) and C-Shell derivates (csh, tcsh). + The resulting output string is crafted in a way that makes it usable + with the two most common shell types: Bourne Shell derived shells + (sh, ksh, ksh93, bash, zsh) and C-Shell derivates (csh, tcsh). - The following special cases are handled: - o If the string contains an apostrophy itself, the apostrophy - character is written in quotation marks, e.g. "'". - The shell cannot handle the syntax 'doesn\'t', so we close the - current argument word, add the apostrophe in quotation marks "", - and open a new argument word instead (_ indicate the input - string characters): - _____ _ _ - 'doesn' "'" 't' + The following special cases are handled: + o If the string contains an apostrophy itself, the apostrophy + character is written in quotation marks, e.g. "'". + The shell cannot handle the syntax 'doesn\'t', so we close the + current argument word, add the apostrophe in quotation marks "", + and open a new argument word instead (_ indicate the input + string characters): + _____ _ _ + 'doesn' "'" 't' - Sequences of apostrophes are combined in one pair of quotation marks: - a'''b - becomes - _ ___ _ - 'a'"'''"'b' + Sequences of apostrophes are combined in one pair of quotation marks: + a'''b + becomes + _ ___ _ + 'a'"'''"'b' - o If the string contains an exclamation mark (!), the C-Shell - interprets it as an event number. Using \! (not within quotation - marks or single quotation marks) is a mechanism understood by - both Bourne Shell and C-Shell. + o If the string contains an exclamation mark (!), the C-Shell + interprets it as an event number. Using \! (not within quotation + marks or single quotation marks) is a mechanism understood by + both Bourne Shell and C-Shell. - If a quotation was already started, the argument word is closed - first: - a!b + If a quotation was already started, the argument word is closed + first: + a!b - become - _ _ _ - 'a'\!'b' + become + _ _ _ + 'a'\!'b' - The result buffer must be large enough for the expanded result. A - bad case regarding expansion is alternating characters and - apostrophes: + The result buffer must be large enough for the expanded result. A + bad case regarding expansion is alternating characters and + apostrophes: - a'b'c'd' (length 8) gets converted to - 'a'"'"'b'"'"'c'"'"'d'"'" (length 24) + a'b'c'd' (length 8) gets converted to + 'a'"'"'b'"'"'c'"'"'d'"'" (length 24) - This is the worst case. + This is the worst case. - Maximum length of the result: - 1 + 6 * (length(input) + 1) / 2) + 1 + Maximum length of the result: + 1 + 6 * (length(input) + 1) / 2) + 1 - => 3 * length(input) + 2 + => 3 * length(input) + 2 - Explanation: - o leading apostrophe - o one character / apostrophe pair (two characters) can get - represented as 6 characters: a' -> a'"'"' - o String terminator (+1) + Explanation: + o leading apostrophe + o one character / apostrophe pair (two characters) can get + represented as 6 characters: a' -> a'"'"' + o String terminator (+1) - A result buffer three times the size of the input buffer + 2 - characters should be safe. + A result buffer three times the size of the input buffer + 2 + characters should be safe. - References: - o csh-compatible quotation (special handling for '!' etc.), see - https://www.grymoire.com/Unix/Csh.html#toc-uh-10 + References: + o csh-compatible quotation (special handling for '!' etc.), see + https://www.grymoire.com/Unix/Csh.html#toc-uh-10 - Return value: - Length of the resulting string (not counting the null-terminator), - or 0 in case of errors, e.g. result buffer too small + Return value: + Length of the resulting string (not counting the null-terminator), + or 0 in case of errors, e.g. result buffer too small - Note: this function could possible be used elsewhere within libssh2, but - until then it is kept static and in this source file. -*/ + Note: this function could possible be used elsewhere within libssh2, but + until then it is kept static and in this source file. + */ static size_t shell_quotearg(const char *path, unsigned char *buf, size_t bufsize) { diff --git a/src/session.h b/src/session.h index 01389a51..be885277 100644 --- a/src/session.h +++ b/src/session.h @@ -49,9 +49,7 @@ The point being to make sure that while in non-blocking mode these always return no matter what the return code is, but in blocking mode it blocks - if EAGAIN is the reason for the return from the underlying function. - -*/ + if EAGAIN is the reason for the return from the underlying function. */ #define BLOCK_ADJUST(rc, sess, x) \ do { \ time_t entry_time = time(NULL); \ diff --git a/src/wincng.c b/src/wincng.c index 102f898f..676854e3 100644 --- a/src/wincng.c +++ b/src/wincng.c @@ -980,7 +980,7 @@ static int wcng_load_private(LIBSSH2_SESSION *session, PEM_RSA_HEADER, PEM_RSA_FOOTER, &data, &datalen); #else - (void)tryLoadRSA; + (void)tryLoadRSA; #endif #if LIBSSH2_DSA @@ -989,7 +989,7 @@ static int wcng_load_private(LIBSSH2_SESSION *session, PEM_DSA_HEADER, PEM_DSA_FOOTER, &data, &datalen); #else - (void)tryLoadDSA; + (void)tryLoadDSA; #endif if(!ret) { @@ -1019,7 +1019,7 @@ static int wcng_load_private_memory(LIBSSH2_SESSION *session, privatekeydata, privatekeydata_len, &data, &datalen); #else - (void)tryLoadRSA; + (void)tryLoadRSA; #endif #if LIBSSH2_DSA diff --git a/tests/openssh_fixture.c b/tests/openssh_fixture.c index 3a6cd9e0..464b73b8 100644 --- a/tests/openssh_fixture.c +++ b/tests/openssh_fixture.c @@ -111,7 +111,7 @@ static int run_command_varg(char **output, const char *command, va_list args) return -1; } - /* Rewrite the command to redirect stderr to stdout to we can output it */ + /* Rewrite the command to redirect stderr to stdout so we can output it */ if(strlen(command_buf) + strlen(redirect_stderr) >= sizeof(buf)) { fprintf(stderr, "Unable to rewrite command (%s)\n", command); return -1; diff --git a/vms/man2help.c b/vms/man2help.c index b7085e71..6bcc008c 100644 --- a/vms/man2help.c +++ b/vms/man2help.c @@ -38,10 +38,9 @@ static void fpcopy(char *output, char *input, int size) } /*----------------------------------------------------------*/ -/* give part of filename in partname. See code for proper - value of i ( 0 = node, 1 = dev, 2 = dir, 3 = name etc. -*/ +/* give part of filename in partname. See code for proper + value of i ( 0 = node, 1 = dev, 2 = dir, 3 = name etc. */ static int fnamepart(char *inputfile, char *part, int whatpart) { struct pf_fabnam *pf;