Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit 9ecd8c9

Browse files
committed
Merge branch 'master' into fix/decoding-headers-can-fail-#8553
* master: Rlp decode returns Result (#8527) Node table sorting according to last contact data (#8541) Keep all enacted blocks notify in order (#8524) ethcore, rpc, machine: refactor block reward application and tracing (#8490) Consolidate crypto functionality in `ethcore-crypto`. (#8432) EIP 145: Bitwise shifting instructions in EVM (#8451) Remove expect (#8536) Don't panic in import_block if invalid rlp (#8522) Pass on storage keys tracing to handle the case when it is not modified (#8491) Fetching logs by hash in blockchain database (#8463) Transaction Pool improvements (#8470) More changes for Android (#8421) Enable WebAssembly and Byzantium for Ellaism (#8520) SecretStore: merge two types of errors into single one + Error::is_non_fatal (#8357) Hardware Wallet trait (#8071) Directly return None if tracing is disabled (#8504) Show imported messages for light client (#8517)
2 parents 9ca99dd + 28c7318 commit 9ecd8c9

File tree

144 files changed

+3429
-1853
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+3429
-1853
lines changed

.gitlab-ci.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,23 @@ windows:
180180
paths:
181181
- parity.zip
182182
name: "x86_64-pc-windows-msvc_parity"
183+
android-armv7:
184+
stage: build
185+
image: parity/parity-android:latest
186+
only:
187+
- beta
188+
- tags
189+
- stable
190+
- triggers
191+
script:
192+
- cargo build --target=armv7-linux-androideabi
193+
# TODO: check that `arm-linux-androideabi-objdump -x ./target/armv7-linux-androideabi/release/parity | grep c++_shared` is empty
194+
tags:
195+
- rust-arm
196+
artifacts:
197+
paths:
198+
- parity.zip
199+
name: "armv7-linux-androideabi_parity"
183200
docker-build:
184201
stage: build
185202
only:

Cargo.lock

Lines changed: 22 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker/android/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,5 @@ ENV CFLAGS_arm_linux_androideabi -std=gnu11 -fPIC -D OS_ANDROID
7575
ENV CFLAGS_armv7_linux_androideabi -std=gnu11 -fPIC -D OS_ANDROID
7676
ENV CXXFLAGS_arm_linux_androideabi -std=gnu++11 -fPIC -fexceptions -frtti -static-libstdc++ -D OS_ANDROID
7777
ENV CXXFLAGS_armv7_linux_androideabi -std=gnu++11 -fPIC -fexceptions -frtti -static-libstdc++ -D OS_ANDROID
78+
ENV CXXSTDLIB_arm_linux_androideabi ""
79+
ENV CXXSTDLIB_armv7_linux_androideabi ""

ethcore/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fetch = { path = "../util/fetch" }
2020
hashdb = { path = "../util/hashdb" }
2121
memorydb = { path = "../util/memorydb" }
2222
patricia-trie = { path = "../util/patricia_trie" }
23+
ethcore-crypto = { path = "crypto" }
2324
error-chain = { version = "0.11", default-features = false }
2425
ethcore-io = { path = "../util/io" }
2526
ethcore-logger = { path = "../logger" }
@@ -56,7 +57,6 @@ util-error = { path = "../util/error" }
5657
snappy = { git = "https://github.com/paritytech/rust-snappy" }
5758
stop-guard = { path = "../util/stop-guard" }
5859
macros = { path = "../util/macros" }
59-
rust-crypto = "0.2.34"
6060
rustc-hex = "1.0"
6161
stats = { path = "../util/stats" }
6262
trace-time = { path = "../util/trace-time" }

ethcore/benches/evm.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ extern crate test;
2020
extern crate ethcore_util as util;
2121
extern crate rand;
2222
extern crate bn;
23-
extern crate crypto;
23+
extern crate ethcore_crypto;
2424
extern crate ethkey;
2525
extern crate rustc_hex;
2626
extern crate ethcore_bigint;
@@ -61,16 +61,13 @@ fn bn_128_mul(b: &mut Bencher) {
6161

6262
#[bench]
6363
fn sha256(b: &mut Bencher) {
64-
use crypto::sha2::Sha256;
65-
use crypto::digest::Digest;
64+
use ethcore_crypto::digest::sha256;
6665

6766
let mut input: [u8; 256] = [0; 256];
6867
let mut out = [0; 32];
6968

7069
b.iter(|| {
71-
let mut sha = Sha256::new();
72-
sha.input(&input);
73-
sha.result(&mut input[0..32]);
70+
sha256(&input);
7471
});
7572
}
7673

ethcore/crypto/Cargo.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@ version = "0.1.0"
44
authors = ["Parity Technologies <admin@parity.io>"]
55

66
[dependencies]
7+
ethereum-types = "0.3"
8+
quick-error = "1.2"
9+
ring = "0.12"
710
rust-crypto = "0.2.36"
811
tiny-keccak = "1.3"
9-
eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1", optional = true }
10-
ethkey = { path = "../../ethkey", optional = true }
11-
ethereum-types = "0.3"
12-
subtle = "0.5"
1312

14-
[features]
15-
default = ["secp256k1"]
16-
secp256k1 = ["eth-secp256k1", "ethkey"]

ethcore/crypto/src/aes.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
2+
// This file is part of Parity.
3+
4+
// Parity is free software: you can redistribute it and/or modify
5+
// it under the terms of the GNU General Public License as published by
6+
// the Free Software Foundation, either version 3 of the License, or
7+
// (at your option) any later version.
8+
9+
// Parity is distributed in the hope that it will be useful,
10+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
// GNU General Public License for more details.
13+
14+
// You should have received a copy of the GNU General Public License
15+
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
16+
17+
use error::SymmError;
18+
use rcrypto::blockmodes::{CtrMode, CbcDecryptor, PkcsPadding};
19+
use rcrypto::aessafe::{AesSafe128Encryptor, AesSafe128Decryptor};
20+
use rcrypto::symmetriccipher::{Encryptor, Decryptor};
21+
use rcrypto::buffer::{RefReadBuffer, RefWriteBuffer, WriteBuffer};
22+
23+
/// Encrypt a message (CTR mode).
24+
///
25+
/// Key (`k`) length and initialisation vector (`iv`) length have to be 16 bytes each.
26+
/// An error is returned if the input lengths are invalid.
27+
pub fn encrypt_128_ctr(k: &[u8], iv: &[u8], plain: &[u8], dest: &mut [u8]) -> Result<(), SymmError> {
28+
let mut encryptor = CtrMode::new(AesSafe128Encryptor::new(k), iv.to_vec());
29+
encryptor.encrypt(&mut RefReadBuffer::new(plain), &mut RefWriteBuffer::new(dest), true)?;
30+
Ok(())
31+
}
32+
33+
/// Decrypt a message (CTR mode).
34+
///
35+
/// Key (`k`) length and initialisation vector (`iv`) length have to be 16 bytes each.
36+
/// An error is returned if the input lengths are invalid.
37+
pub fn decrypt_128_ctr(k: &[u8], iv: &[u8], encrypted: &[u8], dest: &mut [u8]) -> Result<(), SymmError> {
38+
let mut encryptor = CtrMode::new(AesSafe128Encryptor::new(k), iv.to_vec());
39+
encryptor.decrypt(&mut RefReadBuffer::new(encrypted), &mut RefWriteBuffer::new(dest), true)?;
40+
Ok(())
41+
}
42+
43+
/// Decrypt a message (CBC mode).
44+
///
45+
/// Key (`k`) length and initialisation vector (`iv`) length have to be 16 bytes each.
46+
/// An error is returned if the input lengths are invalid.
47+
pub fn decrypt_128_cbc(k: &[u8], iv: &[u8], encrypted: &[u8], dest: &mut [u8]) -> Result<usize, SymmError> {
48+
let mut encryptor = CbcDecryptor::new(AesSafe128Decryptor::new(k), PkcsPadding, iv.to_vec());
49+
let len = dest.len();
50+
let mut buffer = RefWriteBuffer::new(dest);
51+
encryptor.decrypt(&mut RefReadBuffer::new(encrypted), &mut buffer, true)?;
52+
Ok(len - buffer.remaining())
53+
}
54+

0 commit comments

Comments
 (0)