Skip to content

Commit 623463c

Browse files
committed
Script for apple_aarch64
1 parent 43268bf commit 623463c

File tree

4 files changed

+100
-47
lines changed

4 files changed

+100
-47
lines changed
Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR ISC
3+
// Thu Oct 16 20:45:49 UTC 2025
34

45
pub(super) const CRYPTO_LIBRARY: &[&str] = &[
56
"crypto/fipsmodule/ml_kem/mlkem/native/aarch64/src/intt.S",
@@ -23,80 +24,82 @@ pub(super) const CRYPTO_LIBRARY: &[&str] = &[
2324
"generated-src/ios-aarch64/crypto/fipsmodule/ghashv8-armx.S",
2425
"generated-src/ios-aarch64/crypto/fipsmodule/keccak1600-armv8.S",
2526
"generated-src/ios-aarch64/crypto/fipsmodule/md5-armv8.S",
26-
"generated-src/ios-aarch64/crypto/fipsmodule/p256-armv8-asm.S",
2727
"generated-src/ios-aarch64/crypto/fipsmodule/p256_beeu-armv8-asm.S",
28+
"generated-src/ios-aarch64/crypto/fipsmodule/p256-armv8-asm.S",
2829
"generated-src/ios-aarch64/crypto/fipsmodule/rndr-armv8.S",
2930
"generated-src/ios-aarch64/crypto/fipsmodule/sha1-armv8.S",
3031
"generated-src/ios-aarch64/crypto/fipsmodule/sha256-armv8.S",
3132
"generated-src/ios-aarch64/crypto/fipsmodule/sha512-armv8.S",
3233
"generated-src/ios-aarch64/crypto/fipsmodule/vpaes-armv8.S",
3334
"generated-src/ios-aarch64/crypto/test/trampoline-armv8.S",
34-
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/bignum_madd_n25519.S",
3535
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/bignum_madd_n25519_alt.S",
36+
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/bignum_madd_n25519.S",
3637
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/bignum_mod_n25519.S",
3738
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/bignum_neg_p25519.S",
38-
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/curve25519_x25519_byte.S",
3939
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/curve25519_x25519_byte_alt.S",
40-
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/curve25519_x25519base_byte.S",
40+
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/curve25519_x25519_byte.S",
4141
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/curve25519_x25519base_byte_alt.S",
42-
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_decode.S",
42+
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/curve25519_x25519base_byte.S",
4343
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_decode_alt.S",
44+
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_decode.S",
4445
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_encode.S",
45-
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_scalarmulbase.S",
4646
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_scalarmulbase_alt.S",
47-
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_scalarmuldouble.S",
47+
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_scalarmulbase.S",
4848
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_scalarmuldouble_alt.S",
49+
"third_party/s2n-bignum/s2n-bignum-imported/arm/curve25519/edwards25519_scalarmuldouble.S",
4950
"third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_emontredc_8n.S",
5051
"third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_kmul_16_32.S",
5152
"third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_kmul_32_64.S",
5253
"third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_ksqr_16_32.S",
5354
"third_party/s2n-bignum/s2n-bignum-imported/arm/fastmul/bignum_ksqr_32_64.S",
54-
"third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_copy_row_from_table.S",
5555
"third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_copy_row_from_table_16.S",
5656
"third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_copy_row_from_table_32.S",
5757
"third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_copy_row_from_table_8n.S",
58+
"third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_copy_row_from_table.S",
5859
"third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_ge.S",
5960
"third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_mul.S",
6061
"third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_optsub.S",
6162
"third_party/s2n-bignum/s2n-bignum-imported/arm/generic/bignum_sqr.S",
6263
"third_party/s2n-bignum/s2n-bignum-imported/arm/p256/bignum_montinv_p256.S",
63-
"third_party/s2n-bignum/s2n-bignum-imported/arm/p256/p256_montjscalarmul.S",
6464
"third_party/s2n-bignum/s2n-bignum-imported/arm/p256/p256_montjscalarmul_alt.S",
65+
"third_party/s2n-bignum/s2n-bignum-imported/arm/p256/p256_montjscalarmul.S",
6566
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_add_p384.S",
6667
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_deamont_p384.S",
6768
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_littleendian_6.S",
6869
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_montinv_p384.S",
69-
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_montmul_p384.S",
7070
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_montmul_p384_alt.S",
71-
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_montsqr_p384.S",
71+
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_montmul_p384.S",
7272
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_montsqr_p384_alt.S",
73+
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_montsqr_p384.S",
7374
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_neg_p384.S",
7475
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_nonzero_6.S",
7576
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_sub_p384.S",
7677
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/bignum_tomont_p384.S",
77-
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/p384_montjdouble.S",
7878
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/p384_montjdouble_alt.S",
79-
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/p384_montjscalarmul.S",
79+
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/p384_montjdouble.S",
8080
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/p384_montjscalarmul_alt.S",
81+
"third_party/s2n-bignum/s2n-bignum-imported/arm/p384/p384_montjscalarmul.S",
8182
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/bignum_add_p521.S",
8283
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/bignum_fromlebytes_p521.S",
8384
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/bignum_inv_p521.S",
84-
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/bignum_mul_p521.S",
8585
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/bignum_mul_p521_alt.S",
86+
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/bignum_mul_p521.S",
8687
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/bignum_neg_p521.S",
87-
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/bignum_sqr_p521.S",
8888
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/bignum_sqr_p521_alt.S",
89+
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/bignum_sqr_p521.S",
8990
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/bignum_sub_p521.S",
9091
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/bignum_tolebytes_p521.S",
91-
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/p521_jdouble.S",
9292
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/p521_jdouble_alt.S",
93-
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/p521_jscalarmul.S",
93+
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/p521_jdouble.S",
9494
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/p521_jscalarmul_alt.S",
95+
"third_party/s2n-bignum/s2n-bignum-imported/arm/p521/p521_jscalarmul.S",
96+
"third_party/s2n-bignum/s2n-bignum-imported/arm/sha3/sha3_keccak_f1600_alt.S",
97+
"third_party/s2n-bignum/s2n-bignum-imported/arm/sha3/sha3_keccak_f1600.S",
98+
"third_party/s2n-bignum/s2n-bignum-imported/arm/sha3/sha3_keccak2_f1600_alt.S",
9599
"third_party/s2n-bignum/s2n-bignum-imported/arm/sha3/sha3_keccak2_f1600.S",
96100
"third_party/s2n-bignum/s2n-bignum-imported/arm/sha3/sha3_keccak4_f1600_alt.S",
97101
"third_party/s2n-bignum/s2n-bignum-imported/arm/sha3/sha3_keccak4_f1600_alt2.S",
98-
"third_party/s2n-bignum/s2n-bignum-imported/arm/sha3/sha3_keccak_f1600.S",
99-
"third_party/s2n-bignum/s2n-bignum-imported/arm/sha3/sha3_keccak_f1600_alt.S",
102+
"third_party/s2n-bignum/s2n-bignum-imported/arm/sha3/sha3_keccak4_f1600.S",
100103
"third_party/s2n-bignum/s2n-bignum-to-be-imported/arm/aes/aes-xts-dec.S",
101104
"third_party/s2n-bignum/s2n-bignum-to-be-imported/arm/aes/aes-xts-enc.S",
102105
];
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env bash
2+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
# SPDX-License-Identifier: Apache-2.0 OR ISC
4+
5+
if [[ ${BASH_VERSINFO[0]} -lt 4 ]]; then
6+
echo Must use bash 4 or later: ${BASH_VERSION}
7+
exit 1
8+
fi
9+
10+
REPO_ROOT=$(git rev-parse --show-toplevel)
11+
SYS_CRATE_DIR="${REPO_ROOT}/aws-lc-sys"
12+
AWS_LC_DIR="${SYS_CRATE_DIR}/aws-lc"
13+
BUILD_CFG_DIR="${SYS_CRATE_DIR}/builder/cc_builder"
14+
BUILD_CFG_FILE="${BUILD_CFG_DIR}/${SCRIPT_NAME}".rs
15+
mkdir -p "${BUILD_CFG_DIR}"
16+
17+
function generate_output() {
18+
TIMESTAMP="$(date -u)"
19+
cat << EOF
20+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
21+
// SPDX-License-Identifier: Apache-2.0 OR ISC
22+
// $TIMESTAMP
23+
24+
pub(super) const CRYPTO_LIBRARY: &[&str] = &[
25+
EOF
26+
for FILE in "${@}"; do
27+
echo " \"${FILE}\","
28+
done
29+
cat << EOF
30+
];
31+
EOF
32+
}
33+
34+
function s2n_bignum_aarch64() {
35+
find third_party/s2n-bignum/s2n-bignum-imported/arm -name "*.S" -type f \
36+
| rg --pcre2 -v '/arm/(mlkem|sm2|tutorial|secp256k1)' \
37+
| rg --pcre2 -v '/arm/curve25519/bignum_(?!(madd_n|mod_n25519.S|neg_p))' \
38+
| rg --pcre2 -v '/arm/curve25519/curve25519_(?!(x25519_byte|x25519base_byte))' \
39+
| rg --pcre2 -v '/arm/curve25519/edwards25519_(?!(decode|encode.S|scalarmul))' \
40+
| rg --pcre2 -v '/arm/fastmul/(?!(bignum_k..._16_32|bignum_k..._32_64|bignum_emontredc_8n.S))' \
41+
| rg --pcre2 -v '/arm/generic/(word|bignum_(?!(copy_row_from_table|ge.S|mul.S|optsub.S|sqr.S)))' \
42+
| rg --pcre2 -v '/arm/p256/(?!(bignum_montinv_|p256_montjscalarmul))' \
43+
| rg --pcre2 -v '/arm/.*/unopt/' \
44+
| rg --pcre2 -v '/arm/p384/(p384_montj(mix)?add|bignum_(?!add|deamont|littleendian|mont|neg|nonzero|sub|tomont))' \
45+
| rg --pcre2 -v '/arm/p521/(bignum_(.*mont.*|cmul|double|half|optneg|triple)_p521(_alt)?\.S|bignum_mod_[np]521_9\.S|p521_j(mix)?add(_alt)?\.S)' \
46+
| sort -f
47+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
# SPDX-License-Identifier: Apache-2.0 OR ISC
4+
set -ex
5+
set -o pipefail
6+
7+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
8+
SCRIPT_NAME="$(basename -s .sh -- "${BASH_SOURCE[0]}")"
9+
10+
source "${SCRIPT_DIR}/_common.sh"
11+
12+
pushd "${AWS_LC_DIR}"
13+
declare -a SOURCE_FILES
14+
SOURCE_FILES=()
15+
mapfile -O 0 -t SOURCE_FILES < <(find crypto/fipsmodule/ml_kem/mlkem/native/aarch64/src -name "*.S" -type f | sort -f)
16+
echo "${SOURCE_FILES[@]}"
17+
mapfile -O ${#SOURCE_FILES[@]} -t SOURCE_FILES < <(find generated-src/ios-aarch64/crypto -name "*.S" -type f | sort -f)
18+
echo "${SOURCE_FILES[@]}"
19+
mapfile -O ${#SOURCE_FILES[@]} -t SOURCE_FILES < <(s2n_bignum_aarch64)
20+
echo "${SOURCE_FILES[@]}"
21+
mapfile -O ${#SOURCE_FILES[@]} -t SOURCE_FILES < <(find third_party/s2n-bignum/s2n-bignum-to-be-imported/arm/aes -name "*.S" -type f | sort -f)
22+
echo "${SOURCE_FILES[@]}"
23+
24+
popd
25+
26+
# Sort SOURCE_FILES array
27+
mapfile -t SOURCE_FILES < <(printf '%s\n' "${SOURCE_FILES[@]}" | sort -f)
28+
29+
generate_output "${SOURCE_FILES[@]}" > "${BUILD_CFG_FILE}"

aws-lc-sys/scripts/cc_builder/universal.sh

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,13 @@
11
#!/usr/bin/env bash
22
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33
# SPDX-License-Identifier: Apache-2.0 OR ISC
4-
54
set -ex
65
set -o pipefail
76

8-
if [[ ${BASH_VERSINFO[0]} -lt 4 ]]; then
9-
echo Must use bash 4 or later: ${BASH_VERSION}
10-
exit 1
11-
fi
12-
7+
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
138
SCRIPT_NAME="$(basename -s .sh -- "${BASH_SOURCE[0]}")"
14-
REPO_ROOT=$(git rev-parse --show-toplevel)
15-
SYS_CRATE_DIR="${REPO_ROOT}/aws-lc-sys"
16-
AWS_LC_DIR="${SYS_CRATE_DIR}/aws-lc"
17-
BUILD_CFG_DIR="${SYS_CRATE_DIR}/builder/cc_builder"
18-
BUILD_CFG_FILE="${BUILD_CFG_DIR}/${SCRIPT_NAME}".rs
19-
mkdir -p "${BUILD_CFG_DIR}"
20-
21-
function generate_output() {
22-
TIMESTAMP="$(date -u)"
23-
cat << EOF
24-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
25-
// SPDX-License-Identifier: Apache-2.0 OR ISC
26-
// $TIMESTAMP
279

28-
pub(super) const CRYPTO_LIBRARY: &[&str] = &[
29-
EOF
30-
for FILE in "${@}"; do
31-
echo " \"${FILE}\","
32-
done
33-
cat << EOF
34-
];
35-
EOF
36-
}
10+
source "${SCRIPT_DIR}/_common.sh"
3711

3812
pushd "${AWS_LC_DIR}"
3913
declare -a SOURCE_FILES

0 commit comments

Comments
 (0)