From 6f302752b960f8574bcc439ff421cdfa130fcd96 Mon Sep 17 00:00:00 2001 From: neonphog Date: Thu, 30 Jul 2020 14:53:30 -0600 Subject: [PATCH 1/5] re-enable tls --- Cargo.lock | 156 +++++++++++++++++++++--- crates/holochain_wasm/Cargo.toml | 2 +- crates/in_stream/Cargo.toml | 1 + crates/in_stream/src/lib.rs | 1 + crates/in_stream/src/tls/certificate.rs | 70 ++--------- crates/net/src/sim2h_worker.rs | 7 +- crates/net/tests/integration.rs | 24 +++- crates/sim2h/src/connection_mgr.rs | 2 +- crates/sim2h/src/lib.rs | 10 +- 9 files changed, 188 insertions(+), 85 deletions(-) mode change 100755 => 100644 crates/sim2h/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 819d76528a..cc59f47ef3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -210,6 +210,11 @@ dependencies = [ "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "bumpalo" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byte-tools" version = "0.2.0" @@ -1334,7 +1339,7 @@ name = "holochain_conductor_wasm" version = "0.0.50-alpha4" dependencies = [ "holochain_core_types 0.0.50-alpha4", - "wasm-bindgen 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1957,6 +1962,7 @@ dependencies = [ "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.25 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rcgen 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2016,6 +2022,14 @@ name = "itoa" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "js-sys" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "json-patch" version = "0.2.2" @@ -2615,6 +2629,15 @@ dependencies = [ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "nom" +version = "4.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "normalize-line-endings" version = "0.2.2" @@ -2971,6 +2994,16 @@ dependencies = [ "rayon 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "pem" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "percent-encoding" version = "1.0.1" @@ -3453,6 +3486,17 @@ dependencies = [ "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rcgen" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "pem 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "ring 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)", + "yasna 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rdrand" version = "0.4.0" @@ -3544,6 +3588,20 @@ dependencies = [ "uuid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ring" +version = "0.16.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", + "spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "untrusted 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "web-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "rkv" version = "0.10.4" @@ -4181,6 +4239,11 @@ dependencies = [ "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "sourcefile" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "spin" version = "0.5.2" @@ -5054,6 +5117,11 @@ dependencies = [ "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unwrap" version = "1.2.1" @@ -5220,51 +5288,67 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wasm-bindgen" -version = "0.2.32" +version = "0.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wasm-bindgen-macro 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.32" +version = "0.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.32" +version = "0.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-macro-support 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.32" +version = "0.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-backend 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", - "wasm-bindgen-shared 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.32" +version = "0.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "wasm-bindgen-webidl" +version = "0.2.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.31 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "wasmer-clif-backend" version = "0.13.1" @@ -5379,6 +5463,26 @@ name = "wasmparser" version = "0.45.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "web-sys" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", + "sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", + "wasm-bindgen-webidl 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "weedle" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "winapi" version = "0.2.8" @@ -5491,6 +5595,14 @@ dependencies = [ "linked-hash-map 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "yasna" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "zeroize" version = "0.9.2" @@ -5555,6 +5667,7 @@ dependencies = [ "checksum block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" "checksum boolinator 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" "checksum bstr 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "31accafdb70df7871592c058eca3985b71104e15ac32f64706022c58867da931" +"checksum bumpalo 2.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad807f2fc2bf185eeb98ff3a901bd46dc5ad58163d0fa4577ba0d25674d71708" "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" @@ -5696,6 +5809,7 @@ dependencies = [ "checksum itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0d47946d458e94a1b7bcabbf6521ea7c037062c81f534615abcad76e84d4970d" "checksum itertools 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" "checksum itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +"checksum js-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "da3ea71161651a4cd97d999b2da139109c537b15ab33abc8ae4ead38deac8a03" "checksum json-patch 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3bde23771b4f5b9900635b0415485323b6d39afa979dcd5541218d67bb9107b4" "checksum jsonrpc-core 14.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9b392c9e8e43a12e6b21160903f473b1066e57fe18477394a93a1efd25654003" "checksum jsonrpc-http-server 14.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "816d63997ea45d3634608edbef83ddb35e661f7c0b27b5b72f237e321f0e9807" @@ -5756,6 +5870,7 @@ dependencies = [ "checksum nickel 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5061a832728db2dacb61cefe0ce303b58f85764ec680e71d9138229640a46d9" "checksum nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" "checksum nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229" +"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" "checksum normalize-line-endings 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2e0a1a39eab95caf4f5556da9289b9e68f0aafac901b2ce80daaf020d3b733a8" "checksum num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cf4825417e1e1406b3782a8ce92f4d53f26ec055e3622e1881ca8e9f5f9e08db" "checksum num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "57450397855d951f1a41305e54851b1a7b8f5d2e349543a02a2effe25459f718" @@ -5795,6 +5910,7 @@ dependencies = [ "checksum parking_lot_core 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" "checksum parking_lot_core 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" "checksum pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" +"checksum pem 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a1581760c757a756a41f0ee3ff01256227bdf64cb752839779b95ffb01c59793" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" "checksum pest 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" @@ -5851,6 +5967,7 @@ dependencies = [ "checksum raw-cpuid 7.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4a349ca83373cfa5d6dbb66fd76e58b2cca08da71a5f6400de0a0a6a9bceeaf" "checksum rayon 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080" "checksum rayon-core 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280" +"checksum rcgen 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "473b47fadc41518b93a9fde7401fe30736f1a2f33708f0d5bc747c6d2daee37f" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" "checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" "checksum redox_users 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" @@ -5860,6 +5977,7 @@ dependencies = [ "checksum regex-syntax 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)" = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" "checksum remove_dir_all 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" "checksum reqwest 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)" = "e542d9f077c126af32536b6aacc75bb7325400eab8cd0743543be5d91660780d" +"checksum ring 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1ba5a8ec64ee89a76c98c549af81ff14813df09c3e6dc4766c3856da48597a0c" "checksum rkv 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)" = "30a3dbc1f4971372545ed4175f23ef206c81e5874cd574d153646e7ee78f6793" "checksum rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac" "checksum rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d45d7afc9b132b34a2479648863aa95c5c88e98b32285326a6ebadc80ec5c9" @@ -5918,6 +6036,7 @@ dependencies = [ "checksum smallvec 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" "checksum snowflake 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "27207bb65232eda1f588cf46db2fee75c0808d557f6b3cf19a75f5d6d7c94df1" "checksum socket2 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)" = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +"checksum sourcefile 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf77cb82ba8453b42b6ae1d692e4cdc92f9a47beaf89a847c8be83f4e328ad3" "checksum spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" "checksum stable_deref_trait 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" "checksum streaming-stats 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fd8abbec7f4bc18e9e761572465226e63f88c1cb90ee8b3f403a81631ef9fd50" @@ -6004,6 +6123,7 @@ dependencies = [ "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" "checksum unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" +"checksum untrusted 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" "checksum unwrap 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e33648dd74328e622c7be51f3b40a303c63f93e6fa5f08778b6203a4c25c20f" "checksum unwrap_to 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cad414b2eed757c1b6f810f8abc814e298a9c89176b21fae092c7a87756fb839" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" @@ -6027,11 +6147,12 @@ dependencies = [ "checksum walkdir 2.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" "checksum want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "797464475f30ddb8830cc529aaaae648d581f99e2036a928877dfde027ddf6b3" "checksum wasi 0.9.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -"checksum wasm-bindgen 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "710152b9cc4b688f91a23ad1574d0f3d6334ccb883896f6886531dc536944330" -"checksum wasm-bindgen-backend 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "1f425d1c38c61c25d6ce5a07411cc9f859fbb1bac0eccdf812d7e7e521d4214a" -"checksum wasm-bindgen-macro 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "8541976809a58d1f08c3689c8ec3d98c9a7910794b1642f96dea56beb527aa1e" -"checksum wasm-bindgen-macro-support 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "e3296c9a30e13a2672e5dbe41a7258e54c74512b579cee1de7c17c7f60080231" -"checksum wasm-bindgen-shared 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)" = "a6c76e3857dc73f19bb3ef9f228f1b7f2552c7bba44a43e3df68daee79e2d963" +"checksum wasm-bindgen 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "4de97fa1806bb1a99904216f6ac5e0c050dc4f8c676dc98775047c38e5c01b55" +"checksum wasm-bindgen-backend 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "5d82c170ef9f5b2c63ad4460dfcee93f3ec04a9a36a4cc20bc973c39e59ab8e3" +"checksum wasm-bindgen-macro 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "f07d50f74bf7a738304f6b8157f4a581e1512cd9e9cdb5baad8c31bbe8ffd81d" +"checksum wasm-bindgen-macro-support 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "95cf8fe77e45ba5f91bc8f3da0c3aa5d464b3d8ed85d84f4d4c7cc106436b1d7" +"checksum wasm-bindgen-shared 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "d9c2d4d4756b2e46d3a5422e06277d02e4d3e1d62d138b76a4c681e925743623" +"checksum wasm-bindgen-webidl 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "24e47859b4eba3d3b9a5c2c299f9d6f8d0b613671315f6f0c5c7f835e524b36a" "checksum wasmer-clif-backend 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c785ab26863bd64d2ce2956083c3db9a09d7d639b6205baee6e54f258f94e034" "checksum wasmer-clif-fork-frontend 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2e13201ef9ef527ad30a6bf1b08e3e024a40cf2731f393d80375dc88506207" "checksum wasmer-clif-fork-wasm 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8b09302cc4fdc4efc03823cb3e1880b0fde578ba43f27ddd212811cb28c1530" @@ -6040,6 +6161,8 @@ dependencies = [ "checksum wasmer-win-exception-handler 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "eac6af8ef69d582a851bb116be4faebc42d1f52ef00922e1688f3eff48d0d96b" "checksum wasmi 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f6a891b45c79e9f96fb66cc84a057211ef9cd2e5e8d093f3dbbd480e146a8758" "checksum wasmparser 0.45.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8b4eab1d9971d0803729cba3617b56eb04fcb4bd25361cb63880ed41a42f20d5" +"checksum web-sys 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "86d515d2f713d3a6ab198031d2181b7540f8e319e4637ec2d4a41a208335ef29" +"checksum weedle 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3bb43f70885151e629e2a19ce9e50bd730fd436cfd4b666894c9ce4de9141164" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" @@ -6053,6 +6176,7 @@ dependencies = [ "checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" "checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2" "checksum yaml-rust 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "39f0c922f1a334134dc2f7a8b67dc5d25f0735263feec974345ff706bcf20b0d" +"checksum yasna 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a563d10ead87e2d798e357d44f40f495ad70bcee4d5c0d3f77a5b1b7376645d9" "checksum zeroize 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4090487fa66630f7b166fba2bbb525e247a5449f41c468cc1d98f8ae6ac03120" "checksum zeroize 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4177936c03b5a349c1b8e4509c46add268e66bc66fe92663729fa0570fe4f213" "checksum zeroize_derive 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "080616bd0e31f36095288bb0acdf1f78ef02c2fa15527d7e993f2a6c7591643e" diff --git a/crates/holochain_wasm/Cargo.toml b/crates/holochain_wasm/Cargo.toml index bc9a8eb74b..e415457dd6 100644 --- a/crates/holochain_wasm/Cargo.toml +++ b/crates/holochain_wasm/Cargo.toml @@ -14,4 +14,4 @@ crate-type = ["cdylib"] [dependencies] holochain_core_types = { version = "=0.0.50-alpha4", path = "../core_types" } -wasm-bindgen = "=0.2.32" +wasm-bindgen = "=0.2.48" diff --git a/crates/in_stream/Cargo.toml b/crates/in_stream/Cargo.toml index ab866a6c49..96f2f12500 100644 --- a/crates/in_stream/Cargo.toml +++ b/crates/in_stream/Cargo.toml @@ -21,6 +21,7 @@ native-tls = "0.2" net2 = "0.2" openssl = "0.10" parking_lot = "0.9" +rcgen = "=0.8.0" serde = { version = "=1.0.104", features = ["rc"] } serde_json = { version = "=1.0.47", features = ["preserve_order"] } serde_derive = "=1.0.104" diff --git a/crates/in_stream/src/lib.rs b/crates/in_stream/src/lib.rs index 4aadc65480..8595933b0a 100644 --- a/crates/in_stream/src/lib.rs +++ b/crates/in_stream/src/lib.rs @@ -1,3 +1,4 @@ +#![feature(matches_macro)] //! Trait system for facilitating non-blocking stream chaining with handshaking //! //! # Example diff --git a/crates/in_stream/src/tls/certificate.rs b/crates/in_stream/src/tls/certificate.rs index 4a1ebd511e..07e2167012 100644 --- a/crates/in_stream/src/tls/certificate.rs +++ b/crates/in_stream/src/tls/certificate.rs @@ -1,61 +1,6 @@ static FAKE_PKCS12: &[u8] = include_bytes!("fake_key.p12"); static FAKE_PASS: &str = "hello"; -use openssl::{ - asn1::Asn1Time, - bn::{BigNum, MsbOption}, - hash::MessageDigest, - pkey::{PKey, Private}, - rsa::Rsa, - x509::{self, X509Name, X509}, -}; - -type PrivateKey = PKey; -type Certificate = x509::X509; - -/// private helper - generate a self-signed cert given an x509 name -fn generate_self_signed(name: X509Name) -> (PrivateKey, Certificate) { - let rsa = Rsa::generate(2048).unwrap(); - let key = PKey::from_rsa(rsa).unwrap(); - - let serial_number = { - let mut serial = BigNum::new().unwrap(); - serial.rand(159, MsbOption::MAYBE_ZERO, false).unwrap(); - serial.to_asn1_integer().unwrap() - }; - - let mut builder = X509::builder().unwrap(); - builder.set_serial_number(&serial_number).unwrap(); - builder.set_version(2).unwrap(); - builder.set_subject_name(&name).unwrap(); - builder.set_issuer_name(&name).unwrap(); - builder.set_pubkey(&key).unwrap(); - let not_before = Asn1Time::days_from_now(0).unwrap(); - builder.set_not_before(¬_before).unwrap(); - let not_after = Asn1Time::days_from_now(3650).unwrap(); - builder.set_not_after(¬_after).unwrap(); - builder.sign(&key, MessageDigest::sha256()).unwrap(); - - let cert: Certificate = builder.build(); - - (key, cert) -} - -/// private helper - generate a self-signed dev certificate -fn generate_dev() -> (PrivateKey, Certificate) { - let o = "InStreamDevCertificate"; - let cn = nanoid::simple(); - - let mut name = X509Name::builder().unwrap(); - name.append_entry_by_nid(openssl::nid::Nid::ORGANIZATIONNAME, o) - .unwrap(); - name.append_entry_by_nid(openssl::nid::Nid::COMMONNAME, &cn) - .unwrap(); - let name = name.build(); - - generate_self_signed(name) -} - /// represents an encrypted TLS certificate, and the passphrase to decrypt it /// obviously, when serializing, you should only encode the data, not the passphrase #[derive(Debug, Clone, PartialEq)] @@ -67,10 +12,21 @@ pub struct TlsCertificate { impl TlsCertificate { /// generate a self-signed dev certificate pub fn generate_dev() -> Self { - let (key, cert) = generate_dev(); + let id = format!("a{}a.a{}a", nanoid::simple(), nanoid::simple()); + let mut params = rcgen::CertificateParams::new(vec![id.into()]); + // would be nice to ed25519 - but seems incompatible with this openssl + //params.alg = &rcgen::PKCS_ED25519; + params.alg = &rcgen::PKCS_ECDSA_P256_SHA256; + let cert = rcgen::Certificate::from_params(params).expect("gen cert"); + + let key = cert.serialize_private_key_der(); + let key = openssl::pkey::PKey::private_key_from_der(&key).expect("private key"); + + let cert = cert.serialize_der().expect("cert der"); + let cert = openssl::x509::X509::from_der(&cert).expect("cert der"); let pkcs12 = openssl::pkcs12::Pkcs12::builder() - .build("dev-passphrase", "in_stream_tls", &*key, &cert) + .build("dev-passphrase", "in_stream_tls", &key, &cert) .unwrap(); Self { diff --git a/crates/net/src/sim2h_worker.rs b/crates/net/src/sim2h_worker.rs index fdc98a3cf7..1cdd71e323 100644 --- a/crates/net/src/sim2h_worker.rs +++ b/crates/net/src/sim2h_worker.rs @@ -42,9 +42,12 @@ const BATCHING_INTERVAL_MS: u64 = 1000; fn connect(url: Lib3hUri, timeout_ms: u64) -> NetResult { // let config = WssConnectConfig::new(TlsConnectConfig::new(TcpConnectConfig::default())); - let config = WssConnectConfig::new(TcpConnectConfig { + //let config = WssConnectConfig::new(TcpConnectConfig { + // connect_timeout_ms: Some(timeout_ms), + //}); + let config = WssConnectConfig::new(TlsConnectConfig::new(TcpConnectConfig { connect_timeout_ms: Some(timeout_ms), - }); + })); Ok(InStreamWss::connect(&url::Url::from(url).into(), config)?) } diff --git a/crates/net/tests/integration.rs b/crates/net/tests/integration.rs index e6b195ebac..53f82363e9 100644 --- a/crates/net/tests/integration.rs +++ b/crates/net/tests/integration.rs @@ -116,6 +116,7 @@ fn sim2h_worker_talks_to_sim2h() { }, ); + #[derive(Debug)] struct ResultData { pub got_handle_store: bool, pub got_handle_dm: bool, @@ -147,6 +148,11 @@ fn sim2h_worker_talks_to_sim2h() { let s = s.lock().unwrap(); s.got_handle_store && s.got_handle_dm && s.got_handle_a_list && s.got_handle_g_list } + + pub fn assert_is_ok(s: &Arc>) { + let repr = format!("{:#?}", *s.lock().unwrap()); + assert!(ResultData::is_ok(s), repr); + } } let result_data = ResultData::new(); @@ -195,7 +201,7 @@ fn sim2h_worker_talks_to_sim2h() { ))) .unwrap(); - for _ in 0..5 { + for _ in 0..10 { std::thread::sleep(std::time::Duration::from_millis(25)); println!("tick: {:?}", worker.tick()); @@ -205,6 +211,12 @@ fn sim2h_worker_talks_to_sim2h() { // to prove out join space is properly re-sent worker.test_close_connection_cause_reconnect(); + for _ in 0..10 { + std::thread::sleep(std::time::Duration::from_millis(25)); + + println!("tick: {:?}", worker.tick()); + } + worker .receive(ht::test_wrap_enc(Lib3hClientProtocol::PublishEntry( ProvidedEntryData { @@ -223,6 +235,12 @@ fn sim2h_worker_talks_to_sim2h() { ))) .unwrap(); + for _ in 0..10 { + std::thread::sleep(std::time::Duration::from_millis(25)); + + println!("tick: {:?}", worker.tick()); + } + worker .receive(ht::test_wrap_enc(Lib3hClientProtocol::SendDirectMessage( DirectMessageData { @@ -235,7 +253,7 @@ fn sim2h_worker_talks_to_sim2h() { ))) .unwrap(); - for _ in 0..40 { + for _ in 0..60 { std::thread::sleep(std::time::Duration::from_millis(25)); println!("tick: {:?}", worker.tick()); @@ -247,5 +265,5 @@ fn sim2h_worker_talks_to_sim2h() { // -- end sim2h worker test -- // - assert!(ResultData::is_ok(&result_data)); + ResultData::assert_is_ok(&result_data); } diff --git a/crates/sim2h/src/connection_mgr.rs b/crates/sim2h/src/connection_mgr.rs index cef50036f0..1f5bd5b633 100644 --- a/crates/sim2h/src/connection_mgr.rs +++ b/crates/sim2h/src/connection_mgr.rs @@ -284,7 +284,7 @@ impl ConnectionMgr { ) } - fn handle_connect_data(&mut self, uri: Lib3hUri, wss: InStreamWss) { + fn handle_connect_data(&mut self, uri: Lib3hUri, wss: TcpWss) { debug!(?uri); let cmd_send = spawn_wss_task(uri.clone(), wss, self.evt_send_from_children.clone()); if let Some(old) = self.wss_map.insert(uri.clone(), cmd_send) { diff --git a/crates/sim2h/src/lib.rs b/crates/sim2h/src/lib.rs old mode 100755 new mode 100644 index 9c099b94a6..4798cc7051 --- a/crates/sim2h/src/lib.rs +++ b/crates/sim2h/src/lib.rs @@ -203,10 +203,10 @@ impl Drop for MetricsTimer { } } -//pub(crate) type TcpWssServer = InStreamListenerWss>; -//pub(crate) type TcpWss = InStreamWss>; -pub(crate) type TcpWssServer = InStreamListenerWss; -pub type TcpWss = InStreamWss; +pub(crate) type TcpWssServer = InStreamListenerWss>; +pub type TcpWss = InStreamWss>; +//pub(crate) type TcpWssServer = InStreamListenerWss; +//pub type TcpWss = InStreamWss; mod connection_mgr; use connection_mgr::*; @@ -1196,7 +1196,7 @@ impl Sim2h { ); let config = TcpBindConfig::default(); - // let config = TlsBindConfig::new(config).dev_certificate(); + let config = TlsBindConfig::new(config).dev_certificate(); // if we don't get any messages within a timeframe from a connection, // the connection will throw a timeout error and disconnect. From f128f371337c353b87931a94da14967a2fe98ead Mon Sep 17 00:00:00 2001 From: David Braden Date: Thu, 30 Jul 2020 14:56:12 -0600 Subject: [PATCH 2/5] remove this red-herring --- crates/in_stream/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/in_stream/src/lib.rs b/crates/in_stream/src/lib.rs index 8595933b0a..4aadc65480 100644 --- a/crates/in_stream/src/lib.rs +++ b/crates/in_stream/src/lib.rs @@ -1,4 +1,3 @@ -#![feature(matches_macro)] //! Trait system for facilitating non-blocking stream chaining with handshaking //! //! # Example From 7473f4d282ddfe581fa7966baddcfaf24916ad2d Mon Sep 17 00:00:00 2001 From: neonphog Date: Thu, 30 Jul 2020 15:01:47 -0600 Subject: [PATCH 3/5] lint --- crates/in_stream/src/tls/certificate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/in_stream/src/tls/certificate.rs b/crates/in_stream/src/tls/certificate.rs index 07e2167012..7d5def5e4b 100644 --- a/crates/in_stream/src/tls/certificate.rs +++ b/crates/in_stream/src/tls/certificate.rs @@ -13,7 +13,7 @@ impl TlsCertificate { /// generate a self-signed dev certificate pub fn generate_dev() -> Self { let id = format!("a{}a.a{}a", nanoid::simple(), nanoid::simple()); - let mut params = rcgen::CertificateParams::new(vec![id.into()]); + let mut params = rcgen::CertificateParams::new(vec![id]); // would be nice to ed25519 - but seems incompatible with this openssl //params.alg = &rcgen::PKCS_ED25519; params.alg = &rcgen::PKCS_ECDSA_P256_SHA256; From f640910c258587248c6d294de143f6b3e7ff777f Mon Sep 17 00:00:00 2001 From: neonphog Date: Thu, 30 Jul 2020 15:13:33 -0600 Subject: [PATCH 4/5] bindgen version --- crates/holochain_wasm/install/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/holochain_wasm/install/default.nix b/crates/holochain_wasm/install/default.nix index bcc115dfb5..313e5d4f64 100644 --- a/crates/holochain_wasm/install/default.nix +++ b/crates/holochain_wasm/install/default.nix @@ -2,7 +2,7 @@ let name = "hc-conductor-wasm-bindgen-install"; - version = "0.2.32"; + version = "0.2.48"; script = pkgs.writeShellScriptBin name '' From 7606a52d26d9a6f335a390159a139bd88ce03640 Mon Sep 17 00:00:00 2001 From: neonphog Date: Thu, 30 Jul 2020 15:46:45 -0600 Subject: [PATCH 5/5] fix stress test crate --- crates/stress/src/bin/sim2h_max_connections.rs | 12 ++++++------ crates/stress/src/bin/sim2h_stress.rs | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/stress/src/bin/sim2h_max_connections.rs b/crates/stress/src/bin/sim2h_max_connections.rs index c1e3e027a7..6edbe5c437 100644 --- a/crates/stress/src/bin/sim2h_max_connections.rs +++ b/crates/stress/src/bin/sim2h_max_connections.rs @@ -14,8 +14,8 @@ use sim2h::{ use std::sync::{Arc, Mutex}; use url2::prelude::*; -//fn await_in_stream_connect(connect_uri: &Lib3hUri) -> InStreamWss> { -fn await_in_stream_connect(connect_uri: &Lib3hUri) -> InStreamWss { +fn await_in_stream_connect(connect_uri: &Lib3hUri) -> InStreamWss> { + //fn await_in_stream_connect(connect_uri: &Lib3hUri) -> InStreamWss { let timeout = std::time::Instant::now() .checked_add(std::time::Duration::from_millis(20000)) .unwrap(); @@ -24,8 +24,8 @@ fn await_in_stream_connect(connect_uri: &Lib3hUri) -> InStreamWss { // keep trying to connect loop { - //let config = WssConnectConfig::new(TlsConnectConfig::new(TcpConnectConfig::default())); - let config = WssConnectConfig::new(TcpConnectConfig::default()); + let config = WssConnectConfig::new(TlsConnectConfig::new(TcpConnectConfig::default())); + //let config = WssConnectConfig::new(TcpConnectConfig::default()); info!("try new connection -- {}", connect_uri); let mut connection = InStreamWss::connect(&(**connect_uri).clone().into(), config).unwrap(); connection.write(WsFrame::Ping(b"".to_vec())).unwrap(); @@ -66,8 +66,8 @@ struct Job { #[allow(dead_code)] pub_key: Arc>>, sec_key: Arc>>, - connection: InStreamWss, - //connection: InStreamWss>, + //connection: InStreamWss, + connection: InStreamWss>, last_ping: std::time::Instant, last_pong: std::time::Instant, } diff --git a/crates/stress/src/bin/sim2h_stress.rs b/crates/stress/src/bin/sim2h_stress.rs index a03c06cc57..d7ced51098 100644 --- a/crates/stress/src/bin/sim2h_stress.rs +++ b/crates/stress/src/bin/sim2h_stress.rs @@ -187,8 +187,8 @@ impl Opt { } } -//fn await_in_stream_connect(connect_uri: &Lib3hUri) -> InStreamWss> { -fn await_in_stream_connect(connect_uri: &Lib3hUri) -> InStreamWss { +fn await_in_stream_connect(connect_uri: &Lib3hUri) -> InStreamWss> { + //fn await_in_stream_connect(connect_uri: &Lib3hUri) -> InStreamWss { let timeout = std::time::Instant::now() .checked_add(std::time::Duration::from_millis(10000)) .unwrap(); @@ -197,8 +197,8 @@ fn await_in_stream_connect(connect_uri: &Lib3hUri) -> InStreamWss { // keep trying to connect loop { - //let config = WssConnectConfig::new(TlsConnectConfig::new(TcpConnectConfig::default())); - let config = WssConnectConfig::new(TcpConnectConfig::default()); + let config = WssConnectConfig::new(TlsConnectConfig::new(TcpConnectConfig::default())); + //let config = WssConnectConfig::new(TcpConnectConfig::default()); let mut connection = InStreamWss::connect(&(**connect_uri).clone().into(), config).unwrap(); connection.write(WsFrame::Ping(b"".to_vec())).unwrap(); @@ -289,8 +289,8 @@ struct Job { #[allow(dead_code)] pub_key: Arc>>, sec_key: Arc>>, - connection: InStreamWss, - //connection: InStreamWss>, + //connection: InStreamWss, + connection: InStreamWss>, stress_config: OptStressRunConfig, got_ack: bool, next_ping: std::time::Instant,