On 2/27/22 23:05, Eric Biggers wrote:
+int blk_crypto_import_key(struct blk_crypto_profile *profile, + const u8 *raw_key, size_t raw_key_size, + u8 longterm_wrapped_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE]) +{ + int ret = -EOPNOTSUPP; + + if (profile && + (profile->key_types_supported & BLK_CRYPTO_KEY_TYPE_HW_WRAPPED) && + profile->ll_ops.import_key) { + blk_crypto_hw_enter(profile); + ret = profile->ll_ops.import_key(profile, raw_key, raw_key_size, + longterm_wrapped_key); + blk_crypto_hw_exit(profile); + } + return ret; +}
For the above and similar functions, please return early if the preconditions have not been met.
+ } + ret = 0; +out: + memzero_explicit(raw_key, sizeof(raw_key)); + memzero_explicit(longterm_wrapped_key, sizeof(longterm_wrapped_key)); + return ret; +}
Please leave a blank line above goto labels Thanks, Bart.