-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #477 from hacspec/jonas/recognize-cal
Infrastructure for known functions, types and constructors
- Loading branch information
Showing
5 changed files
with
222 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use hax_lib_protocol::crypto::*; | ||
|
||
fn crypto_abstractions() { | ||
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(); | ||
} |
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