Lines Matching +full:dynamic +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-only
90 var.name = kcalloc(key_len - 1, sizeof(wchar_t), GFP_KERNEL); in plpks_get_variable()
92 return -ENOMEM; in plpks_get_variable()
93 rc = utf8s_to_utf16s(key, key_len - 1, UTF16_LITTLE_ENDIAN, (wchar_t *)var.name, in plpks_get_variable()
94 key_len - 1); in plpks_get_variable()
113 if (rc && rc != -ENOENT) { in plpks_get_variable()
115 // Return -EIO since userspace probably doesn't care about the in plpks_get_variable()
117 rc = -EIO; in plpks_get_variable()
132 return -EINVAL; in plpks_set_variable()
136 var.name = kcalloc(key_len - 1, sizeof(wchar_t), GFP_KERNEL); in plpks_set_variable()
138 return -ENOMEM; in plpks_set_variable()
139 rc = utf8s_to_utf16s(key, key_len - 1, UTF16_LITTLE_ENDIAN, (wchar_t *)var.name, in plpks_set_variable()
140 key_len - 1); in plpks_set_variable()
145 // Flags are contained in the first 8 bytes of the buffer, and are always big-endian in plpks_set_variable()
148 var.datalen = data_size - sizeof(flags); in plpks_set_variable()
154 // userspace on write, so we return it rather than just -EIO in plpks_set_variable()
163 * Return the key management mode.
167 * indicates that the key management mode is dynamic. Any failure in
168 * reading SB_VERSION defaults the key management mode to static. The error
169 * codes -ENOENT or -EPERM are expected in static key management mode. An
173 * Return 0 to indicate that the key management mode is static. Otherwise
174 * return the SB_VERSION value to indicate that the key management mode is
175 * dynamic.
179 u8 mode; in plpks_get_sb_keymgmt_mode() local
186 .data = &mode, in plpks_get_sb_keymgmt_mode()
191 if (rc != -ENOENT && rc != -EPERM) in plpks_get_sb_keymgmt_mode()
193 mode = 0; in plpks_get_sb_keymgmt_mode()
195 return mode; in plpks_get_sb_keymgmt_mode()
199 * PLPKS dynamic secure boot doesn't give us a format string in the same way
202 * "ibm,plpks-sb-v<n>" or "ibm,plpks-sb-v0", based on the key management mode,
207 u8 mode; in plpks_secvar_format() local
209 mode = plpks_get_sb_keymgmt_mode(); in plpks_secvar_format()
210 return snprintf(buf, bufsize, "ibm,plpks-sb-v%hhu", mode); in plpks_secvar_format()
243 u8 mode; in plpks_secvar_init() local
246 return -ENODEV; in plpks_secvar_init()
248 mode = plpks_get_sb_keymgmt_mode(); in plpks_secvar_init()
249 if (mode) in plpks_secvar_init()