Bluetooth: let the crypto subsystem generate the ecc privkey
That Bluetooth SMP knows about the private key is pointless, since the detection of debug key usage is actually via the public key portion. With this patch, the Bluetooth SMP will stop keeping a copy of the ecdh private key and will let the crypto subsystem to generate and handle the ecdh private key, potentially benefiting of hardware ecc private key generation and retention. The loop that tries to generate a correct private key is now removed and we trust the crypto subsystem to generate a correct private key. This backup logic should be done in crypto, if really needed. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:

committed by
Marcel Holtmann

parent
168ed65483
commit
c0153b0b90
@@ -152,11 +152,11 @@ static int __init test_ecdh_sample(struct crypto_kpp *tfm, const u8 priv_a[32],
|
||||
dhkey_a = &tmp[0];
|
||||
dhkey_b = &tmp[32];
|
||||
|
||||
ret = compute_ecdh_secret(tfm, pub_b, priv_a, dhkey_a);
|
||||
ret = set_ecdh_privkey(tfm, priv_a);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = compute_ecdh_secret(tfm, pub_a, priv_b, dhkey_b);
|
||||
ret = compute_ecdh_secret(tfm, pub_b, dhkey_a);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
@@ -165,9 +165,17 @@ static int __init test_ecdh_sample(struct crypto_kpp *tfm, const u8 priv_a[32],
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = set_ecdh_privkey(tfm, priv_b);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = compute_ecdh_secret(tfm, pub_a, dhkey_b);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
if (memcmp(dhkey_b, dhkey, 32))
|
||||
ret = -EINVAL;
|
||||
|
||||
/* fall through*/
|
||||
out:
|
||||
kfree(tmp);
|
||||
return ret;
|
||||
|
Reference in New Issue
Block a user