Created
August 17, 2017 08:46
-
-
Save heartsucker/be15bfa592055460dd10907e1e7ec9e5 to your computer and use it in GitHub Desktop.
ring / curve25519-dalek possible incompatibility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root] | |
name = "ring-dalek" | |
version = "0.1.0" | |
dependencies = [ | |
"curve25519-dalek 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
"ring 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
"untrusted 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "arrayref" | |
version = "0.3.4" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "bitflags" | |
version = "0.7.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "coco" | |
version = "0.1.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
"scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "conv" | |
version = "0.3.3" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "curve25519-dalek" | |
version = "0.10.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"arrayref 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", | |
"digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"generic-array 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", | |
"subtle 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "custom_derive" | |
version = "0.1.7" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "digest" | |
version = "0.6.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"generic-array 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "either" | |
version = "1.1.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "futures" | |
version = "0.1.14" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "gcc" | |
version = "0.3.51" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "generic-array" | |
version = "0.8.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", | |
"typenum 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "lazy_static" | |
version = "0.2.8" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "libc" | |
version = "0.2.29" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "magenta" | |
version = "0.1.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", | |
"magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "magenta-sys" | |
version = "0.1.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "nodrop" | |
version = "0.1.9" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "num-traits" | |
version = "0.1.40" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "num_cpus" | |
version = "1.6.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "odds" | |
version = "0.2.25" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "rand" | |
version = "0.3.16" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", | |
"magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "rayon" | |
version = "0.7.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"rayon-core 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "rayon-core" | |
version = "1.2.1" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", | |
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", | |
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", | |
"num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)", | |
"rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "ring" | |
version = "0.11.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", | |
"lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", | |
"libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", | |
"rayon 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", | |
"untrusted 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "scopeguard" | |
version = "0.3.2" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "subtle" | |
version = "0.2.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
dependencies = [ | |
"num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", | |
] | |
[[package]] | |
name = "typenum" | |
version = "1.9.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[[package]] | |
name = "untrusted" | |
version = "0.5.0" | |
source = "registry+https://github.com/rust-lang/crates.io-index" | |
[metadata] | |
"checksum arrayref 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0fd1479b7c29641adbd35ff3b5c293922d696a92f25c8c975da3e0acbc87258f" | |
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d" | |
"checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd" | |
"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299" | |
"checksum curve25519-dalek 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08cb827885e49a3b696deb399ea1f0ea4ade1300fc8ce65b3395739e899b0f00" | |
"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9" | |
"checksum digest 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e5b29bf156f3f4b3c4f610a25ff69370616ae6e0657d416de22645483e72af0a" | |
"checksum either 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18785c1ba806c258137c937e44ada9ee7e69a37e3c72077542cd2f069d78562a" | |
"checksum futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4b63a4792d4f8f686defe3b39b92127fea6344de5d38202b2ee5a11bbbf29d6a" | |
"checksum gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)" = "120d07f202dcc3f72859422563522b66fe6463a4c513df062874daad05f85f0a" | |
"checksum generic-array 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6181b378c58e5aacf4d3e17836737465cb2857750b53f6b46672a3509f2a8d9d" | |
"checksum lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3b37545ab726dd833ec6420aaba8231c5b320814b9029ad585555d2a03e94fbf" | |
"checksum libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)" = "8a014d9226c2cc402676fbe9ea2e15dd5222cd1dd57f576b5b283178c944a264" | |
"checksum magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf0336886480e671965f794bc9b6fce88503563013d1bfb7a502c81fe3ac527" | |
"checksum magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40d014c7011ac470ae28e2f76a02bfea4a8480f73e701353b49ad7a8d75f4699" | |
"checksum nodrop 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "52cd74cd09beba596430cc6e3091b74007169a56246e1262f0ba451ea95117b2" | |
"checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0" | |
"checksum num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aec53c34f2d0247c5ca5d32cca1478762f301740468ee9ee6dcb7a0dd7a0c584" | |
"checksum odds 0.2.25 (registry+https://github.com/rust-lang/crates.io-index)" = "c3df9b730298cea3a1c3faa90b7e2f9df3a9c400d0936d6015e6165734eefcba" | |
"checksum rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "eb250fd207a4729c976794d03db689c9be1d634ab5a1c9da9492a13d8fecbcdf" | |
"checksum rayon 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a77c51c07654ddd93f6cb543c7a849863b03abc7e82591afda6dc8ad4ac3ac4a" | |
"checksum rayon-core 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7febc28567082c345f10cddc3612c6ea020fc3297a1977d472cf9fdb73e6e493" | |
"checksum ring 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2a6dc7fc06a05e6de183c5b97058582e9da2de0c136eafe49609769c507724" | |
"checksum scopeguard 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c79eb2c3ac4bc2507cda80e7f3ac5b88bd8eae4c0914d5663e6a8933994be918" | |
"checksum subtle 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "32dbfc4beea0a08bfe33114d0f5e5092f35f6fa387a955b4a2c68888cdd7b0f2" | |
"checksum typenum 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "13a99dc6780ef33c78780b826cf9d2a78840b72cae9474de4bcaf9051e60ebbd" | |
"checksum untrusted 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6b65243989ef6aacd9c0d6bd2b822765c3361d8ed352185a6f3a41f3a718c673" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "ring-dalek" | |
version = "0.1.0" | |
[dependencies] | |
curve25519-dalek = "0.10" | |
ring = "0.11" | |
untrusted = "0.5" | |
[[bin]] | |
name = "main" | |
path = "./src/main.rs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
heartsucker@pythagoras:/tmp/ring-dalek$ cargo --version | |
cargo 0.22.0-nightly (7704f7b1f 2017-08-09) | |
heartsucker@pythagoras:/tmp/ring-dalek$ rustc --version | |
rustc 1.21.0-nightly (ab40a7cb0 2017-08-13) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate curve25519_dalek; | |
extern crate ring; | |
extern crate untrusted; | |
use curve25519_dalek::curve::CompressedEdwardsY; | |
use ring::rand::SystemRandom; | |
use ring::signature::Ed25519KeyPair; | |
fn main() { | |
for _ in 1..1000 { | |
let pkcs8_bytes = Ed25519KeyPair::generate_pkcs8(&SystemRandom::new()) | |
.expect("Couldn't make key"); | |
let pair = Ed25519KeyPair::from_pkcs8(untrusted::Input::from(&pkcs8_bytes)) | |
.expect("Failed to parse bytes"); | |
let pub_point = pair.public_key_bytes(); | |
let mut pub_point_array = [0; 32]; | |
for i in 0..32 { | |
pub_point_array[0] = pub_point[i]; | |
} | |
CompressedEdwardsY(pub_point_array).decompress().expect("could not decompress"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pub_point_array[i] = pub_point[i];
, perhaps? Or even better, usecopy_from_slice()
.