diff --git a/crypto/include/dap_hash.h b/crypto/include/dap_hash.h index 7a194c8bdc8cce0b369c4266f595985e84fa239f..ebd8b63e2457845ce9d4e5576e72b29e0357cbf6 100755 --- a/crypto/include/dap_hash.h +++ b/crypto/include/dap_hash.h @@ -164,13 +164,14 @@ DAP_STATIC_INLINE char *dap_hash_fast_str_new( const void *a_data, size_t a_data return NULL; } -#define dap_get_data_hash_str_static(data,data_size,strname) \ -do { \ - strname = DAP_NEW_STACK_SIZE(char, DAP_CHAIN_HASH_FAST_STR_SIZE); \ - dap_hash_fast_t dummy_hash; \ - dap_hash_fast(data,data_size,&dummy_hash); \ - dap_chain_hash_fast_to_str(&dummy_hash,strname,DAP_CHAIN_HASH_FAST_STR_SIZE); \ -} while (0) +DAP_STATIC_INLINE dap_hash_str_t dap_get_data_hash_str(const void *a_data, size_t a_data_size) +{ + dap_hash_str_t l_ret = { }; + dap_hash_fast_t dummy_hash; + dap_hash_fast(a_data, a_data_size, &dummy_hash); + dap_chain_hash_fast_to_str(&dummy_hash, l_ret.s, DAP_CHAIN_HASH_FAST_STR_SIZE); + return l_ret; +} #ifdef __cplusplus } diff --git a/crypto/src/dap_cert.c b/crypto/src/dap_cert.c index 059b801398598a92b3280c783a1826c00e05d213..f1f0d8693db9667f3d015cf639061790217e86dd 100755 --- a/crypto/src/dap_cert.c +++ b/crypto/src/dap_cert.c @@ -236,11 +236,8 @@ dap_cert_t * dap_cert_generate_mem_with_seed(const char * a_cert_name, dap_enc_k if (l_enc_key) { dap_cert_t * l_cert = dap_cert_new(a_cert_name); l_cert->enc_key = l_enc_key; - if (a_seed && a_seed_size) { - char *l_hash_str; - dap_get_data_hash_str_static(a_seed, a_seed_size, l_hash_str); - log_it(L_DEBUG, "Certificate generated with seed hash %s", l_hash_str); - } + if (a_seed && a_seed_size) + log_it(L_DEBUG, "Certificate generated with seed hash %s", dap_get_data_hash_str(a_seed, a_seed_size).s); return l_cert; } else { log_it(L_ERROR,"Can't generate key in memory!"); diff --git a/net/client/dap_client_pvt.c b/net/client/dap_client_pvt.c index 12df95cb8f6ecfa954aaa7dc1ea46b732cba556a..7e7b88faa0bb1cf69342d70170e20aef696268cc 100644 --- a/net/client/dap_client_pvt.c +++ b/net/client/dap_client_pvt.c @@ -144,7 +144,9 @@ static void s_client_internal_clean(dap_client_pvt_t *a_client_pvt) } if (a_client_pvt->stream_es) { dap_stream_delete_unsafe(a_client_pvt->stream); - a_client_pvt->stream = a_client_pvt->stream_es = a_client_pvt->stream_key = NULL; + a_client_pvt->stream = NULL; + a_client_pvt->stream_es = NULL; + a_client_pvt->stream_key = NULL; a_client_pvt->stream_id = 0; }