-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cabal: Add a flag to enable/disable scrypt #2767
Conversation
5b8fd57
to
33c6bb5
Compare
. CBOR.toStrictByteString | ||
. CBOR.encodeBytes | ||
. BA.convert | ||
|
||
encryptPasswordWithScrypt :: (BA.ByteArrayAccess a, BA.ByteArray b) => a -> IO b |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For posterity: The documentation of the scrypt
package notes that the ByteString returned by Scrypt.getEncryptedPass
contains not just the encrypted password, but also the parameters and salt used to encrypt it. In contrast, the generate
function from the cryptonite
package only seems to return that encrypted password.
The difference does not matter for the integration test, but it would matter for legacy wallets (hence the choice to keep the scrypt
dependency in the core library.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes good point - thanks - this will need fixing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
bfa2462
to
497954e
Compare
497954e
to
24da1b0
Compare
I can confirm that without scrypt you can build v2021-09-09 of the cardano wallet on ARM64 without any further issue. I wanted to use it on the paper wallet terminal with cardano-python for testing. Which uses a raspberry pi. Just so you know it is smooth sailing after this 👍 |
I have merged in the latest |
09d5f87
to
2e21852
Compare
Hi, How were you able to build it without scrypt? I am trying to build I'm running: And it still shows me that Thanks. |
@bakon11 Was just to check if there were major hurdles beyond this. I removed all references to scrypt in the source code. Not recommended to really use it this way. IMHO, I am not an expert. The nix build of this repository worked like this 'nix-build -A cardano-wallet'. But it requires a lot of storage space. |
gotcha, so the scrypt flag that should signal cabal not to build it, won't work if there is actual references to scrypt in the source correct? Yeah, I agree removing it is not the best solution, but it's a solution to help keep on building a proof of concept project until a real fix is available. |
Yes indeed. What are you building? If you want to discuss you can find me on my discord here M2tec discord |
@HeinrichApfelmus, @rvl can we get this over the line? I've run into this today. |
d956343
to
c77a34d
Compare
Will be updating this PR soon, please hold tight. |
Hello thanks for the work |
cf505a1
to
4242c54
Compare
75f4b0c
to
6b48f57
Compare
bors try |
tryBuild succeeded: |
bors try |
@rvl if you're ok with this we can merge |
tryBuild succeeded: |
I'm not too keen on changing the scrypt package in the main code, for the time being. But we can replace this package in the integration tests, without too much risk.
I simply moved them to LegacySpec, and ensured LegacySpec only ran when scrypt was set. However, I'm seeing the following failures with +scrypt set: test/unit/Cardano/Wallet/Primitive/Passphrase/LegacySpec.hs:53:9: 1) Cardano.Wallet.Primitive.Passphrase.Legacy, Scrypt tests-only cryptonite version, Verify passphrase expected: True but got: False To rerun use: --match "/Cardano.Wallet.Primitive.Passphrase.Legacy/Scrypt tests-only cryptonite version/Verify passphrase/" test/unit/Cardano/Wallet/Primitive/Passphrase/LegacySpec.hs:68:9: 2) Cardano.Wallet.Primitive.Passphrase.Legacy, Scrypt tests-only cryptonite version, getSalt expected: Just "abc" but got: Just "+jottFIZjVmXoC7LlTBZWlYzBX4QQwfduFuxCkMHUis=" To rerun use: --match "/Cardano.Wallet.Primitive.Passphrase.Legacy/Scrypt tests-only cryptonite version/getSalt/" test/unit/Cardano/Wallet/Primitive/Passphrase/LegacySpec.hs:84:13: 3) Cardano.Wallet.Primitive.Passphrase.Legacy, Scrypt tests-only cryptonite version, golden test legacy passphrase encryption, compare new implementation with cardano-sl - short password expected: Right () but got: Left ErrWrongPassphrase To rerun use: --match "/Cardano.Wallet.Primitive.Passphrase.Legacy/Scrypt tests-only cryptonite version/golden test legacy passphrase encryption/compare new implementation with cardano-sl - short password/" test/unit/Cardano/Wallet/Primitive/Passphrase/LegacySpec.hs:94:13: 4) Cardano.Wallet.Primitive.Passphrase.Legacy, Scrypt tests-only cryptonite version, golden test legacy passphrase encryption, compare new implementation with cardano-sl - normal password expected: Right () but got: Left ErrWrongPassphrase To rerun use: --match "/Cardano.Wallet.Primitive.Passphrase.Legacy/Scrypt tests-only cryptonite version/golden test legacy passphrase encryption/compare new implementation with cardano-sl - normal password/" test/unit/Cardano/Wallet/Primitive/Passphrase/LegacySpec.hs:103:13: 5) Cardano.Wallet.Primitive.Passphrase.Legacy, Scrypt tests-only cryptonite version, golden test legacy passphrase encryption, compare new implementation with cardano-sl - empty password expected: Right () but got: Left ErrWrongPassphrase To rerun use: --match "/Cardano.Wallet.Primitive.Passphrase.Legacy/Scrypt tests-only cryptonite version/golden test legacy passphrase encryption/compare new implementation with cardano-sl - empty password/" test/unit/Cardano/Wallet/Primitive/Passphrase/LegacySpec.hs:113:13: 6) Cardano.Wallet.Primitive.Passphrase.Legacy, Scrypt tests-only cryptonite version, golden test legacy passphrase encryption, compare new implementation with cardano-sl - cardano-wallet password expected: Right () but got: Left ErrWrongPassphrase To rerun use: --match "/Cardano.Wallet.Primitive.Passphrase.Legacy/Scrypt tests-only cryptonite version/golden test legacy passphrase encryption/compare new implementation with cardano-sl - cardano-wallet password/" Randomized with seed 866879004 Finished in 28.5483 seconds, used 40.2343 seconds of CPU time 85 examples, 6 failures
1. Swap order of cborify and hashMaybe This makes the legacy golden tests pass, and matches the old implementation. 2. Fix getSalt implementation The salt should be converted from base64. This fixes the test "Verify passphrase" calling `checkPassphraseTestingOnly`. The getSalt golden value was updated. With the "Verify passphrase" test now succeeding, it seems like the previous expected salt value — "abc" — was just a dummy value, and not the right expectation.
This way it matches the implemetnation on `master`.
I manually tested these on current master — before the commits of this PR — and they passed.
cdf9a54
to
72d44e9
Compare
I checked it and rebased again. It looks good to merge. |
bors r+ |
Build succeeded: |
Hello I have been following this topic and this one also input-output-hk/daedalus#2677 Thanks |
any update on the scrypt issue? I'm getting this on an apple m1. I tried using the flag mentioned in the thread above and same error |
Issue Number
ADP-842
Fixes #2578.
Overview
scrypt
package.scrypt
withcryptonite
for the integration tests onlyIf
scrypt
does not compile for your target system, then disable it with:Comments
I'm not too keen on changing the scrypt package in the main code, for the time being. But we can replace this package in the integration tests, without too much risk.
Need to use conditional modules instead of CPP because that breaks stylish-haskell.