-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Use libsecp256k1? #458
Comments
Hi @xcthulhu, |
BitCoinJ simply vendors libsecp256k1. From reading the two code bases, EthereumJ I doubt this would have much impact on your supported platforms. I notice you are using SpongyCastle rather than BouncyCastle - does EthereumJ really support Android?
Better safe than sorry, IMO. BitCoinJ's code aught to be a drop in replacement for EthereumJ's, so this shouldn't be much effort. |
According to release notes BouncyCastle since 1.59 version has a resistance against timing attacks. There are two options for this issue to be resolved: (i) wait for SpongyCastle update, it yet has no release sticking with BC 1.59 (ii) migrate to BouncyCastle and use it's latest version. Second way looks much more intrusive |
I don't know what migrating to bouncycastle would do in terms of android compatibility, but I can tell you that the actual migration takes little to no effort - I replaced it with a minute or two of CTRL + R's in IntelliJ today. |
I was looking at:
ethereumj/ethereumj-core/src/main/java/org/ethereum/crypto/ECKey.java
Line 710 in 4f80b8d
I notice that you use SpongyCastle/BouncyCastle's ECDSASigner, which just uses
java.math.BigIntegers
and is open to timing attacks.The BitCoinJ code, which this is forked from, wraps a JNI call to libsecp256k1, which in turn uses constant time arithmetic borrowed from GMP:
https://github.com/bitcoinj/bitcoinj/blob/master/core/src/main/java/org/bitcoinj/core/ECKey.java#L669
The current implementation is RFC6979 compliant and since it uses SpongyCastle it may be portable to android... is there any interest in giving this up and backporting the BitCoinJ ECDSA signature algorithm?
The text was updated successfully, but these errors were encountered: