Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Delete OpenSSL #2659

Merged
merged 6 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
fetch-depth: 0
- name: Setup environment variables
run: |
echo "OPENSSL_STATIC=yes" >> $GITHUB_ENV
echo "RUSTFLAGS=--remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity" >> $GITHUB_ENV
- name: Cache Cargo
uses: actions/cache@v2
Expand All @@ -58,17 +57,6 @@ jobs:
toolchain: ${{ matrix.rust }}
override: true
if: contains(matrix.os, 'macos')
- name: Build static-linked openssl
run: |
# https://github.com/rust-lang/cargo/issues/713#issuecomment-59597433
git clone git://git.openssl.org/openssl.git
cd openssl
./config -fPIC --prefix=/usr/local --openssldir=/usr/local/ssl
make
sudo make install
echo "OPENSSL_LIB_DIR=/usr/local/lib64" >> $GITHUB_ENV
echo "OPENSSL_INCLUDE_DIR=/usr/local/include" >> $GITHUB_ENV
if: contains(matrix.target, 'linux-gnu')
- name: Build
run: |
cargo clean --target ${{ matrix.target }} --release
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ jobs:

- name: Setup environment variables
run: |
echo "OPENSSL_STATIC=yes" >> $GITHUB_ENV
echo "RUSTFLAGS=--remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity" >> $GITHUB_ENV

# GITHUB_REF_NAME will be something link 2353/merge for branch builds, which isn't great as a dfx version
Expand Down Expand Up @@ -75,18 +74,6 @@ jobs:
override: true
if: contains(matrix.os, 'macos')

- name: Build static-linked openssl
run: |
# https://github.com/rust-lang/cargo/issues/713#issuecomment-59597433
git clone git://git.openssl.org/openssl.git
cd openssl
./config -fPIC --prefix=/usr/local --openssldir=/usr/local/ssl
make
sudo make install
echo "OPENSSL_LIB_DIR=/usr/local/lib64" >> $GITHUB_ENV
echo "OPENSSL_INCLUDE_DIR=/usr/local/include" >> $GITHUB_ENV
if: contains(matrix.target, 'linux-gnu')

- name: Build
run: |
cargo clean --target ${{ matrix.target }} --release
Expand Down
50 changes: 25 additions & 25 deletions Cargo.lock

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

9 changes: 3 additions & 6 deletions src/dfx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ path = "src/main.rs"
[build-dependencies]
flate2 = "1.0.11"
hex = "0.4.2"
openssl = "0.10.32"
sha2 = "0.10.6"
tar = "0.4.26"
walkdir = "2.3.2"

Expand Down Expand Up @@ -54,13 +54,12 @@ mime = "0.3.16"
mime_guess = "2.0.4"
net2 = "0.2.34"
num-traits = "0.2"
openssl = "0.10.32"
pem = "1.0.2"
petgraph = "0.6.0"
rand = "0.8.5"
regex = "1.5.5"
ring = "0.16.11"
reqwest = { version = "0.11.9", features = [ "blocking", "json", "rustls-tls" ] }
reqwest = { version = "0.11.9", default-features = false, features = [ "blocking", "json", "rustls-tls", "native-tls-vendored" ] }
rustls = "0.20.4"
rust_decimal = "1.22.0"
schemars = "0.8"
Expand All @@ -69,6 +68,7 @@ serde = "1.0"
serde_bytes = "0.11.2"
serde_cbor = "0.11.1"
serde_json = "1.0.79"
sha2 = "0.10.6"
shell-words = "1.1.0"
slog = { version = "2.5.2", features = ["max_level_trace"] }
slog-async = "2.4.0"
Expand Down Expand Up @@ -107,6 +107,3 @@ env_logger = "0.9"
proptest = "1.0"
mockito = "0.31.0"
tempfile = "3.1.0"

[features]
vendored-openssl = ["openssl/vendored"]
4 changes: 2 additions & 2 deletions src/dfx/assets/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use flate2::write::GzEncoder;
use flate2::Compression;
use openssl::sha::Sha256;
use sha2::{Digest, Sha256};
use std::fs::{read_to_string, File};
use std::io::{BufRead, Read, Write};
use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -32,7 +32,7 @@ fn calculate_hash_of_inputs(project_root_path: &Path) -> String {
sha256.update(&buffer);
}

hex::encode(sha256.finish())
hex::encode(sha256.finalize())
}

fn get_project_root_path() -> PathBuf {
Expand Down
4 changes: 2 additions & 2 deletions src/dfx/src/lib/nns_types/account_identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use anyhow::Context;
use candid::CandidType;
use candid::Principal;
use openssl::sha::Sha224;
use serde::{de, de::Error, Deserialize, Serialize};
use sha2::{Digest, Sha224};
use std::convert::{TryFrom, TryInto};
use std::fmt::{Display, Formatter};
use std::str::FromStr;
Expand Down Expand Up @@ -38,7 +38,7 @@ impl AccountIdentifier {
hash.update(&sub_account.0[..]);

AccountIdentifier {
hash: hash.finish(),
hash: hash.finalize().into(),
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/dfx/src/lib/operations/canister/install_canister.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use ic_utils::interfaces::management_canister::builders::{CanisterInstall, Insta
use ic_utils::interfaces::ManagementCanister;
use ic_utils::Argument;
use itertools::Itertools;
use openssl::sha::sha256;
use sha2::{Digest, Sha256};
use slog::info;
use std::collections::HashSet;
use std::io::stdin;
Expand Down Expand Up @@ -103,10 +103,10 @@ pub async fn install_canister(
let wasm_path = canister_info.get_build_wasm_path();
let wasm_module = std::fs::read(&wasm_path)
.with_context(|| format!("Failed to read {}.", wasm_path.to_string_lossy()))?;
let new_hash = sha256(&wasm_module);
let new_hash = Sha256::digest(&wasm_module);

if mode == InstallMode::Upgrade
&& matches!(&installed_module_hash, Some(old_hash) if old_hash[..] == new_hash)
&& matches!(&installed_module_hash, Some(old_hash) if old_hash[..] == new_hash[..])
&& !upgrade_unchanged
{
println!(
Expand Down Expand Up @@ -139,7 +139,7 @@ pub async fn install_canister(
.await
{
Ok(reported_hash) => {
if reported_hash == new_hash {
if reported_hash[..] == new_hash[..] {
break;
} else if installed_module_hash
.as_deref()
Expand Down
Binary file modified src/distributed/assetstorage.wasm.gz
Binary file not shown.