Skip to content

Commit 201fed9

Browse files
larseggertNot-Nik
authored andcommitted
chore: Bump MSRV to 1.87 (#3312)
* chore: Bump MSRV to 1.87 And deal with the fallout. * Fixes * Fixes * Fixes --------- Signed-off-by: Lars Eggert <lars@eggert.org>
1 parent 4fa82e9 commit 201fed9

13 files changed

Lines changed: 30 additions & 34 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ authors = ["Martin Thomson <mt@lowentropy.net>", "Andy Leiserson <aleiserson@moz
55
categories = ["network-programming", "web-programming"]
66
keywords = ["nss", "crypto", "mozilla", "firefox"]
77
edition = "2021"
8-
rust-version = "1.81.0"
8+
rust-version = "1.87.0"
99
build = "build.rs"
1010
license = "MIT/Apache-2.0"
1111
description = "Gecko API for NSS"

bindings/nspr_types.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/aead.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl RealAead {
134134
secret,
135135
p.as_ptr().cast(),
136136
c_uint::try_from(p.len())?,
137-
&mut ctx,
137+
&raw mut ctx,
138138
)?;
139139
Ok(Self {
140140
ctx: AeadContext::from_ptr(ctx)?,
@@ -169,7 +169,7 @@ impl AeadTrait for RealAead {
169169
input.as_ptr(),
170170
c_uint::try_from(input.len())?,
171171
output.as_mut_ptr(),
172-
&mut l,
172+
&raw mut l,
173173
c_uint::try_from(output.len())?,
174174
)
175175
}?;
@@ -191,7 +191,7 @@ impl AeadTrait for RealAead {
191191
data.as_ptr(),
192192
c_uint::try_from(data.len() - self.expansion())?,
193193
data.as_mut_ptr(),
194-
&mut l,
194+
&raw mut l,
195195
c_uint::try_from(data.len())?,
196196
)
197197
}?;
@@ -219,7 +219,7 @@ impl AeadTrait for RealAead {
219219
input.as_ptr(),
220220
c_uint::try_from(input.len())?,
221221
output.as_mut_ptr(),
222-
&mut l,
222+
&raw mut l,
223223
c_uint::try_from(output.len())?,
224224
)
225225
}?;
@@ -240,7 +240,7 @@ impl AeadTrait for RealAead {
240240
data.as_ptr(),
241241
c_uint::try_from(data.len())?,
242242
data.as_mut_ptr(),
243-
&mut l,
243+
&raw mut l,
244244
c_uint::try_from(data.len())?,
245245
)
246246
}?;

src/agent.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::{
1414
convert::{TryFrom as _, TryInto as _},
1515
ffi::{CStr, CString},
1616
fmt::{self, Debug, Display, Formatter, Write as _},
17-
mem::{size_of, MaybeUninit},
17+
mem::MaybeUninit,
1818
ops::{Deref, DerefMut},
1919
os::raw::{c_uint, c_void},
2020
pin::Pin,
@@ -248,9 +248,9 @@ fn get_alpn(fd: *mut prio::PRFileDesc, pre: bool) -> Res<Option<String>> {
248248
secstatus_to_res(unsafe {
249249
ssl::SSL_GetNextProto(
250250
fd,
251-
&mut alpn_state,
251+
&raw mut alpn_state,
252252
chosen.as_mut_ptr(),
253-
&mut chosen_len,
253+
&raw mut chosen_len,
254254
c_uint::try_from(chosen.len())?,
255255
)
256256
})?;
@@ -592,7 +592,7 @@ impl SecretAgent {
592592
/// If the range of versions isn't supported.
593593
pub fn set_version_range(&mut self, min: Version, max: Version) -> Res<()> {
594594
let range = ssl::SSLVersionRange { min, max };
595-
secstatus_to_res(unsafe { ssl::SSL_VersionRangeSet(self.fd, &range) })
595+
secstatus_to_res(unsafe { ssl::SSL_VersionRangeSet(self.fd, &raw const range) })
596596
}
597597

598598
/// Enable a set of ciphers. Note that the order of these is not respected.
@@ -1333,7 +1333,7 @@ impl Server {
13331333
// ssl_auth_null means "I don't care what sort of certificate this is".
13341334
authType: ssl::SSLAuthType::ssl_auth_null,
13351335
certChain: null(),
1336-
stapledOCSPResponses: &ocsp_array,
1336+
stapledOCSPResponses: &raw const ocsp_array,
13371337
signedCertTimestamps: std::ptr::from_ref(&sct_item).cast(),
13381338
delegCred: null(),
13391339
delegCredPrivKey: null(),
@@ -1343,7 +1343,7 @@ impl Server {
13431343
agent.fd,
13441344
(*cert).cast(),
13451345
(*key).cast(),
1346-
&extra,
1346+
&raw const extra,
13471347
c_uint::try_from(size_of::<ssl::SSLExtraServerCertDataStr>())?,
13481348
)
13491349
})?;

src/agentio.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ unsafe extern "C" fn agent_available64(mut fd: PrFd) -> PRInt64 {
348348
clippy::cast_possible_truncation,
349349
reason = "Cast is safe because prio::PR_AF_INET is 2."
350350
)]
351-
unsafe extern "C" fn agent_getname(_fd: PrFd, addr: *mut prio::PRNetAddr) -> PrStatus {
351+
const unsafe extern "C" fn agent_getname(_fd: PrFd, addr: *mut prio::PRNetAddr) -> PrStatus {
352352
let Some(a) = addr.as_mut() else {
353353
return PR_FAILURE;
354354
};
@@ -359,7 +359,10 @@ unsafe extern "C" fn agent_getname(_fd: PrFd, addr: *mut prio::PRNetAddr) -> PrS
359359
PR_SUCCESS
360360
}
361361

362-
unsafe extern "C" fn agent_getsockopt(_fd: PrFd, opt: *mut prio::PRSocketOptionData) -> PrStatus {
362+
const unsafe extern "C" fn agent_getsockopt(
363+
_fd: PrFd,
364+
opt: *mut prio::PRSocketOptionData,
365+
) -> PrStatus {
363366
if let Some(o) = opt.as_mut() {
364367
if o.option == prio::PRSockOption_PR_SockOpt_Nonblocking {
365368
o.value.non_blocking = 1;

src/cert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct CertificateInfo {
3131

3232
fn peer_certificate_chain(fd: *mut PRFileDesc) -> Option<ScopedSECItemArray> {
3333
let mut chain_ptr: *mut SECItemArray = std::ptr::null_mut();
34-
let rv = unsafe { SSL_PeerCertificateChainDER(fd, &mut chain_ptr) };
34+
let rv = unsafe { SSL_PeerCertificateChainDER(fd, &raw mut chain_ptr) };
3535
if rv.is_ok() {
3636
ScopedSECItemArray::from_ptr(chain_ptr).ok()
3737
} else {

src/ech.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub fn generate_keys() -> Res<(PrivateKey, PublicKey)> {
115115
*slot,
116116
p11::CK_MECHANISM_TYPE::from(CKM_EC_KEY_PAIR_GEN),
117117
addr_of_mut!(param_item).cast(),
118-
&mut public_ptr,
118+
&raw mut public_ptr,
119119
p11::PK11_ATTR_SESSION | p11::PK11_ATTR_INSENSITIVE | p11::PK11_ATTR_PUBLIC,
120120
p11::CK_FLAGS::from(CKF_DERIVE),
121121
p11::CK_FLAGS::from(CKF_DERIVE),
@@ -132,7 +132,7 @@ pub fn generate_keys() -> Res<(PrivateKey, PublicKey)> {
132132
*slot,
133133
p11::CK_MECHANISM_TYPE::from(CKM_EC_KEY_PAIR_GEN),
134134
addr_of_mut!(param_item).cast(),
135-
&mut public_ptr,
135+
&raw mut public_ptr,
136136
p11::PK11_ATTR_SESSION | p11::PK11_ATTR_SENSITIVE | p11::PK11_ATTR_PRIVATE,
137137
p11::CK_FLAGS::from(CKF_DERIVE),
138138
p11::CK_FLAGS::from(CKF_DERIVE),
@@ -191,7 +191,7 @@ pub fn encode_config(config: u8, public_name: &str, pk: &PublicKey) -> Res<Vec<u
191191
SUITES.as_ptr(),
192192
c_uint::try_from(SUITES.len())?,
193193
encoded.as_mut_ptr(),
194-
&mut encoded_len,
194+
&raw mut encoded_len,
195195
c_uint::try_from(encoded.len())?,
196196
)?;
197197
}

src/hkdf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pub fn extract(
170170
) -> Res<SymKey> {
171171
let mut prk: *mut PK11SymKey = null_mut();
172172
let salt_ptr: *mut PK11SymKey = salt.map_or(null_mut(), |s| **s);
173-
unsafe { SSL_HkdfExtract(version, cipher, salt_ptr, **ikm, &mut prk) }?;
173+
unsafe { SSL_HkdfExtract(version, cipher, salt_ptr, **ikm, &raw mut prk) }?;
174174
SymKey::from_ptr(prk)
175175
}
176176

@@ -200,7 +200,7 @@ pub fn expand_label(
200200
c_uint::try_from(handshake_hash.len())?,
201201
l.as_ptr().cast(),
202202
c_uint::try_from(l.len())?,
203-
&mut secret,
203+
&raw mut secret,
204204
)
205205
}?;
206206
SymKey::from_ptr(secret)

src/hp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl Key {
9797
c_uint::try_from(l.len())?,
9898
mech,
9999
key_size,
100-
&mut secret,
100+
&raw mut secret,
101101
)
102102
}?;
103103
let key = SymKey::from_ptr(secret).or(Err(Error::Hkdf))?;
@@ -153,7 +153,7 @@ impl Key {
153153
PK11_CipherOp(
154154
**context.borrow_mut(),
155155
output.as_mut_ptr(),
156-
&mut output_len,
156+
&raw mut output_len,
157157
c_int::try_from(output.len())?,
158158
sample.as_ptr().cast(),
159159
c_int::try_from(Self::SAMPLE_SIZE)?,
@@ -178,7 +178,7 @@ impl Key {
178178
CK_MECHANISM_TYPE::from(CKM_CHACHA20),
179179
std::ptr::from_mut(param_item.as_mut()),
180180
output[..].as_mut_ptr(),
181-
&mut output_len,
181+
&raw mut output_len,
182182
c_uint::try_from(output.len())?,
183183
[0; Self::SAMPLE_SIZE].as_ptr(),
184184
c_uint::try_from(Self::SAMPLE_SIZE)?,

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ fn version_check() -> Res<()> {
145145
fn enable_ssl_trace() -> Res<()> {
146146
let opt = Opt::Locking.as_int();
147147
let mut v: ::std::os::raw::c_int = 0;
148-
secstatus_to_res(unsafe { ssl::SSL_OptionGetDefault(opt, &mut v) })
148+
secstatus_to_res(unsafe { ssl::SSL_OptionGetDefault(opt, &raw mut v) })
149149
}
150150

151151
fn init_once(db: Option<PathBuf>) -> Res<NssLoaded> {

0 commit comments

Comments
 (0)