File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 26
26
27
27
use std:: sync:: atomic;
28
28
29
- use crate :: { Keyring , KeyringSerial , SpecialKeyring } ;
29
+ use crate :: { Key , Keyring , KeyringSerial , SpecialKeyring } ;
30
30
31
31
pub mod kernel;
32
32
pub mod keys;
@@ -43,9 +43,17 @@ pub fn new_test_keyring() -> Keyring {
43
43
. unwrap ( )
44
44
}
45
45
46
- pub fn invalid_keyring ( ) -> Keyring {
46
+ unsafe fn invalid_serial ( ) -> KeyringSerial {
47
47
// Yes, we're explicitly breaking the NonZeroI32 rules here. However, it is not passing through
48
48
// any bits which care (e.g., `Option`), so this is purely to test that using an invalid
49
49
// keyring ID gives back `EINVAL` as expected.
50
- unsafe { Keyring :: new ( KeyringSerial :: new_unchecked ( 0 ) ) }
50
+ KeyringSerial :: new_unchecked ( 0 )
51
+ }
52
+
53
+ pub fn invalid_keyring ( ) -> Keyring {
54
+ unsafe { Keyring :: new ( invalid_serial ( ) ) }
55
+ }
56
+
57
+ pub fn invalid_key ( ) -> Key {
58
+ unsafe { Key :: new ( invalid_serial ( ) ) }
51
59
}
You can’t perform that action at this time.
0 commit comments