Skip to content

Conversation

@jwendell
Copy link
Member

The previous code directly accessed the r and s members of the ECDSA_SIG struct when converting the JWT signature to an ECDSA signature object. This worked with BoringSSL which exposes struct internals, but fails with OpenSSL where ECDSA_SIG is an opaque type.

This change uses ECDSA_SIG_set0() to set the r and s BIGNUM values, which is supported by both BoringSSL and OpenSSL. The BIGNUMs are created separately and then transferred to the ECDSA_SIG object via ECDSA_SIG_set0(), which takes ownership of them. The unique_ptrs are released after the transfer to prevent double-free.

@jwendell
Copy link
Member Author

We've been carrying this as a patch since ever in the openssl fork. Now that jwt is in Envoy itself, this is a good change to get in, as it makes the code work on both libraries.

Similar to the change in #42156

@jwendell jwendell force-pushed the uniqueptr1 branch 4 times, most recently from 7f622f1 to 484bd96 Compare January 31, 2026 18:48
The previous code directly accessed the r and s members of the
ECDSA_SIG struct when converting the JWT signature to an ECDSA
signature object. This worked with BoringSSL which exposes struct
internals, but fails with OpenSSL where ECDSA_SIG is an opaque type.

This change uses ECDSA_SIG_set0() to set the r and s BIGNUM values,
which is supported by both BoringSSL and OpenSSL. The BIGNUMs are
created separately and then transferred to the ECDSA_SIG object via
ECDSA_SIG_set0(), which takes ownership of them. The unique_ptrs are
released after the transfer to prevent double-free.

Signed-off-by: Jonh Wendell <[email protected]>
@jwendell jwendell enabled auto-merge (squash) February 1, 2026 15:28
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.

1 participant