diff options
author | Anderson Toshiyuki Sasaki <ansasaki@redhat.com> | 2019-07-29 17:40:35 +0200 |
---|---|---|
committer | Jakub Jelen <jjelen@redhat.com> | 2019-08-08 09:44:18 +0200 |
commit | b2e7ef6836bea23b283f377f8630f5d49db385f9 (patch) | |
tree | 92ad35fe17b757f4a59a6a6682f8a49e059115cc | |
parent | 651fea9f1408c759619f21d0966bcbe8b1e33f88 (diff) | |
download | libssh-b2e7ef6836bea23b283f377f8630f5d49db385f9.tar.gz libssh-b2e7ef6836bea23b283f377f8630f5d49db385f9.tar.xz libssh-b2e7ef6836bea23b283f377f8630f5d49db385f9.zip |
Replace ssh_print_hexa() with ssh_log_hexdump()
Replace all occurrences of the deprecated function ssh_print_hexa() with
the introduced ssh_log_hexdump().
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 68baebbd6222995ca5aceac1d9dac53fe0b8a7c0)
-rw-r--r-- | src/chachapoly.c | 14 | ||||
-rw-r--r-- | src/curve25519.c | 4 | ||||
-rw-r--r-- | src/dh_key.c | 4 | ||||
-rw-r--r-- | src/ecdh_crypto.c | 4 | ||||
-rw-r--r-- | src/ecdh_gcrypt.c | 4 | ||||
-rw-r--r-- | src/kex.c | 20 | ||||
-rw-r--r-- | src/packet_crypt.c | 10 | ||||
-rw-r--r-- | src/pki.c | 32 | ||||
-rw-r--r-- | src/pki_crypto.c | 12 | ||||
-rw-r--r-- | src/pki_gcrypt.c | 8 | ||||
-rw-r--r-- | src/pki_mbedcrypto.c | 6 |
11 files changed, 59 insertions, 59 deletions
diff --git a/src/chachapoly.c b/src/chachapoly.c index caa694cb..820e7f6e 100644 --- a/src/chachapoly.c +++ b/src/chachapoly.c @@ -109,11 +109,11 @@ static void chacha20_poly1305_aead_encrypt(struct ssh_cipher_struct *cipher, out_packet->payload, len - sizeof(uint32_t)); - /* ssh_print_hexa("poly1305_ctx", poly1305_ctx, sizeof(poly1305_ctx)); */ + /* ssh_log_hexdump("poly1305_ctx", poly1305_ctx, sizeof(poly1305_ctx)); */ /* step 4, compute the MAC */ poly1305_auth(tag, (uint8_t *)out_packet, len, poly1305_ctx); - /* ssh_print_hexa("poly1305 src", (uint8_t *)out_packet, len); - ssh_print_hexa("poly1305 tag", tag, POLY1305_TAGLEN); */ + /* ssh_log_hexdump("poly1305 src", (uint8_t *)out_packet, len); + ssh_log_hexdump("poly1305 tag", tag, POLY1305_TAGLEN); */ } static int chacha20_poly1305_aead_decrypt_length( @@ -159,17 +159,17 @@ static int chacha20_poly1305_aead_decrypt(struct ssh_cipher_struct *cipher, poly1305_ctx, POLY1305_KEYLEN); #if 0 - ssh_print_hexa("poly1305_ctx", poly1305_ctx, sizeof(poly1305_ctx)); + ssh_log_hexdump("poly1305_ctx", poly1305_ctx, sizeof(poly1305_ctx)); #endif poly1305_auth(tag, (uint8_t *)complete_packet, encrypted_size + sizeof(uint32_t), poly1305_ctx); #if 0 - ssh_print_hexa("poly1305 src", + ssh_log_hexdump("poly1305 src", (uint8_t*)complete_packet, encrypted_size + 4); - ssh_print_hexa("poly1305 tag", tag, POLY1305_TAGLEN); - ssh_print_hexa("received tag", mac, POLY1305_TAGLEN); + ssh_log_hexdump("poly1305 tag", tag, POLY1305_TAGLEN); + ssh_log_hexdump("received tag", mac, POLY1305_TAGLEN); #endif cmp = memcmp(tag, mac, POLY1305_TAGLEN); diff --git a/src/curve25519.c b/src/curve25519.c index 92f603dd..cf7c2dc0 100644 --- a/src/curve25519.c +++ b/src/curve25519.c @@ -101,9 +101,9 @@ static int ssh_curve25519_build_k(ssh_session session) { } #ifdef DEBUG_CRYPTO - ssh_print_hexa("Session server cookie", + ssh_log_hexdump("Session server cookie", session->next_crypto->server_kex.cookie, 16); - ssh_print_hexa("Session client cookie", + ssh_log_hexdump("Session client cookie", session->next_crypto->client_kex.cookie, 16); ssh_print_bignum("Shared secret key", session->next_crypto->shared_secret); #endif diff --git a/src/dh_key.c b/src/dh_key.c index cc69dfe7..32c4af2e 100644 --- a/src/dh_key.c +++ b/src/dh_key.c @@ -277,9 +277,9 @@ static void ssh_dh_debug(ssh_session session) ssh_print_bignum("e", e); ssh_print_bignum("f", f); - ssh_print_hexa("Session server cookie", + ssh_log_hexdump("Session server cookie", session->next_crypto->server_kex.cookie, 16); - ssh_print_hexa("Session client cookie", + ssh_log_hexdump("Session client cookie", session->next_crypto->client_kex.cookie, 16); ssh_print_bignum("k", session->next_crypto->shared_secret); } diff --git a/src/ecdh_crypto.c b/src/ecdh_crypto.c index 86e4551c..9bdfe310 100644 --- a/src/ecdh_crypto.c +++ b/src/ecdh_crypto.c @@ -181,9 +181,9 @@ int ecdh_build_k(ssh_session session) { session->next_crypto->ecdh_privkey = NULL; #ifdef DEBUG_CRYPTO - ssh_print_hexa("Session server cookie", + ssh_log_hexdump("Session server cookie", session->next_crypto->server_kex.cookie, 16); - ssh_print_hexa("Session client cookie", + ssh_log_hexdump("Session client cookie", session->next_crypto->client_kex.cookie, 16); ssh_print_bignum("Shared secret key", session->next_crypto->shared_secret); #endif diff --git a/src/ecdh_gcrypt.c b/src/ecdh_gcrypt.c index 473846b8..3c3fe8f0 100644 --- a/src/ecdh_gcrypt.c +++ b/src/ecdh_gcrypt.c @@ -242,9 +242,9 @@ int ecdh_build_k(ssh_session session) session->next_crypto->ecdh_privkey = NULL; #ifdef DEBUG_CRYPTO - ssh_print_hexa("Session server cookie", + ssh_log_hexdump("Session server cookie", session->next_crypto->server_kex.cookie, 16); - ssh_print_hexa("Session client cookie", + ssh_log_hexdump("Session client cookie", session->next_crypto->client_kex.cookie, 16); ssh_print_bignum("Shared secret key", session->next_crypto->shared_secret); #endif @@ -547,7 +547,7 @@ void ssh_list_kex(struct ssh_kex_struct *kex) { int i = 0; #ifdef DEBUG_CRYPTO - ssh_print_hexa("session cookie", kex->cookie, 16); + ssh_log_hexdump("session cookie", kex->cookie, 16); #endif for(i = 0; i < SSH_KEX_METHODS; i++) { @@ -1119,7 +1119,7 @@ int ssh_make_sessionid(ssh_session session) } #ifdef DEBUG_CRYPTO - ssh_print_hexa("hash buffer", ssh_buffer_get(buf), ssh_buffer_get_len(buf)); + ssh_log_hexdump("hash buffer", ssh_buffer_get(buf), ssh_buffer_get_len(buf)); #endif switch (session->next_crypto->kex_type) { @@ -1195,8 +1195,8 @@ int ssh_make_sessionid(ssh_session session) } #ifdef DEBUG_CRYPTO printf("Session hash: \n"); - ssh_print_hexa("secret hash", session->next_crypto->secret_hash, session->next_crypto->digest_len); - ssh_print_hexa("session id", session->next_crypto->session_id, session->next_crypto->digest_len); + ssh_log_hexdump("secret hash", session->next_crypto->secret_hash, session->next_crypto->digest_len); + ssh_log_hexdump("session id", session->next_crypto->session_id, session->next_crypto->digest_len); #endif rc = SSH_OK; @@ -1383,15 +1383,15 @@ int ssh_generate_session_keys(ssh_session session) } #ifdef DEBUG_CRYPTO - ssh_print_hexa("Client to Server IV", IV_cli_to_srv, IV_len); - ssh_print_hexa("Server to Client IV", IV_srv_to_cli, IV_len); - ssh_print_hexa("Client to Server Encryption Key", enckey_cli_to_srv, + ssh_log_hexdump("Client to Server IV", IV_cli_to_srv, IV_len); + ssh_log_hexdump("Server to Client IV", IV_srv_to_cli, IV_len); + ssh_log_hexdump("Client to Server Encryption Key", enckey_cli_to_srv, enckey_cli_to_srv_len); - ssh_print_hexa("Server to Client Encryption Key", enckey_srv_to_cli, + ssh_log_hexdump("Server to Client Encryption Key", enckey_srv_to_cli, enckey_srv_to_cli_len); - ssh_print_hexa("Client to Server Integrity Key", intkey_cli_to_srv, + ssh_log_hexdump("Client to Server Integrity Key", intkey_cli_to_srv, intkey_cli_to_srv_len); - ssh_print_hexa("Server to Client Integrity Key", intkey_srv_to_cli, + ssh_log_hexdump("Server to Client Integrity Key", intkey_srv_to_cli, intkey_srv_to_cli_len); #endif diff --git a/src/packet_crypt.c b/src/packet_crypt.c index 2ed097ad..e31ab432 100644 --- a/src/packet_crypt.c +++ b/src/packet_crypt.c @@ -196,11 +196,11 @@ unsigned char *ssh_packet_encrypt(ssh_session session, void *data, uint32_t len) hmac_final(ctx, crypto->hmacbuf, &finallen); } #ifdef DEBUG_CRYPTO - ssh_print_hexa("mac: ",data,hmac_digest_len(type)); + ssh_log_hexdump("mac: ",data,hmac_digest_len(type)); if (finallen != hmac_digest_len(type)) { printf("Final len is %d\n",finallen); } - ssh_print_hexa("Packet hmac", crypto->hmacbuf, hmac_digest_len(type)); + ssh_log_hexdump("Packet hmac", crypto->hmacbuf, hmac_digest_len(type)); #endif } explicit_bzero(out, len); @@ -264,9 +264,9 @@ int ssh_packet_hmac_verify(ssh_session session, hmac_final(ctx, hmacbuf, &hmaclen); #ifdef DEBUG_CRYPTO - ssh_print_hexa("received mac",mac,hmaclen); - ssh_print_hexa("Computed mac",hmacbuf,hmaclen); - ssh_print_hexa("seq",(unsigned char *)&seq,sizeof(uint32_t)); + ssh_log_hexdump("received mac",mac,hmaclen); + ssh_log_hexdump("Computed mac",hmacbuf,hmaclen); + ssh_log_hexdump("seq",(unsigned char *)&seq,sizeof(uint32_t)); #endif if (secure_memcmp(mac, hmacbuf, hmaclen) == 0) { return 0; @@ -1064,12 +1064,12 @@ int pki_import_privkey_buffer(enum ssh_keytypes_e type, rc = pki_privkey_build_dss(key, p, q, g, pubkey, privkey); #ifdef DEBUG_CRYPTO - ssh_print_hexa("p", ssh_string_data(p), ssh_string_len(p)); - ssh_print_hexa("q", ssh_string_data(q), ssh_string_len(q)); - ssh_print_hexa("g", ssh_string_data(g), ssh_string_len(g)); - ssh_print_hexa("pubkey", ssh_string_data(pubkey), + ssh_log_hexdump("p", ssh_string_data(p), ssh_string_len(p)); + ssh_log_hexdump("q", ssh_string_data(q), ssh_string_len(q)); + ssh_log_hexdump("g", ssh_string_data(g), ssh_string_len(g)); + ssh_log_hexdump("pubkey", ssh_string_data(pubkey), ssh_string_len(pubkey)); - ssh_print_hexa("privkey", ssh_string_data(privkey), + ssh_log_hexdump("privkey", ssh_string_data(privkey), ssh_string_len(privkey)); #endif ssh_string_burn(p); @@ -1105,13 +1105,13 @@ int pki_import_privkey_buffer(enum ssh_keytypes_e type, rc = pki_privkey_build_rsa(key, n, e, d, iqmp, p, q); #ifdef DEBUG_CRYPTO - ssh_print_hexa("n", ssh_string_data(n), ssh_string_len(n)); - ssh_print_hexa("e", ssh_string_data(e), ssh_string_len(e)); - ssh_print_hexa("d", ssh_string_data(d), ssh_string_len(d)); - ssh_print_hexa("iqmp", ssh_string_data(iqmp), + ssh_log_hexdump("n", ssh_string_data(n), ssh_string_len(n)); + ssh_log_hexdump("e", ssh_string_data(e), ssh_string_len(e)); + ssh_log_hexdump("d", ssh_string_data(d), ssh_string_len(d)); + ssh_log_hexdump("iqmp", ssh_string_data(iqmp), ssh_string_len(iqmp)); - ssh_print_hexa("p", ssh_string_data(p), ssh_string_len(p)); - ssh_print_hexa("q", ssh_string_data(q), ssh_string_len(q)); + ssh_log_hexdump("p", ssh_string_data(p), ssh_string_len(p)); + ssh_log_hexdump("q", ssh_string_data(q), ssh_string_len(q)); #endif ssh_string_burn(n); ssh_string_free(n); @@ -1237,9 +1237,9 @@ static int pki_import_pubkey_buffer(ssh_buffer buffer, rc = pki_pubkey_build_dss(key, p, q, g, pubkey); #ifdef DEBUG_CRYPTO - ssh_print_hexa("p", ssh_string_data(p), ssh_string_len(p)); - ssh_print_hexa("q", ssh_string_data(q), ssh_string_len(q)); - ssh_print_hexa("g", ssh_string_data(g), ssh_string_len(g)); + ssh_log_hexdump("p", ssh_string_data(p), ssh_string_len(p)); + ssh_log_hexdump("q", ssh_string_data(q), ssh_string_len(q)); + ssh_log_hexdump("g", ssh_string_data(g), ssh_string_len(g)); #endif ssh_string_burn(p); ssh_string_free(p); @@ -1268,8 +1268,8 @@ static int pki_import_pubkey_buffer(ssh_buffer buffer, rc = pki_pubkey_build_rsa(key, e, n); #ifdef DEBUG_CRYPTO - ssh_print_hexa("e", ssh_string_data(e), ssh_string_len(e)); - ssh_print_hexa("n", ssh_string_data(n), ssh_string_len(n)); + ssh_log_hexdump("e", ssh_string_data(e), ssh_string_len(e)); + ssh_log_hexdump("n", ssh_string_data(n), ssh_string_len(n)); #endif ssh_string_burn(e); ssh_string_free(e); diff --git a/src/pki_crypto.c b/src/pki_crypto.c index 4cb23e60..9b348194 100644 --- a/src/pki_crypto.c +++ b/src/pki_crypto.c @@ -1519,7 +1519,7 @@ static int pki_signature_from_rsa_blob(const ssh_key pubkey, #ifdef DEBUG_CRYPTO SSH_LOG(SSH_LOG_WARN, "RSA signature len: %lu", (unsigned long)len); - ssh_print_hexa("RSA signature", ssh_string_data(sig_blob), len); + ssh_log_hexdump("RSA signature", ssh_string_data(sig_blob), len); #endif if (len == rsalen) { @@ -1583,8 +1583,8 @@ static int pki_signature_from_dsa_blob(UNUSED_PARAM(const ssh_key pubkey), } #ifdef DEBUG_CRYPTO - ssh_print_hexa("r", ssh_string_data(sig_blob), 20); - ssh_print_hexa("s", (unsigned char *)ssh_string_data(sig_blob) + 20, 20); + ssh_log_hexdump("r", ssh_string_data(sig_blob), 20); + ssh_log_hexdump("s", (unsigned char *)ssh_string_data(sig_blob) + 20, 20); #endif r = ssh_string_new(20); @@ -1695,7 +1695,7 @@ static int pki_signature_from_ecdsa_blob(UNUSED_PARAM(const ssh_key pubkey), } #ifdef DEBUG_CRYPTO - ssh_print_hexa("r", ssh_string_data(r), ssh_string_len(r)); + ssh_log_hexdump("r", ssh_string_data(r), ssh_string_len(r)); #endif pr = ssh_make_string_bn(r); @@ -1723,7 +1723,7 @@ static int pki_signature_from_ecdsa_blob(UNUSED_PARAM(const ssh_key pubkey), } #ifdef DEBUG_CRYPTO - ssh_print_hexa("s", ssh_string_data(s), ssh_string_len(s)); + ssh_log_hexdump("s", ssh_string_data(s), ssh_string_len(s)); #endif ps = ssh_make_string_bn(s); @@ -2074,7 +2074,7 @@ ssh_signature pki_sign_data(const ssh_key privkey, } #ifdef DEBUG_CRYPTO - ssh_print_hexa("Generated signature", raw_sig_data, raw_sig_len); + ssh_log_hexdump("Generated signature", raw_sig_data, raw_sig_len); #endif /* Allocate and fill output signature */ diff --git a/src/pki_gcrypt.c b/src/pki_gcrypt.c index 705830c0..b014d63c 100644 --- a/src/pki_gcrypt.c +++ b/src/pki_gcrypt.c @@ -1945,7 +1945,7 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey, SSH_LOG(SSH_LOG_DEBUG, "DSA signature len: %lu", (unsigned long)len); - ssh_print_hexa("DSA signature", ssh_string_data(sig_blob), len); + ssh_log_hexdump("DSA signature", ssh_string_data(sig_blob), len); #endif err = gcry_sexp_build(&sig->dsa_sig, @@ -1980,7 +1980,7 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey, #ifdef DEBUG_CRYPTO SSH_LOG(SSH_LOG_DEBUG, "RSA signature len: %lu", (unsigned long)len); - ssh_print_hexa("RSA signature", ssh_string_data(sig_blob), len); + ssh_log_hexdump("RSA signature", ssh_string_data(sig_blob), len); #endif err = gcry_sexp_build(&sig->rsa_sig, @@ -2055,8 +2055,8 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey, } #ifdef DEBUG_CRYPTO - ssh_print_hexa("r", ssh_string_data(r), ssh_string_len(r)); - ssh_print_hexa("s", ssh_string_data(s), ssh_string_len(s)); + ssh_log_hexdump("r", ssh_string_data(r), ssh_string_len(r)); + ssh_log_hexdump("s", ssh_string_data(s), ssh_string_len(s)); #endif err = gcry_sexp_build(&sig->ecdsa_sig, diff --git a/src/pki_mbedcrypto.c b/src/pki_mbedcrypto.c index 3993c74c..738923ca 100644 --- a/src/pki_mbedcrypto.c +++ b/src/pki_mbedcrypto.c @@ -873,7 +873,7 @@ static ssh_signature pki_signature_from_rsa_blob(const ssh_key pubkey, const } #ifdef DEBUG_CRYPTO SSH_LOG(SSH_LOG_WARN, "RSA signature len: %lu", (unsigned long)len); - ssh_print_hexa("RSA signature", ssh_string_data(sig_blob), len); + ssh_log_hexdump("RSA signature", ssh_string_data(sig_blob), len); #endif if (len == rsalen) { @@ -966,7 +966,7 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey, return NULL; } #ifdef DEBUG_CRYPTO - ssh_print_hexa("r", ssh_string_data(r), ssh_string_len(r)); + ssh_log_hexdump("r", ssh_string_data(r), ssh_string_len(r)); #endif sig->ecdsa_sig.r = ssh_make_string_bn(r); ssh_string_burn(r); @@ -986,7 +986,7 @@ ssh_signature pki_signature_from_blob(const ssh_key pubkey, } #ifdef DEBUG_CRYPTO - ssh_print_hexa("s", ssh_string_data(s), ssh_string_len(s)); + ssh_log_hexdump("s", ssh_string_data(s), ssh_string_len(s)); #endif sig->ecdsa_sig.s = ssh_make_string_bn(s); ssh_string_burn(s); |