Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

AES128-CTR replacement #3638

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

AES128-CTR replacement #3638

wants to merge 4 commits into from

Conversation

chfast
Copy link
Member

@chfast chfast commented Mar 14, 2017

No description provided.

Copy link
Contributor

@gcolvin gcolvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a clean translation of typical crypto code. If you wanted an OO interface then state_t could be wrapped with an AES class with Cipher() and BlockCopy() as public methods and the rest private.

@chfast chfast force-pushed the replace-cryptopp-aes branch from d3c0996 to 69f2e51 Compare March 14, 2017 20:28
@chfast chfast changed the title Experimental: AES replacement AES128-CTR replacement Mar 14, 2017
@codecov-io
Copy link

codecov-io commented Mar 14, 2017

Codecov Report

Merging #3638 into develop will decrease coverage by 0.77%.
The diff coverage is 86.86%.

@@             Coverage Diff             @@
##           develop    #3638      +/-   ##
===========================================
- Coverage    50.15%   49.37%   -0.78%     
===========================================
  Files          356      355       -1     
  Lines        26950    25996     -954     
  Branches      3222     3226       +4     
===========================================
- Hits         13517    12836     -681     
+ Misses       12287    12104     -183     
- Partials      1054     1056       +2
Impacted Files Coverage Δ
libdevcrypto/SecretStore.cpp 43.82% <ø> (-5.28%)
libethcore/KeyManager.cpp 43.7% <ø> (ø)
test/libdevcrypto/crypto.cpp 95.24% <ø> (-0.43%)
libdevcrypto/CryptoPP.cpp 81.48% <ø> (ø)
libdevcrypto/Common.h 64.28% <ø> (-4.47%)
libdevcrypto/Common.cpp 61.23% <ø> (+0.34%)
libdevcrypto/AES.h 100% <100%> (ø)
test/libdevcrypto/AES.cpp 100% <100%> (ø)
libdevcrypto/AES.cpp 78.37% <80.64%> (-3.98%)
libethereum/Transaction.cpp 51.02% <0%> (-25.22%)
... and 93 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea88803...0dac6ca. Read the comment docs.

@chfast chfast force-pushed the replace-cryptopp-aes branch from 69f2e51 to 0dac6ca Compare March 14, 2017 20:41
namespace
{

// This code is modified version of https://github.com/kokke/tiny-AES128-C.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please mention that it was released under the "unlicense", roughly equivalent to a release to the public domain.

{
for (int j = 0; j < 4; ++j)
{
tempa[j] = roundKeys[(i-1) * 4 + j];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i is bounded by Nb * (Nr + 1) and j is bounded by 4 - is there any easier way to (perhaps in an automated way) check that this does not go out of bounds with respect to roundKeys?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hoped I will not have to decrypt this indexing :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but this just looks like dynamite to me. Buffers passed as plain pointers with sizes resulting from formulas including weird constants, it is just too easy to confuse two constants here, and we don't really know how much this library is used, tested, etc.

@chfast
Copy link
Member Author

chfast commented Mar 21, 2017

I agree with @chriseth now. We should spend some time to find good AES implementation for both 128 and 256 (presale wallet) size.

@pirapira
Copy link
Member

@chfast what's the status here?

@chfast chfast changed the base branch from develop to master August 2, 2018 08:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants