blk-crypto-profile.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright 2019 Google LLC
  4. */
  5. /**
  6. * DOC: blk-crypto profiles
  7. *
  8. * 'struct blk_crypto_profile' contains all generic inline encryption-related
  9. * state for a particular inline encryption device. blk_crypto_profile serves
  10. * as the way that drivers for inline encryption hardware expose their crypto
  11. * capabilities and certain functions (e.g., functions to program and evict
  12. * keys) to upper layers. Device drivers that want to support inline encryption
  13. * construct a crypto profile, then associate it with the disk's request_queue.
  14. *
  15. * If the device has keyslots, then its blk_crypto_profile also handles managing
  16. * these keyslots in a device-independent way, using the driver-provided
  17. * functions to program and evict keys as needed. This includes keeping track
  18. * of which key and how many I/O requests are using each keyslot, getting
  19. * keyslots for I/O requests, and handling key eviction requests.
  20. *
  21. * For more information, see Documentation/block/inline-encryption.rst.
  22. */
  23. #define pr_fmt(fmt) "blk-crypto: " fmt
  24. #include <linux/blk-crypto-profile.h>
  25. #include <linux/device.h>
  26. #include <linux/atomic.h>
  27. #include <linux/mutex.h>
  28. #include <linux/pm_runtime.h>
  29. #include <linux/wait.h>
  30. #include <linux/blkdev.h>
  31. #include <linux/blk-integrity.h>
  32. #include "blk-crypto-internal.h"
  33. struct blk_crypto_keyslot {
  34. atomic_t slot_refs;
  35. struct list_head idle_slot_node;
  36. struct hlist_node hash_node;
  37. const struct blk_crypto_key *key;
  38. struct blk_crypto_profile *profile;
  39. };
  40. static inline void blk_crypto_hw_enter(struct blk_crypto_profile *profile)
  41. {
  42. /*
  43. * Calling into the driver requires profile->lock held and the device
  44. * resumed. But we must resume the device first, since that can acquire
  45. * and release profile->lock via blk_crypto_reprogram_all_keys().
  46. */
  47. if (profile->dev)
  48. pm_runtime_get_sync(profile->dev);
  49. down_write(&profile->lock);
  50. }
  51. static inline void blk_crypto_hw_exit(struct blk_crypto_profile *profile)
  52. {
  53. up_write(&profile->lock);
  54. if (profile->dev)
  55. pm_runtime_put_sync(profile->dev);
  56. }
  57. /**
  58. * blk_crypto_profile_init() - Initialize a blk_crypto_profile
  59. * @profile: the blk_crypto_profile to initialize
  60. * @num_slots: the number of keyslots
  61. *
  62. * Storage drivers must call this when starting to set up a blk_crypto_profile,
  63. * before filling in additional fields.
  64. *
  65. * Return: 0 on success, or else a negative error code.
  66. */
  67. int blk_crypto_profile_init(struct blk_crypto_profile *profile,
  68. unsigned int num_slots)
  69. {
  70. unsigned int slot;
  71. unsigned int i;
  72. unsigned int slot_hashtable_size;
  73. memset(profile, 0, sizeof(*profile));
  74. /*
  75. * profile->lock of an underlying device can nest inside profile->lock
  76. * of a device-mapper device, so use a dynamic lock class to avoid
  77. * false-positive lockdep reports.
  78. */
  79. #ifdef CONFIG_LOCKDEP
  80. lockdep_register_key(&profile->lockdep_key);
  81. __init_rwsem(&profile->lock, "&profile->lock", &profile->lockdep_key);
  82. #else
  83. init_rwsem(&profile->lock);
  84. #endif
  85. if (num_slots == 0)
  86. return 0;
  87. /* Initialize keyslot management data. */
  88. profile->slots = kvcalloc(num_slots, sizeof(profile->slots[0]),
  89. GFP_KERNEL);
  90. if (!profile->slots)
  91. goto err_destroy;
  92. profile->num_slots = num_slots;
  93. init_waitqueue_head(&profile->idle_slots_wait_queue);
  94. INIT_LIST_HEAD(&profile->idle_slots);
  95. for (slot = 0; slot < num_slots; slot++) {
  96. profile->slots[slot].profile = profile;
  97. list_add_tail(&profile->slots[slot].idle_slot_node,
  98. &profile->idle_slots);
  99. }
  100. spin_lock_init(&profile->idle_slots_lock);
  101. slot_hashtable_size = roundup_pow_of_two(num_slots);
  102. /*
  103. * hash_ptr() assumes bits != 0, so ensure the hash table has at least 2
  104. * buckets. This only makes a difference when there is only 1 keyslot.
  105. */
  106. if (slot_hashtable_size < 2)
  107. slot_hashtable_size = 2;
  108. profile->log_slot_ht_size = ilog2(slot_hashtable_size);
  109. profile->slot_hashtable =
  110. kvmalloc_array(slot_hashtable_size,
  111. sizeof(profile->slot_hashtable[0]), GFP_KERNEL);
  112. if (!profile->slot_hashtable)
  113. goto err_destroy;
  114. for (i = 0; i < slot_hashtable_size; i++)
  115. INIT_HLIST_HEAD(&profile->slot_hashtable[i]);
  116. return 0;
  117. err_destroy:
  118. blk_crypto_profile_destroy(profile);
  119. return -ENOMEM;
  120. }
  121. EXPORT_SYMBOL_GPL(blk_crypto_profile_init);
  122. static void blk_crypto_profile_destroy_callback(void *profile)
  123. {
  124. blk_crypto_profile_destroy(profile);
  125. }
  126. /**
  127. * devm_blk_crypto_profile_init() - Resource-managed blk_crypto_profile_init()
  128. * @dev: the device which owns the blk_crypto_profile
  129. * @profile: the blk_crypto_profile to initialize
  130. * @num_slots: the number of keyslots
  131. *
  132. * Like blk_crypto_profile_init(), but causes blk_crypto_profile_destroy() to be
  133. * called automatically on driver detach.
  134. *
  135. * Return: 0 on success, or else a negative error code.
  136. */
  137. int devm_blk_crypto_profile_init(struct device *dev,
  138. struct blk_crypto_profile *profile,
  139. unsigned int num_slots)
  140. {
  141. int err = blk_crypto_profile_init(profile, num_slots);
  142. if (err)
  143. return err;
  144. return devm_add_action_or_reset(dev,
  145. blk_crypto_profile_destroy_callback,
  146. profile);
  147. }
  148. EXPORT_SYMBOL_GPL(devm_blk_crypto_profile_init);
  149. static inline struct hlist_head *
  150. blk_crypto_hash_bucket_for_key(struct blk_crypto_profile *profile,
  151. const struct blk_crypto_key *key)
  152. {
  153. return &profile->slot_hashtable[
  154. hash_ptr(key, profile->log_slot_ht_size)];
  155. }
  156. static void
  157. blk_crypto_remove_slot_from_lru_list(struct blk_crypto_keyslot *slot)
  158. {
  159. struct blk_crypto_profile *profile = slot->profile;
  160. unsigned long flags;
  161. spin_lock_irqsave(&profile->idle_slots_lock, flags);
  162. list_del(&slot->idle_slot_node);
  163. spin_unlock_irqrestore(&profile->idle_slots_lock, flags);
  164. }
  165. static struct blk_crypto_keyslot *
  166. blk_crypto_find_keyslot(struct blk_crypto_profile *profile,
  167. const struct blk_crypto_key *key)
  168. {
  169. const struct hlist_head *head =
  170. blk_crypto_hash_bucket_for_key(profile, key);
  171. struct blk_crypto_keyslot *slotp;
  172. hlist_for_each_entry(slotp, head, hash_node) {
  173. if (slotp->key == key)
  174. return slotp;
  175. }
  176. return NULL;
  177. }
  178. static struct blk_crypto_keyslot *
  179. blk_crypto_find_and_grab_keyslot(struct blk_crypto_profile *profile,
  180. const struct blk_crypto_key *key)
  181. {
  182. struct blk_crypto_keyslot *slot;
  183. slot = blk_crypto_find_keyslot(profile, key);
  184. if (!slot)
  185. return NULL;
  186. if (atomic_inc_return(&slot->slot_refs) == 1) {
  187. /* Took first reference to this slot; remove it from LRU list */
  188. blk_crypto_remove_slot_from_lru_list(slot);
  189. }
  190. return slot;
  191. }
  192. /**
  193. * blk_crypto_keyslot_index() - Get the index of a keyslot
  194. * @slot: a keyslot that blk_crypto_get_keyslot() returned
  195. *
  196. * Return: the 0-based index of the keyslot within the device's keyslots.
  197. */
  198. unsigned int blk_crypto_keyslot_index(struct blk_crypto_keyslot *slot)
  199. {
  200. return slot - slot->profile->slots;
  201. }
  202. EXPORT_SYMBOL_GPL(blk_crypto_keyslot_index);
  203. /**
  204. * blk_crypto_get_keyslot() - Get a keyslot for a key, if needed.
  205. * @profile: the crypto profile of the device the key will be used on
  206. * @key: the key that will be used
  207. * @slot_ptr: If a keyslot is allocated, an opaque pointer to the keyslot struct
  208. * will be stored here; otherwise NULL will be stored here.
  209. *
  210. * If the device has keyslots, this gets a keyslot that's been programmed with
  211. * the specified key. If the key is already in a slot, this reuses it;
  212. * otherwise this waits for a slot to become idle and programs the key into it.
  213. *
  214. * This must be paired with a call to blk_crypto_put_keyslot().
  215. *
  216. * Context: Process context. Takes and releases profile->lock.
  217. * Return: BLK_STS_OK on success, meaning that either a keyslot was allocated or
  218. * one wasn't needed; or a blk_status_t error on failure.
  219. */
  220. blk_status_t blk_crypto_get_keyslot(struct blk_crypto_profile *profile,
  221. const struct blk_crypto_key *key,
  222. struct blk_crypto_keyslot **slot_ptr)
  223. {
  224. struct blk_crypto_keyslot *slot;
  225. int slot_idx;
  226. int err;
  227. *slot_ptr = NULL;
  228. /*
  229. * If the device has no concept of "keyslots", then there is no need to
  230. * get one.
  231. */
  232. if (profile->num_slots == 0)
  233. return BLK_STS_OK;
  234. down_read(&profile->lock);
  235. slot = blk_crypto_find_and_grab_keyslot(profile, key);
  236. up_read(&profile->lock);
  237. if (slot)
  238. goto success;
  239. for (;;) {
  240. blk_crypto_hw_enter(profile);
  241. slot = blk_crypto_find_and_grab_keyslot(profile, key);
  242. if (slot) {
  243. blk_crypto_hw_exit(profile);
  244. goto success;
  245. }
  246. /*
  247. * If we're here, that means there wasn't a slot that was
  248. * already programmed with the key. So try to program it.
  249. */
  250. if (!list_empty(&profile->idle_slots))
  251. break;
  252. blk_crypto_hw_exit(profile);
  253. wait_event(profile->idle_slots_wait_queue,
  254. !list_empty(&profile->idle_slots));
  255. }
  256. slot = list_first_entry(&profile->idle_slots, struct blk_crypto_keyslot,
  257. idle_slot_node);
  258. slot_idx = blk_crypto_keyslot_index(slot);
  259. err = profile->ll_ops.keyslot_program(profile, key, slot_idx);
  260. if (err) {
  261. wake_up(&profile->idle_slots_wait_queue);
  262. blk_crypto_hw_exit(profile);
  263. return errno_to_blk_status(err);
  264. }
  265. /* Move this slot to the hash list for the new key. */
  266. if (slot->key)
  267. hlist_del(&slot->hash_node);
  268. slot->key = key;
  269. hlist_add_head(&slot->hash_node,
  270. blk_crypto_hash_bucket_for_key(profile, key));
  271. atomic_set(&slot->slot_refs, 1);
  272. blk_crypto_remove_slot_from_lru_list(slot);
  273. blk_crypto_hw_exit(profile);
  274. success:
  275. *slot_ptr = slot;
  276. return BLK_STS_OK;
  277. }
  278. /**
  279. * blk_crypto_put_keyslot() - Release a reference to a keyslot
  280. * @slot: The keyslot to release the reference of (may be NULL).
  281. *
  282. * Context: Any context.
  283. */
  284. void blk_crypto_put_keyslot(struct blk_crypto_keyslot *slot)
  285. {
  286. struct blk_crypto_profile *profile;
  287. unsigned long flags;
  288. if (!slot)
  289. return;
  290. profile = slot->profile;
  291. if (atomic_dec_and_lock_irqsave(&slot->slot_refs,
  292. &profile->idle_slots_lock, flags)) {
  293. list_add_tail(&slot->idle_slot_node, &profile->idle_slots);
  294. spin_unlock_irqrestore(&profile->idle_slots_lock, flags);
  295. wake_up(&profile->idle_slots_wait_queue);
  296. }
  297. }
  298. /**
  299. * __blk_crypto_cfg_supported() - Check whether the given crypto profile
  300. * supports the given crypto configuration.
  301. * @profile: the crypto profile to check
  302. * @cfg: the crypto configuration to check for
  303. *
  304. * Return: %true if @profile supports the given @cfg.
  305. */
  306. bool __blk_crypto_cfg_supported(struct blk_crypto_profile *profile,
  307. const struct blk_crypto_config *cfg)
  308. {
  309. if (!profile)
  310. return false;
  311. if (!(profile->modes_supported[cfg->crypto_mode] & cfg->data_unit_size))
  312. return false;
  313. if (profile->max_dun_bytes_supported < cfg->dun_bytes)
  314. return false;
  315. if (!(profile->key_types_supported & cfg->key_type))
  316. return false;
  317. return true;
  318. }
  319. /*
  320. * This is an internal function that evicts a key from an inline encryption
  321. * device that can be either a real device or the blk-crypto-fallback "device".
  322. * It is used only by blk_crypto_evict_key(); see that function for details.
  323. */
  324. int __blk_crypto_evict_key(struct blk_crypto_profile *profile,
  325. const struct blk_crypto_key *key)
  326. {
  327. struct blk_crypto_keyslot *slot;
  328. int err;
  329. if (profile->num_slots == 0) {
  330. if (profile->ll_ops.keyslot_evict) {
  331. blk_crypto_hw_enter(profile);
  332. err = profile->ll_ops.keyslot_evict(profile, key, -1);
  333. blk_crypto_hw_exit(profile);
  334. return err;
  335. }
  336. return 0;
  337. }
  338. blk_crypto_hw_enter(profile);
  339. slot = blk_crypto_find_keyslot(profile, key);
  340. if (!slot) {
  341. /*
  342. * Not an error, since a key not in use by I/O is not guaranteed
  343. * to be in a keyslot. There can be more keys than keyslots.
  344. */
  345. err = 0;
  346. goto out;
  347. }
  348. if (WARN_ON_ONCE(atomic_read(&slot->slot_refs) != 0)) {
  349. /* BUG: key is still in use by I/O */
  350. err = -EBUSY;
  351. goto out_remove;
  352. }
  353. err = profile->ll_ops.keyslot_evict(profile, key,
  354. blk_crypto_keyslot_index(slot));
  355. out_remove:
  356. /*
  357. * Callers free the key even on error, so unlink the key from the hash
  358. * table and clear slot->key even on error.
  359. */
  360. hlist_del(&slot->hash_node);
  361. slot->key = NULL;
  362. out:
  363. blk_crypto_hw_exit(profile);
  364. return err;
  365. }
  366. /**
  367. * blk_crypto_reprogram_all_keys() - Re-program all keyslots.
  368. * @profile: The crypto profile
  369. *
  370. * Re-program all keyslots that are supposed to have a key programmed. This is
  371. * intended only for use by drivers for hardware that loses its keys on reset.
  372. *
  373. * Context: Process context. Takes and releases profile->lock.
  374. */
  375. void blk_crypto_reprogram_all_keys(struct blk_crypto_profile *profile)
  376. {
  377. unsigned int slot;
  378. if (profile->num_slots == 0)
  379. return;
  380. /* This is for device initialization, so don't resume the device */
  381. down_write(&profile->lock);
  382. for (slot = 0; slot < profile->num_slots; slot++) {
  383. const struct blk_crypto_key *key = profile->slots[slot].key;
  384. int err;
  385. if (!key)
  386. continue;
  387. err = profile->ll_ops.keyslot_program(profile, key, slot);
  388. WARN_ON(err);
  389. }
  390. up_write(&profile->lock);
  391. }
  392. EXPORT_SYMBOL_GPL(blk_crypto_reprogram_all_keys);
  393. void blk_crypto_profile_destroy(struct blk_crypto_profile *profile)
  394. {
  395. if (!profile)
  396. return;
  397. #ifdef CONFIG_LOCKDEP
  398. lockdep_unregister_key(&profile->lockdep_key);
  399. #endif
  400. kvfree(profile->slot_hashtable);
  401. kvfree_sensitive(profile->slots,
  402. sizeof(profile->slots[0]) * profile->num_slots);
  403. memzero_explicit(profile, sizeof(*profile));
  404. }
  405. EXPORT_SYMBOL_GPL(blk_crypto_profile_destroy);
  406. bool blk_crypto_register(struct blk_crypto_profile *profile,
  407. struct request_queue *q)
  408. {
  409. if (blk_integrity_queue_supports_integrity(q)) {
  410. pr_warn("Integrity and hardware inline encryption are not supported together. Disabling hardware inline encryption.\n");
  411. return false;
  412. }
  413. q->crypto_profile = profile;
  414. return true;
  415. }
  416. EXPORT_SYMBOL_GPL(blk_crypto_register);
  417. /**
  418. * blk_crypto_derive_sw_secret() - Derive software secret from wrapped key
  419. * @bdev: a block device that supports hardware-wrapped keys
  420. * @eph_key: the hardware-wrapped key in ephemerally-wrapped form
  421. * @eph_key_size: size of @eph_key in bytes
  422. * @sw_secret: (output) the software secret
  423. *
  424. * Given a hardware-wrapped key in ephemerally-wrapped form (the same form that
  425. * it is used for I/O), ask the hardware to derive the secret which software can
  426. * use for cryptographic tasks other than inline encryption. This secret is
  427. * guaranteed to be cryptographically isolated from the inline encryption key,
  428. * i.e. derived with a different KDF context.
  429. *
  430. * Return: 0 on success, -EOPNOTSUPP if the block device doesn't support
  431. * hardware-wrapped keys, -EBADMSG if the key isn't a valid
  432. * hardware-wrapped key, or another -errno code.
  433. */
  434. int blk_crypto_derive_sw_secret(struct block_device *bdev,
  435. const u8 *eph_key, size_t eph_key_size,
  436. u8 sw_secret[BLK_CRYPTO_SW_SECRET_SIZE])
  437. {
  438. struct blk_crypto_profile *profile =
  439. bdev_get_queue(bdev)->crypto_profile;
  440. int err;
  441. if (!profile)
  442. return -EOPNOTSUPP;
  443. if (!(profile->key_types_supported & BLK_CRYPTO_KEY_TYPE_HW_WRAPPED))
  444. return -EOPNOTSUPP;
  445. if (!profile->ll_ops.derive_sw_secret)
  446. return -EOPNOTSUPP;
  447. blk_crypto_hw_enter(profile);
  448. err = profile->ll_ops.derive_sw_secret(profile, eph_key, eph_key_size,
  449. sw_secret);
  450. blk_crypto_hw_exit(profile);
  451. return err;
  452. }
  453. EXPORT_SYMBOL_GPL(blk_crypto_derive_sw_secret);
  454. /**
  455. * blk_crypto_intersect_capabilities() - restrict supported crypto capabilities
  456. * by child device
  457. * @parent: the crypto profile for the parent device
  458. * @child: the crypto profile for the child device, or NULL
  459. *
  460. * This clears all crypto capabilities in @parent that aren't set in @child. If
  461. * @child is NULL, then this clears all parent capabilities.
  462. *
  463. * Only use this when setting up the crypto profile for a layered device, before
  464. * it's been exposed yet.
  465. */
  466. void blk_crypto_intersect_capabilities(struct blk_crypto_profile *parent,
  467. const struct blk_crypto_profile *child)
  468. {
  469. if (child) {
  470. unsigned int i;
  471. parent->max_dun_bytes_supported =
  472. min(parent->max_dun_bytes_supported,
  473. child->max_dun_bytes_supported);
  474. for (i = 0; i < ARRAY_SIZE(child->modes_supported); i++)
  475. parent->modes_supported[i] &= child->modes_supported[i];
  476. parent->key_types_supported &= child->key_types_supported;
  477. } else {
  478. parent->max_dun_bytes_supported = 0;
  479. memset(parent->modes_supported, 0,
  480. sizeof(parent->modes_supported));
  481. parent->key_types_supported = 0;
  482. }
  483. }
  484. EXPORT_SYMBOL_GPL(blk_crypto_intersect_capabilities);
  485. /**
  486. * blk_crypto_has_capabilities() - Check whether @target supports at least all
  487. * the crypto capabilities that @reference does.
  488. * @target: the target profile
  489. * @reference: the reference profile
  490. *
  491. * Return: %true if @target supports all the crypto capabilities of @reference.
  492. */
  493. bool blk_crypto_has_capabilities(const struct blk_crypto_profile *target,
  494. const struct blk_crypto_profile *reference)
  495. {
  496. int i;
  497. if (!reference)
  498. return true;
  499. if (!target)
  500. return false;
  501. for (i = 0; i < ARRAY_SIZE(target->modes_supported); i++) {
  502. if (reference->modes_supported[i] & ~target->modes_supported[i])
  503. return false;
  504. }
  505. if (reference->max_dun_bytes_supported >
  506. target->max_dun_bytes_supported)
  507. return false;
  508. if (reference->key_types_supported & ~target->key_types_supported)
  509. return false;
  510. return true;
  511. }
  512. EXPORT_SYMBOL_GPL(blk_crypto_has_capabilities);
  513. /**
  514. * blk_crypto_update_capabilities() - Update the capabilities of a crypto
  515. * profile to match those of another crypto
  516. * profile.
  517. * @dst: The crypto profile whose capabilities to update.
  518. * @src: The crypto profile whose capabilities this function will update @dst's
  519. * capabilities to.
  520. *
  521. * Blk-crypto requires that crypto capabilities that were
  522. * advertised when a bio was created continue to be supported by the
  523. * device until that bio is ended. This is turn means that a device cannot
  524. * shrink its advertised crypto capabilities without any explicit
  525. * synchronization with upper layers. So if there's no such explicit
  526. * synchronization, @src must support all the crypto capabilities that
  527. * @dst does (i.e. we need blk_crypto_has_capabilities(@src, @dst)).
  528. *
  529. * Note also that as long as the crypto capabilities are being expanded, the
  530. * order of updates becoming visible is not important because it's alright
  531. * for blk-crypto to see stale values - they only cause blk-crypto to
  532. * believe that a crypto capability isn't supported when it actually is (which
  533. * might result in blk-crypto-fallback being used if available, or the bio being
  534. * failed).
  535. */
  536. void blk_crypto_update_capabilities(struct blk_crypto_profile *dst,
  537. const struct blk_crypto_profile *src)
  538. {
  539. memcpy(dst->modes_supported, src->modes_supported,
  540. sizeof(dst->modes_supported));
  541. dst->max_dun_bytes_supported = src->max_dun_bytes_supported;
  542. dst->key_types_supported = src->key_types_supported;
  543. }
  544. EXPORT_SYMBOL_GPL(blk_crypto_update_capabilities);