Skip to content

openssl: clear local secret before free in ssh2_ecdh_gen_k() with OpenSSL 1.1.1 - #2545

Closed
vszakats wants to merge 3 commits into
libssh2:masterfrom
vszakats:ossl-clearsec
Closed

vszakats wants to merge 3 commits into
libssh2:masterfrom
vszakats:ossl-clearsec

Conversation

@vszakats

@vszakats vszakats commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

Also:

  • use separate variable to store the secret buffer size and the length
    of the actual secret.
  • fix the type of the actual secret size to be int to match the API
    and avoid a cast.

Reported by Copilot
Bug: #2544 (comment)
Follow-up to aba34f5 #41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Clears the temporary ECDH shared secret securely in the legacy OpenSSL path.

Changes:

  • Separates buffer capacity from the API-returned secret length.
  • Uses the correct int type and securely zeroes the full allocation before freeing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants