Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
c474e65
aes-xts experiments
pennyannn Feb 14, 2025
00a95b3
More experiments
pennyannn Feb 14, 2025
19f9d1c
Add Decrypt function- its instructions are all understood by the deco…
nebeid Mar 18, 2025
8579d6a
The decrypt version is now from linux-aarch64.
nebeid Mar 18, 2025
b246573
enable stopping at first error.
nebeid Mar 20, 2025
e17e788
Save decoded output to a text file.
nebeid Mar 21, 2025
2397213
Update decoded output after adding post-index register offset to the …
nebeid Mar 25, 2025
cc7f0a2
New decoded output after shuffling around some instructions.
nebeid Apr 4, 2025
9eb985e
Start proof for AES256 encrypt
pennyannn May 30, 2025
3639711
Continuing the AES specification.
nebeid Jun 17, 2025
9b134b2
The spec test vector succeeds after converting the inputs to little e…
nebeid Jun 19, 2025
69dab0b
Post conditions and MAYCHANGE for an AES block encryption proof.
nebeid Jun 24, 2025
4bd82d1
Proof of AES encryption of one block.
nebeid Jun 25, 2025
a1c9c3c
Add aes-xts decrypt programs
pennyannn Jun 23, 2025
c558535
Add aes program and spec
pennyannn Jun 24, 2025
1e8932b
Symbolic simulation and fixed a bug in code
pennyannn Jun 24, 2025
8649a9c
Finish the proof for aes-xts-decrypt
pennyannn Jun 24, 2025
5b951ab
Fix a bug
pennyannn Jun 27, 2025
684f3f7
Set up for aes-xts one block proof
pennyannn Jun 25, 2025
3dde459
Define spec for one block xts and define conversion
pennyannn Jul 1, 2025
aadaeae
Add proof for one block xts
pennyannn Jul 1, 2025
0379411
Update one block proof to use more clean version
pennyannn Jul 22, 2025
70a24e0
WIP: define XTS full specification
pennyannn Jul 22, 2025
31fccb6
Experiment with conversions
pennyannn Jul 25, 2025
424ddb5
Fix type issue in cipher stealing
pennyannn Aug 19, 2025
d981037
Write conversions and add tests
pennyannn Aug 20, 2025
ebb74f2
The ultimate clean up
pennyannn Aug 21, 2025
52f494b
The ultimate ultimate clean up to fix perror
pennyannn Aug 22, 2025
ec3b91e
Update the specification to match the standard for tweak calculation
pennyannn Aug 29, 2025
937ec02
Update clean version of xts decrypt
pennyannn Aug 28, 2025
76891bc
Add a structure for the proof
pennyannn Aug 29, 2025
bd5a004
Eliminating some CHEAT_TACs
pennyannn Sep 17, 2025
e7f22b8
Eliminate more CHEAT_TACs and prove a bunch of lemmas
pennyannn Sep 17, 2025
3893ef4
Fixing MAYCHANGE and preserved registers
pennyannn Sep 24, 2025
39f7f44
WIP: proving main goal
pennyannn Sep 26, 2025
a4545a8
Simplify specification
pennyannn Sep 26, 2025
4a582ce
WIP: proving main goal
pennyannn Sep 27, 2025
71f0f31
Further simplify the spec
pennyannn Oct 1, 2025
e9e93ae
WIP: proving main goal
pennyannn Oct 1, 2025
37f7de3
Update the spec
pennyannn Oct 2, 2025
16f0fe2
WIP: prove main goal
pennyannn Oct 3, 2025
4fe026f
Revert "Update the spec"
pennyannn Oct 3, 2025
84b25ef
Finished: prove main goal
pennyannn Oct 3, 2025
e7eff18
WIP: prove tail
pennyannn Oct 6, 2025
4902ff6
Restructure proof to add a cut point before cipher stealing and finis…
pennyannn Oct 7, 2025
5e47b52
Update the program with respect to AWS-LC PR2734
pennyannn Oct 8, 2025
66f1ac0
Finished: verify cipher stealing
pennyannn Oct 9, 2025
2a9540e
Tried to fix the non-overlapping issue
pennyannn Oct 22, 2025
a84575d
Fixing some issues
pennyannn Oct 22, 2025
21c97d6
Prepare for bounded proofs
pennyannn Oct 22, 2025
cc97952
Finished: bounded proofs
pennyannn Oct 22, 2025
d0ee743
Add the final subroutine theorem
pennyannn Oct 24, 2025
13d85ba
Thanks for John Harrison, cleaning up the last CHEAT_TAC
pennyannn Oct 31, 2025
d476108
More experiments
pennyannn Feb 14, 2025
248e996
One block of AES-256-XTS encrypt: Spec and a test vector (using conve…
nebeid Jul 6, 2025
2cca201
Adding new assembly for AES-XTS:
nebeid Jul 7, 2025
25279ee
Proof of one-block AES-XTS encrypt.
nebeid Jul 18, 2025
75c991a
AES-XTS encrypt (any input length) spec. To be tested
nebeid Aug 18, 2025
19ae854
Make encrypt_spec match decrypt_spec.
nebeid Sep 3, 2025
014bd1a
Working through the conversions for AES-XTS encrypt test vector.
nebeid Sep 5, 2025
2ea0b4d
Fixed a bug in cipher_stealing_encrypt in the computation of the last…
nebeid Sep 8, 2025
b655c7a
Completed AES-XTS Encrypt specs and their tests.
nebeid Sep 9, 2025
92ad994
Use the asm code integrated in AWS-LC and redo the 1-block proof base…
nebeid Sep 19, 2025
fbeca3b
WIP: full proof: - loop invariant, one subgoal proven. - proof of cod…
nebeid Sep 25, 2025
8b644e9
Moved udiv and second tweak operations to later, WIP: full proof; cod…
nebeid Oct 3, 2025
e09df03
Update byte_list_at.
nebeid Oct 3, 2025
2e59a4e
Update AES-XTS encrypt spec removing the byte list returned in case o…
nebeid Oct 3, 2025
b174713
Subgoal 2 of the loop invariant proven.
nebeid Oct 3, 2025
16d95d8
Changed back bytes_to_int128 to its original definition.
nebeid Oct 8, 2025
be9b78d
WIP: subgoal 3 of the loop invariant.
nebeid Oct 8, 2025
fd5608a
WIP: subgoal 3 of the loop invariant, arrived at the inductive step.
nebeid Oct 10, 2025
a40790c
WIP: subgoal 3 of the loop invariant, going through the inductive step.
nebeid Oct 16, 2025
0c17c9e
WIP: subgoal 3 of the loop invariant, at the inductive step, reduced …
nebeid Oct 16, 2025
e0b9298
WIP: subgoal 3 of the loop invariant, at the inductive step, reduced …
nebeid Oct 16, 2025
3e1e4b7
subgoal 3 of the loop invariant; the inductive step - DONE.
nebeid Oct 17, 2025
c7d22ee
Subgoal 4 of main loop invariant: backedge is not taken until i = num…
nebeid Oct 20, 2025
4ad8a49
Assembly changes in cipher-stealing from AWS-LC PR2734 to avoid loopi…
nebeid Oct 24, 2025
0d537e7
Subgoal 5: case len mod 0x50 = 0x40.
nebeid Oct 28, 2025
de50b65
Subgoal 5: case len mod 0x50 = 0x30.
nebeid Oct 30, 2025
52764d7
Subgoal 5: case len mod 0x50 = 0x20.
nebeid Oct 31, 2025
b1022a7
Subgoal 5: case len mod 0x50 = 0x10.
nebeid Oct 31, 2025
f58dd81
Subgoal 5: case len mod 0x50 = 0 (wip).
nebeid Oct 31, 2025
2613e30
Subgoal 5: case len mod 0x50 = 0.
nebeid Nov 3, 2025
20c362e
Cipher-stealing: case tail = 0.
nebeid Nov 4, 2025
751144f
Cipher-stealing: case tail != 0, loop invariant up to subgoal 2.
nebeid Nov 6, 2025
be81ad3
Cipher-stealing: case tail != 0, loop invariant subgoal 3: WIP.
nebeid Nov 10, 2025
07ac140
Cipher-stealing: case tail != 0, loop invariant back to subgoal 2: WIP.
nebeid Nov 10, 2025
e393090
Cipher-stealing: case tail != 0, loop invariant subgoal 2: done.
nebeid Nov 14, 2025
b573211
Cipher-stealing: case tail != 0, loop invariant subgoal 3: symbolic s…
nebeid Nov 19, 2025
43de77e
Cipher-stealing: case tail != 0, loop invariant subgoal 3: symbolic s…
nebeid Nov 21, 2025
68c4b01
Cipher-stealing: case tail != 0, loop invariant subgoal 3: symbolic s…
nebeid Nov 24, 2025
8939997
Cipher-stealing: case tail != 0, loop invariant: Reworking subgoal 2 …
nebeid Nov 25, 2025
33d6537
Cipher-stealing: case tail != 0, loop invariant: Reworking subgoal 2 …
nebeid Nov 25, 2025
f7052bd
Cipher-stealing: case tail != 0, loop invariant: Subgoal 2: Done, pen…
nebeid Nov 26, 2025
3d0374b
Cipher-stealing: case tail != 0, loop invariant: Subgoal 3: case i=3 …
nebeid Nov 27, 2025
e0c6afa
Cipher-stealing: case tail != 0, loop invariant: Subgoal 3: complete.
nebeid Nov 28, 2025
9012060
Cipher-stealing: case tail != 0, loop invariant: Subgoal 4: complete.
nebeid Nov 28, 2025
bc7d0f4
Cipher-stealing: case tail != 0, loop invariant: Subgoal 5, wip.
nebeid Nov 28, 2025
dd5e06f
Cipher-stealing: case tail != 0, loop invariant: Subgoal 5, wip (inco…
nebeid Dec 1, 2025
3e0a69f
Cipher-stealing: case tail != 0, loop invariant: Subgoal 5, proved su…
nebeid Dec 1, 2025
fc80078
Cipher-stealing: complete.
nebeid Dec 1, 2025
8aa0c50
Less than 2 blocks: with the late W19 setting bug, assumptions are er…
nebeid Dec 2, 2025
047b301
Less than 2 blocks: with the fix setting W19 before branching, no ass…
nebeid Dec 2, 2025
f714f88
Less than 2 blocks: proof done.
nebeid Dec 3, 2025
5c17ac8
Less than 3 blocks: proof done.
nebeid Dec 4, 2025
2c9d89f
Less than 4 blocks, less than 5 blocks: proofs done.
nebeid Dec 4, 2025
df435d5
AES256-XTS encrypt proof: complete.
nebeid Dec 4, 2025
0e7e6df
AES256-XTS encrypt proof including stack management: complete.
nebeid Dec 5, 2025
f13b9fe
Adjust 1-block proof to the code after the W19 fix.
nebeid Dec 10, 2025
9f8f791
Use the updated tactic name.
nebeid Dec 10, 2025
7067386
Clean up Makefiles and rename files to keep consistency
pennyannn Dec 19, 2025
9d64670
Refactor the structure of files
pennyannn Dec 19, 2025
1efe5ed
Put AES encrypt and decrypt proofs in tutorial
pennyannn Dec 23, 2025
3d02501
Integrate assembly
pennyannn Dec 23, 2025
c49f61e
Fix issue in collect-signatures
pennyannn Dec 23, 2025
71bbe67
Add benchmark for AES-XTS
pennyannn Dec 23, 2025
8940450
Fix missing sematest for ldrb shifted register variant
pennyannn Dec 23, 2025
b5607f8
Rename AES_KEY as s2n_bignum_AES_KEY
pennyannn Dec 23, 2025
cc064b8
Fix benchmark platform check
pennyannn Dec 23, 2025
f34f3b1
Add sematest for strb shifted register no shift
pennyannn Dec 23, 2025
3e4f514
Update signature
pennyannn Dec 23, 2025
5c072d5
Rename aes_hw_xts_encrypt to aes_xts_encrypt and similarly for decrypt
pennyannn Dec 23, 2025
33cb597
Merge branch 'main' into aes-xts
nebeid Jan 16, 2026
32349ca
Added explanation to encrypt tutorial.
nebeid Jan 16, 2026
d3035e8
Put AES encrypt and decrypt proofs in one file in the tutorial, with …
nebeid Jan 20, 2026
c2541e2
Merge remote-tracking branch 'upstream/main' into aes-xts
nebeid Jan 20, 2026
45f4e61
Revert "Put AES encrypt and decrypt proofs in one file in the tutoria…
nebeid Jan 20, 2026
f958559
Added explanation to the decrypt tutorial.
nebeid Jan 21, 2026
a124e9b
Add banners and remove print function in collect-signatures.py.
nebeid Jan 22, 2026
58c21b5
Put AES encrypt and decrypt proofs in one file in the tutorial (2nd a…
nebeid Jan 22, 2026
f6cffa6
Merge remote-tracking branch 'upstream/main' into aes-xts
nebeid Jan 26, 2026
d196208
Put specs for list and tweak calculation in a common spec file.
nebeid Jan 26, 2026
2d46477
Update the name of the encrypt subroutine theorem to match the decryp…
nebeid Jan 26, 2026
97ae2a7
Merge branch 'main' into aes-xts
nebeid Feb 18, 2026
1a615ae
Prove CIPHER_STEALING_SAFE of aes-xts decrypt
aqjune-aws Jan 14, 2026
2e362c7
Prove CIPHER_STEALING_SAFE of aes-xts encrypt
nebeid Mar 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions arm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,17 @@ UNOPT_OBJ = p256/unopt/bignum_montmul_p256_base.o \
fastmul/unopt/bignum_mul_8_16_base.o \
fastmul/unopt/bignum_sqr_8_16_base.o

OBJ = $(POINT_OBJ) $(BIGNUM_OBJ)
AES_XTS_OBJ = aes-xts/aes_xts_decrypt.o \
aes-xts/aes_xts_encrypt.o


OBJ = $(POINT_OBJ) $(BIGNUM_OBJ) $(AES_XTS_OBJ)

# Tutorial assembly files

TUTORIAL_PROOFS = $(wildcard tutorial/*.ml)

TUTORIAL_OBJ = $(filter-out tutorial/safety.o, $(TUTORIAL_PROOFS:.ml=.o)) \
TUTORIAL_OBJ = $(filter-out tutorial/aes_encrypt_decrypt.o tutorial/safety.o, $(TUTORIAL_PROOFS:.ml=.o)) \
curve25519/bignum_mod_n25519.o p256/bignum_mux_4.o \
tutorial/rel_loop2.o \
tutorial/rel_simp2.o tutorial/rel_veceq2.o tutorial/rel_equivtac2.o \
Expand All @@ -421,9 +425,9 @@ TUTORIAL_OBJ = $(filter-out tutorial/safety.o, $(TUTORIAL_PROOFS:.ml=.o)) \
# x18 should not be used for Apple platforms. Check this using grep.

%.o : %.S
cat $< | $(PREPROCESS) | $(SPLIT) | grep -v -E '^\s+\.(quad|hword)\s+(0x|-)?[0-9a-f]+$$' | $(ASSEMBLE) -o $@ -
cat $< | $(PREPROCESS) | $(SPLIT) | grep -v -E '^\s+.quad\s+0x[0-9a-f]+$$' | $(ASSEMBLE) -march=armv8-a+crypto -o $@ -
$(OBJDUMP) $@ | ( ( ! grep --ignore-case -E 'w18|[^0]x18' ) || ( rm $@ ; exit 1 ) )
cat $< | $(PREPROCESS) | $(SPLIT) | $(ASSEMBLE) -o $@ -
cat $< | $(PREPROCESS) | $(SPLIT) | $(ASSEMBLE) -march=armv8-a+crypto -o $@ -

libs2nbignum.a: $(OBJ) ; ar -rc libs2nbignum.a $(OBJ)

Expand Down Expand Up @@ -525,6 +529,12 @@ sm2/sm2_montjscalarmul_alt.native: sm2/sm2_montjadd_alt.native sm2/sm2_montjdoub
tutorial/safety.native: tutorial/safety.ml proofs/bignum_mux_4.ml \
curve25519/bignum_mod_n25519.o ; \
../tools/build-proof.sh "$<" "$(HOLLIGHT)" "$@"

# aes_encrypt_decrypt tutorial concatenates proofs for both aes_encrypt.S and aes_decrypt.S
tutorial/aes_encrypt_decrypt.native: tutorial/aes_encrypt_decrypt.ml \
tutorial/aes_encrypt.o tutorial/aes_decrypt.o ; \
../tools/build-proof.sh "$<" "$(HOLLIGHT)" "$@"

# other tutorials have their .o files
.SECONDEXPANSION:
tutorial/%.native: tutorial/%.ml tutorial/%.o ; ../tools/build-proof.sh "$<" "$(HOLLIGHT)" "$@"
Expand Down
39 changes: 39 additions & 0 deletions arm/aes-xts/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#############################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT-0
#############################################################################

# If actually on an ARM8 machine, just use the GNU assembler (as). Otherwise
# use a cross-assembling version so that the code can still be assembled
# and the proofs checked against the object files (though you won't be able
# to run code without additional emulation infrastructure). The aarch64
# cross-assembling version can be installed manually by something like:
#
# sudo apt-get install binutils-aarch64-linux-gnu

#UNAME_RESULT=$(shell uname -p)
OSTYPE_RESULT=$(shell uname -s)
ARCHTYPE_RESULT=$(shell uname -m)

ifeq ($(ARCHTYPE_RESULT),aarch64)
GAS=as
else
ifeq ($(OSTYPE_RESULT),Darwin)
GAS=as -arch arm64
OBJDUMP=otool -tvV
else
GAS=aarch64-linux-gnu-as
endif
endif

# List of object files

OBJ = aes_xts_decrypt.o \
aes_xts_encrypt.o


%.o : %.S ; $(CC) -E -I../../include $< | $(GAS) -o $@ -

default: $(OBJ);

clean:; rm -f *.o *.correct
Loading