mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-26 07:23:53 +01:00
More static analysis tweaks.
This commit is contained in:
parent
000d81d54f
commit
98219bdd1b
1 changed files with 3 additions and 2 deletions
|
@ -114,8 +114,9 @@ public final class HDKeyDerivation {
|
||||||
BigInteger ilInt = HDUtils.toBigInteger(il);
|
BigInteger ilInt = HDUtils.toBigInteger(il);
|
||||||
assertLessThanN(ilInt, "Illegal derived key: I_L >= n");
|
assertLessThanN(ilInt, "Illegal derived key: I_L >= n");
|
||||||
byte[] keyBytes;
|
byte[] keyBytes;
|
||||||
if (parent.hasPrivate()) {
|
final BigInteger privAsFieldElement = parent.getPrivAsFieldElement();
|
||||||
BigInteger ki = parent.getPrivAsFieldElement().add(ilInt).mod(HDUtils.getEcParams().getN());
|
if (privAsFieldElement != null) {
|
||||||
|
BigInteger ki = privAsFieldElement.add(ilInt).mod(HDUtils.getEcParams().getN());
|
||||||
assertNonZero(ki, "Illegal derived key: derived private key equals 0.");
|
assertNonZero(ki, "Illegal derived key: derived private key equals 0.");
|
||||||
keyBytes = ki.toByteArray();
|
keyBytes = ki.toByteArray();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue