Skip to content

Commit

Permalink
Move crypto abstraction names to their own module
Browse files Browse the repository at this point in the history
  • Loading branch information
jschneider-bensch committed Jan 30, 2024
1 parent 1202b7e commit c2eaa9a
Showing 1 changed file with 2 additions and 31 deletions.
33 changes: 2 additions & 31 deletions engine/names/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,13 @@
#![feature(try_trait_v2)]
#![feature(allocator_api)]

use hax_lib_protocol::crypto::*;
extern crate alloc;
/* This is a dummy Rust file. Every path used in this file will be
* exported and made available automatically in OCaml. */

fn dummy_hax_concrete_ident_wrapper<I: core::iter::Iterator<Item = u8>>(x: I, mut y: I) {
// Crypto abstraction layer names
let bytes = vec![0u8; 32];
let iv = AEADIV::from_bytes(&bytes);
let key = AEADKey::from_bytes(AEADAlgorithm::Chacha20Poly1305, &bytes);

let (cipher_text, tag) = aead_encrypt(key, iv, &bytes, &bytes);
let iv = AEADIV::from_bytes(&bytes);
let key = AEADKey::from_bytes(AEADAlgorithm::Chacha20Poly1305, &bytes);
let _ = aead_decrypt(key, iv, &bytes, &cipher_text, AEADTag::from_bytes(&bytes));

let p = DHElement::from_bytes(&bytes);
let s = DHScalar::from_bytes(&bytes);
dh_scalar_multiply(DHGroup::X25519, s.clone(), p);
dh_scalar_multiply_base(DHGroup::X25519, s);

let _ = hmac(HMACAlgorithm::Sha256, &bytes, &bytes);

let _ = 1u64.to_le_bytes();
let slice = &bytes[0..1];
let _ = slice.len();
let _ = slice.to_vec();
let _ = [slice, slice].concat();
let mut v = vec![0];
v.extend_from_slice(slice);
v.truncate(1);

let _ = hash(HashAlgorithm::Sha256, &bytes);
let _ = cipher_text.clone();
// End crypto abstractions example
mod crypto_abstractions;

fn dummy_hax_concrete_ident_wrapper<I: core::iter::Iterator<Item = u8>>(x: I, mut y: I) {
let _: core::result::Result<u8, u8> = core::result::Result::Ok(0);
let _: core::result::Result<u8, u8> = core::result::Result::Err(0);
let _ = x.fold(0, |a, b| a + b);
Expand Down

0 comments on commit c2eaa9a

Please sign in to comment.