comparison common-kex.c @ 1912:8b4274d34fe8

Use buf_burn_free() instead of two calls
author Matt Johnston <matt@ucc.asn.au>
date Tue, 29 Mar 2022 23:47:30 +0800
parents 3bfacfc996cf
children 3f4cdf839a1a
comparison
equal deleted inserted replaced
1911:ced53051e200 1912:8b4274d34fe8
304 hash_desc->init(&hs); 304 hash_desc->init(&hs);
305 hash_process_mp(hash_desc, &hs, ses.dh_K); 305 hash_process_mp(hash_desc, &hs, ses.dh_K);
306 mp_clear(ses.dh_K); 306 mp_clear(ses.dh_K);
307 m_free(ses.dh_K); 307 m_free(ses.dh_K);
308 hash_desc->process(&hs, ses.hash->data, ses.hash->len); 308 hash_desc->process(&hs, ses.hash->data, ses.hash->len);
309 buf_burn(ses.hash); 309 buf_burn_free(ses.hash);
310 buf_free(ses.hash);
311 ses.hash = NULL; 310 ses.hash = NULL;
312 311
313 if (IS_DROPBEAR_CLIENT) { 312 if (IS_DROPBEAR_CLIENT) {
314 trans_IV = C2S_IV; 313 trans_IV = C2S_IV;
315 recv_IV = S2C_IV; 314 recv_IV = S2C_IV;
801 printhex("kexhashbuf", ses.kexhashbuf->data, ses.kexhashbuf->len); 800 printhex("kexhashbuf", ses.kexhashbuf->data, ses.kexhashbuf->len);
802 printhex("kexhash", ses.hash->data, ses.hash->len); 801 printhex("kexhash", ses.hash->data, ses.hash->len);
803 } 802 }
804 #endif 803 #endif
805 804
806 buf_burn(ses.kexhashbuf); 805 buf_burn_free(ses.kexhashbuf);
807 buf_free(ses.kexhashbuf);
808 m_burn(&hs, sizeof(hash_state)); 806 m_burn(&hs, sizeof(hash_state));
809 ses.kexhashbuf = NULL; 807 ses.kexhashbuf = NULL;
810 808
811 /* first time around, we set the session_id to H */ 809 /* first time around, we set the session_id to H */
812 if (ses.session_id == NULL) { 810 if (ses.session_id == NULL) {