summaryrefslogtreecommitdiff
path: root/src/crypto
Commit message (Collapse)AuthorAgeFilesLines
* crypto: check+throw for Cryptonight v1 invalid inputjeffro2562025-07-111-1/+11
| | | | | | | If `crypto::cn_slow_hash()` is called with `variant=1` and an input length of less thab 43 bytes, it triggers a program exit. This checks first and throws an exception instead. Thank you to ADA Logics and the MAGIC Monero Fund for reporting this!
* crypto: make CRYPTO_DEFINE_HASH_FUNCTIONS adhere strict aliasingjeffro2562025-01-091-2/+7
| | | | This code could've caused issues if the pointer to the `public_key`, `key_image`, `hash`, etc wasn't aligned on an 8-byte boundary.
* build: fix build with Boost 1.85 and remove instances of viewkey logging ↵jeffro2562024-09-101-3/+11
| | | | | | | | | | | [RELEASE] 1. Use std::is_standard_layout and std::is_trivially_copyable instead of std::is_pod for KV byte-wise serialization, which fixes compile issue for Boost UUIDs 2. Removed reimplementation of std::hash for boost::uuids::uuid 3. Removed << operator overload for crypto::secret_key 4. Removed instances in code where private view key was dumped to the log in plaintext Release version of #9450, containing C++14 modified assertions
* JH hash compiler workaroundsSChernykh2023-11-041-4/+13
| | | | | | | - Fixed uninitialized `state->x` warning - Fixed broken code with `-O3` or `-Ofast` The old code is known to break GCC 10.1 and GCC 11.4
* Fixed deadlock and crash when syncing with full dataset on WindowsSChernykh2023-03-292-5/+8
| | | | | | | | | | | | It's not allowed to use WaitForSingleObject with _beginthread, because the thread closes its own handle before exiting. So the wait function will either wait on an invalid handle, or on a different handle used by something else. Or, if it starts waiting before the thread exits, the behavior is undefined according to MS: "If this handle is closed while the wait is still pending, the function's behavior is undefined." In my test sync I observed threads getting stuck infinitely on WaitForSingleObject, and then rx_set_main_seedhash spamming new threads when RandomX seed changes again. Eventually the system ran out of resources, and monerod aborted with "Couldn't start RandomX seed thread" message. This PR fixes it by using `_beginthreadex` instead and explicitly closing the handle when it's safe.
* Demote large pages warning to `mdebug`SChernykh2023-01-171-4/+7
|
* RandomX: print VM allocation warnings only onceSChernykh2023-01-111-2/+10
|
* Refactored rx-slow-hash.cSChernykh2022-12-143-199/+348
| | | | | | | | | - Straight-forward call interface: `void rx_slow_hash(const char *seedhash, const void *data, size_t length, char *result_hash)` - Consensus chain seed hash is now updated by calling `rx_set_main_seedhash` whenever a block is added/removed or a reorg happens - `rx_slow_hash` will compute correct hash no matter if `rx_set_main_seedhash` was called or not (the only difference is performance) - New environment variable `MONERO_RANDOMX_FULL_MEM` to force use the full dataset for PoW verification (faster block verification) - When dataset is used for PoW verification, dataset updates don't stall other threads (verification is done in light mode then) - When mining is running, PoW checks now also use dataset for faster verification
* Merge pull request #8262luigi11112022-05-101-32/+61
|\ | | | | | | 268a039 Optimized keccak implementation (SChernykh)
| * Optimized keccak implementationSChernykh2022-04-181-32/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All tests were conducted on the same PC (Ryzen 5 5600X running at fixed 4.65 GHz). Before: test_cn_fast_hash<32> (100000 calls) - OK: 1 us/call test_cn_fast_hash<16384> (1000 calls) - OK: 164 us/call After: test_cn_fast_hash<32> (100000 calls) - OK: 0 us/call test_cn_fast_hash<16384> (1000 calls) - OK: 31 us/call More than 5 times speedup for cn_fast_hash. Also noticed consistent 1-2% improvement in test_construct_tx results.
* | Add view tags to outputs to reduce wallet scanning timej-berman2022-04-182-1/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | Implements view tags as proposed by @UkoeHB in MRL issue https://github.com/monero-project/research-lab/issues/73 At tx construction, the sender adds a 1-byte view tag to each output. The view tag is derived from the sender-receiver shared secret. When scanning for outputs, the receiver can check the view tag for a match, in order to reduce scanning time. When the view tag does not match, the wallet avoids the more expensive EC operations when deriving the output public key using the shared secret.
* | CMake: Add missing headers via monero_find_all_headers macromj-xmr2022-04-061-21/+1
|/
* Copyright: Update to 2022mj-xmr2022-03-0439-39/+43
|
* Merge pull request #8052luigi11112022-03-022-8/+44
|\ | | | | | | c36ea26 fix ge_p3_is_point_at_infinity(), which is evaluating field elements that haven't been reduced by the field order (koe)
| * fix ge_p3_is_point_at_infinity(), which is evaluating field elements that ↵koe2022-01-252-8/+44
| | | | | | | | haven't been reduced by the field order
* | Merge pull request #7877luigi11112022-03-021-1/+10
|\ \ | | | | | | | | | e08abaa multisig key exchange update and refactor (koe)
| * | multisig key exchange update and refactorkoe2022-02-221-1/+10
| | |
* | | crypto: fix constant randomx exceptions in large page allocatormoneromooo-monero2022-02-191-1/+4
| | | | | | | | | | | | | | | | | | If allocating large pages fails, we don't try again. This has the obvious drawback of not being able to use large pages if they fail once.
* | | Merge pull request #8031luigi11112021-11-091-16/+54
|\ \ \ | |_|/ |/| | | | | 187633c slow_hash: don't blow out Mac stack on ARM64 (Howard Chu)
| * | slow_hash: don't blow out Mac stack on ARM64Howard Chu2021-10-301-16/+54
| | |
* | | crypto: fix typo in ifdefselsta2021-10-291-1/+1
|/ /
* / ARMv8: detect AES support dynamicallyHoward Chu2021-10-101-35/+105
|/
* cmake: set xcode file typeselsta2021-04-281-0/+1
|
* Merge pull request #7373luigi11112021-03-291-10/+18
|\ | | | | | | 86263b3 Honor LARGE_PAGES flag in randomx umask (Howard Chu)
| * Honor LARGE_PAGES flag in randomx umaskHoward Chu2021-02-111-10/+18
| |
* | New add_aux_pow RPC to support merge miningmoneromooo-monero2021-02-092-0/+155
|/
* crypto: fix non zero scalar being 0 after reducingmoneromooo-monero2020-12-041-4/+8
|
* Merge pull request #6111Riccardo Spagni2020-09-061-4/+46
|\ | | | | | | | | | | d20ff4f64 functional_tests: add a large (many randomx epochs) p2p reorg test (moneromooo-monero) 6a0b3b1f8 functional_tests: add randomx tests (moneromooo-monero) 9d42649d5 core: fix mining from a block that's not the current top (moneromooo-monero)
| * functional_tests: add randomx testsmoneromooo-monero2020-08-271-4/+46
| |
* | CLSAG signaturesSarang Noether2020-08-272-0/+102
|/
* Merge pull request #6337Alexander Blair2020-08-164-0/+152
|\ | | | | | | a11ec4ac1 Support for supercop ASM in wallet, and benchmark for supercop (Lee Clagett)
| * Support for supercop ASM in wallet, and benchmark for supercopLee Clagett2020-05-164-0/+152
| |
* | Updates InProofV1, OutProofV1, and ReserveProofV1 to new V2 variants that ↵Sarang Noether2020-08-092-9/+137
|/ | | | include all public proof parameters in Schnorr challenges, along with hash function domain separators. Includes new randomized unit tests.
* Merge pull request #6538Alexander Blair2020-07-191-10/+2
|\ | | | | | | 7178bb5c8 keccak: remove aligned check (moneromooo-monero)
| * keccak: remove aligned checkmoneromooo-monero2020-05-161-10/+2
| | | | | | | | | | | | Some tools report the alignment check as UB, which seems a bit dubious, but since the performance difference between the two versions is minimal, I'll go with the safe version
* | Update copyright year to 2020SomaticFanatic2020-05-0633-33/+33
|/ | | | Update copyright year to 2020
* Merge pull request #6441luigi11112020-05-051-0/+6
|\ | | | | | | 613071f use memwipe on secret k/alpha values (moneromooo-monero)
| * use memwipe on secret k/alpha valuesmoneromooo-monero2020-04-151-0/+6
| | | | | | | | Reported by UkoeHB_ and sarang
* | Adding Dandelion++ support to public networks:Lee Clagett2020-03-261-0/+70
|/ | | | | | - New flag in NOTIFY_NEW_TRANSACTION to indicate stem mode - Stem loops detected in tx_pool.cpp - Embargo timeout for a blackhole attack during stem phase
* Merge pull request #6298luigi11112020-03-311-0/+4
|\ | | | | | | fe92fa1 [randomx] Add missing randomx_vm_set_cache() (cohcho)
| * [randomx] Add missing randomx_vm_set_cache()cohcho2020-01-171-0/+4
| |
* | Merge pull request #6223Alexander Blair2020-02-281-7/+14
|\ \ | |/ |/| | | c3613031 Silence miner debugmsg spam (Howard Chu)
| * Silence miner debugmsg spamHoward Chu2019-12-091-7/+14
| | | | | | | | Don't try to allocate the dataset repeatedly if it has already failed.
* | Replace memset with memwipe.Bert Peters2019-11-131-4/+5
|/
* RandomX: update to v1.1.4tevador2019-10-131-76/+30
| | | | | | | * Faster cache initialization with SSSE3/AVX2 * Automatic detection of CPU capabilities in RandomX * Fixed a possible out-of-bounds access in superscalar program generator * Use MONERO_RANDOMX_UMASK to manually disable RandomX flags in monerod
* Fix for miners on reorgHoward Chu2019-10-071-1/+4
| | | | Make sure dataset gets re-init'd if a reorg changes the epoch
* Update to RandomX v1.1.3, simplifyHoward Chu2019-10-051-19/+2
| | | | | | We don't need to detect if the cache has changed, just always call to set it on the VM. The call will be a no-op if the cache hasn't changed.
* Fix randomx cache selection for RPCsHoward Chu2019-10-031-12/+28
| | | | Was using the wrong cache slot, and returning invalid PoW hashes to RPC clients
* RandomX integrationHoward Chu2019-09-255-7/+446
| | | | Support RandomX PoW algorithm
* Merge pull request #5877luigi11112019-09-241-3/+2
|\ | | | | | | | | | | 2cd4fd8 Changed the use of boost:value_initialized for C++ list initializer (JesusRami) 4ad191f Removed unused boost/value_init header (whyamiroot) 928f4be Make null hash constants constexpr (whyamiroot)