Merge pull request #7 from huitseeker/Cleanup_CI

Make CI run on PRs as well
This commit is contained in:
François Garillot
2020-06-13 08:49:53 -04:00
committed by GitHub
3 changed files with 14 additions and 15 deletions
+5 -1
View File
@@ -1,5 +1,9 @@
name: Rust CI name: Rust CI
on: [push] on:
push:
pull_request:
types: [opened, repoened, synchronize]
jobs: jobs:
combo: combo:
name: test + Clippy + rustfmt name: test + Clippy + rustfmt
+7 -7
View File
@@ -113,10 +113,11 @@ where
KeyFormat: KeyPair, KeyFormat: KeyPair,
{ {
pub fn to_bytes(&self) -> Vec<u8> { pub fn to_bytes(&self) -> Vec<u8> {
let mut res = Vec::new(); [
res.extend(self.envelope.to_bytes()); &self.envelope.to_bytes(),
res.extend(self.client_s_pk.to_arr()); self.client_s_pk.to_arr().as_slice(),
res ]
.concat()
} }
} }
@@ -165,12 +166,11 @@ impl<Grp: Group> TryFrom<&[u8]> for LoginFirstMessage<Grp> {
impl<Grp: Group> LoginFirstMessage<Grp> { impl<Grp: Group> LoginFirstMessage<Grp> {
pub fn to_bytes(&self) -> Vec<u8> { pub fn to_bytes(&self) -> Vec<u8> {
let output: Vec<u8> = [ [
self.alpha.to_bytes().as_slice(), self.alpha.to_bytes().as_slice(),
&self.ke1_message.to_bytes(), &self.ke1_message.to_bytes(),
] ]
.concat(); .concat()
output
} }
} }
+2 -7
View File
@@ -29,9 +29,7 @@ fn client_registration_roundtrip() {
let mut rng = OsRng; let mut rng = OsRng;
let sc = <RistrettoPoint as Group>::random_scalar(&mut rng); let sc = <RistrettoPoint as Group>::random_scalar(&mut rng);
// serialization order: scalar, password // serialization order: scalar, password
let mut bytes: Vec<u8> = vec![]; let bytes: Vec<u8> = [&sc.as_bytes()[..], &pw[..]].concat();
bytes.extend_from_slice(sc.as_bytes());
bytes.extend_from_slice(pw);
let reg = ClientRegistration::<ChaCha20Poly1305, RistrettoPoint>::try_from(&bytes[..]).unwrap(); let reg = ClientRegistration::<ChaCha20Poly1305, RistrettoPoint>::try_from(&bytes[..]).unwrap();
let reg_bytes = reg.to_bytes(); let reg_bytes = reg.to_bytes();
assert_eq!(reg_bytes, bytes); assert_eq!(reg_bytes, bytes);
@@ -113,10 +111,7 @@ fn register_third_message_roundtrip() {
) )
.unwrap(); .unwrap();
let mut message = Vec::new(); let message: Vec<u8> = [&ciphertext.to_bytes(), &pubkey_bytes[..]].concat();
message.extend_from_slice(&ciphertext.to_bytes());
message.extend_from_slice(&pubkey_bytes);
let r3 = let r3 =
RegisterThirdMessage::<ChaCha20Poly1305, SignalKeyPair>::try_from(&message[..]).unwrap(); RegisterThirdMessage::<ChaCha20Poly1305, SignalKeyPair>::try_from(&message[..]).unwrap();
let r3_bytes = r3.to_bytes(); let r3_bytes = r3.to_bytes();