mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge tag 'v7.0-p1' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto update from Herbert Xu:
"API:
- Fix race condition in hwrng core by using RCU
Algorithms:
- Allow authenc(sha224,rfc3686) in fips mode
- Add test vectors for authenc(hmac(sha384),cbc(aes))
- Add test vectors for authenc(hmac(sha224),cbc(aes))
- Add test vectors for authenc(hmac(md5),cbc(des3_ede))
- Add lz4 support in hisi_zip
- Only allow clear key use during self-test in s390/{phmac,paes}
Drivers:
- Set rng quality to 900 in airoha
- Add gcm(aes) support for AMD/Xilinx Versal device
- Allow tfms to share device in hisilicon/trng"
* tag 'v7.0-p1' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (100 commits)
crypto: img-hash - Use unregister_ahashes in img_{un}register_algs
crypto: testmgr - Add test vectors for authenc(hmac(md5),cbc(des3_ede))
crypto: cesa - Simplify return statement in mv_cesa_dequeue_req_locked
crypto: testmgr - Add test vectors for authenc(hmac(sha224),cbc(aes))
crypto: testmgr - Add test vectors for authenc(hmac(sha384),cbc(aes))
hwrng: core - use RCU and work_struct to fix race condition
crypto: starfive - Fix memory leak in starfive_aes_aead_do_one_req()
crypto: xilinx - Fix inconsistant indentation
crypto: rng - Use unregister_rngs in register_rngs
crypto: atmel - Use unregister_{aeads,ahashes,skciphers}
hwrng: optee - simplify OP-TEE context match
crypto: ccp - Add sysfs attribute for boot integrity
dt-bindings: crypto: atmel,at91sam9g46-sha: add microchip,lan9691-sha
dt-bindings: crypto: atmel,at91sam9g46-aes: add microchip,lan9691-aes
dt-bindings: crypto: qcom,inline-crypto-engine: document the Milos ICE
crypto: caam - fix netdev memory leak in dpaa2_caam_probe
crypto: hisilicon/qm - increase wait time for mailbox
crypto: hisilicon/qm - obtain the mailbox configuration at one time
crypto: hisilicon/qm - remove unnecessary code in qm_mb_write()
crypto: hisilicon/qm - move the barrier before writing to the mailbox register
...
This commit is contained in:
@@ -8,6 +8,21 @@ Description:
|
||||
0: Not fused
|
||||
1: Fused
|
||||
|
||||
What: /sys/bus/pci/devices/<BDF>/boot_integrity
|
||||
Date: April 2026
|
||||
KernelVersion: 6.20
|
||||
Contact: mario.limonciello@amd.com
|
||||
Description:
|
||||
The /sys/bus/pci/devices/<BDF>/boot_integrity reports
|
||||
whether the AMD CPU or APU is used for a hardware root of trust
|
||||
during the boot process.
|
||||
Possible values:
|
||||
0: Not hardware root of trust.
|
||||
1: Hardware root of trust
|
||||
|
||||
NOTE: Vendors may provide design specific alternative hardware
|
||||
root of trust implementations.
|
||||
|
||||
What: /sys/bus/pci/devices/<BDF>/debug_lock_on
|
||||
Date: June 2022
|
||||
KernelVersion: 5.19
|
||||
|
||||
@@ -16,6 +16,7 @@ properties:
|
||||
- const: atmel,at91sam9g46-aes
|
||||
- items:
|
||||
- enum:
|
||||
- microchip,lan9691-aes
|
||||
- microchip,sam9x7-aes
|
||||
- microchip,sama7d65-aes
|
||||
- const: atmel,at91sam9g46-aes
|
||||
|
||||
@@ -16,6 +16,7 @@ properties:
|
||||
- const: atmel,at91sam9g46-sha
|
||||
- items:
|
||||
- enum:
|
||||
- microchip,lan9691-sha
|
||||
- microchip,sam9x7-sha
|
||||
- microchip,sama7d65-sha
|
||||
- const: atmel,at91sam9g46-sha
|
||||
|
||||
@@ -14,6 +14,7 @@ properties:
|
||||
items:
|
||||
- enum:
|
||||
- qcom,kaanapali-inline-crypto-engine
|
||||
- qcom,milos-inline-crypto-engine
|
||||
- qcom,qcs8300-inline-crypto-engine
|
||||
- qcom,sa8775p-inline-crypto-engine
|
||||
- qcom,sc7180-inline-crypto-engine
|
||||
|
||||
@@ -30,6 +30,7 @@ properties:
|
||||
- qcom,sm8550-trng
|
||||
- qcom,sm8650-trng
|
||||
- qcom,sm8750-trng
|
||||
- qcom,x1e80100-trng
|
||||
- const: qcom,trng
|
||||
|
||||
reg:
|
||||
|
||||
@@ -14,6 +14,8 @@ description: |
|
||||
The ZynqMP AES-GCM hardened cryptographic accelerator is used to
|
||||
encrypt or decrypt the data with provided key and initialization vector.
|
||||
|
||||
deprecated: true
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: xlnx,zynqmp-aes
|
||||
|
||||
@@ -104,6 +104,7 @@ properties:
|
||||
used to encrypt or decrypt the data with provided key and initialization
|
||||
vector.
|
||||
type: object
|
||||
deprecated: true
|
||||
|
||||
required:
|
||||
- compatible
|
||||
|
||||
@@ -40,6 +40,10 @@
|
||||
#define PAES_256_PROTKEY_SIZE (32 + 32) /* key + verification pattern */
|
||||
#define PXTS_256_PROTKEY_SIZE (32 + 32 + 32) /* k1 + k2 + verification pattern */
|
||||
|
||||
static bool pkey_clrkey_allowed;
|
||||
module_param_named(clrkey, pkey_clrkey_allowed, bool, 0444);
|
||||
MODULE_PARM_DESC(clrkey, "Allow clear key material (default N)");
|
||||
|
||||
static u8 *ctrblk;
|
||||
static DEFINE_MUTEX(ctrblk_lock);
|
||||
|
||||
@@ -192,10 +196,14 @@ static inline int pxts_ctx_setkey(struct s390_pxts_ctx *ctx,
|
||||
* This function may sleep - don't call in non-sleeping context.
|
||||
*/
|
||||
static inline int convert_key(const u8 *key, unsigned int keylen,
|
||||
struct paes_protkey *pk)
|
||||
struct paes_protkey *pk, bool tested)
|
||||
{
|
||||
u32 xflags = PKEY_XFLAG_NOMEMALLOC;
|
||||
int rc, i;
|
||||
|
||||
if (tested && !pkey_clrkey_allowed)
|
||||
xflags |= PKEY_XFLAG_NOCLEARKEY;
|
||||
|
||||
pk->len = sizeof(pk->protkey);
|
||||
|
||||
/*
|
||||
@@ -209,7 +217,7 @@ static inline int convert_key(const u8 *key, unsigned int keylen,
|
||||
}
|
||||
rc = pkey_key2protkey(key, keylen,
|
||||
pk->protkey, &pk->len, &pk->type,
|
||||
PKEY_XFLAG_NOMEMALLOC);
|
||||
xflags);
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -231,7 +239,7 @@ out:
|
||||
* unnecessary additional conversion but never to invalid data on en-
|
||||
* or decrypt operations.
|
||||
*/
|
||||
static int paes_convert_key(struct s390_paes_ctx *ctx)
|
||||
static int paes_convert_key(struct s390_paes_ctx *ctx, bool tested)
|
||||
{
|
||||
struct paes_protkey pk;
|
||||
int rc;
|
||||
@@ -240,7 +248,7 @@ static int paes_convert_key(struct s390_paes_ctx *ctx)
|
||||
ctx->pk_state = PK_STATE_CONVERT_IN_PROGRESS;
|
||||
spin_unlock_bh(&ctx->pk_lock);
|
||||
|
||||
rc = convert_key(ctx->keybuf, ctx->keylen, &pk);
|
||||
rc = convert_key(ctx->keybuf, ctx->keylen, &pk, tested);
|
||||
|
||||
/* update context */
|
||||
spin_lock_bh(&ctx->pk_lock);
|
||||
@@ -263,7 +271,7 @@ static int paes_convert_key(struct s390_paes_ctx *ctx)
|
||||
* pk_type, pk_len and the protected key in the tfm context.
|
||||
* See also comments on function paes_convert_key.
|
||||
*/
|
||||
static int pxts_convert_key(struct s390_pxts_ctx *ctx)
|
||||
static int pxts_convert_key(struct s390_pxts_ctx *ctx, bool tested)
|
||||
{
|
||||
struct paes_protkey pk0, pk1;
|
||||
size_t split_keylen;
|
||||
@@ -273,7 +281,7 @@ static int pxts_convert_key(struct s390_pxts_ctx *ctx)
|
||||
ctx->pk_state = PK_STATE_CONVERT_IN_PROGRESS;
|
||||
spin_unlock_bh(&ctx->pk_lock);
|
||||
|
||||
rc = convert_key(ctx->keybuf, ctx->keylen, &pk0);
|
||||
rc = convert_key(ctx->keybuf, ctx->keylen, &pk0, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
@@ -287,7 +295,7 @@ static int pxts_convert_key(struct s390_pxts_ctx *ctx)
|
||||
}
|
||||
split_keylen = ctx->keylen / 2;
|
||||
rc = convert_key(ctx->keybuf + split_keylen,
|
||||
split_keylen, &pk1);
|
||||
split_keylen, &pk1, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
if (pk0.type != pk1.type) {
|
||||
@@ -343,6 +351,7 @@ static int ecb_paes_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
|
||||
unsigned int key_len)
|
||||
{
|
||||
struct s390_paes_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
bool tested = crypto_skcipher_tested(tfm);
|
||||
long fc;
|
||||
int rc;
|
||||
|
||||
@@ -352,7 +361,7 @@ static int ecb_paes_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
|
||||
goto out;
|
||||
|
||||
/* convert key into protected key */
|
||||
rc = paes_convert_key(ctx);
|
||||
rc = paes_convert_key(ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
@@ -382,7 +391,7 @@ out:
|
||||
|
||||
static int ecb_paes_do_crypt(struct s390_paes_ctx *ctx,
|
||||
struct s390_pecb_req_ctx *req_ctx,
|
||||
bool maysleep)
|
||||
bool tested, bool maysleep)
|
||||
{
|
||||
struct ecb_param *param = &req_ctx->param;
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
@@ -430,7 +439,7 @@ static int ecb_paes_do_crypt(struct s390_paes_ctx *ctx,
|
||||
rc = -EKEYEXPIRED;
|
||||
goto out;
|
||||
}
|
||||
rc = paes_convert_key(ctx);
|
||||
rc = paes_convert_key(ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
spin_lock_bh(&ctx->pk_lock);
|
||||
@@ -450,6 +459,7 @@ static int ecb_paes_crypt(struct skcipher_request *req, unsigned long modifier)
|
||||
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
|
||||
struct s390_paes_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
bool tested = crypto_skcipher_tested(tfm);
|
||||
int rc;
|
||||
|
||||
/*
|
||||
@@ -468,7 +478,7 @@ static int ecb_paes_crypt(struct skcipher_request *req, unsigned long modifier)
|
||||
|
||||
/* Try synchronous operation if no active engine usage */
|
||||
if (!atomic_read(&ctx->via_engine_ctr)) {
|
||||
rc = ecb_paes_do_crypt(ctx, req_ctx, false);
|
||||
rc = ecb_paes_do_crypt(ctx, req_ctx, tested, false);
|
||||
if (rc == 0)
|
||||
goto out;
|
||||
}
|
||||
@@ -531,11 +541,12 @@ static int ecb_paes_do_one_request(struct crypto_engine *engine, void *areq)
|
||||
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
|
||||
struct s390_paes_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
bool tested = crypto_skcipher_tested(tfm);
|
||||
int rc;
|
||||
|
||||
/* walk has already been prepared */
|
||||
|
||||
rc = ecb_paes_do_crypt(ctx, req_ctx, true);
|
||||
rc = ecb_paes_do_crypt(ctx, req_ctx, tested, true);
|
||||
if (rc == -EKEYEXPIRED) {
|
||||
/*
|
||||
* Protected key expired, conversion is in process.
|
||||
@@ -602,6 +613,7 @@ static int cbc_paes_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
|
||||
unsigned int key_len)
|
||||
{
|
||||
struct s390_paes_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
bool tested = crypto_skcipher_tested(tfm);
|
||||
long fc;
|
||||
int rc;
|
||||
|
||||
@@ -611,7 +623,7 @@ static int cbc_paes_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
|
||||
goto out;
|
||||
|
||||
/* convert raw key into protected key */
|
||||
rc = paes_convert_key(ctx);
|
||||
rc = paes_convert_key(ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
@@ -641,7 +653,7 @@ out:
|
||||
|
||||
static int cbc_paes_do_crypt(struct s390_paes_ctx *ctx,
|
||||
struct s390_pcbc_req_ctx *req_ctx,
|
||||
bool maysleep)
|
||||
bool tested, bool maysleep)
|
||||
{
|
||||
struct cbc_param *param = &req_ctx->param;
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
@@ -693,7 +705,7 @@ static int cbc_paes_do_crypt(struct s390_paes_ctx *ctx,
|
||||
rc = -EKEYEXPIRED;
|
||||
goto out;
|
||||
}
|
||||
rc = paes_convert_key(ctx);
|
||||
rc = paes_convert_key(ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
spin_lock_bh(&ctx->pk_lock);
|
||||
@@ -713,6 +725,7 @@ static int cbc_paes_crypt(struct skcipher_request *req, unsigned long modifier)
|
||||
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
|
||||
struct s390_paes_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
bool tested = crypto_skcipher_tested(tfm);
|
||||
int rc;
|
||||
|
||||
/*
|
||||
@@ -731,7 +744,7 @@ static int cbc_paes_crypt(struct skcipher_request *req, unsigned long modifier)
|
||||
|
||||
/* Try synchronous operation if no active engine usage */
|
||||
if (!atomic_read(&ctx->via_engine_ctr)) {
|
||||
rc = cbc_paes_do_crypt(ctx, req_ctx, false);
|
||||
rc = cbc_paes_do_crypt(ctx, req_ctx, tested, false);
|
||||
if (rc == 0)
|
||||
goto out;
|
||||
}
|
||||
@@ -794,11 +807,12 @@ static int cbc_paes_do_one_request(struct crypto_engine *engine, void *areq)
|
||||
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
|
||||
struct s390_paes_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
bool tested = crypto_skcipher_tested(tfm);
|
||||
int rc;
|
||||
|
||||
/* walk has already been prepared */
|
||||
|
||||
rc = cbc_paes_do_crypt(ctx, req_ctx, true);
|
||||
rc = cbc_paes_do_crypt(ctx, req_ctx, tested, true);
|
||||
if (rc == -EKEYEXPIRED) {
|
||||
/*
|
||||
* Protected key expired, conversion is in process.
|
||||
@@ -865,6 +879,7 @@ static int ctr_paes_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
|
||||
unsigned int key_len)
|
||||
{
|
||||
struct s390_paes_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
bool tested = crypto_skcipher_tested(tfm);
|
||||
long fc;
|
||||
int rc;
|
||||
|
||||
@@ -874,7 +889,7 @@ static int ctr_paes_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
|
||||
goto out;
|
||||
|
||||
/* convert raw key into protected key */
|
||||
rc = paes_convert_key(ctx);
|
||||
rc = paes_convert_key(ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
@@ -919,7 +934,7 @@ static inline unsigned int __ctrblk_init(u8 *ctrptr, u8 *iv, unsigned int nbytes
|
||||
|
||||
static int ctr_paes_do_crypt(struct s390_paes_ctx *ctx,
|
||||
struct s390_pctr_req_ctx *req_ctx,
|
||||
bool maysleep)
|
||||
bool tested, bool maysleep)
|
||||
{
|
||||
struct ctr_param *param = &req_ctx->param;
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
@@ -979,7 +994,7 @@ static int ctr_paes_do_crypt(struct s390_paes_ctx *ctx,
|
||||
rc = -EKEYEXPIRED;
|
||||
goto out;
|
||||
}
|
||||
rc = paes_convert_key(ctx);
|
||||
rc = paes_convert_key(ctx, tested);
|
||||
if (rc) {
|
||||
if (locked)
|
||||
mutex_unlock(&ctrblk_lock);
|
||||
@@ -1006,7 +1021,7 @@ static int ctr_paes_do_crypt(struct s390_paes_ctx *ctx,
|
||||
rc = -EKEYEXPIRED;
|
||||
goto out;
|
||||
}
|
||||
rc = paes_convert_key(ctx);
|
||||
rc = paes_convert_key(ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
spin_lock_bh(&ctx->pk_lock);
|
||||
@@ -1029,6 +1044,7 @@ static int ctr_paes_crypt(struct skcipher_request *req)
|
||||
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
|
||||
struct s390_paes_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
bool tested = crypto_skcipher_tested(tfm);
|
||||
int rc;
|
||||
|
||||
/*
|
||||
@@ -1046,7 +1062,7 @@ static int ctr_paes_crypt(struct skcipher_request *req)
|
||||
|
||||
/* Try synchronous operation if no active engine usage */
|
||||
if (!atomic_read(&ctx->via_engine_ctr)) {
|
||||
rc = ctr_paes_do_crypt(ctx, req_ctx, false);
|
||||
rc = ctr_paes_do_crypt(ctx, req_ctx, tested, false);
|
||||
if (rc == 0)
|
||||
goto out;
|
||||
}
|
||||
@@ -1099,11 +1115,12 @@ static int ctr_paes_do_one_request(struct crypto_engine *engine, void *areq)
|
||||
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
|
||||
struct s390_paes_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
bool tested = crypto_skcipher_tested(tfm);
|
||||
int rc;
|
||||
|
||||
/* walk has already been prepared */
|
||||
|
||||
rc = ctr_paes_do_crypt(ctx, req_ctx, true);
|
||||
rc = ctr_paes_do_crypt(ctx, req_ctx, tested, true);
|
||||
if (rc == -EKEYEXPIRED) {
|
||||
/*
|
||||
* Protected key expired, conversion is in process.
|
||||
@@ -1190,6 +1207,7 @@ static int xts_paes_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
|
||||
unsigned int in_keylen)
|
||||
{
|
||||
struct s390_pxts_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
bool tested = crypto_skcipher_tested(tfm);
|
||||
u8 ckey[2 * AES_MAX_KEY_SIZE];
|
||||
unsigned int ckey_len;
|
||||
long fc;
|
||||
@@ -1205,7 +1223,7 @@ static int xts_paes_setkey(struct crypto_skcipher *tfm, const u8 *in_key,
|
||||
goto out;
|
||||
|
||||
/* convert raw key(s) into protected key(s) */
|
||||
rc = pxts_convert_key(ctx);
|
||||
rc = pxts_convert_key(ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
@@ -1255,7 +1273,7 @@ out:
|
||||
|
||||
static int xts_paes_do_crypt_fullkey(struct s390_pxts_ctx *ctx,
|
||||
struct s390_pxts_req_ctx *req_ctx,
|
||||
bool maysleep)
|
||||
bool tested, bool maysleep)
|
||||
{
|
||||
struct xts_full_km_param *param = &req_ctx->param.full_km_param;
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
@@ -1299,7 +1317,7 @@ static int xts_paes_do_crypt_fullkey(struct s390_pxts_ctx *ctx,
|
||||
rc = -EKEYEXPIRED;
|
||||
goto out;
|
||||
}
|
||||
rc = pxts_convert_key(ctx);
|
||||
rc = pxts_convert_key(ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
spin_lock_bh(&ctx->pk_lock);
|
||||
@@ -1318,7 +1336,8 @@ static inline int __xts_2keys_prep_param(struct s390_pxts_ctx *ctx,
|
||||
struct xts_km_param *param,
|
||||
struct skcipher_walk *walk,
|
||||
unsigned int keylen,
|
||||
unsigned int offset, bool maysleep)
|
||||
unsigned int offset,
|
||||
bool tested, bool maysleep)
|
||||
{
|
||||
struct xts_pcc_param pcc_param;
|
||||
unsigned long cc = 1;
|
||||
@@ -1337,7 +1356,7 @@ static inline int __xts_2keys_prep_param(struct s390_pxts_ctx *ctx,
|
||||
rc = -EKEYEXPIRED;
|
||||
break;
|
||||
}
|
||||
rc = pxts_convert_key(ctx);
|
||||
rc = pxts_convert_key(ctx, tested);
|
||||
if (rc)
|
||||
break;
|
||||
continue;
|
||||
@@ -1351,7 +1370,7 @@ static inline int __xts_2keys_prep_param(struct s390_pxts_ctx *ctx,
|
||||
|
||||
static int xts_paes_do_crypt_2keys(struct s390_pxts_ctx *ctx,
|
||||
struct s390_pxts_req_ctx *req_ctx,
|
||||
bool maysleep)
|
||||
bool tested, bool maysleep)
|
||||
{
|
||||
struct xts_km_param *param = &req_ctx->param.km_param;
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
@@ -1369,7 +1388,7 @@ static int xts_paes_do_crypt_2keys(struct s390_pxts_ctx *ctx,
|
||||
|
||||
if (!req_ctx->param_init_done) {
|
||||
rc = __xts_2keys_prep_param(ctx, param, walk,
|
||||
keylen, offset, maysleep);
|
||||
keylen, offset, tested, maysleep);
|
||||
if (rc)
|
||||
goto out;
|
||||
req_ctx->param_init_done = true;
|
||||
@@ -1392,7 +1411,7 @@ static int xts_paes_do_crypt_2keys(struct s390_pxts_ctx *ctx,
|
||||
rc = -EKEYEXPIRED;
|
||||
goto out;
|
||||
}
|
||||
rc = pxts_convert_key(ctx);
|
||||
rc = pxts_convert_key(ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
spin_lock_bh(&ctx->pk_lock);
|
||||
@@ -1408,7 +1427,7 @@ out:
|
||||
|
||||
static int xts_paes_do_crypt(struct s390_pxts_ctx *ctx,
|
||||
struct s390_pxts_req_ctx *req_ctx,
|
||||
bool maysleep)
|
||||
bool tested, bool maysleep)
|
||||
{
|
||||
int pk_state, rc = 0;
|
||||
|
||||
@@ -1436,11 +1455,11 @@ static int xts_paes_do_crypt(struct s390_pxts_ctx *ctx,
|
||||
switch (ctx->fc) {
|
||||
case CPACF_KM_PXTS_128:
|
||||
case CPACF_KM_PXTS_256:
|
||||
rc = xts_paes_do_crypt_2keys(ctx, req_ctx, maysleep);
|
||||
rc = xts_paes_do_crypt_2keys(ctx, req_ctx, tested, maysleep);
|
||||
break;
|
||||
case CPACF_KM_PXTS_128_FULL:
|
||||
case CPACF_KM_PXTS_256_FULL:
|
||||
rc = xts_paes_do_crypt_fullkey(ctx, req_ctx, maysleep);
|
||||
rc = xts_paes_do_crypt_fullkey(ctx, req_ctx, tested, maysleep);
|
||||
break;
|
||||
default:
|
||||
rc = -EINVAL;
|
||||
@@ -1457,6 +1476,7 @@ static inline int xts_paes_crypt(struct skcipher_request *req, unsigned long mod
|
||||
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
|
||||
struct s390_pxts_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
bool tested = crypto_skcipher_tested(tfm);
|
||||
int rc;
|
||||
|
||||
/*
|
||||
@@ -1475,7 +1495,7 @@ static inline int xts_paes_crypt(struct skcipher_request *req, unsigned long mod
|
||||
|
||||
/* Try synchronous operation if no active engine usage */
|
||||
if (!atomic_read(&ctx->via_engine_ctr)) {
|
||||
rc = xts_paes_do_crypt(ctx, req_ctx, false);
|
||||
rc = xts_paes_do_crypt(ctx, req_ctx, tested, false);
|
||||
if (rc == 0)
|
||||
goto out;
|
||||
}
|
||||
@@ -1538,11 +1558,12 @@ static int xts_paes_do_one_request(struct crypto_engine *engine, void *areq)
|
||||
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
|
||||
struct s390_pxts_ctx *ctx = crypto_skcipher_ctx(tfm);
|
||||
struct skcipher_walk *walk = &req_ctx->walk;
|
||||
bool tested = crypto_skcipher_tested(tfm);
|
||||
int rc;
|
||||
|
||||
/* walk has already been prepared */
|
||||
|
||||
rc = xts_paes_do_crypt(ctx, req_ctx, true);
|
||||
rc = xts_paes_do_crypt(ctx, req_ctx, tested, true);
|
||||
if (rc == -EKEYEXPIRED) {
|
||||
/*
|
||||
* Protected key expired, conversion is in process.
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
static struct crypto_engine *phmac_crypto_engine;
|
||||
#define MAX_QLEN 10
|
||||
|
||||
static bool pkey_clrkey_allowed;
|
||||
module_param_named(clrkey, pkey_clrkey_allowed, bool, 0444);
|
||||
MODULE_PARM_DESC(clrkey, "Allow clear key material (default N)");
|
||||
|
||||
/*
|
||||
* A simple hash walk helper
|
||||
*/
|
||||
@@ -311,10 +315,14 @@ static inline int phmac_tfm_ctx_setkey(struct phmac_tfm_ctx *tfm_ctx,
|
||||
* This function may sleep - don't call in non-sleeping context.
|
||||
*/
|
||||
static inline int convert_key(const u8 *key, unsigned int keylen,
|
||||
struct phmac_protkey *pk)
|
||||
struct phmac_protkey *pk, bool tested)
|
||||
{
|
||||
u32 xflags = PKEY_XFLAG_NOMEMALLOC;
|
||||
int rc, i;
|
||||
|
||||
if (tested && !pkey_clrkey_allowed)
|
||||
xflags |= PKEY_XFLAG_NOCLEARKEY;
|
||||
|
||||
pk->len = sizeof(pk->protkey);
|
||||
|
||||
/*
|
||||
@@ -328,7 +336,7 @@ static inline int convert_key(const u8 *key, unsigned int keylen,
|
||||
}
|
||||
rc = pkey_key2protkey(key, keylen,
|
||||
pk->protkey, &pk->len, &pk->type,
|
||||
PKEY_XFLAG_NOMEMALLOC);
|
||||
xflags);
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -350,7 +358,7 @@ out:
|
||||
* unnecessary additional conversion but never to invalid data on the
|
||||
* hash operation.
|
||||
*/
|
||||
static int phmac_convert_key(struct phmac_tfm_ctx *tfm_ctx)
|
||||
static int phmac_convert_key(struct phmac_tfm_ctx *tfm_ctx, bool tested)
|
||||
{
|
||||
struct phmac_protkey pk;
|
||||
int rc;
|
||||
@@ -359,7 +367,7 @@ static int phmac_convert_key(struct phmac_tfm_ctx *tfm_ctx)
|
||||
tfm_ctx->pk_state = PK_STATE_CONVERT_IN_PROGRESS;
|
||||
spin_unlock_bh(&tfm_ctx->pk_lock);
|
||||
|
||||
rc = convert_key(tfm_ctx->keybuf, tfm_ctx->keylen, &pk);
|
||||
rc = convert_key(tfm_ctx->keybuf, tfm_ctx->keylen, &pk, tested);
|
||||
|
||||
/* update context */
|
||||
spin_lock_bh(&tfm_ctx->pk_lock);
|
||||
@@ -404,6 +412,7 @@ static int phmac_kmac_update(struct ahash_request *req, bool maysleep)
|
||||
struct kmac_sha2_ctx *ctx = &req_ctx->kmac_ctx;
|
||||
struct hash_walk_helper *hwh = &req_ctx->hwh;
|
||||
unsigned int bs = crypto_ahash_blocksize(tfm);
|
||||
bool tested = crypto_ahash_tested(tfm);
|
||||
unsigned int offset, k, n;
|
||||
int rc = 0;
|
||||
|
||||
@@ -444,7 +453,7 @@ static int phmac_kmac_update(struct ahash_request *req, bool maysleep)
|
||||
rc = -EKEYEXPIRED;
|
||||
goto out;
|
||||
}
|
||||
rc = phmac_convert_key(tfm_ctx);
|
||||
rc = phmac_convert_key(tfm_ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
spin_lock_bh(&tfm_ctx->pk_lock);
|
||||
@@ -480,7 +489,7 @@ static int phmac_kmac_update(struct ahash_request *req, bool maysleep)
|
||||
rc = -EKEYEXPIRED;
|
||||
goto out;
|
||||
}
|
||||
rc = phmac_convert_key(tfm_ctx);
|
||||
rc = phmac_convert_key(tfm_ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
spin_lock_bh(&tfm_ctx->pk_lock);
|
||||
@@ -517,6 +526,7 @@ static int phmac_kmac_final(struct ahash_request *req, bool maysleep)
|
||||
struct kmac_sha2_ctx *ctx = &req_ctx->kmac_ctx;
|
||||
unsigned int ds = crypto_ahash_digestsize(tfm);
|
||||
unsigned int bs = crypto_ahash_blocksize(tfm);
|
||||
bool tested = crypto_ahash_tested(tfm);
|
||||
unsigned int k, n;
|
||||
int rc = 0;
|
||||
|
||||
@@ -537,7 +547,7 @@ static int phmac_kmac_final(struct ahash_request *req, bool maysleep)
|
||||
rc = -EKEYEXPIRED;
|
||||
goto out;
|
||||
}
|
||||
rc = phmac_convert_key(tfm_ctx);
|
||||
rc = phmac_convert_key(tfm_ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
spin_lock_bh(&tfm_ctx->pk_lock);
|
||||
@@ -741,11 +751,12 @@ static int phmac_setkey(struct crypto_ahash *tfm,
|
||||
struct phmac_tfm_ctx *tfm_ctx = crypto_ahash_ctx(tfm);
|
||||
unsigned int ds = crypto_ahash_digestsize(tfm);
|
||||
unsigned int bs = crypto_ahash_blocksize(tfm);
|
||||
bool tested = crypto_ahash_tested(tfm);
|
||||
unsigned int tmpkeylen;
|
||||
u8 *tmpkey = NULL;
|
||||
int rc = 0;
|
||||
|
||||
if (!crypto_ahash_tested(tfm)) {
|
||||
if (!tested) {
|
||||
/*
|
||||
* selftest running: key is a raw hmac clear key and needs
|
||||
* to get embedded into a 'clear key token' in order to have
|
||||
@@ -770,7 +781,7 @@ static int phmac_setkey(struct crypto_ahash *tfm,
|
||||
goto out;
|
||||
|
||||
/* convert raw key into protected key */
|
||||
rc = phmac_convert_key(tfm_ctx);
|
||||
rc = phmac_convert_key(tfm_ctx, tested);
|
||||
if (rc)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
* @param keylen size of the key blob in bytes
|
||||
* @param protkey pointer to buffer receiving the protected key
|
||||
* @param xflags additional execution flags (see PKEY_XFLAG_* definitions below)
|
||||
* As of now the only supported flag is PKEY_XFLAG_NOMEMALLOC.
|
||||
* As of now the only supported flags are PKEY_XFLAG_NOMEMALLOC
|
||||
* and PKEY_XFLAG_NOCLEARKEY.
|
||||
* @return 0 on success, negative errno value on failure
|
||||
*/
|
||||
int pkey_key2protkey(const u8 *key, u32 keylen,
|
||||
@@ -38,4 +39,9 @@ int pkey_key2protkey(const u8 *key, u32 keylen,
|
||||
*/
|
||||
#define PKEY_XFLAG_NOMEMALLOC 0x0001
|
||||
|
||||
/*
|
||||
* Do not accept a clear key token as source for a protected key.
|
||||
*/
|
||||
#define PKEY_XFLAG_NOCLEARKEY 0x0002
|
||||
|
||||
#endif /* _KAPI_PKEY_H */
|
||||
|
||||
+6
-12
@@ -60,10 +60,8 @@ static int __maybe_unused crypto_acomp_report(
|
||||
return nla_put(skb, CRYPTOCFGA_REPORT_ACOMP, sizeof(racomp), &racomp);
|
||||
}
|
||||
|
||||
static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg)
|
||||
__maybe_unused;
|
||||
|
||||
static void crypto_acomp_show(struct seq_file *m, struct crypto_alg *alg)
|
||||
static void __maybe_unused crypto_acomp_show(struct seq_file *m,
|
||||
struct crypto_alg *alg)
|
||||
{
|
||||
seq_puts(m, "type : acomp\n");
|
||||
}
|
||||
@@ -337,17 +335,13 @@ int crypto_register_acomps(struct acomp_alg *algs, int count)
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
ret = crypto_register_acomp(&algs[i]);
|
||||
if (ret)
|
||||
goto err;
|
||||
if (ret) {
|
||||
crypto_unregister_acomps(algs, i);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
for (--i; i >= 0; --i)
|
||||
crypto_unregister_acomp(&algs[i]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_register_acomps);
|
||||
|
||||
|
||||
+2
-3
@@ -151,9 +151,8 @@ static int __maybe_unused crypto_aead_report(
|
||||
return nla_put(skb, CRYPTOCFGA_REPORT_AEAD, sizeof(raead), &raead);
|
||||
}
|
||||
|
||||
static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg)
|
||||
__maybe_unused;
|
||||
static void crypto_aead_show(struct seq_file *m, struct crypto_alg *alg)
|
||||
static void __maybe_unused crypto_aead_show(struct seq_file *m,
|
||||
struct crypto_alg *alg)
|
||||
{
|
||||
struct aead_alg *aead = container_of(alg, struct aead_alg, base);
|
||||
|
||||
|
||||
+6
-11
@@ -801,9 +801,8 @@ static int __maybe_unused crypto_ahash_report(
|
||||
return nla_put(skb, CRYPTOCFGA_REPORT_HASH, sizeof(rhash), &rhash);
|
||||
}
|
||||
|
||||
static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
|
||||
__maybe_unused;
|
||||
static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
|
||||
static void __maybe_unused crypto_ahash_show(struct seq_file *m,
|
||||
struct crypto_alg *alg)
|
||||
{
|
||||
seq_printf(m, "type : ahash\n");
|
||||
seq_printf(m, "async : %s\n",
|
||||
@@ -1020,17 +1019,13 @@ int crypto_register_ahashes(struct ahash_alg *algs, int count)
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
ret = crypto_register_ahash(&algs[i]);
|
||||
if (ret)
|
||||
goto err;
|
||||
if (ret) {
|
||||
crypto_unregister_ahashes(algs, i);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
for (--i; i >= 0; --i)
|
||||
crypto_unregister_ahash(&algs[i]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_register_ahashes);
|
||||
|
||||
|
||||
+2
-4
@@ -46,10 +46,8 @@ static int __maybe_unused crypto_akcipher_report(
|
||||
sizeof(rakcipher), &rakcipher);
|
||||
}
|
||||
|
||||
static void crypto_akcipher_show(struct seq_file *m, struct crypto_alg *alg)
|
||||
__maybe_unused;
|
||||
|
||||
static void crypto_akcipher_show(struct seq_file *m, struct crypto_alg *alg)
|
||||
static void __maybe_unused crypto_akcipher_show(struct seq_file *m,
|
||||
struct crypto_alg *alg)
|
||||
{
|
||||
seq_puts(m, "type : akcipher\n");
|
||||
}
|
||||
|
||||
+5
-9
@@ -511,17 +511,13 @@ int crypto_register_algs(struct crypto_alg *algs, int count)
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
ret = crypto_register_alg(&algs[i]);
|
||||
if (ret)
|
||||
goto err;
|
||||
if (ret) {
|
||||
crypto_unregister_algs(algs, i);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
for (--i; i >= 0; --i)
|
||||
crypto_unregister_alg(&algs[i]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_register_algs);
|
||||
|
||||
@@ -529,7 +525,7 @@ void crypto_unregister_algs(struct crypto_alg *algs, int count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
for (i = count - 1; i >= 0; --i)
|
||||
crypto_unregister_alg(&algs[i]);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_unregister_algs);
|
||||
|
||||
@@ -306,7 +306,7 @@ static const u32 bf_sbox[256 * 4] = {
|
||||
|
||||
/*
|
||||
* The blowfish encipher, processes 64-bit blocks.
|
||||
* NOTE: This function MUSTN'T respect endianess
|
||||
* NOTE: This function MUSTN'T respect endianness
|
||||
*/
|
||||
static void encrypt_block(struct bf_ctx *bctx, u32 *dst, u32 *src)
|
||||
{
|
||||
|
||||
+12
-21
@@ -524,16 +524,13 @@ int crypto_engine_register_aeads(struct aead_engine_alg *algs, int count)
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
ret = crypto_engine_register_aead(&algs[i]);
|
||||
if (ret)
|
||||
goto err;
|
||||
if (ret) {
|
||||
crypto_engine_unregister_aeads(algs, i);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
crypto_engine_unregister_aeads(algs, i);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_engine_register_aeads);
|
||||
|
||||
@@ -566,16 +563,13 @@ int crypto_engine_register_ahashes(struct ahash_engine_alg *algs, int count)
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
ret = crypto_engine_register_ahash(&algs[i]);
|
||||
if (ret)
|
||||
goto err;
|
||||
if (ret) {
|
||||
crypto_engine_unregister_ahashes(algs, i);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
crypto_engine_unregister_ahashes(algs, i);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_engine_register_ahashes);
|
||||
|
||||
@@ -638,16 +632,13 @@ int crypto_engine_register_skciphers(struct skcipher_engine_alg *algs,
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
ret = crypto_engine_register_skcipher(&algs[i]);
|
||||
if (ret)
|
||||
goto err;
|
||||
if (ret) {
|
||||
crypto_engine_unregister_skciphers(algs, i);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
crypto_engine_unregister_skciphers(algs, i);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(crypto_engine_register_skciphers);
|
||||
|
||||
|
||||
+17
-32
@@ -226,40 +226,37 @@ static inline unsigned short drbg_sec_strength(drbg_flag_t flags)
|
||||
* @entropy buffer of seed data to be checked
|
||||
*
|
||||
* return:
|
||||
* 0 on success
|
||||
* -EAGAIN on when the CTRNG is not yet primed
|
||||
* < 0 on error
|
||||
* %true on success
|
||||
* %false when the CTRNG is not yet primed
|
||||
*/
|
||||
static int drbg_fips_continuous_test(struct drbg_state *drbg,
|
||||
const unsigned char *entropy)
|
||||
static bool drbg_fips_continuous_test(struct drbg_state *drbg,
|
||||
const unsigned char *entropy)
|
||||
{
|
||||
unsigned short entropylen = drbg_sec_strength(drbg->core->flags);
|
||||
int ret = 0;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_CRYPTO_FIPS))
|
||||
return 0;
|
||||
return true;
|
||||
|
||||
/* skip test if we test the overall system */
|
||||
if (list_empty(&drbg->test_data.list))
|
||||
return 0;
|
||||
return true;
|
||||
/* only perform test in FIPS mode */
|
||||
if (!fips_enabled)
|
||||
return 0;
|
||||
return true;
|
||||
|
||||
if (!drbg->fips_primed) {
|
||||
/* Priming of FIPS test */
|
||||
memcpy(drbg->prev, entropy, entropylen);
|
||||
drbg->fips_primed = true;
|
||||
/* priming: another round is needed */
|
||||
return -EAGAIN;
|
||||
return false;
|
||||
}
|
||||
ret = memcmp(drbg->prev, entropy, entropylen);
|
||||
if (!ret)
|
||||
if (!memcmp(drbg->prev, entropy, entropylen))
|
||||
panic("DRBG continuous self test failed\n");
|
||||
memcpy(drbg->prev, entropy, entropylen);
|
||||
|
||||
/* the test shall pass when the two values are not equal */
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
@@ -845,20 +842,13 @@ static inline int __drbg_seed(struct drbg_state *drbg, struct list_head *seed,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int drbg_get_random_bytes(struct drbg_state *drbg,
|
||||
unsigned char *entropy,
|
||||
unsigned int entropylen)
|
||||
static inline void drbg_get_random_bytes(struct drbg_state *drbg,
|
||||
unsigned char *entropy,
|
||||
unsigned int entropylen)
|
||||
{
|
||||
int ret;
|
||||
|
||||
do {
|
||||
do
|
||||
get_random_bytes(entropy, entropylen);
|
||||
ret = drbg_fips_continuous_test(drbg, entropy);
|
||||
if (ret && ret != -EAGAIN)
|
||||
return ret;
|
||||
} while (ret);
|
||||
|
||||
return 0;
|
||||
while (!drbg_fips_continuous_test(drbg, entropy));
|
||||
}
|
||||
|
||||
static int drbg_seed_from_random(struct drbg_state *drbg)
|
||||
@@ -875,13 +865,10 @@ static int drbg_seed_from_random(struct drbg_state *drbg)
|
||||
drbg_string_fill(&data, entropy, entropylen);
|
||||
list_add_tail(&data.list, &seedlist);
|
||||
|
||||
ret = drbg_get_random_bytes(drbg, entropy, entropylen);
|
||||
if (ret)
|
||||
goto out;
|
||||
drbg_get_random_bytes(drbg, entropy, entropylen);
|
||||
|
||||
ret = __drbg_seed(drbg, &seedlist, true, DRBG_SEED_STATE_FULL);
|
||||
|
||||
out:
|
||||
memzero_explicit(entropy, entropylen);
|
||||
return ret;
|
||||
}
|
||||
@@ -956,9 +943,7 @@ static int drbg_seed(struct drbg_state *drbg, struct drbg_string *pers,
|
||||
if (!rng_is_initialized())
|
||||
new_seed_state = DRBG_SEED_STATE_PARTIAL;
|
||||
|
||||
ret = drbg_get_random_bytes(drbg, entropy, entropylen);
|
||||
if (ret)
|
||||
goto out;
|
||||
drbg_get_random_bytes(drbg, entropy, entropylen);
|
||||
|
||||
if (!drbg->jent) {
|
||||
drbg_string_fill(&data1, entropy, entropylen);
|
||||
|
||||
+10
-19
@@ -90,33 +90,24 @@ void ecc_digits_from_bytes(const u8 *in, unsigned int nbytes,
|
||||
}
|
||||
EXPORT_SYMBOL(ecc_digits_from_bytes);
|
||||
|
||||
static u64 *ecc_alloc_digits_space(unsigned int ndigits)
|
||||
{
|
||||
size_t len = ndigits * sizeof(u64);
|
||||
|
||||
if (!len)
|
||||
return NULL;
|
||||
|
||||
return kmalloc(len, GFP_KERNEL);
|
||||
}
|
||||
|
||||
static void ecc_free_digits_space(u64 *space)
|
||||
{
|
||||
kfree_sensitive(space);
|
||||
}
|
||||
|
||||
struct ecc_point *ecc_alloc_point(unsigned int ndigits)
|
||||
{
|
||||
struct ecc_point *p = kmalloc(sizeof(*p), GFP_KERNEL);
|
||||
struct ecc_point *p;
|
||||
size_t ndigits_sz;
|
||||
|
||||
if (!ndigits)
|
||||
return NULL;
|
||||
|
||||
p = kmalloc(sizeof(*p), GFP_KERNEL);
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
p->x = ecc_alloc_digits_space(ndigits);
|
||||
ndigits_sz = ndigits * sizeof(u64);
|
||||
p->x = kmalloc(ndigits_sz, GFP_KERNEL);
|
||||
if (!p->x)
|
||||
goto err_alloc_x;
|
||||
|
||||
p->y = ecc_alloc_digits_space(ndigits);
|
||||
p->y = kmalloc(ndigits_sz, GFP_KERNEL);
|
||||
if (!p->y)
|
||||
goto err_alloc_y;
|
||||
|
||||
@@ -125,7 +116,7 @@ struct ecc_point *ecc_alloc_point(unsigned int ndigits)
|
||||
return p;
|
||||
|
||||
err_alloc_y:
|
||||
ecc_free_digits_space(p->x);
|
||||
kfree(p->x);
|
||||
err_alloc_x:
|
||||
kfree(p);
|
||||
return NULL;
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ ATOMIC_NOTIFIER_HEAD(fips_fail_notif_chain);
|
||||
EXPORT_SYMBOL_GPL(fips_fail_notif_chain);
|
||||
|
||||
/* Process kernel command-line parameter at boot time. fips=0 or fips=1 */
|
||||
static int fips_enable(char *str)
|
||||
static int __init fips_enable(char *str)
|
||||
{
|
||||
if (kstrtoint(str, 0, &fips_enabled))
|
||||
return 0;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user