Skip to content

Commit b55dbb5

Browse files
committed
Fix tests on macOS
It seems that `OSSL_PROVIDER_try_load` can leave errors on the stack.
1 parent e053a9c commit b55dbb5

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

openssl/src/cms.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -475,14 +475,10 @@ mod test {
475475
// check verification result - this is an invalid signature
476476
// defined in openssl crypto/cms/cms.h
477477
const CMS_R_CERTIFICATE_VERIFY_ERROR: i32 = 100;
478-
match res {
479-
Err(es) => {
480-
let error_array = es.errors();
481-
assert_eq!(1, error_array.len());
482-
let code = error_array[0].code();
483-
assert_eq!(ffi::ERR_GET_REASON(code), CMS_R_CERTIFICATE_VERIFY_ERROR);
484-
}
485-
_ => panic!("expected CMS verification error, got Ok()"),
486-
}
478+
let es = res.unwrap_err();
479+
let error_array = es.errors();
480+
assert_eq!(1, error_array.len());
481+
let code = error_array[0].reason_code();
482+
assert_eq!(code, CMS_R_CERTIFICATE_VERIFY_ERROR);
487483
}
488484
}

openssl/src/provider.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ impl Provider {
5555
retain_fallbacks as _,
5656
))?;
5757

58+
// OSSL_PROVIDER_try_load seems to leave errors on the stack, even
59+
// when it succeeds.
60+
let _ = ErrorStack::get();
61+
5862
Ok(Provider::from_ptr(p))
5963
}
6064
}

0 commit comments

Comments
 (0)