mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-18 15:20:56 +03:00
checksrc: verify label indent, fix fallouts
Also update two labels to match the rest of the source. checksrc update credit: Emanuele Torre @emanuele6 Ref: https://github.com/curl/curl/pull/11134 Closes #1042
This commit is contained in:
@@ -75,6 +75,7 @@ my %warnings = (
|
||||
'INCLUDEDUP', => 'same file is included again',
|
||||
'INDENTATION' => 'wrong start column for code',
|
||||
'LONGLINE' => "Line longer than $max_column",
|
||||
'SPACEBEFORELABEL' => 'labels not at the start of the line',
|
||||
'MULTISPACE' => 'multiple spaces used when not suitable',
|
||||
'NOSPACEEQUALS' => 'equals sign without preceding space',
|
||||
'NOTEQUALSZERO', => 'if/while comparison with != 0',
|
||||
@@ -697,6 +698,11 @@ sub scanfile {
|
||||
$line, length($1), $file, $ol, "no space before colon of switch label");
|
||||
}
|
||||
|
||||
if($prevl !~ /\?\z/ && $l =~ /^ +([A-Za-z_][A-Za-z0-9_]*):$/ && $1 ne 'default') {
|
||||
checkwarn("SPACEBEFORELABEL",
|
||||
$line, length($1), $file, $ol, "no space before label");
|
||||
}
|
||||
|
||||
# scan for use of banned functions
|
||||
if($l =~ /^(.*\W)
|
||||
(gmtime|localtime|
|
||||
|
||||
@@ -1486,18 +1486,18 @@ _libssh2_curve25519_new(LIBSSH2_SESSION *session,
|
||||
|
||||
if(EVP_PKEY_keygen_init(pctx) != 1 ||
|
||||
EVP_PKEY_keygen(pctx, &key) != 1) {
|
||||
goto cleanExit;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
if(out_private_key) {
|
||||
privLen = LIBSSH2_ED25519_KEY_LEN;
|
||||
priv = LIBSSH2_ALLOC(session, privLen);
|
||||
if(!priv)
|
||||
goto cleanExit;
|
||||
goto clean_exit;
|
||||
|
||||
if(EVP_PKEY_get_raw_private_key(key, priv, &privLen) != 1 ||
|
||||
privLen != LIBSSH2_ED25519_KEY_LEN) {
|
||||
goto cleanExit;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
*out_private_key = priv;
|
||||
@@ -1508,11 +1508,11 @@ _libssh2_curve25519_new(LIBSSH2_SESSION *session,
|
||||
pubLen = LIBSSH2_ED25519_KEY_LEN;
|
||||
pub = LIBSSH2_ALLOC(session, pubLen);
|
||||
if(!pub)
|
||||
goto cleanExit;
|
||||
goto clean_exit;
|
||||
|
||||
if(EVP_PKEY_get_raw_public_key(key, pub, &pubLen) != 1 ||
|
||||
pubLen != LIBSSH2_ED25519_KEY_LEN) {
|
||||
goto cleanExit;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
*out_public_key = pub;
|
||||
@@ -1522,7 +1522,7 @@ _libssh2_curve25519_new(LIBSSH2_SESSION *session,
|
||||
/* success */
|
||||
rc = 0;
|
||||
|
||||
cleanExit:
|
||||
clean_exit:
|
||||
|
||||
if(pctx)
|
||||
EVP_PKEY_CTX_free(pctx);
|
||||
@@ -3311,32 +3311,32 @@ _libssh2_curve25519_gen_k(_libssh2_bn **k,
|
||||
LIBSSH2_ED25519_KEY_LEN);
|
||||
|
||||
if(!peer_key || !server_key) {
|
||||
goto cleanExit;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
server_key_ctx = EVP_PKEY_CTX_new(server_key, NULL);
|
||||
if(!server_key_ctx) {
|
||||
goto cleanExit;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
rc = EVP_PKEY_derive_init(server_key_ctx);
|
||||
if(rc <= 0) {
|
||||
goto cleanExit;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
rc = EVP_PKEY_derive_set_peer(server_key_ctx, peer_key);
|
||||
if(rc <= 0) {
|
||||
goto cleanExit;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
rc = EVP_PKEY_derive(server_key_ctx, NULL, &out_len);
|
||||
if(rc <= 0) {
|
||||
goto cleanExit;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
if(out_len != LIBSSH2_ED25519_KEY_LEN) {
|
||||
rc = -1;
|
||||
goto cleanExit;
|
||||
goto clean_exit;
|
||||
}
|
||||
|
||||
rc = EVP_PKEY_derive(server_key_ctx, out_shared_key, &out_len);
|
||||
@@ -3348,7 +3348,7 @@ _libssh2_curve25519_gen_k(_libssh2_bn **k,
|
||||
rc = -1;
|
||||
}
|
||||
|
||||
cleanExit:
|
||||
clean_exit:
|
||||
|
||||
if(server_key_ctx)
|
||||
EVP_PKEY_CTX_free(server_key_ctx);
|
||||
|
||||
Reference in New Issue
Block a user