Skip to content

pem: de-duplicate two identical curve type conversions functions - #2427

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

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

Conversation

@vszakats

@vszakats vszakats commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

Also drop redundant sanity checks.

Follow-up to 262c97f #2421

Copilot AI review requested due to automatic review settings July 24, 2026 18:49

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 de-duplicates identical ECDSA curve-name → ssh2_curve_type conversion helpers previously implemented separately in the OpenSSL and mbedTLS backends, centralizing the logic in pem.c for reuse.

Changes:

  • Introduces a shared helper ssh2_pem_ecdsa_curve_type_from_name() in src/pem.c.
  • Removes the now-redundant backend-specific helpers from src/openssl.c and src/mbedtls.c.
  • Exposes the shared helper via an internal prototype in src/libssh2_priv.h and updates call sites.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/pem.c Adds shared ECDSA curve type parsing helper.
src/openssl.c Removes duplicated helper and switches to shared implementation.
src/mbedtls.c Removes duplicated helper and switches to shared implementation.
src/libssh2_priv.h Declares the shared helper for internal use.

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

Comment thread src/pem.c Resolved
Comment thread src/libssh2_priv.h Resolved
Copilot AI review requested due to automatic review settings July 24, 2026 18:56

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/pem.c Resolved
Copilot AI review requested due to automatic review settings July 24, 2026 19:03

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread src/pem.c Resolved
Comment thread src/pem.c Resolved
Copilot AI review requested due to automatic review settings July 24, 2026 19:11

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

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

@vszakats vszakats closed this in 5cee200 Jul 24, 2026
@vszakats
vszakats deleted the dedupe branch July 24, 2026 19:22
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