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

Commit

Permalink
Merge branch 'master' into fix/decoding-headers-can-fail-#8553
Browse files Browse the repository at this point in the history
* 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)
  • Loading branch information
dvdplm committed May 8, 2018
2 parents 9ca99dd + 28c7318 commit 9ecd8c9
Show file tree
Hide file tree
Showing 144 changed files with 3,429 additions and 1,853 deletions.
17 changes: 17 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,23 @@ windows:
paths:
- parity.zip
name: "x86_64-pc-windows-msvc_parity"
android-armv7:
stage: build
image: parity/parity-android:latest
only:
- beta
- tags
- stable
- triggers
script:
- cargo build --target=armv7-linux-androideabi
# TODO: check that `arm-linux-androideabi-objdump -x ./target/armv7-linux-androideabi/release/parity | grep c++_shared` is empty
tags:
- rust-arm
artifacts:
paths:
- parity.zip
name: "armv7-linux-androideabi_parity"
docker-build:
stage: build
only:
Expand Down
48 changes: 22 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions docker/android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,5 @@ ENV CFLAGS_arm_linux_androideabi -std=gnu11 -fPIC -D OS_ANDROID
ENV CFLAGS_armv7_linux_androideabi -std=gnu11 -fPIC -D OS_ANDROID
ENV CXXFLAGS_arm_linux_androideabi -std=gnu++11 -fPIC -fexceptions -frtti -static-libstdc++ -D OS_ANDROID
ENV CXXFLAGS_armv7_linux_androideabi -std=gnu++11 -fPIC -fexceptions -frtti -static-libstdc++ -D OS_ANDROID
ENV CXXSTDLIB_arm_linux_androideabi ""
ENV CXXSTDLIB_armv7_linux_androideabi ""
2 changes: 1 addition & 1 deletion ethcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fetch = { path = "../util/fetch" }
hashdb = { path = "../util/hashdb" }
memorydb = { path = "../util/memorydb" }
patricia-trie = { path = "../util/patricia_trie" }
ethcore-crypto = { path = "crypto" }
error-chain = { version = "0.11", default-features = false }
ethcore-io = { path = "../util/io" }
ethcore-logger = { path = "../logger" }
Expand Down Expand Up @@ -56,7 +57,6 @@ util-error = { path = "../util/error" }
snappy = { git = "https://github.com/paritytech/rust-snappy" }
stop-guard = { path = "../util/stop-guard" }
macros = { path = "../util/macros" }
rust-crypto = "0.2.34"
rustc-hex = "1.0"
stats = { path = "../util/stats" }
trace-time = { path = "../util/trace-time" }
Expand Down
9 changes: 3 additions & 6 deletions ethcore/benches/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern crate test;
extern crate ethcore_util as util;
extern crate rand;
extern crate bn;
extern crate crypto;
extern crate ethcore_crypto;
extern crate ethkey;
extern crate rustc_hex;
extern crate ethcore_bigint;
Expand Down Expand Up @@ -61,16 +61,13 @@ fn bn_128_mul(b: &mut Bencher) {

#[bench]
fn sha256(b: &mut Bencher) {
use crypto::sha2::Sha256;
use crypto::digest::Digest;
use ethcore_crypto::digest::sha256;

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

b.iter(|| {
let mut sha = Sha256::new();
sha.input(&input);
sha.result(&mut input[0..32]);
sha256(&input);
});
}

Expand Down
10 changes: 3 additions & 7 deletions ethcore/crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ version = "0.1.0"
authors = ["Parity Technologies <[email protected]>"]

[dependencies]
ethereum-types = "0.3"
quick-error = "1.2"
ring = "0.12"
rust-crypto = "0.2.36"
tiny-keccak = "1.3"
eth-secp256k1 = { git = "https://github.com/paritytech/rust-secp256k1", optional = true }
ethkey = { path = "../../ethkey", optional = true }
ethereum-types = "0.3"
subtle = "0.5"

[features]
default = ["secp256k1"]
secp256k1 = ["eth-secp256k1", "ethkey"]
54 changes: 54 additions & 0 deletions ethcore/crypto/src/aes.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.

// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.

use error::SymmError;
use rcrypto::blockmodes::{CtrMode, CbcDecryptor, PkcsPadding};
use rcrypto::aessafe::{AesSafe128Encryptor, AesSafe128Decryptor};
use rcrypto::symmetriccipher::{Encryptor, Decryptor};
use rcrypto::buffer::{RefReadBuffer, RefWriteBuffer, WriteBuffer};

/// Encrypt a message (CTR mode).
///
/// Key (`k`) length and initialisation vector (`iv`) length have to be 16 bytes each.
/// An error is returned if the input lengths are invalid.
pub fn encrypt_128_ctr(k: &[u8], iv: &[u8], plain: &[u8], dest: &mut [u8]) -> Result<(), SymmError> {
let mut encryptor = CtrMode::new(AesSafe128Encryptor::new(k), iv.to_vec());
encryptor.encrypt(&mut RefReadBuffer::new(plain), &mut RefWriteBuffer::new(dest), true)?;
Ok(())
}

/// Decrypt a message (CTR mode).
///
/// Key (`k`) length and initialisation vector (`iv`) length have to be 16 bytes each.
/// An error is returned if the input lengths are invalid.
pub fn decrypt_128_ctr(k: &[u8], iv: &[u8], encrypted: &[u8], dest: &mut [u8]) -> Result<(), SymmError> {
let mut encryptor = CtrMode::new(AesSafe128Encryptor::new(k), iv.to_vec());
encryptor.decrypt(&mut RefReadBuffer::new(encrypted), &mut RefWriteBuffer::new(dest), true)?;
Ok(())
}

/// Decrypt a message (CBC mode).
///
/// Key (`k`) length and initialisation vector (`iv`) length have to be 16 bytes each.
/// An error is returned if the input lengths are invalid.
pub fn decrypt_128_cbc(k: &[u8], iv: &[u8], encrypted: &[u8], dest: &mut [u8]) -> Result<usize, SymmError> {
let mut encryptor = CbcDecryptor::new(AesSafe128Decryptor::new(k), PkcsPadding, iv.to_vec());
let len = dest.len();
let mut buffer = RefWriteBuffer::new(dest);
encryptor.decrypt(&mut RefReadBuffer::new(encrypted), &mut buffer, true)?;
Ok(len - buffer.remaining())
}

Loading

0 comments on commit 9ecd8c9

Please sign in to comment.