Skip to content

src: dedupe OpenSSH PEM macros into crypto.h - #2034

Closed
vszakats wants to merge 4 commits into
libssh2:masterfrom
vszakats:dedupe-macros
Closed

vszakats wants to merge 4 commits into
libssh2:masterfrom
vszakats:dedupe-macros

Conversation

@vszakats

Copy link
Copy Markdown
Member

Follow-up to 56c12e9 #2022

@vszakats vszakats changed the title src: dedupe AUTH_MAGIC macro into crypto.h src: dedupe OpenSSH PEM macros into crypto.h Jun 10, 2026

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

This PR consolidates duplicated OpenSSH private key PEM header/footer/auth-magic string macros into a single shared location (src/crypto.h), and updates the Windows CNG backend and PEM parser to use the shared definitions. This follows up on prior work to correctly validate the OpenSSH key-v1 magic string including its required NUL terminator.

Changes:

  • Move OpenSSH private key PEM header/footer and openssh-key-v1 auth-magic macros into src/crypto.h.
  • Update src/pem.c to use the shared OPENSSH_PRIVKEY_* macros for OpenSSH PEM parsing and auth-magic validation.
  • Update src/wincng.c to use the shared OPENSSH_PRIVKEY_* macros for ECDSA OpenSSH key parsing.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/wincng.c Replaces local OpenSSH PEM/auth-magic macros with shared OPENSSH_PRIVKEY_* macros.
src/pem.c Switches OpenSSH PEM parsing/auth-magic checks to the shared OPENSSH_PRIVKEY_* macros.
src/crypto.h Introduces shared OpenSSH private key PEM header/footer/auth-magic macro definitions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vszakats vszakats closed this in f1d0722 Jun 11, 2026
@vszakats
vszakats deleted the dedupe-macros branch June 11, 2026 00:49
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