aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
AgeCommit message (Collapse)Author
2018-07-27Update copyright headers to 2018DrahtBot
2018-07-09Merge #13386: SHA256 implementations based on Intel SHA ExtensionsWladimir J. van der Laan
66b2cf1ccfad545a8ec3f2a854e23f647322bf30 Use immintrin.h everywhere for intrinsics (Pieter Wuille) 4c935e2eee456ff66cdfb908b0edffdd1e8a6c04 Add SHA256 implementation using using Intel SHA intrinsics (Pieter Wuille) 268400d3188200c9e3dcd3482c4853354388a721 [Refactor] CPU feature detection logic for SHA256 (Pieter Wuille) Pull request description: Based on #13191. This adds SHA256 implementations that use Intel's SHA Extension instructions (using intrinsics). This needs GCC 4.9 or Clang 3.4. In addition to #13191, two extra implementations are provided: * (a) A variable-length SHA256 implementation using SHA extensions. * (b) A 2-way 64-byte input double-SHA256 implementation using SHA extensions. Benchmarks for 9001-element Merkle tree root computation on an AMD Ryzen 1800X system: * Using generic C++ code (pre-#10821): 6.1ms * Using SSE4 (master, #10821): 4.6ms * Using 4-way SSE4 specialized for 64-byte inputs (#13191): 2.8ms * Using 8-way AVX2 specialized for 64-byte inputs (#13191): 2.1ms * Using 2-way SHA-NI specialized for 64-byte inputs (this PR): 0.56ms Benchmarks for 32-byte SHA256 on the same system: * Using SSE4 (master, #10821): 190ns * Using SHA-NI (this PR): 53ns Benchmarks for 1000000-byte SHA256 on the same system: * Using SSE4 (master, #10821): 2.5ms * Using SHA-NI (this PR): 0.51ms Tree-SHA512: 2b319e33b22579f815d91f9daf7994a5e1e799c4f73c13e15070dd54ba71f3f6438ccf77ae9cbd1ce76f972d9cbeb5f0edfea3d86f101bbc1055db70e42743b7
2018-07-07Use __cpuid_count for gnu C to avoid gitian build fail.Chun Kuan Lee
2018-06-26Use immintrin.h everywhere for intrinsicsPieter Wuille
2018-06-26Add SHA256 implementation using using Intel SHA intrinsicsPieter Wuille
2018-06-24[Refactor] CPU feature detection logic for SHA256Pieter Wuille
2018-06-24Merge #13471: For AVX2 code, also check for AVX, XSAVE, and OS supportWladimir J. van der Laan
32d153fa360f73b4999701b97d55b12318fd2659 For AVX2 code, also check for AVX, XSAVE, and OS support (Pieter Wuille) Pull request description: Fixes #12903. Tree-SHA512: 01e71efb5d3a43c49a145a5b1dc4fe7d0a491e1e78479e7df830a2aaac57c3dcfc316e28984c695206c76f93b68e4350fc037ca36756ca579b7070e39c835da2
2018-06-18For AVX2 code, also check for AVX, XSAVE, and OS supportPieter Wuille
2018-06-12Improve coverage of SHA256 SelfTest codePieter Wuille
2018-06-12Merge #13393: Enable double-SHA256-for-64-byte code on 32-bit x86Wladimir J. van der Laan
57ba401abcfe564a2c4d259e0f758401ed74616d Enable double-SHA256-for-64-byte code on 32-bit x86 (Pieter Wuille) Pull request description: The SSE4 and AVX2 double-SHA256-for-64-byte input code from #13191 compiles fine on 32-bit x86 systems, but the autodetection logic in sha256.cpp doesn't enable it. Fix this. Note that these instruction sets are only available on CPUs that support 64-bit mode as well, so it is only beneficial in the (perhaps unlikely) scenario where a 64-bit CPU is running a 32-bit Bitcoin Core binary. Tree-SHA512: 39d5963c1ba8c33932549d5fe98bd184932689a40aeba95043eca31dd6824f566197c546b60905555eccaf407408a5f0f200247bb0907450d309b0a70b245102
2018-06-06Use bracket syntax includes ("#include <foo.h>")practicalswift
2018-06-04Enable double-SHA256-for-64-byte code on 32-bit x86Pieter Wuille
2018-05-298-way AVX2 implementation for double SHA256 on 64-byte inputsPieter Wuille
2018-05-294-way SSE4.1 implementation for double SHA256 on 64-byte inputsPieter Wuille
2018-05-29Specialized double sha256 for 64 byte inputsPieter Wuille
2018-05-08Refactor SHA256 codePieter Wuille
2018-03-01Consensus: Fix bug when compiler do not support __builtin_clz*532479301
#ifdef is not correct since defination is defined to 0 or 1. Should change to #if
2018-01-03Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa
2017-11-16scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider
-BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT-
2017-09-05Merge #11143: Fix include path for bitcoin-config.hWladimir J. van der Laan
5abb93f0e Fix include path for bitcoin-config.h in crypto/common.h (danra) Pull request description: All the other files in the repo which include bitcoin-config.h do so with the appropriate subfolder prefixed: config/bitcoin-config.h The header should be included with the appropriate subfolder here as well. Tree-SHA512: abda23a9cf251553f90afe0ee1866de46ed579471f4139737239a4f9334ca817d985deac6336740898718775d1264c0b80cb348668b10a9cae970895f2de37b8
2017-09-05Merge #11176: build: Rename --enable-experimental-asm to --enable-asm and ↵Wladimir J. van der Laan
enable by default 538cc0ca8 build: Mention use of asm in summary (Wladimir J. van der Laan) ce5381e7f build: Rename --enable-experimental-asm to --enable-asm and enable by default (Wladimir J. van der Laan) Pull request description: Now that 0.15 is branched off, enable assembler SHA256 optimizations by default, but still allow disabling them, for example if something goes wrong with auto-detection on a platform. Also add mention of the use of asm in the configure summary. Tree-SHA512: cd20c497f65edd6b1e8b2cc3dfe82be11fcf4777543c830ccdec6c10f25eab4576b0f2953f3957736d7e04deaa4efca777aa84b12bb1cecb40c258e86c120ec8
2017-09-02Update hmac_sha256.hUtsav Gupta
Fixed a typo
2017-08-31Fix include path for bitcoin-config.h in crypto/common.hdanra
All the other files in the repo which include bitcoin-config.h do so with the appropriate subfolder prefixed: config/bitcoin-config.h The header should be included with the appropriate subfolder here as well. This canonicalization also allows getting rid of a bit of extra configuration in Makefile.am.
2017-08-28build: Rename --enable-experimental-asm to --enable-asm and enable by defaultWladimir J. van der Laan
Now that 0.15 is branched off, enable assembler SHA256 optimizations by default.
2017-08-16Declare single-argument (non-converting) constructors "explicit"practicalswift
In order to avoid unintended implicit conversions.
2017-08-07scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift
instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
2017-07-20Protect SSE4 code behind a compile-time flagPieter Wuille
2017-07-20Add selftest for SHA256 transformPieter Wuille
2017-07-20Add SSE4 based SHA256Pieter Wuille
2017-07-20Add SHA256 dispatcherPieter Wuille
2017-07-20Support multi-block SHA256 transformsPieter Wuille
Extracted from a patch by Wladimir van der Laan.
2017-06-05Limit variable scopepracticalswift
2017-03-29Add a FastRandomContext::randrange and use itPieter Wuille
2017-03-29Add ChaCha20Pieter Wuille
2017-01-12Avoid unaligned access in crypto i/oPieter Wuille
2016-12-31Increment MIT Licence copyright header year on files modified in 2016isle2983
Edited via: $ contrib/devtools/copyright_header.py update .
2016-12-08Update ctaesPieter Wuille
2016-11-28Fix some typosfsb4000
2016-05-13crypto: add AES 128/256 CBC classesCory Fields
The output should always match openssl's, even for failed operations. Even for a decrypt with broken padding, the output is always deterministic (and attemtps to be constant-time).
2016-05-13Add ctaes-based constant time AES implementationPieter Wuille
2016-05-11Merge commit 'a545127fbccef4ee674d18d43732ce00ba97f782' as 'src/crypto/ctaes'Pieter Wuille
2016-04-15crypto: bytes counts are 64 bitWladimir J. van der Laan
Byte counts for SHA256, SHA512, SHA1 and RIPEMD160 must be 64 bits. `size_t` has a different size per platform, causing divergent results when hashing more than 4GB of data.
2015-03-06build: Endian compatibilityWladimir J. van der Laan
- Detect endian instead of stopping configure on big-endian - Add `byteswap.h` and `endian.h` header for compatibility with Windows and other operating systems that don't come with them - Update `crypto/common.h` functions to use compat endian header
2015-01-06Use libsecp256k1's RFC6979 implementationPieter Wuille
2014-12-19Added "Core" to copyright headerssandakersmann
Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-11-20Header define style cleanupsPieter Wuille
2014-11-20Add the RFC6979 PRNGPieter Wuille
2014-11-20Add HMAC-SHA256Pieter Wuille
2014-11-20Split up crypto/sha2Pieter Wuille
2014-11-03Fix all header definesPavel Janík