aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto.go
Commit message (Collapse)AuthorAgeFilesLines
* core/vm: faster create/create2 (#17806)Martin Holst Swende2018-10-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | * core/vm/runtim: benchmark create/create2 * core/vm: do less hashing in CREATE2 * core/vm: avoid storing jumpdest analysis for initcode * core/vm: avoid unneccesary lookups, remove unused fields * core/vm: go formatting tests * core/vm: save jumpdest analysis locally * core/vm: use common.Hash instead of nil, fix review comments * core/vm: removed type destinations * core/vm: correct check for empty hash * eth: more elegant api_tracer * core/vm: address review concerns
* crypto: change formula for create2 (#17393)gary rong2018-08-141-2/+2
|
* core, crypto, params: implement CREATE2 evm instrction (#17196)gary rong2018-07-241-0/+6
| | | | | | | | | | * core, crypto, params: implement CREATE2 evm instrction * core/vm: add opcode to string mapping * core: remove past fork checking * core, crypto: use option2 to generate new address
* crypto: replace ToECDSAPub with error-checking func UnmarshalPubkey (#16932)Felix Lange2018-06-121-5/+8
| | | | | | ToECDSAPub was unsafe because it returned a non-nil key with nil X, Y in case of invalid input. This change replaces ToECDSAPub with UnmarshalPubkey across the codebase.
* crypto: fix golint warnings (#16710)kiel barry2018-05-091-6/+6
|
* crypto: ensure private keys are < N (#15745)Alex Wu2018-01-021-0/+10
| | | Fixes #15744
* crypto: Fix comment typoGeorge Ornbo2017-12-151-1/+1
|
* crypto: fix error check in toECDSA (#15632)Felix Lange2017-12-121-0/+3
| | | | | | | | With this change, key, err := crypto.HexToECDSA("000000...") returns nil key and an error instead of a non-nil key with nil X and Y inside. Issue found by @guidovranken.
* accounts/keystore, crypto: don't enforce key checks on existing keyfilesPéter Szilágyi2017-06-011-8/+20
|
* accounts/keystore, crypto: enforce 256 bit keys on importPéter Szilágyi2017-05-231-15/+12
|
* crypto, pow, vendor: hash optimizations, mmap ethashPéter Szilágyi2017-03-091-36/+0
|
* crypto, pow: add pure Go implementation of ethashPéter Szilágyi2017-03-091-0/+48
|
* common: move big integer math to common/math (#3699)Felix Lange2017-02-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common: remove CurrencyToString Move denomination values to params instead. * common: delete dead code * common: move big integer operations to common/math This commit consolidates all big integer operations into common/math and adds tests and documentation. There should be no change in semantics for BigPow, BigMin, BigMax, S256, U256, Exp and their behaviour is now locked in by tests. The BigD, BytesToBig and Bytes2Big functions don't provide additional value, all uses are replaced by new(big.Int).SetBytes(). BigToBytes is now called PaddedBigBytes, its minimum output size parameter is now specified as the number of bytes instead of bits. The single use of this function is in the EVM's MSTORE instruction. Big and String2Big are replaced by ParseBig, which is slightly stricter. It previously accepted leading zeros for hexadecimal inputs but treated decimal inputs as octal if a leading zero digit was present. ParseUint64 is used in places where String2Big was used to decode a uint64. The new functions MustParseBig and MustParseUint64 are now used in many places where parsing errors were previously ignored. * common: delete unused big integer variables * accounts/abi: replace uses of BytesToBig with use of encoding/binary * common: remove BytesToBig * common: remove Bytes2Big * common: remove BigTrue * cmd/utils: add BigFlag and use it for error-checked integer flags While here, remove environment variable processing for DirectoryFlag because we don't use it. * core: add missing error checks in genesis block parser * common: remove String2Big * cmd/evm: use utils.BigFlag * common/math: check for 256 bit overflow in ParseBig This is supposed to prevent silent overflow/truncation of values in the genesis block JSON. Without this check, a genesis block that set a balance larger than 256 bits would lead to weird behaviour in the VM. * cmd/utils: fixup import
* crypto: add btcec fallback for sign/recover without cgo (#3680)Felix Lange2017-02-181-79/+16
| | | | | | | | | | | * vendor: add github.com/btcsuite/btcd/btcec * crypto: add btcec fallback for sign/recover without cgo This commit adds a non-cgo fallback implementation of secp256k1 operations. * crypto, core/vm: remove wrappers for sha256, ripemd160
* all: fix spelling errorsPéter Szilágyi2017-01-071-2/+2
|
* accounts, core, crypto, internal: use normalised V during signature handling ↵Péter Szilágyi2017-01-051-26/+5
| | | | | | | | | (#3455) To address increasing complexity in code that handles signatures, this PR discards all notion of "different" signature types at the library level. Both the crypto and accounts package is reduced to only be able to produce plain canonical secp256k1 signatures. This makes the crpyto APIs much cleaner, simpler and harder to abuse.
* internal/ethapi: add personal_sign and fix eth_sign to hash message (#2940)bas-vk2016-10-291-4/+33
| | | | | | | | | | | | | | | | | | | | This commit includes several API changes: - The behavior of eth_sign is changed. It now accepts an arbitrary message, prepends the well-known string \x19Ethereum Signed Message:\n<length of message> hashes the result using keccak256 and calculates the signature of the hash. This breaks backwards compatability! - personal_sign(hash, address [, password]) is added. It has the same semantics as eth_sign but also accepts a password. The private key used to sign the hash is temporarily unlocked in the scope of the request. - personal_recover(message, signature) is added and returns the address for the account that created a signature.
* all: fix go vet warningsFelix Lange2016-04-151-2/+2
|
* accounts, crypto: move keystore to package accountsFelix Lange2016-04-121-106/+0
| | | | | | | | | | The account management API was originally implemented as a thin layer around crypto.KeyStore, on the grounds that several kinds of key stores would be implemented later on. It turns out that this won't happen so KeyStore is a superflous abstraction. In this commit crypto.KeyStore and everything related to it moves to package accounts and is unexported.
* tests: remove eth, node, accounts dependenciesFelix Lange2016-04-121-13/+0
| | | | Unlocking the accounts in the test doesn't help with anything.
* crypto: Remove dead codeRicardo Catalinas Jiménez2016-02-221-1/+0
|
* crypto: Add backward compatible aliases for Sha3{,Hash}()Ricardo Catalinas Jiménez2016-02-221-0/+4
|
* all: Rename crypto.Sha3{,Hash}() to crypto.Keccak256{,Hash}()Ricardo Catalinas Jiménez2016-02-221-5/+5
| | | | As we aren't really using the standarized SHA-3
* parmas, crypto, core, core/vm: homestead consensus protocol changesGustav Simonsson2016-02-181-2/+11
| | | | | | | | * change gas cost for contract creating txs * invalidate signature with s value greater than secp256k1 N / 2 * OOG contract creation if not enough gas to store code * new difficulty adjustment algorithm * new DELEGATECALL op code
* crypto, crypto/ecies, crypto/secp256k1: libsecp256k1 scalar multGustav Simonsson2015-11-301-17/+9
| | | | thanks to Felix Lange (fjl) for help with design & impl
* cmd/utils, crypto: add --lightkdf flag for lighter KDFDrake Burroughs2015-10-291-1/+1
|
* console:zelig2015-10-221-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lines with leading space are ommitted from history * exit processed even with whitespace around * all whitespace lines (not only empty ones) are ignored add 7 missing commands to admin api autocomplete registrar: methods now return proper error if reg addresses are not set. fixes #1457 rpc/console: fix personal.newAccount() regression. Now all comms accept interactive password registrar: add registrar tests for errors crypto: catch AES decryption error on presale wallet import + fix error msg format. fixes #1580 CLI: improve error message when starting a second instance of geth. fixes #1564 cli/accounts: unlock multiple accounts. fixes #1785 * make unlocking multiple accounts work with inline <() fd * passwdfile now correctly read only once * improve logs * fix CLI help text for unlocking fix regression with docRoot / admin API * docRoot/jspath passed to rpc/api ParseApis, which passes onto adminApi * docRoot field for JS console in order to pass when RPC is (re)started * improve flag desc for jspath common/docserver: catch http errors from response fix rpc/api tests common/natspec: fix end to end test (skipped because takes 8s) registrar: fix major regression: * deploy registrars on frontier * register HashsReg and UrlHint in GlobalRegistrar. * set all 3 contract addresses in code * zero out addresses first in tests
* Merge pull request #1853 from Gustav-Simonsson/libsecp256k1_updateJeffrey Wilcke2015-10-161-1/+9
|\ | | | | Update libsecp256k1, Go wrapper and tests
| * core/secp256k1: update libsecp256k1 Go wrapper and testsGustav Simonsson2015-10-091-1/+9
| |
* | crypto: correct sig validation, add more unit testsGustav Simonsson2015-09-221-13/+2
|/
* Change go-uuid to use the current supported repository.Jeff R. Allen2015-09-121-1/+1
|
* all: fix license headers one more timeFelix Lange2015-07-241-1/+1
| | | | I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
* all: update license headers to distiguish GPL/LGPLFelix Lange2015-07-231-4/+4
| | | | | All code outside of cmd/ is licensed as LGPL. The headers now reflect this by calling the whole work "the go-ethereum library".
* all: update license informationFelix Lange2015-07-071-0/+16
|
* fix account orderingzelig2015-07-031-1/+1
| | | | | | | | * chronological order of creation * new naming scheme keystore/UTC--<created_at UTC ISO8601>-<address hex> * KeyStore2 -> KeyStore * backward compatibility * refactor keyStore methods
* Change keystore to version 3Gustav Simonsson2015-06-241-7/+19
| | | | | | | | | | | | * Change password protection crypto in keystore to version 3 * Update KeyStoreTests/basic_tests.json * Add support for PBKDF2 with HMAC-SHA256 * Change MAC and encryption key to avoid unnecessary hashing * Add tests for test vectors in new wiki page defining version 3 * Add tests for new keystore tests in ethereum/tests repo * Move JSON loading util to common for use in both tests and crypto packages * Add backwards compatibility with key store version 1
* crypto: return common.Address rather than raw bytesobscuren2015-06-051-4/+4
|
* Initialise curve N value in package initGustav Simonsson2015-06-031-1/+3
|
* Add EC signature validations before call to libsecp256k1Gustav Simonsson2015-06-021-0/+14
|
* Change default keystore dirGustav Simonsson2015-05-131-1/+1
|
* Update key store to new spec but keep address field for nowGustav Simonsson2015-05-121-1/+1
| | | | * Also fix address types post-rebase
* Use common.Address type for accounts.AddressGustav Simonsson2015-05-121-3/+3
|
* Improve key store passphrase cryptoGustav Simonsson2015-05-121-1/+1
| | | | | | | * Change MAC-then-Encrypt to Encrypt-then-MAC * Change AES256 to AES128 * Use first 16 bytes of KDF derived key for AES and remaining 16 for MAC
* Add loading of block test privkey if presentGustav Simonsson2015-04-281-0/+13
|
* crypto: update {Load,Save}ECDSA comments to mention hex encodingFelix Lange2015-04-191-2/+3
|
* removed utility function and implemented hex conversation in crypto functionsBas van Kervel2015-04-091-2/+9
|
* Support for import/export hex encoded keys, closes #635Bas van Kervel2015-04-091-3/+3
|
* Forward and log EC recover err and remove dup pubkey len checkGustav Simonsson2015-04-071-9/+7
|
* Cleanup.obscuren2015-03-291-9/+7
|
* common: remove WriteFile and ReadAllFile (use ioutil instead)zelig2015-03-271-2/+4
|
* import/export accountszelig2015-03-271-0/+5
| | | | | | | | | | | - cli: add passwordfile flag - cli: change unlock flag only takes account - cli: with unlock you are prompted for password or use passfile with password flag - cli: unlockAccount used in normal client start (run) and accountExport - cli: getPassword used in accountCreate and accountImport - accounts: Manager.Import, Manager.Export - crypto: SaveECDSA (to complement LoadECDSA) to save to file - crypto: NewKeyFromECDSA added (used in accountImport and New = generated constructor)
* Merge remote-tracking branch 'ethereum/conversion' into conversionFelix Lange2015-03-171-2/+5
|\
| * converted vmobscuren2015-03-171-2/+5
| |
* | crypto: fix Sha3Hash and add a test for itFelix Lange2015-03-171-1/+1
|/
* crypto: add Sha3HashFelix Lange2015-03-171-1/+10
|
* Moved ethutil => commonobscuren2015-03-161-5/+5
|
* crypto: switch to golang.org/x/cryptoFelix Lange2015-02-171-2/+2
| | | | | code.google.com/p/go.crypto is deprecated and will cause problems in future versions of Go.
* Moved ECIES to repo & added secondary title for webviewobscuren2015-02-141-1/+1
| | | | | * ECIES moved from obscuren to ethereum * Added html META[name=badge] to reflect menuItem.secondaryTitle
* crypto: add key loading functionsFelix Lange2015-02-101-0/+28
|
* crypto: make it easier to run Sha3 on multiple inputsFelix Lange2015-02-061-3/+4
| | | | | crypto.Sha3(append(foo, bar)) --> crypto.Sha3(foo, bar) crypto.Sha3([]byte{}) --> crypto.Sha3()
* Fixed whisper pub key bugobscuren2015-01-301-1/+1
| | | | | * Unrecoverable messages would cause segfault when recovering invalid pub key
* Address pull request commentsGustav Simonsson2015-01-281-4/+3
| | | | | | | | | * Use crypto.Sign instead of directly calling secp256k1 lib * Rename UserAccount to Account and Addr to Address (for consistency) * Change AccountManager.Sign to take ptr to Account instead of address byte array * Simplify copying of Accounts in Accounts() * PubkeyToAddress and GetEntropyCSPRNG now exported
* Add accounts package and refactor key storesGustav Simonsson2015-01-261-2/+8
| | | | | | | | * Add initial UserAccount and AccountManager structs * Add NewAccount, Sign and Accounts functions * Refactor key stores to use key address as main identifier while keeping the UUID. * Use key address as file/dir names instead of UUID
* Merge branch 'import_presale_keys' of ↵obscuren2015-01-231-0/+105
|\ | | | | | | | | | | | | https://github.com/Gustav-Simonsson/go-ethereum into Gustav-Simonsson-import_presale_keys Conflicts: crypto/crypto.go
| * CamelCase aesCBCDecryptGustav Simonsson2015-01-221-2/+2
| |
| * Add ImportPreSaleKeyGustav Simonsson2015-01-211-0/+104
| | | | | | | | | | | | * ImportPreSaleKey takes a KeyStore, a presale key JSON (e.g. file content) and a password string. It stores the key in the given key store. * Refactored common AES decryption and moved some functions to crypto.go
* | Use curve params instead of hardcoded 32 bytesobscuren2015-01-231-1/+1
| |
* | Pad private key when signing & length check for hashes in signobscuren2015-01-231-1/+6
|/
* Moved `obscuren` secp256k1-goobscuren2015-01-221-1/+1
|
* Moved sha3 from `obscuren`obscuren2015-01-221-1/+1
|
* Added length checkesobscuren2014-12-131-1/+18
|
* Changed new methods to use ecdsa package for pub prv keysobscuren2014-12-101-23/+32
|
* Added Encrypt & Decrypt using the ECIES w/ testsobscuren2014-12-101-0/+42
|
* ethcrypto => cryptoobscuren2014-10-311-0/+47