Skip to content

Commit

Permalink
Use .S.o files instead of crypto_test to address the ADRP issue
Browse files Browse the repository at this point in the history
  • Loading branch information
pennyannn committed Aug 21, 2024
1 parent d53f4bc commit 3d1e24a
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
16 changes: 13 additions & 3 deletions Tests/ELFParser/AWSLCAESV8.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ Author(s): Yan Peng
-/
import Tests.ELFParser.AWSLCCrypto

-- Importing just the aesv8-armx.S.o file to avoid ADRP issue.
-- Details: PC relative addressing are used for locating constants
-- The address changes every time linking happens.
-- We use the .o files to avoid having to deal with address change.
def AESV8ELF :=
(getELFFile (System.mkFilePath
["Tests", "ELFParser", "Data", "aws-lc-build", "crypto",
"fipsmodule", "CMakeFiles", "fipsmodule.dir",
"aesv8-armx.S.o"]))

/--
info: [0xa9bf7bfd#32,
0x910003fd#32,
Expand All @@ -20,8 +30,8 @@ info: [0xa9bf7bfd#32,
0x54000e8c#32,
0x7200143f#32,
0x54000e41#32,
0xf0ffdbc3#32,
0x91008063#32,
0x90000003#32,
0x91000063#32,
0x7103003f#32,
0x6e201c00#32,
0x4cdf7003#32,
Expand Down Expand Up @@ -138,7 +148,7 @@ info: [0xa9bf7bfd#32,
0xd65f03c0#32]
-/
#guard_msgs in
#eval do (getSymbolInsts "aes_hw_set_encrypt_key" (← CryptoELF))
#eval do (getSymbolInsts "aes_hw_set_encrypt_key" (← AESV8ELF))

/--
info: [0x00000001#32,
Expand Down
5 changes: 4 additions & 1 deletion Tests/ELFParser/AWSLCCrypto.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Author(s): Shilpi Goel
-/
import Tests.ELFParser.SymbolContents

def CryptoELF := (getELFFile (System.mkFilePath ["Tests", "ELFParser", "Data", "crypto_test"]))
def CryptoELF :=
(getELFFile (System.mkFilePath
["Tests", "ELFParser", "Data",
"aws-lc-build", "crypto", "crypto_test"]))

/--
info: true -/
Expand Down
19 changes: 15 additions & 4 deletions Tests/ELFParser/AWSLCSHA2.lean
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,24 @@ Author(s): Shilpi Goel
-/
import Tests.ELFParser.AWSLCCrypto

-- Importing just the sha512-armv8.S.o file to avoid ADRP issue.
-- Details: PC relative addressing are used for locating constants
-- The address changes every time linking happens.
-- We use the .o files to avoid having to deal with address change.
def SHA512ELF :=
(getELFFile (System.mkFilePath
["Tests", "ELFParser", "Data", "aws-lc-build", "crypto",
"fipsmodule", "CMakeFiles", "fipsmodule.dir",
"sha512-armv8.S.o"]))

/--
info: [0xa9bf7bfd#32,
0x910003fd#32,
0x4cdf2030#32,
0x4cdf2034#32,
0x4c402c00#32,
0xd0ffdb43#32,
0x91100063#32,
0x90000003#32,
0x91000063#32,
0x4e200a10#32,
0x4e200a31#32,
0x4e200a52#32,
Expand Down Expand Up @@ -509,9 +519,10 @@ info: [0xa9bf7bfd#32,
0xb5ffc382#32,
0x4c002c00#32,
0xf84107fd#32,
0xd65f03c0#32]-/
0xd65f03c0#32]
-/
#guard_msgs in
#eval do (getSymbolInsts "sha512_block_data_order_hw" (← CryptoELF))
#eval do (getSymbolInsts "sha512_block_data_order_hw" (← SHA512ELF))

/--
info: [0xd728ae22#32,
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_awslc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ cmake -GNinja \
ninja

# Move crypto_test to LNSym
cp -f crypto/crypto_test ${LNSym_DIR}/Tests/ELFParser/Data/crypto_test
cp -rf ../aws-lc-build ${LNSym_DIR}/Tests/ELFParser/Data/aws-lc-build

0 comments on commit 3d1e24a

Please sign in to comment.