compare the ecies mac in constant time and test the invalid password cause
What changed, and why it matters
This commit updates a subproject dependency called 'drongo' and adds a test. The title says the update makes an ECIES (a type of encryption) MAC comparison run in constant time, which is a defensive fix against timing attacks that could let someone guess a wallet password faster. The new test checks that entering the wrong password produces a clear 'invalid password' error rather than a vague import error. No direct code change is shown in the diff for the crypto routine itself; it lives inside the updated submodule.
Review the actual diff inside the drongo submodule commit 31130261ea12ce6c0836550b6a1653a083f78c38 to confirm the constant-time comparison is implemented correctly and covers all MAC comparison paths. Ensure the change is included in release notes as a hardening improvement.
Security signals we found
Constant-time cryptographic comparison (ECIES MAC)
Timing side-channel hardening
Encrypted wallet import password handling
Defensive regression test for invalid password error propagation
Evidence from the diff
The diff only shows a submodule bump in ‘drongo’ from cee00202dc8e8b09d223d694781459a6da9e05e3 to 31130261ea12ce6c0836550b6a1653a083f78c38, plus a new unit test in ElectrumTest.java. The commit message states the submodule change ‘compare[s] the ecies mac in constant time’ and that the test verifies the invalid-password cause is preserved. Constant-time MAC comparison prevents timing side-channels during encrypted wallet import password verification. The test asserts that importing an Electrum-encrypted wallet with password ‘wrong’ throws ImportException whose cause is InvalidPasswordException, ensuring UI error messages remain specific.
Changed components
drongo submodule (ECIES MAC verification)src/test/java/com/sparrowwallet/sparrow/io/ElectrumTest.javaInspect captured patch +12 / −1
### drongo
@@ -1 +1 @@
-Subproject commit cee00202dc8e8b09d223d694781459a6da9e05e3
+Subproject commit 31130261ea12ce6c0836550b6a1653a083f78c38
### src/test/java/com/sparrowwallet/sparrow/io/ElectrumTest.java
@@ -3,6 +3,7 @@
import com.google.common.io.ByteStreams;
import com.sparrowwallet.drongo.Network;
import com.sparrowwallet.drongo.Utils;
+import com.sparrowwallet.drongo.crypto.InvalidPasswordException;
import com.sparrowwallet.drongo.policy.PolicyType;
import com.sparrowwallet.drongo.protocol.ScriptType;
import com.sparrowwallet.drongo.wallet.MnemonicException;
@@ -107,6 +108,16 @@ public void testEncryptedImport() throws ImportException, IOException {
Assertions.assertEquals("xpub69iSRreMB6fu24sU8Tdxv7yYGqzPkDwPkwqUfKJTxW3p8afW7XvTewVCapuX3dQjdD197iF65WcjYaNpFbwWT3RyuZ1KJ3ToJNVWKWyAJ6f", wallet.getKeystores().get(0).getExtendedPublicKey().toString());
}
+ @Test
+ public void testEncryptedImportInvalidPassword() throws IOException {
+ Electrum electrum = new Electrum();
+ byte[] walletBytes = ByteStreams.toByteArray(getInputStream("electrum-encrypted"));
+
+ ImportException importException = Assertions.assertThrows(ImportException.class, () -> electrum.importWallet(new ByteArrayInputStream(walletBytes), "wrong"));
+ //FileImportPane reports "Invalid wallet password" by unwrapping this cause - dropping it degrades the message to a generic import error
+ Assertions.assertInstanceOf(InvalidPasswordException.class, importException.getCause());
+ }
+
@Test
public void testSinglesigSeedExport() throws ImportException, ExportException, IOException, MnemonicException {
Electrum electrum = new Electrum();Why this scored 47/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.