Skip to content

Commit 5247252

Browse files
committed
Fix and rename sig_scheme_to_nid
This recently started failing in the `client_real_world` test, as the server switched to an ECDSA cert chain.
1 parent 37e6e49 commit 5247252

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/constants.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use core::ffi::{c_int, CStr};
22
use openssl_sys::{
3-
NID_X9_62_prime256v1, NID_rsaEncryption, NID_rsassaPss, NID_secp384r1, NID_secp521r1,
4-
NID_ED25519, NID_ED448, NID_X25519, NID_X448,
3+
NID_X9_62_id_ecPublicKey, NID_X9_62_prime256v1, NID_rsaEncryption, NID_rsassaPss,
4+
NID_secp384r1, NID_secp521r1, NID_ED25519, NID_ED448, NID_X25519, NID_X448,
55
};
66

77
use rustls::{AlertDescription, NamedGroup, SignatureScheme};
@@ -88,14 +88,14 @@ pub fn alert_desc_to_short_string(value: c_int) -> &'static CStr {
8888
}
8989
}
9090

91-
pub fn sig_scheme_to_nid(scheme: SignatureScheme) -> Option<c_int> {
91+
pub fn sig_scheme_to_type_nid(scheme: SignatureScheme) -> Option<c_int> {
9292
use SignatureScheme::*;
9393
match scheme {
9494
RSA_PKCS1_SHA256 | RSA_PKCS1_SHA384 | RSA_PKCS1_SHA512 => Some(NID_rsaEncryption),
9595
RSA_PSS_SHA256 | RSA_PSS_SHA384 | RSA_PSS_SHA512 => Some(NID_rsassaPss),
96-
ECDSA_NISTP256_SHA256 => Some(NID_X9_62_prime256v1),
97-
ECDSA_NISTP384_SHA384 => Some(NID_secp384r1),
98-
ECDSA_NISTP521_SHA512 => Some(NID_secp521r1),
96+
ECDSA_NISTP256_SHA256 | ECDSA_NISTP384_SHA384 | ECDSA_NISTP521_SHA512 => {
97+
Some(NID_X9_62_id_ecPublicKey)
98+
}
9999
ED25519 => Some(NID_ED25519),
100100
ED448 => Some(NID_ED448),
101101
// Omitted: SHA1 legacy schemes.

src/entry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustls::pki_types::{CertificateDer, PrivatePkcs8KeyDer};
1717

1818
use crate::bio::{Bio, BIO, BIO_METHOD};
1919
use crate::callbacks::SslCallbackContext;
20-
use crate::constants::{named_group_to_nid, sig_scheme_to_nid};
20+
use crate::constants::{named_group_to_nid, sig_scheme_to_type_nid};
2121
use crate::error::{ffi_panic_boundary, Error, MysteriouslyOppositeReturnValue};
2222
use crate::evp_pkey::EvpPkey;
2323
use crate::ex_data::ExData;
@@ -1192,7 +1192,7 @@ entry! {
11921192
let sigalg_nid = try_clone_arc!(ssl)
11931193
.get()
11941194
.get_last_verification_sig_scheme()
1195-
.and_then(sig_scheme_to_nid);
1195+
.and_then(sig_scheme_to_type_nid);
11961196

11971197
match sigalg_nid {
11981198
Some(nid) => {

0 commit comments

Comments
 (0)