From 6e7bd662346c7acb8945dbdadc227d7357c2108a Mon Sep 17 00:00:00 2001 From: Tom French Date: Tue, 7 Jan 2025 17:40:53 +0000 Subject: [PATCH 1/2] feat!: update `aes128_encrypt` to return an array --- compiler/noirc_evaluator/src/acir/acir_variable.rs | 2 +- .../src/brillig/brillig_gen/brillig_black_box.rs | 10 ++-------- noir_stdlib/src/aes128.nr | 6 +++++- .../execution_success/aes128_encrypt/src/main.nr | 4 ++-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/compiler/noirc_evaluator/src/acir/acir_variable.rs b/compiler/noirc_evaluator/src/acir/acir_variable.rs index a253999bfd0..cf6b1fcc7f7 100644 --- a/compiler/noirc_evaluator/src/acir/acir_variable.rs +++ b/compiler/noirc_evaluator/src/acir/acir_variable.rs @@ -1421,7 +1421,7 @@ impl> AcirContext { } }?; output_count = input_size + (16 - input_size % 16); - (vec![], vec![F::from(output_count as u128)]) + (vec![], vec![]) } BlackBoxFunc::RecursiveAggregation => { let proof_type_var = match inputs.pop() { diff --git a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs index 2ddcea26570..1fc39b58223 100644 --- a/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs +++ b/compiler/noirc_evaluator/src/brillig/brillig_gen/brillig_black_box.rs @@ -355,15 +355,14 @@ pub(crate) fn convert_black_box_call { if let ( [inputs, BrilligVariable::BrilligArray(iv), BrilligVariable::BrilligArray(key)], - [BrilligVariable::SingleAddr(out_len), BrilligVariable::BrilligVector(outputs)], + [outputs], ) = (function_arguments, function_results) { let inputs = convert_array_or_vector(brillig_context, *inputs, bb_func); let iv = brillig_context.codegen_brillig_array_to_heap_array(*iv); let key = brillig_context.codegen_brillig_array_to_heap_array(*key); - let outputs_vector = - brillig_context.codegen_brillig_vector_to_heap_vector(*outputs); + let outputs_vector = convert_array_or_vector(brillig_context, *outputs, bb_func); brillig_context.black_box_op_instruction(BlackBoxOp::AES128Encrypt { inputs, @@ -372,11 +371,6 @@ pub(crate) fn convert_black_box_call(input: [u8; N], iv: [u8; 16], key: [u8; 16]) -> [u8] {} +pub fn aes128_encrypt( + input: [u8; N], + iv: [u8; 16], + key: [u8; 16], +) -> [u8; N + 16 - N % 16] {} // docs:end:aes128 diff --git a/test_programs/execution_success/aes128_encrypt/src/main.nr b/test_programs/execution_success/aes128_encrypt/src/main.nr index 7738bed5255..243984a8300 100644 --- a/test_programs/execution_success/aes128_encrypt/src/main.nr +++ b/test_programs/execution_success/aes128_encrypt/src/main.nr @@ -22,12 +22,12 @@ unconstrained fn decode_hex(s: str) -> [u8; M] { unconstrained fn cipher(plaintext: [u8; 12], iv: [u8; 16], key: [u8; 16]) -> [u8; 16] { let result = std::aes128::aes128_encrypt(plaintext, iv, key); - result.as_array() + result } fn main(inputs: str<12>, iv: str<16>, key: str<16>, output: str<32>) { let result: [u8; 16] = - std::aes128::aes128_encrypt(inputs.as_bytes(), iv.as_bytes(), key.as_bytes()).as_array(); + std::aes128::aes128_encrypt(inputs.as_bytes(), iv.as_bytes(), key.as_bytes()); let output_bytes: [u8; 16] = unsafe { //@safety: testing context From 263bd8b0d9f0f6708ea22b554c91d2256f14c4ba Mon Sep 17 00:00:00 2001 From: Tom French Date: Tue, 7 Jan 2025 19:03:53 +0000 Subject: [PATCH 2/2] . --- .github/workflows/reports.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reports.yml b/.github/workflows/reports.yml index 6c93156eddd..811f4d6f37b 100644 --- a/.github/workflows/reports.yml +++ b/.github/workflows/reports.yml @@ -299,7 +299,7 @@ jobs: fail-fast: false matrix: include: - - project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-contracts, is_library: true } + # - project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-contracts, is_library: true } - project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-inner, take_average: true } - project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-tail, take_average: true } - project: { repo: AztecProtocol/aztec-packages, path: noir-projects/noir-protocol-circuits/crates/private-kernel-reset, take_average: true }