/* Represents a crypto mode supported by blk-crypto */ struct blk_crypto_mode { constchar *name; /* name of this mode, shown in sysfs */ constchar *cipher_str; /* crypto API name (for fallback case) */ unsignedint keysize; /* key size in bytes */ unsignedint security_strength; /* security strength in bytes */ unsignedint ivsize; /* iv size in bytes */
};
void __bio_crypt_advance(struct bio *bio, unsignedint bytes); staticinlinevoid bio_crypt_advance(struct bio *bio, unsignedint bytes)
{ if (bio_has_crypt_ctx(bio))
__bio_crypt_advance(bio, bytes);
}
void __bio_crypt_free_ctx(struct bio *bio); staticinlinevoid bio_crypt_free_ctx(struct bio *bio)
{ if (bio_has_crypt_ctx(bio))
__bio_crypt_free_ctx(bio);
}
staticinlinevoid bio_crypt_do_front_merge(struct request *rq, struct bio *bio)
{ #ifdef CONFIG_BLK_INLINE_ENCRYPTION if (bio_has_crypt_ctx(bio))
memcpy(rq->crypt_ctx->bc_dun, bio->bi_crypt_context->bc_dun, sizeof(rq->crypt_ctx->bc_dun)); #endif
}
bool __blk_crypto_bio_prep(struct bio **bio_ptr); staticinlinebool blk_crypto_bio_prep(struct bio **bio_ptr)
{ if (bio_has_crypt_ctx(*bio_ptr)) return __blk_crypto_bio_prep(bio_ptr); returntrue;
}
int __blk_crypto_rq_bio_prep(struct request *rq, struct bio *bio,
gfp_t gfp_mask); /** * blk_crypto_rq_bio_prep - Prepare a request's crypt_ctx when its first bio * is inserted * @rq: The request to prepare * @bio: The first bio being inserted into the request * @gfp_mask: Memory allocation flags * * Return: 0 on success, -ENOMEM if out of memory. -ENOMEM is only possible if * @gfp_mask doesn't include %__GFP_DIRECT_RECLAIM.
*/ staticinlineint blk_crypto_rq_bio_prep(struct request *rq, struct bio *bio,
gfp_t gfp_mask)
{ if (bio_has_crypt_ctx(bio)) return __blk_crypto_rq_bio_prep(rq, bio, gfp_mask); return 0;
}
#ifdef CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK
int blk_crypto_fallback_start_using_mode(enum blk_crypto_mode_num mode_num);
bool blk_crypto_fallback_bio_prep(struct bio **bio_ptr);
int blk_crypto_fallback_evict_key(conststruct blk_crypto_key *key);
#else/* CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK */
staticinlineint
blk_crypto_fallback_start_using_mode(enum blk_crypto_mode_num mode_num)
{
pr_warn_once("crypto API fallback is disabled\n"); return -ENOPKG;
}
staticinlinebool blk_crypto_fallback_bio_prep(struct bio **bio_ptr)
{
pr_warn_once("crypto API fallback disabled; failing request.\n");
(*bio_ptr)->bi_status = BLK_STS_NOTSUPP; returnfalse;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.