Skip to content

Commit a37f67a

Browse files
committed
Add KEY_TYPE_KEYRING and KEY_TYPE_BIG_KEY
1 parent e84ba76 commit a37f67a

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

keyutils-raw/src/constants.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@
2929

3030
use crate::types::{key_perm_t, key_serial_t};
3131

32+
// TODO: change these to &CStr when const fns get unblocked.
33+
pub const KEY_TYPE_KEYRING: &str = "keyring";
3234
pub const KEY_TYPE_USER: &str = "user";
3335
pub const KEY_TYPE_LOGON: &str = "logon";
36+
pub const KEY_TYPE_BIG_KEY: &str = "big_key";
3437

3538
pub const KEY_SPEC_THREAD_KEYRING: key_serial_t = -1;
3639
pub const KEY_SPEC_PROCESS_KEYRING: key_serial_t = -2;

src/keytypes/big_key.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
//! Big keys
2828
2929
use crate::keytype::*;
30+
use keyutils_raw::KEY_TYPE_BIG_KEY;
3031

3132
/// Big keys.
3233
///
@@ -42,6 +43,6 @@ impl KeyType for BigKey {
4243
type Payload = [u8];
4344

4445
fn name() -> &'static str {
45-
"big_key"
46+
KEY_TYPE_BIG_KEY
4647
}
4748
}

src/keytypes/keyring.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
//! Keyrings
2828
2929
use crate::keytype::*;
30+
use keyutils_raw::KEY_TYPE_KEYRING;
3031

3132
/// Keyrings contain other keys.
3233
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
@@ -39,6 +40,6 @@ impl KeyType for Keyring {
3940
type Payload = ();
4041

4142
fn name() -> &'static str {
42-
"keyring"
43+
KEY_TYPE_KEYRING
4344
}
4445
}

0 commit comments

Comments
 (0)