blk-crypto.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright 2019 Google LLC
  4. */
  5. /*
  6. * Refer to Documentation/block/inline-encryption.rst for detailed explanation.
  7. */
  8. #define pr_fmt(fmt) "blk-crypto: " fmt
  9. #include <linux/bio.h>
  10. #include <linux/blkdev.h>
  11. #include <linux/blk-crypto-profile.h>
  12. #include <linux/module.h>
  13. #include <linux/ratelimit.h>
  14. #include <linux/slab.h>
  15. #include "blk-crypto-internal.h"
  16. const struct blk_crypto_mode blk_crypto_modes[] = {
  17. [BLK_ENCRYPTION_MODE_AES_256_XTS] = {
  18. .name = "AES-256-XTS",
  19. .cipher_str = "xts(aes)",
  20. .keysize = 64,
  21. .security_strength = 32,
  22. .ivsize = 16,
  23. },
  24. [BLK_ENCRYPTION_MODE_AES_128_CBC_ESSIV] = {
  25. .name = "AES-128-CBC-ESSIV",
  26. .cipher_str = "essiv(cbc(aes),sha256)",
  27. .keysize = 16,
  28. .security_strength = 16,
  29. .ivsize = 16,
  30. },
  31. [BLK_ENCRYPTION_MODE_ADIANTUM] = {
  32. .name = "Adiantum",
  33. .cipher_str = "adiantum(xchacha12,aes)",
  34. .keysize = 32,
  35. .security_strength = 32,
  36. .ivsize = 32,
  37. },
  38. [BLK_ENCRYPTION_MODE_SM4_XTS] = {
  39. .name = "SM4-XTS",
  40. .cipher_str = "xts(sm4)",
  41. .keysize = 32,
  42. .security_strength = 16,
  43. .ivsize = 16,
  44. },
  45. };
  46. /*
  47. * This number needs to be at least (the number of threads doing IO
  48. * concurrently) * (maximum recursive depth of a bio), so that we don't
  49. * deadlock on crypt_ctx allocations. The default is chosen to be the same
  50. * as the default number of post read contexts in both EXT4 and F2FS.
  51. */
  52. static int num_prealloc_crypt_ctxs = 128;
  53. module_param(num_prealloc_crypt_ctxs, int, 0444);
  54. MODULE_PARM_DESC(num_prealloc_crypt_ctxs,
  55. "Number of bio crypto contexts to preallocate");
  56. static struct kmem_cache *bio_crypt_ctx_cache;
  57. static mempool_t *bio_crypt_ctx_pool;
  58. static int __init bio_crypt_ctx_init(void)
  59. {
  60. size_t i;
  61. bio_crypt_ctx_cache = KMEM_CACHE(bio_crypt_ctx, 0);
  62. if (!bio_crypt_ctx_cache)
  63. goto out_no_mem;
  64. bio_crypt_ctx_pool = mempool_create_slab_pool(num_prealloc_crypt_ctxs,
  65. bio_crypt_ctx_cache);
  66. if (!bio_crypt_ctx_pool)
  67. goto out_no_mem;
  68. /* This is assumed in various places. */
  69. BUILD_BUG_ON(BLK_ENCRYPTION_MODE_INVALID != 0);
  70. /*
  71. * Validate the crypto mode properties. This ideally would be done with
  72. * static assertions, but boot-time checks are the next best thing.
  73. */
  74. for (i = 0; i < BLK_ENCRYPTION_MODE_MAX; i++) {
  75. BUG_ON(blk_crypto_modes[i].keysize >
  76. BLK_CRYPTO_MAX_RAW_KEY_SIZE);
  77. BUG_ON(blk_crypto_modes[i].security_strength >
  78. blk_crypto_modes[i].keysize);
  79. BUG_ON(blk_crypto_modes[i].ivsize > BLK_CRYPTO_MAX_IV_SIZE);
  80. }
  81. return 0;
  82. out_no_mem:
  83. panic("Failed to allocate mem for bio crypt ctxs\n");
  84. }
  85. subsys_initcall(bio_crypt_ctx_init);
  86. void bio_crypt_set_ctx(struct bio *bio, const struct blk_crypto_key *key,
  87. const u64 dun[BLK_CRYPTO_DUN_ARRAY_SIZE], gfp_t gfp_mask)
  88. {
  89. struct bio_crypt_ctx *bc;
  90. /*
  91. * The caller must use a gfp_mask that contains __GFP_DIRECT_RECLAIM so
  92. * that the mempool_alloc() can't fail.
  93. */
  94. WARN_ON_ONCE(!(gfp_mask & __GFP_DIRECT_RECLAIM));
  95. bc = mempool_alloc(bio_crypt_ctx_pool, gfp_mask);
  96. bc->bc_key = key;
  97. memcpy(bc->bc_dun, dun, sizeof(bc->bc_dun));
  98. bio->bi_crypt_context = bc;
  99. }
  100. void __bio_crypt_free_ctx(struct bio *bio)
  101. {
  102. mempool_free(bio->bi_crypt_context, bio_crypt_ctx_pool);
  103. bio->bi_crypt_context = NULL;
  104. }
  105. int __bio_crypt_clone(struct bio *dst, struct bio *src, gfp_t gfp_mask)
  106. {
  107. dst->bi_crypt_context = mempool_alloc(bio_crypt_ctx_pool, gfp_mask);
  108. if (!dst->bi_crypt_context)
  109. return -ENOMEM;
  110. *dst->bi_crypt_context = *src->bi_crypt_context;
  111. return 0;
  112. }
  113. /* Increments @dun by @inc, treating @dun as a multi-limb integer. */
  114. void bio_crypt_dun_increment(u64 dun[BLK_CRYPTO_DUN_ARRAY_SIZE],
  115. unsigned int inc)
  116. {
  117. int i;
  118. for (i = 0; inc && i < BLK_CRYPTO_DUN_ARRAY_SIZE; i++) {
  119. dun[i] += inc;
  120. /*
  121. * If the addition in this limb overflowed, then we need to
  122. * carry 1 into the next limb. Else the carry is 0.
  123. */
  124. if (dun[i] < inc)
  125. inc = 1;
  126. else
  127. inc = 0;
  128. }
  129. }
  130. void __bio_crypt_advance(struct bio *bio, unsigned int bytes)
  131. {
  132. struct bio_crypt_ctx *bc = bio->bi_crypt_context;
  133. bio_crypt_dun_increment(bc->bc_dun,
  134. bytes >> bc->bc_key->data_unit_size_bits);
  135. }
  136. /*
  137. * Returns true if @bc->bc_dun plus @bytes converted to data units is equal to
  138. * @next_dun, treating the DUNs as multi-limb integers.
  139. */
  140. bool bio_crypt_dun_is_contiguous(const struct bio_crypt_ctx *bc,
  141. unsigned int bytes,
  142. const u64 next_dun[BLK_CRYPTO_DUN_ARRAY_SIZE])
  143. {
  144. int i;
  145. unsigned int carry = bytes >> bc->bc_key->data_unit_size_bits;
  146. for (i = 0; i < BLK_CRYPTO_DUN_ARRAY_SIZE; i++) {
  147. if (bc->bc_dun[i] + carry != next_dun[i])
  148. return false;
  149. /*
  150. * If the addition in this limb overflowed, then we need to
  151. * carry 1 into the next limb. Else the carry is 0.
  152. */
  153. if ((bc->bc_dun[i] + carry) < carry)
  154. carry = 1;
  155. else
  156. carry = 0;
  157. }
  158. /* If the DUN wrapped through 0, don't treat it as contiguous. */
  159. return carry == 0;
  160. }
  161. /*
  162. * Checks that two bio crypt contexts are compatible - i.e. that
  163. * they are mergeable except for data_unit_num continuity.
  164. */
  165. static bool bio_crypt_ctx_compatible(struct bio_crypt_ctx *bc1,
  166. struct bio_crypt_ctx *bc2)
  167. {
  168. if (!bc1)
  169. return !bc2;
  170. return bc2 && bc1->bc_key == bc2->bc_key;
  171. }
  172. bool bio_crypt_rq_ctx_compatible(struct request *rq, struct bio *bio)
  173. {
  174. return bio_crypt_ctx_compatible(rq->crypt_ctx, bio->bi_crypt_context);
  175. }
  176. /*
  177. * Checks that two bio crypt contexts are compatible, and also
  178. * that their data_unit_nums are continuous (and can hence be merged)
  179. * in the order @bc1 followed by @bc2.
  180. */
  181. bool bio_crypt_ctx_mergeable(struct bio_crypt_ctx *bc1, unsigned int bc1_bytes,
  182. struct bio_crypt_ctx *bc2)
  183. {
  184. if (!bio_crypt_ctx_compatible(bc1, bc2))
  185. return false;
  186. return !bc1 || bio_crypt_dun_is_contiguous(bc1, bc1_bytes, bc2->bc_dun);
  187. }
  188. blk_status_t __blk_crypto_rq_get_keyslot(struct request *rq)
  189. {
  190. return blk_crypto_get_keyslot(rq->q->crypto_profile,
  191. rq->crypt_ctx->bc_key,
  192. &rq->crypt_keyslot);
  193. }
  194. void __blk_crypto_rq_put_keyslot(struct request *rq)
  195. {
  196. blk_crypto_put_keyslot(rq->crypt_keyslot);
  197. rq->crypt_keyslot = NULL;
  198. }
  199. void __blk_crypto_free_request(struct request *rq)
  200. {
  201. /* The keyslot, if one was needed, should have been released earlier. */
  202. if (WARN_ON_ONCE(rq->crypt_keyslot))
  203. __blk_crypto_rq_put_keyslot(rq);
  204. mempool_free(rq->crypt_ctx, bio_crypt_ctx_pool);
  205. rq->crypt_ctx = NULL;
  206. }
  207. /*
  208. * Process a bio with a crypto context. Returns true if the caller should
  209. * submit the passed in bio, false if the bio is consumed.
  210. *
  211. * See the kerneldoc comment for blk_crypto_submit_bio for further details.
  212. */
  213. bool __blk_crypto_submit_bio(struct bio *bio)
  214. {
  215. const struct blk_crypto_key *bc_key = bio->bi_crypt_context->bc_key;
  216. struct block_device *bdev = bio->bi_bdev;
  217. /* Error if bio has no data. */
  218. if (WARN_ON_ONCE(!bio_has_data(bio))) {
  219. bio_io_error(bio);
  220. return false;
  221. }
  222. /*
  223. * If the device does not natively support the encryption context, try to use
  224. * the fallback if available.
  225. */
  226. if (!blk_crypto_config_supported_natively(bdev, &bc_key->crypto_cfg)) {
  227. if (!IS_ENABLED(CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK)) {
  228. pr_warn_once("%pg: crypto API fallback disabled; failing request.\n",
  229. bdev);
  230. bio->bi_status = BLK_STS_NOTSUPP;
  231. bio_endio(bio);
  232. return false;
  233. }
  234. return blk_crypto_fallback_bio_prep(bio);
  235. }
  236. return true;
  237. }
  238. EXPORT_SYMBOL_GPL(__blk_crypto_submit_bio);
  239. int __blk_crypto_rq_bio_prep(struct request *rq, struct bio *bio,
  240. gfp_t gfp_mask)
  241. {
  242. if (!rq->crypt_ctx) {
  243. rq->crypt_ctx = mempool_alloc(bio_crypt_ctx_pool, gfp_mask);
  244. if (!rq->crypt_ctx)
  245. return -ENOMEM;
  246. }
  247. *rq->crypt_ctx = *bio->bi_crypt_context;
  248. return 0;
  249. }
  250. /**
  251. * blk_crypto_init_key() - Prepare a key for use with blk-crypto
  252. * @blk_key: Pointer to the blk_crypto_key to initialize.
  253. * @key_bytes: the bytes of the key
  254. * @key_size: size of the key in bytes
  255. * @key_type: type of the key -- either raw or hardware-wrapped
  256. * @crypto_mode: identifier for the encryption algorithm to use
  257. * @dun_bytes: number of bytes that will be used to specify the DUN when this
  258. * key is used
  259. * @data_unit_size: the data unit size to use for en/decryption
  260. *
  261. * Return: 0 on success, -errno on failure. The caller is responsible for
  262. * zeroizing both blk_key and key_bytes when done with them.
  263. */
  264. int blk_crypto_init_key(struct blk_crypto_key *blk_key,
  265. const u8 *key_bytes, size_t key_size,
  266. enum blk_crypto_key_type key_type,
  267. enum blk_crypto_mode_num crypto_mode,
  268. unsigned int dun_bytes,
  269. unsigned int data_unit_size)
  270. {
  271. const struct blk_crypto_mode *mode;
  272. memset(blk_key, 0, sizeof(*blk_key));
  273. if (crypto_mode >= ARRAY_SIZE(blk_crypto_modes))
  274. return -EINVAL;
  275. mode = &blk_crypto_modes[crypto_mode];
  276. switch (key_type) {
  277. case BLK_CRYPTO_KEY_TYPE_RAW:
  278. if (key_size != mode->keysize)
  279. return -EINVAL;
  280. break;
  281. case BLK_CRYPTO_KEY_TYPE_HW_WRAPPED:
  282. if (key_size < mode->security_strength ||
  283. key_size > BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE)
  284. return -EINVAL;
  285. break;
  286. default:
  287. return -EINVAL;
  288. }
  289. if (dun_bytes == 0 || dun_bytes > mode->ivsize)
  290. return -EINVAL;
  291. if (!is_power_of_2(data_unit_size))
  292. return -EINVAL;
  293. blk_key->crypto_cfg.crypto_mode = crypto_mode;
  294. blk_key->crypto_cfg.dun_bytes = dun_bytes;
  295. blk_key->crypto_cfg.data_unit_size = data_unit_size;
  296. blk_key->crypto_cfg.key_type = key_type;
  297. blk_key->data_unit_size_bits = ilog2(data_unit_size);
  298. blk_key->size = key_size;
  299. memcpy(blk_key->bytes, key_bytes, key_size);
  300. return 0;
  301. }
  302. bool blk_crypto_config_supported_natively(struct block_device *bdev,
  303. const struct blk_crypto_config *cfg)
  304. {
  305. return __blk_crypto_cfg_supported(bdev_get_queue(bdev)->crypto_profile,
  306. cfg);
  307. }
  308. /*
  309. * Check if bios with @cfg can be en/decrypted by blk-crypto (i.e. either the
  310. * block_device it's submitted to supports inline crypto, or the
  311. * blk-crypto-fallback is enabled and supports the cfg).
  312. */
  313. bool blk_crypto_config_supported(struct block_device *bdev,
  314. const struct blk_crypto_config *cfg)
  315. {
  316. if (IS_ENABLED(CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK) &&
  317. cfg->key_type == BLK_CRYPTO_KEY_TYPE_RAW)
  318. return true;
  319. return blk_crypto_config_supported_natively(bdev, cfg);
  320. }
  321. /**
  322. * blk_crypto_start_using_key() - Start using a blk_crypto_key on a device
  323. * @bdev: block device to operate on
  324. * @key: A key to use on the device
  325. *
  326. * Upper layers must call this function to ensure that either the hardware
  327. * supports the key's crypto settings, or the crypto API fallback has transforms
  328. * for the needed mode allocated and ready to go. This function may allocate
  329. * an skcipher, and *should not* be called from the data path, since that might
  330. * cause a deadlock
  331. *
  332. * Return: 0 on success; -EOPNOTSUPP if the key is wrapped but the hardware does
  333. * not support wrapped keys; -ENOPKG if the key is a raw key but the
  334. * hardware does not support raw keys and blk-crypto-fallback is either
  335. * disabled or the needed algorithm is disabled in the crypto API; or
  336. * another -errno code if something else went wrong.
  337. */
  338. int blk_crypto_start_using_key(struct block_device *bdev,
  339. const struct blk_crypto_key *key)
  340. {
  341. if (blk_crypto_config_supported_natively(bdev, &key->crypto_cfg))
  342. return 0;
  343. if (key->crypto_cfg.key_type != BLK_CRYPTO_KEY_TYPE_RAW) {
  344. pr_warn_ratelimited("%pg: no support for wrapped keys\n", bdev);
  345. return -EOPNOTSUPP;
  346. }
  347. return blk_crypto_fallback_start_using_mode(key->crypto_cfg.crypto_mode);
  348. }
  349. /**
  350. * blk_crypto_evict_key() - Evict a blk_crypto_key from a block_device
  351. * @bdev: a block_device on which I/O using the key may have been done
  352. * @key: the key to evict
  353. *
  354. * For a given block_device, this function removes the given blk_crypto_key from
  355. * the keyslot management structures and evicts it from any underlying hardware
  356. * keyslot(s) or blk-crypto-fallback keyslot it may have been programmed into.
  357. *
  358. * Upper layers must call this before freeing the blk_crypto_key. It must be
  359. * called for every block_device the key may have been used on. The key must no
  360. * longer be in use by any I/O when this function is called.
  361. *
  362. * Context: May sleep.
  363. */
  364. void blk_crypto_evict_key(struct block_device *bdev,
  365. const struct blk_crypto_key *key)
  366. {
  367. struct request_queue *q = bdev_get_queue(bdev);
  368. int err;
  369. if (blk_crypto_config_supported_natively(bdev, &key->crypto_cfg))
  370. err = __blk_crypto_evict_key(q->crypto_profile, key);
  371. else
  372. err = blk_crypto_fallback_evict_key(key);
  373. /*
  374. * An error can only occur here if the key failed to be evicted from a
  375. * keyslot (due to a hardware or driver issue) or is allegedly still in
  376. * use by I/O (due to a kernel bug). Even in these cases, the key is
  377. * still unlinked from the keyslot management structures, and the caller
  378. * is allowed and expected to free it right away. There's nothing
  379. * callers can do to handle errors, so just log them and return void.
  380. */
  381. if (err)
  382. pr_warn_ratelimited("%pg: error %d evicting key\n", bdev, err);
  383. }
  384. EXPORT_SYMBOL_GPL(blk_crypto_evict_key);
  385. static int blk_crypto_ioctl_import_key(struct blk_crypto_profile *profile,
  386. void __user *argp)
  387. {
  388. struct blk_crypto_import_key_arg arg;
  389. u8 raw_key[BLK_CRYPTO_MAX_RAW_KEY_SIZE];
  390. u8 lt_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE];
  391. int ret;
  392. if (copy_from_user(&arg, argp, sizeof(arg)))
  393. return -EFAULT;
  394. if (memchr_inv(arg.reserved, 0, sizeof(arg.reserved)))
  395. return -EINVAL;
  396. if (arg.raw_key_size < 16 || arg.raw_key_size > sizeof(raw_key))
  397. return -EINVAL;
  398. if (copy_from_user(raw_key, u64_to_user_ptr(arg.raw_key_ptr),
  399. arg.raw_key_size)) {
  400. ret = -EFAULT;
  401. goto out;
  402. }
  403. ret = blk_crypto_import_key(profile, raw_key, arg.raw_key_size, lt_key);
  404. if (ret < 0)
  405. goto out;
  406. if (ret > arg.lt_key_size) {
  407. ret = -EOVERFLOW;
  408. goto out;
  409. }
  410. arg.lt_key_size = ret;
  411. if (copy_to_user(u64_to_user_ptr(arg.lt_key_ptr), lt_key,
  412. arg.lt_key_size) ||
  413. copy_to_user(argp, &arg, sizeof(arg))) {
  414. ret = -EFAULT;
  415. goto out;
  416. }
  417. ret = 0;
  418. out:
  419. memzero_explicit(raw_key, sizeof(raw_key));
  420. memzero_explicit(lt_key, sizeof(lt_key));
  421. return ret;
  422. }
  423. static int blk_crypto_ioctl_generate_key(struct blk_crypto_profile *profile,
  424. void __user *argp)
  425. {
  426. struct blk_crypto_generate_key_arg arg;
  427. u8 lt_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE];
  428. int ret;
  429. if (copy_from_user(&arg, argp, sizeof(arg)))
  430. return -EFAULT;
  431. if (memchr_inv(arg.reserved, 0, sizeof(arg.reserved)))
  432. return -EINVAL;
  433. ret = blk_crypto_generate_key(profile, lt_key);
  434. if (ret < 0)
  435. goto out;
  436. if (ret > arg.lt_key_size) {
  437. ret = -EOVERFLOW;
  438. goto out;
  439. }
  440. arg.lt_key_size = ret;
  441. if (copy_to_user(u64_to_user_ptr(arg.lt_key_ptr), lt_key,
  442. arg.lt_key_size) ||
  443. copy_to_user(argp, &arg, sizeof(arg))) {
  444. ret = -EFAULT;
  445. goto out;
  446. }
  447. ret = 0;
  448. out:
  449. memzero_explicit(lt_key, sizeof(lt_key));
  450. return ret;
  451. }
  452. static int blk_crypto_ioctl_prepare_key(struct blk_crypto_profile *profile,
  453. void __user *argp)
  454. {
  455. struct blk_crypto_prepare_key_arg arg;
  456. u8 lt_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE];
  457. u8 eph_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE];
  458. int ret;
  459. if (copy_from_user(&arg, argp, sizeof(arg)))
  460. return -EFAULT;
  461. if (memchr_inv(arg.reserved, 0, sizeof(arg.reserved)))
  462. return -EINVAL;
  463. if (arg.lt_key_size > sizeof(lt_key))
  464. return -EINVAL;
  465. if (copy_from_user(lt_key, u64_to_user_ptr(arg.lt_key_ptr),
  466. arg.lt_key_size)) {
  467. ret = -EFAULT;
  468. goto out;
  469. }
  470. ret = blk_crypto_prepare_key(profile, lt_key, arg.lt_key_size, eph_key);
  471. if (ret < 0)
  472. goto out;
  473. if (ret > arg.eph_key_size) {
  474. ret = -EOVERFLOW;
  475. goto out;
  476. }
  477. arg.eph_key_size = ret;
  478. if (copy_to_user(u64_to_user_ptr(arg.eph_key_ptr), eph_key,
  479. arg.eph_key_size) ||
  480. copy_to_user(argp, &arg, sizeof(arg))) {
  481. ret = -EFAULT;
  482. goto out;
  483. }
  484. ret = 0;
  485. out:
  486. memzero_explicit(lt_key, sizeof(lt_key));
  487. memzero_explicit(eph_key, sizeof(eph_key));
  488. return ret;
  489. }
  490. int blk_crypto_ioctl(struct block_device *bdev, unsigned int cmd,
  491. void __user *argp)
  492. {
  493. struct blk_crypto_profile *profile =
  494. bdev_get_queue(bdev)->crypto_profile;
  495. if (!profile)
  496. return -EOPNOTSUPP;
  497. switch (cmd) {
  498. case BLKCRYPTOIMPORTKEY:
  499. return blk_crypto_ioctl_import_key(profile, argp);
  500. case BLKCRYPTOGENERATEKEY:
  501. return blk_crypto_ioctl_generate_key(profile, argp);
  502. case BLKCRYPTOPREPAREKEY:
  503. return blk_crypto_ioctl_prepare_key(profile, argp);
  504. default:
  505. return -ENOTTY;
  506. }
  507. }