)]}'
{"src/openvpn/auth_token.c":[{"author":{"_account_id":1000002,"name":"Gert Doering","display_name":"Gert Doering","email":"gert@greenie.muc.de","username":"cron2"},"change_message_id":"cc7122df52b8f132922078a016b9a0fb707e6262","unresolved":true,"context_lines":[{"line_number":173,"context_line":"    init_key_ctx(key_ctx, \u0026key_params, \u0026kt, false, \"auth-token secret\");"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":"    secure_memzero(\u0026key, sizeof(key));"},{"line_number":176,"context_line":"    buf_clear(\u0026server_secret_key);"},{"line_number":177,"context_line":"    free_buf(\u0026server_secret_key);"},{"line_number":178,"context_line":"}"},{"line_number":179,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"4b8b5320_cc7d30e0","line":176,"updated":"2026-11-01 10:12:18.000000000","message":"this is doing the `secure_memzero()` twice, as `buf_clear()` already does it - so yes on the concept, but one of those calls is enough.","commit_id":"b9f4c1f5236329ee63284a2b85ebba5baf2095e1"},{"author":{"_account_id":1000035,"name":"Steffan Karger","display_name":"Steffan Karger","email":"steffan@karger.me","username":"syzzer","status":"Commits and comments are my own views, not those of my employer."},"change_message_id":"0c566359c0dbb74c0d40cf5e8e169aeb308c0304","unresolved":true,"context_lines":[{"line_number":173,"context_line":"    init_key_ctx(key_ctx, \u0026key_params, \u0026kt, false, \"auth-token secret\");"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":"    secure_memzero(\u0026key, sizeof(key));"},{"line_number":176,"context_line":"    buf_clear(\u0026server_secret_key);"},{"line_number":177,"context_line":"    free_buf(\u0026server_secret_key);"},{"line_number":178,"context_line":"}"},{"line_number":179,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"54c89017_9e7d7158","line":176,"in_reply_to":"2b59e930_e9fc3717","updated":"2026-11-01 18:57:56.000000000","message":"Clearing key data we no longer use is a good practice we should do more consistently. This function seems to be making a lot of copies of the key. (Looks like we grew the struct key_parameters somewhat recently, which introduces yet another copy...) Should we not also clear struct key_params ?","commit_id":"b9f4c1f5236329ee63284a2b85ebba5baf2095e1"},{"author":{"_account_id":1000062,"name":"Hansaem Wi","email":"hansaemw@gmail.com","username":"wihansaem1991"},"change_message_id":"9917b778d2f3cc498e979d0f6569854488972af7","unresolved":true,"context_lines":[{"line_number":173,"context_line":"    init_key_ctx(key_ctx, \u0026key_params, \u0026kt, false, \"auth-token secret\");"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":"    secure_memzero(\u0026key, sizeof(key));"},{"line_number":176,"context_line":"    buf_clear(\u0026server_secret_key);"},{"line_number":177,"context_line":"    free_buf(\u0026server_secret_key);"},{"line_number":178,"context_line":"}"},{"line_number":179,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"2b59e930_e9fc3717","line":176,"in_reply_to":"4b8b5320_cc7d30e0","updated":"2026-11-01 12:38:40.000000000","message":"Thanks for the review. The two calls wipe two different copies of the key, so I don\u0027t think one of them is redundant here:\n\n- buf_read() copies the key out of server_secret_key into the struct key on the stack, so after init_key_ctx() the key is still both in `key` on the stack and in the 2048-byte heap buffer that read_pem_key_file() or generate_ephemeral_key() filled.\n- secure_memzero(\u0026key, sizeof(key)) wipes the stack copy, as tls_crypt_v2_init_server_key() does with srv_key. There the buffer points at srv_key itself, so one call covers both.\n- buf_clear(\u0026server_secret_key) wipes the heap buffer before free_buf(). This heap copy is the one that was found by scanning freed blocks in test_auth_token.\n\nIf you would rather keep only one of them, I would keep buf_clear(). I can also add a short comment to each line so the two copies are obvious.","commit_id":"b9f4c1f5236329ee63284a2b85ebba5baf2095e1"},{"author":{"_account_id":1000002,"name":"Gert Doering","display_name":"Gert Doering","email":"gert@greenie.muc.de","username":"cron2"},"change_message_id":"93e80b6d325845e0fb1348ab27690872d0a8c26c","unresolved":true,"context_lines":[{"line_number":173,"context_line":"    init_key_ctx(key_ctx, \u0026key_params, \u0026kt, false, \"auth-token secret\");"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":"    secure_memzero(\u0026key, sizeof(key));"},{"line_number":176,"context_line":"    buf_clear(\u0026server_secret_key);"},{"line_number":177,"context_line":"    free_buf(\u0026server_secret_key);"},{"line_number":178,"context_line":"}"},{"line_number":179,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"e6f1e189_2cbb9eb6","line":176,"in_reply_to":"54c89017_9e7d7158","updated":"2026-11-01 21:45:44.000000000","message":"@hansaemw@gmail.com oh indeed, sorry for not looking more closely.  I withdraw my -1 on that aspect, and leave the rest of the review to @steffan@karger.me","commit_id":"b9f4c1f5236329ee63284a2b85ebba5baf2095e1"},{"author":{"_account_id":1000062,"name":"Hansaem Wi","email":"hansaemw@gmail.com","username":"wihansaem1991"},"change_message_id":"e38d8d6ef9154a8d8007ff13c71d8bef8ce720a9","unresolved":false,"context_lines":[{"line_number":173,"context_line":"    init_key_ctx(key_ctx, \u0026key_params, \u0026kt, false, \"auth-token secret\");"},{"line_number":174,"context_line":""},{"line_number":175,"context_line":"    secure_memzero(\u0026key, sizeof(key));"},{"line_number":176,"context_line":"    buf_clear(\u0026server_secret_key);"},{"line_number":177,"context_line":"    free_buf(\u0026server_secret_key);"},{"line_number":178,"context_line":"}"},{"line_number":179,"context_line":""}],"source_content_type":"text/x-csrc","patch_set":1,"id":"613b8e50_88b46a66","line":176,"in_reply_to":"e6f1e189_2cbb9eb6","updated":"2026-11-02 00:46:30.000000000","message":"Done in patch set 2, thanks.\n\nThe same struct key_parameters copy is left on the stack in init_key_ctx_bi() (data channel keys when epoch keys are not used, tls-auth, tls-crypt and static keys) and in tls_crypt_v2_init_server_key(). crypto_epoch.c already clears its copies, so I wiped those two in https://gerrit.openvpn.net/c/openvpn/+/2078. Scanning the stack right after init_key_ctx_bi() in test_crypto found the cipher and HMAC keys twice each before that change and not after it.","commit_id":"b9f4c1f5236329ee63284a2b85ebba5baf2095e1"}]}
