visaljs 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/cli.js +565 -75
- package/node/include/js_node.h +28 -5
- package/node/include/js_uv.h +36 -0
- package/node/prelude/crypto.js +7 -10
- package/node/prelude/dns.js +99 -0
- package/node/prelude/dns_promises.js +10 -0
- package/node/prelude/http.js +1039 -195
- package/node/prelude/internal/crypto/asym.js +39 -12
- package/node/prelude/internal/crypto/dh_groups.js +12 -0
- package/node/prelude/internal/crypto/diffiehellman.js +354 -0
- package/node/prelude/internal/crypto/hash.js +1 -1
- package/node/prelude/internal/crypto/key_type.js +3 -0
- package/node/prelude/internal/crypto/keys.js +39 -9
- package/node/prelude/internal/http_agent.js +249 -0
- package/node/prelude/internal/net.js +33 -0
- package/node/prelude/internal/socketaddress.js +249 -0
- package/node/prelude/internal/tls/common.js +306 -0
- package/node/prelude/internal/tls/wrap.js +1217 -0
- package/node/prelude/internal/tls/x509.js +394 -0
- package/node/prelude/net.js +1083 -50
- package/node/prelude/stream.js +6 -0
- package/node/prelude/tls.js +141 -0
- package/node/prelude/util.js +5 -2
- package/node/prelude/util_types.js +85 -0
- package/node/src/host_http.c +268 -270
- package/node/src/host_loop.c +84 -0
- package/node/src/host_net.c +495 -0
- package/node/src/host_sys.c +16 -0
- package/package.json +1 -1
- package/runtime/include/js_builtins.h +16 -0
- package/runtime/include/js_console.h +2 -0
- package/runtime/include/js_core.def +23 -0
- package/runtime/include/js_crypto.h +23 -0
- package/runtime/include/js_generator.h +2 -3
- package/runtime/include/js_promise.h +0 -2
- package/runtime/src/async_iter.c +4 -1
- package/runtime/src/boringssl_support.cc +34 -0
- package/runtime/src/builtin_table.c +8 -0
- package/runtime/src/components.c +10 -0
- package/runtime/src/console.c +6 -18
- package/runtime/src/core_all.c +1 -0
- package/runtime/src/crypto_asym.c +450 -241
- package/runtime/src/crypto_bn.c +91 -0
- package/runtime/src/crypto_cipher.c +153 -75
- package/runtime/src/crypto_hash.c +68 -53
- package/runtime/src/crypto_internal.h +55 -26
- package/runtime/src/crypto_pkey.c +198 -61
- package/runtime/src/crypto_subtle.c +42 -16
- package/runtime/src/crypto_tls.c +678 -0
- package/runtime/src/generator.c +8 -1
- package/runtime/src/global.c +2 -4
- package/runtime/src/internal.h +0 -1
- package/runtime/src/jobs.c +2 -1
- package/runtime/src/promise.c +4 -1
- package/runtime/src/tls_roots.gen.h +3215 -0
- package/runtime/src/util_types.c +52 -0
- package/runtime/src/weak.c +2 -1
- package/runtime/third_party/boringssl/LICENSE +238 -0
- package/runtime/third_party/boringssl/README.md +46 -0
- package/runtime/third_party/boringssl/VERSION +1 -0
- package/runtime/third_party/boringssl/crypto/aes/aes.cc +44 -0
- package/runtime/third_party/boringssl/crypto/armv8_feature_parsing.h +67 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_bitstr.cc +297 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_bool.cc +50 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_d2i_fp.cc +47 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_dup.cc +42 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_gentm.cc +130 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_i2d_fp.cc +44 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_int.cc +467 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_mbstr.cc +242 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_object.cc +191 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_octet.cc +32 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_strex.cc +411 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_strnid.cc +208 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_time.cc +248 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_type.cc +467 -0
- package/runtime/third_party/boringssl/crypto/asn1/a_utctm.cc +128 -0
- package/runtime/third_party/boringssl/crypto/asn1/asn1_lib.cc +453 -0
- package/runtime/third_party/boringssl/crypto/asn1/asn1_par.cc +61 -0
- package/runtime/third_party/boringssl/crypto/asn1/asn_pack.cc +56 -0
- package/runtime/third_party/boringssl/crypto/asn1/f_int.cc +63 -0
- package/runtime/third_party/boringssl/crypto/asn1/f_string.cc +52 -0
- package/runtime/third_party/boringssl/crypto/asn1/internal.h +430 -0
- package/runtime/third_party/boringssl/crypto/asn1/posix_time.cc +244 -0
- package/runtime/third_party/boringssl/crypto/asn1/tasn_dec.cc +611 -0
- package/runtime/third_party/boringssl/crypto/asn1/tasn_enc.cc +348 -0
- package/runtime/third_party/boringssl/crypto/asn1/tasn_fre.cc +163 -0
- package/runtime/third_party/boringssl/crypto/asn1/tasn_new.cc +274 -0
- package/runtime/third_party/boringssl/crypto/asn1/tasn_typ.cc +92 -0
- package/runtime/third_party/boringssl/crypto/asn1/tasn_utl.cc +218 -0
- package/runtime/third_party/boringssl/crypto/base64/base64.cc +433 -0
- package/runtime/third_party/boringssl/crypto/bcm_support.h +62 -0
- package/runtime/third_party/boringssl/crypto/bio/bio.cc +715 -0
- package/runtime/third_party/boringssl/crypto/bio/bio_mem.cc +260 -0
- package/runtime/third_party/boringssl/crypto/bio/connect.cc +463 -0
- package/runtime/third_party/boringssl/crypto/bio/errno.cc +52 -0
- package/runtime/third_party/boringssl/crypto/bio/fd.cc +193 -0
- package/runtime/third_party/boringssl/crypto/bio/file.cc +283 -0
- package/runtime/third_party/boringssl/crypto/bio/hexdump.cc +154 -0
- package/runtime/third_party/boringssl/crypto/bio/internal.h +128 -0
- package/runtime/third_party/boringssl/crypto/bio/pair.cc +426 -0
- package/runtime/third_party/boringssl/crypto/bio/printf.cc +59 -0
- package/runtime/third_party/boringssl/crypto/bio/socket.cc +210 -0
- package/runtime/third_party/boringssl/crypto/bio/socket_helper.cc +179 -0
- package/runtime/third_party/boringssl/crypto/blake2/blake2.cc +173 -0
- package/runtime/third_party/boringssl/crypto/bn/bn_asn1.cc +57 -0
- package/runtime/third_party/boringssl/crypto/bn/convert.cc +409 -0
- package/runtime/third_party/boringssl/crypto/bn/div.cc +102 -0
- package/runtime/third_party/boringssl/crypto/bn/exponentiation.cc +168 -0
- package/runtime/third_party/boringssl/crypto/bn/sqrt.cc +93 -0
- package/runtime/third_party/boringssl/crypto/buf/buf.cc +119 -0
- package/runtime/third_party/boringssl/crypto/bytestring/asn1_compat.cc +54 -0
- package/runtime/third_party/boringssl/crypto/bytestring/ber.cc +268 -0
- package/runtime/third_party/boringssl/crypto/bytestring/cbb.cc +787 -0
- package/runtime/third_party/boringssl/crypto/bytestring/cbs.cc +977 -0
- package/runtime/third_party/boringssl/crypto/bytestring/internal.h +134 -0
- package/runtime/third_party/boringssl/crypto/bytestring/unicode.cc +156 -0
- package/runtime/third_party/boringssl/crypto/chacha/chacha.cc +226 -0
- package/runtime/third_party/boringssl/crypto/chacha/internal.h +103 -0
- package/runtime/third_party/boringssl/crypto/cipher/derive_key.cc +106 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_aesctrhmac.cc +294 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_aeseax.cc +351 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_aesgcmsiv.cc +918 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_chacha20poly1305.cc +404 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_des.cc +214 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_null.cc +55 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_rc2.cc +432 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_rc4.cc +56 -0
- package/runtime/third_party/boringssl/crypto/cipher/e_tls.cc +615 -0
- package/runtime/third_party/boringssl/crypto/cipher/get_cipher.cc +85 -0
- package/runtime/third_party/boringssl/crypto/cipher/internal.h +399 -0
- package/runtime/third_party/boringssl/crypto/cipher/tls_cbc.cc +476 -0
- package/runtime/third_party/boringssl/crypto/cms/cms.cc +178 -0
- package/runtime/third_party/boringssl/crypto/conf/conf.cc +637 -0
- package/runtime/third_party/boringssl/crypto/conf/internal.h +54 -0
- package/runtime/third_party/boringssl/crypto/cpu_aarch64_apple.cc +76 -0
- package/runtime/third_party/boringssl/crypto/cpu_aarch64_fuchsia.cc +58 -0
- package/runtime/third_party/boringssl/crypto/cpu_aarch64_linux.cc +66 -0
- package/runtime/third_party/boringssl/crypto/cpu_aarch64_openbsd.cc +45 -0
- package/runtime/third_party/boringssl/crypto/cpu_aarch64_sysreg.cc +66 -0
- package/runtime/third_party/boringssl/crypto/cpu_aarch64_win.cc +52 -0
- package/runtime/third_party/boringssl/crypto/cpu_arm_freebsd.cc +55 -0
- package/runtime/third_party/boringssl/crypto/cpu_arm_linux.cc +173 -0
- package/runtime/third_party/boringssl/crypto/cpu_arm_linux.h +141 -0
- package/runtime/third_party/boringssl/crypto/cpu_intel.cc +287 -0
- package/runtime/third_party/boringssl/crypto/crypto.cc +152 -0
- package/runtime/third_party/boringssl/crypto/curve25519/asm/x25519-asm-arm.S +2124 -0
- package/runtime/third_party/boringssl/crypto/curve25519/cpace.cc +227 -0
- package/runtime/third_party/boringssl/crypto/curve25519/curve25519.cc +2436 -0
- package/runtime/third_party/boringssl/crypto/curve25519/curve25519_64_adx.cc +18 -0
- package/runtime/third_party/boringssl/crypto/curve25519/curve25519_tables.h +3264 -0
- package/runtime/third_party/boringssl/crypto/curve25519/internal.h +202 -0
- package/runtime/third_party/boringssl/crypto/curve25519/spake25519.cc +532 -0
- package/runtime/third_party/boringssl/crypto/des/des.cc +837 -0
- package/runtime/third_party/boringssl/crypto/des/internal.h +144 -0
- package/runtime/third_party/boringssl/crypto/dh/dh_asn1.cc +109 -0
- package/runtime/third_party/boringssl/crypto/dh/params.cc +411 -0
- package/runtime/third_party/boringssl/crypto/digest/digest_extra.cc +361 -0
- package/runtime/third_party/boringssl/crypto/dsa/dsa.cc +922 -0
- package/runtime/third_party/boringssl/crypto/dsa/dsa_asn1.cc +306 -0
- package/runtime/third_party/boringssl/crypto/dsa/internal.h +56 -0
- package/runtime/third_party/boringssl/crypto/ec/ec_asn1.cc +542 -0
- package/runtime/third_party/boringssl/crypto/ec/ec_derive.cc +94 -0
- package/runtime/third_party/boringssl/crypto/ec/hash_to_curve.cc +773 -0
- package/runtime/third_party/boringssl/crypto/ec/internal.h +114 -0
- package/runtime/third_party/boringssl/crypto/ecdh/ecdh.cc +75 -0
- package/runtime/third_party/boringssl/crypto/ecdsa/ecdsa_asn1.cc +337 -0
- package/runtime/third_party/boringssl/crypto/ecdsa/ecdsa_p1363.cc +54 -0
- package/runtime/third_party/boringssl/crypto/engine/engine.cc +95 -0
- package/runtime/third_party/boringssl/crypto/err/err.cc +820 -0
- package/runtime/third_party/boringssl/crypto/err/internal.h +45 -0
- package/runtime/third_party/boringssl/crypto/evp/evp.cc +454 -0
- package/runtime/third_party/boringssl/crypto/evp/evp_asn1.cc +439 -0
- package/runtime/third_party/boringssl/crypto/evp/evp_ctx.cc +541 -0
- package/runtime/third_party/boringssl/crypto/evp/evp_kem.cc +101 -0
- package/runtime/third_party/boringssl/crypto/evp/internal.h +427 -0
- package/runtime/third_party/boringssl/crypto/evp/p_dh.cc +326 -0
- package/runtime/third_party/boringssl/crypto/evp/p_dsa.cc +333 -0
- package/runtime/third_party/boringssl/crypto/evp/p_ec.cc +736 -0
- package/runtime/third_party/boringssl/crypto/evp/p_ed25519.cc +359 -0
- package/runtime/third_party/boringssl/crypto/evp/p_hkdf.cc +204 -0
- package/runtime/third_party/boringssl/crypto/evp/p_mldsa.cc +549 -0
- package/runtime/third_party/boringssl/crypto/evp/p_mlkem.cc +510 -0
- package/runtime/third_party/boringssl/crypto/evp/p_rsa.cc +1185 -0
- package/runtime/third_party/boringssl/crypto/evp/p_x25519.cc +371 -0
- package/runtime/third_party/boringssl/crypto/evp/p_xwing.cc +300 -0
- package/runtime/third_party/boringssl/crypto/evp/pbkdf.cc +105 -0
- package/runtime/third_party/boringssl/crypto/evp/print.cc +287 -0
- package/runtime/third_party/boringssl/crypto/evp/scrypt.cc +218 -0
- package/runtime/third_party/boringssl/crypto/evp/sign.cc +95 -0
- package/runtime/third_party/boringssl/crypto/ex_data.cc +140 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/aes.cc.inc +208 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/aes_nohw.cc.inc +1279 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/cbc.cc.inc +132 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/cfb.cc.inc +168 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/ctr.cc.inc +102 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/gcm.cc.inc +614 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/gcm_nohw.cc.inc +304 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/internal.h +590 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/key_wrap.cc.inc +211 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/mode_wrappers.cc.inc +97 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/aes/ofb.cc.inc +55 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bcm.cc +288 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bcm_interface.h +953 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/add.cc.inc +276 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/asm/x86_64-gcc.cc.inc +573 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/bn.cc.inc +377 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/bytes.cc.inc +230 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/cmp.cc.inc +161 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/ctx.cc.inc +127 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/div.cc.inc +738 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/div_extra.cc.inc +90 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/exponentiation.cc.inc +743 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/gcd.cc.inc +281 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/gcd_extra.cc.inc +327 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/generic.cc.inc +579 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/internal.h +810 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/jacobi.cc.inc +101 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/montgomery.cc.inc +408 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/montgomery_inv.cc.inc +179 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/mul.cc.inc +347 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/prime.cc.inc +931 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/random.cc.inc +261 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.cc.inc +144 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/rsaz_exp.h +109 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/shift.cc.inc +317 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/bn/sqrt.cc.inc +370 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/aead.cc.inc +619 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/cipher.cc.inc +837 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/e_aes.cc.inc +1240 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/e_aesccm.cc.inc +440 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/cipher/internal.h +461 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/cmac/cmac.cc.inc +293 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/delocate.h +95 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/dh/check.cc.inc +198 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/dh/dh.cc.inc +401 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/dh/internal.h +63 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/digest/digest.cc.inc +221 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/digest/digests.cc.inc +184 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/digest/internal.h +72 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/digest/md32_common.h +166 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/digestsign/digestsign.cc.inc +230 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/builtin_curves.h +277 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/ec.cc.inc +1024 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/ec_key.cc.inc +536 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/ec_montgomery.cc.inc +379 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/felem.cc.inc +250 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/internal.h +752 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/oct.cc.inc +174 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256-nistz-table.h +9502 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256-nistz.cc.inc +740 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256-nistz.h +207 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256.cc.inc +578 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/p256_table.h +297 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/scalar.cc.inc +184 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/simple.cc.inc +246 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/simple_mul.cc.inc +274 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/util.cc.inc +258 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ec/wnaf.cc.inc +224 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ecdh/ecdh.cc.inc +91 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ecdsa/ecdsa.cc.inc +288 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/ecdsa/internal.h +57 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/entropy/internal.h +38 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/entropy/jitter.cc.inc +487 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/entropy/sha512.cc.inc +329 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/fips_shared_support.cc +28 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/hkdf/hkdf.cc.inc +114 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/hmac/hmac.cc.inc +218 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/keccak/internal.h +165 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/keccak/keccak.cc.inc +647 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/mldsa/fips_known_values.inc +1345 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/mldsa/mldsa.cc.inc +3323 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/mlkem/fips_known_values.inc +411 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/mlkem/mlkem.cc.inc +1856 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rand/android_entropy_client.cc.inc +82 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rand/ctrdrbg.cc.inc +401 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rand/internal.h +99 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rand/rand.cc.inc +486 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rsa/internal.h +167 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rsa/padding.cc.inc +371 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rsa/rsa.cc.inc +996 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/rsa/rsa_impl.cc.inc +1000 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/self_check/fips.cc.inc +129 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/self_check/self_check.cc.inc +1093 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/service_indicator/internal.h +112 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/service_indicator/service_indicator.cc.inc +330 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/sha/internal.h +205 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/sha/sha1.cc.inc +404 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/sha/sha256.cc.inc +315 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/sha/sha512.cc.inc +473 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/address.h +144 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/fips_known_values.inc +674 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/fors.cc.inc +179 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/fors.h +48 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/merkle.cc.inc +164 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/merkle.h +58 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/params.h +178 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/slhdsa.cc.inc +690 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/thash.cc.inc +326 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/thash.h +71 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/wots.cc.inc +172 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/slhdsa/wots.h +40 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/tls/internal.h +33 -0
- package/runtime/third_party/boringssl/crypto/fipsmodule/tls/kdf.cc.inc +180 -0
- package/runtime/third_party/boringssl/crypto/fuzzer_mode.cc +30 -0
- package/runtime/third_party/boringssl/crypto/hpke/hpke.cc +1514 -0
- package/runtime/third_party/boringssl/crypto/hrss/asm/poly_rq_mul.S +8489 -0
- package/runtime/third_party/boringssl/crypto/hrss/hrss.cc +2189 -0
- package/runtime/third_party/boringssl/crypto/hrss/internal.h +64 -0
- package/runtime/third_party/boringssl/crypto/internal.h +1767 -0
- package/runtime/third_party/boringssl/crypto/lhash/internal.h +222 -0
- package/runtime/third_party/boringssl/crypto/lhash/lhash.cc +312 -0
- package/runtime/third_party/boringssl/crypto/md4/md4.cc +207 -0
- package/runtime/third_party/boringssl/crypto/md5/internal.h +34 -0
- package/runtime/third_party/boringssl/crypto/md5/md5.cc +255 -0
- package/runtime/third_party/boringssl/crypto/mem.cc +577 -0
- package/runtime/third_party/boringssl/crypto/mem_internal.h +706 -0
- package/runtime/third_party/boringssl/crypto/mldsa/mldsa.cc +296 -0
- package/runtime/third_party/boringssl/crypto/mlkem/mlkem.cc +108 -0
- package/runtime/third_party/boringssl/crypto/obj/obj.cc +494 -0
- package/runtime/third_party/boringssl/crypto/obj/obj_dat.h +11722 -0
- package/runtime/third_party/boringssl/crypto/obj/obj_xref.cc +83 -0
- package/runtime/third_party/boringssl/crypto/params_internal.h +30 -0
- package/runtime/third_party/boringssl/crypto/pem/internal.h +135 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_all.cc +153 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_info.cc +250 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_lib.cc +707 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_oth.cc +45 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_pk8.cc +211 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_pkey.cc +147 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_x509.cc +25 -0
- package/runtime/third_party/boringssl/crypto/pem/pem_xaux.cc +25 -0
- package/runtime/third_party/boringssl/crypto/pkcs7/internal.h +67 -0
- package/runtime/third_party/boringssl/crypto/pkcs7/pkcs7.cc +198 -0
- package/runtime/third_party/boringssl/crypto/pkcs7/pkcs7_x509.cc +527 -0
- package/runtime/third_party/boringssl/crypto/pkcs8/internal.h +98 -0
- package/runtime/third_party/boringssl/crypto/pkcs8/p5_pbev2.cc +286 -0
- package/runtime/third_party/boringssl/crypto/pkcs8/pkcs8.cc +473 -0
- package/runtime/third_party/boringssl/crypto/pkcs8/pkcs8_x509.cc +1328 -0
- package/runtime/third_party/boringssl/crypto/poly1305/internal.h +54 -0
- package/runtime/third_party/boringssl/crypto/poly1305/poly1305.cc +315 -0
- package/runtime/third_party/boringssl/crypto/poly1305/poly1305_arm.cc +294 -0
- package/runtime/third_party/boringssl/crypto/poly1305/poly1305_arm_asm.S +2017 -0
- package/runtime/third_party/boringssl/crypto/poly1305/poly1305_vec.cc +853 -0
- package/runtime/third_party/boringssl/crypto/pool/internal.h +95 -0
- package/runtime/third_party/boringssl/crypto/pool/pool.cc +282 -0
- package/runtime/third_party/boringssl/crypto/rand/deterministic.cc +58 -0
- package/runtime/third_party/boringssl/crypto/rand/fork_detect.cc +222 -0
- package/runtime/third_party/boringssl/crypto/rand/forkunsafe.cc +44 -0
- package/runtime/third_party/boringssl/crypto/rand/getentropy.cc +53 -0
- package/runtime/third_party/boringssl/crypto/rand/internal.h +67 -0
- package/runtime/third_party/boringssl/crypto/rand/ios.cc +35 -0
- package/runtime/third_party/boringssl/crypto/rand/rand.cc +79 -0
- package/runtime/third_party/boringssl/crypto/rand/trusty.cc +39 -0
- package/runtime/third_party/boringssl/crypto/rand/urandom.cc +149 -0
- package/runtime/third_party/boringssl/crypto/rand/windows.cc +91 -0
- package/runtime/third_party/boringssl/crypto/rc4/rc4.cc +56 -0
- package/runtime/third_party/boringssl/crypto/refcount.cc +49 -0
- package/runtime/third_party/boringssl/crypto/rsa/internal.h +51 -0
- package/runtime/third_party/boringssl/crypto/rsa/rsa_asn1.cc +404 -0
- package/runtime/third_party/boringssl/crypto/rsa/rsa_crypt.cc +530 -0
- package/runtime/third_party/boringssl/crypto/rsa/rsa_extra.cc +30 -0
- package/runtime/third_party/boringssl/crypto/rsa/rsa_print.cc +25 -0
- package/runtime/third_party/boringssl/crypto/sha/sha1.cc +55 -0
- package/runtime/third_party/boringssl/crypto/sha/sha256.cc +89 -0
- package/runtime/third_party/boringssl/crypto/sha/sha512.cc +106 -0
- package/runtime/third_party/boringssl/crypto/siphash/siphash.cc +81 -0
- package/runtime/third_party/boringssl/crypto/slhdsa/slhdsa.cc +167 -0
- package/runtime/third_party/boringssl/crypto/spake2plus/internal.h +204 -0
- package/runtime/third_party/boringssl/crypto/spake2plus/spake2plus.cc +501 -0
- package/runtime/third_party/boringssl/crypto/stack/stack.cc +462 -0
- package/runtime/third_party/boringssl/crypto/thread.cc +68 -0
- package/runtime/third_party/boringssl/crypto/thread_none.cc +48 -0
- package/runtime/third_party/boringssl/crypto/thread_pthread.cc +138 -0
- package/runtime/third_party/boringssl/crypto/thread_win.cc +227 -0
- package/runtime/third_party/boringssl/crypto/trust_token/internal.h +405 -0
- package/runtime/third_party/boringssl/crypto/trust_token/pmbtoken.cc +1672 -0
- package/runtime/third_party/boringssl/crypto/trust_token/trust_token.cc +701 -0
- package/runtime/third_party/boringssl/crypto/trust_token/voprf.cc +1266 -0
- package/runtime/third_party/boringssl/crypto/x509/a_digest.cc +52 -0
- package/runtime/third_party/boringssl/crypto/x509/a_sign.cc +100 -0
- package/runtime/third_party/boringssl/crypto/x509/a_verify.cc +77 -0
- package/runtime/third_party/boringssl/crypto/x509/algorithm.cc +167 -0
- package/runtime/third_party/boringssl/crypto/x509/asn1_gen.cc +540 -0
- package/runtime/third_party/boringssl/crypto/x509/by_dir.cc +301 -0
- package/runtime/third_party/boringssl/crypto/x509/by_file.cc +226 -0
- package/runtime/third_party/boringssl/crypto/x509/i2d_pr.cc +37 -0
- package/runtime/third_party/boringssl/crypto/x509/internal.h +697 -0
- package/runtime/third_party/boringssl/crypto/x509/name_print.cc +187 -0
- package/runtime/third_party/boringssl/crypto/x509/policy.cc +686 -0
- package/runtime/third_party/boringssl/crypto/x509/rsa_pss.cc +187 -0
- package/runtime/third_party/boringssl/crypto/x509/t_crl.cc +106 -0
- package/runtime/third_party/boringssl/crypto/x509/t_req.cc +206 -0
- package/runtime/third_party/boringssl/crypto/x509/t_x509.cc +292 -0
- package/runtime/third_party/boringssl/crypto/x509/t_x509a.cc +81 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_akey.cc +174 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_akeya.cc +31 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_alt.cc +636 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_bcons.cc +96 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_bitst.cc +100 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_conf.cc +369 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_cpols.cc +417 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_crld.cc +471 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_enum.cc +74 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_extku.cc +97 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_genn.cc +238 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_ia5.cc +83 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_info.cc +162 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_int.cc +83 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_lib.cc +349 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_ncons.cc +798 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_ocsp.cc +92 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_pcons.cc +102 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_pmaps.cc +110 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_prn.cc +183 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_purp.cc +580 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_skey.cc +128 -0
- package/runtime/third_party/boringssl/crypto/x509/v3_utl.cc +1311 -0
- package/runtime/third_party/boringssl/crypto/x509/x509.cc +47 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_att.cc +188 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_cmp.cc +243 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_d2.cc +66 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_def.cc +42 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_ext.cc +161 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_lu.cc +570 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_mtc.cc +598 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_obj.cc +169 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_req.cc +248 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_set.cc +166 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_trs.cc +123 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_txt.cc +147 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_v3.cc +249 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_vfy.cc +1531 -0
- package/runtime/third_party/boringssl/crypto/x509/x509_vpm.cc +449 -0
- package/runtime/third_party/boringssl/crypto/x509/x509cset.cc +222 -0
- package/runtime/third_party/boringssl/crypto/x509/x509name.cc +377 -0
- package/runtime/third_party/boringssl/crypto/x509/x509rset.cc +55 -0
- package/runtime/third_party/boringssl/crypto/x509/x509spki.cc +91 -0
- package/runtime/third_party/boringssl/crypto/x509/x_algor.cc +223 -0
- package/runtime/third_party/boringssl/crypto/x509/x_all.cc +352 -0
- package/runtime/third_party/boringssl/crypto/x509/x_attrib.cc +61 -0
- package/runtime/third_party/boringssl/crypto/x509/x_crl.cc +325 -0
- package/runtime/third_party/boringssl/crypto/x509/x_exten.cc +42 -0
- package/runtime/third_party/boringssl/crypto/x509/x_name.cc +407 -0
- package/runtime/third_party/boringssl/crypto/x509/x_pubkey.cc +199 -0
- package/runtime/third_party/boringssl/crypto/x509/x_req.cc +80 -0
- package/runtime/third_party/boringssl/crypto/x509/x_sig.cc +51 -0
- package/runtime/third_party/boringssl/crypto/x509/x_spki.cc +44 -0
- package/runtime/third_party/boringssl/crypto/x509/x_x509.cc +495 -0
- package/runtime/third_party/boringssl/crypto/x509/x_x509a.cc +169 -0
- package/runtime/third_party/boringssl/crypto/xwing/xwing.cc +257 -0
- package/runtime/third_party/boringssl/gen/bcm/aes-gcm-avx2-x86_64-apple.S +1326 -0
- package/runtime/third_party/boringssl/gen/bcm/aes-gcm-avx2-x86_64-linux.S +1327 -0
- package/runtime/third_party/boringssl/gen/bcm/aes-gcm-avx512-x86_64-apple.S +1252 -0
- package/runtime/third_party/boringssl/gen/bcm/aes-gcm-avx512-x86_64-linux.S +1253 -0
- package/runtime/third_party/boringssl/gen/bcm/aesni-gcm-x86_64-apple.S +873 -0
- package/runtime/third_party/boringssl/gen/bcm/aesni-gcm-x86_64-linux.S +885 -0
- package/runtime/third_party/boringssl/gen/bcm/aesni-x86-apple.S +2490 -0
- package/runtime/third_party/boringssl/gen/bcm/aesni-x86-linux.S +2530 -0
- package/runtime/third_party/boringssl/gen/bcm/aesni-x86_64-apple.S +2413 -0
- package/runtime/third_party/boringssl/gen/bcm/aesni-x86_64-linux.S +2397 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-armv7-linux.S +784 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-armv8-apple.S +792 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-armv8-linux.S +786 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-armv8-win.S +798 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-gcm-armv8-apple.S +2912 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-gcm-armv8-linux.S +2907 -0
- package/runtime/third_party/boringssl/gen/bcm/aesv8-gcm-armv8-win.S +2915 -0
- package/runtime/third_party/boringssl/gen/bcm/armv4-mont-linux.S +932 -0
- package/runtime/third_party/boringssl/gen/bcm/armv8-mont-apple.S +1440 -0
- package/runtime/third_party/boringssl/gen/bcm/armv8-mont-linux.S +1440 -0
- package/runtime/third_party/boringssl/gen/bcm/armv8-mont-win.S +1446 -0
- package/runtime/third_party/boringssl/gen/bcm/bn-586-apple.S +530 -0
- package/runtime/third_party/boringssl/gen/bcm/bn-586-linux.S +540 -0
- package/runtime/third_party/boringssl/gen/bcm/bn-armv8-apple.S +88 -0
- package/runtime/third_party/boringssl/gen/bcm/bn-armv8-linux.S +87 -0
- package/runtime/third_party/boringssl/gen/bcm/bn-armv8-win.S +87 -0
- package/runtime/third_party/boringssl/gen/bcm/bsaes-armv7-linux.S +1520 -0
- package/runtime/third_party/boringssl/gen/bcm/co-586-apple.S +1256 -0
- package/runtime/third_party/boringssl/gen/bcm/co-586-linux.S +1264 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-armv4-linux.S +242 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-neon-armv8-apple.S +337 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-neon-armv8-linux.S +335 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-neon-armv8-win.S +341 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-ssse3-x86-apple.S +288 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-ssse3-x86-linux.S +292 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-ssse3-x86_64-apple.S +426 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-ssse3-x86_64-linux.S +425 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-x86-apple.S +322 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-x86-linux.S +328 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-x86_64-apple.S +1134 -0
- package/runtime/third_party/boringssl/gen/bcm/ghash-x86_64-linux.S +1129 -0
- package/runtime/third_party/boringssl/gen/bcm/ghashv8-armv7-linux.S +244 -0
- package/runtime/third_party/boringssl/gen/bcm/ghashv8-armv8-apple.S +567 -0
- package/runtime/third_party/boringssl/gen/bcm/ghashv8-armv8-linux.S +563 -0
- package/runtime/third_party/boringssl/gen/bcm/ghashv8-armv8-win.S +571 -0
- package/runtime/third_party/boringssl/gen/bcm/p256-armv8-asm-apple.S +1744 -0
- package/runtime/third_party/boringssl/gen/bcm/p256-armv8-asm-linux.S +1725 -0
- package/runtime/third_party/boringssl/gen/bcm/p256-armv8-asm-win.S +1765 -0
- package/runtime/third_party/boringssl/gen/bcm/p256-x86_64-asm-apple.S +4544 -0
- package/runtime/third_party/boringssl/gen/bcm/p256-x86_64-asm-linux.S +4600 -0
- package/runtime/third_party/boringssl/gen/bcm/p256_beeu-armv8-asm-apple.S +310 -0
- package/runtime/third_party/boringssl/gen/bcm/p256_beeu-armv8-asm-linux.S +310 -0
- package/runtime/third_party/boringssl/gen/bcm/p256_beeu-armv8-asm-win.S +310 -0
- package/runtime/third_party/boringssl/gen/bcm/p256_beeu-x86_64-asm-apple.S +321 -0
- package/runtime/third_party/boringssl/gen/bcm/p256_beeu-x86_64-asm-linux.S +335 -0
- package/runtime/third_party/boringssl/gen/bcm/rdrand-x86_64-apple.S +58 -0
- package/runtime/third_party/boringssl/gen/bcm/rdrand-x86_64-linux.S +57 -0
- package/runtime/third_party/boringssl/gen/bcm/rsaz-avx2-apple.S +1756 -0
- package/runtime/third_party/boringssl/gen/bcm/rsaz-avx2-linux.S +1751 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-586-apple.S +3782 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-586-linux.S +3788 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-armv4-large-linux.S +1479 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-armv8-apple.S +1219 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-armv8-linux.S +1218 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-armv8-win.S +1222 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-x86_64-apple.S +5454 -0
- package/runtime/third_party/boringssl/gen/bcm/sha1-x86_64-linux.S +5450 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-586-apple.S +5593 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-586-linux.S +5599 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-armv4-linux.S +2840 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-armv8-apple.S +1195 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-armv8-linux.S +1194 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-armv8-win.S +1198 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-x86_64-apple.S +4173 -0
- package/runtime/third_party/boringssl/gen/bcm/sha256-x86_64-linux.S +4170 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-586-apple.S +2406 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-586-linux.S +2410 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-armv4-linux.S +1857 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-armv8-apple.S +1598 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-armv8-linux.S +1597 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-armv8-win.S +1601 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-x86_64-apple.S +2979 -0
- package/runtime/third_party/boringssl/gen/bcm/sha512-x86_64-linux.S +2978 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-armv7-linux.S +1225 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-armv8-apple.S +1238 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-armv8-linux.S +1220 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-armv8-win.S +1256 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-x86-apple.S +680 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-x86-linux.S +706 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-x86_64-apple.S +1146 -0
- package/runtime/third_party/boringssl/gen/bcm/vpaes-x86_64-linux.S +1133 -0
- package/runtime/third_party/boringssl/gen/bcm/x86-mont-apple.S +216 -0
- package/runtime/third_party/boringssl/gen/bcm/x86-mont-linux.S +218 -0
- package/runtime/third_party/boringssl/gen/bcm/x86_64-mont-apple.S +1238 -0
- package/runtime/third_party/boringssl/gen/bcm/x86_64-mont-linux.S +1237 -0
- package/runtime/third_party/boringssl/gen/bcm/x86_64-mont5-apple.S +3644 -0
- package/runtime/third_party/boringssl/gen/bcm/x86_64-mont5-linux.S +3628 -0
- package/runtime/third_party/boringssl/gen/boringssl_prefix_symbols_internal_x86_64_win_asm.inc +325 -0
- package/runtime/third_party/boringssl/gen/boringssl_prefix_symbols_internal_x86_win_asm.inc +325 -0
- package/runtime/third_party/boringssl/gen/crypto/aes128gcmsiv-x86_64-apple.S +3113 -0
- package/runtime/third_party/boringssl/gen/crypto/aes128gcmsiv-x86_64-linux.S +3091 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-armv4-linux.S +1450 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-armv8-apple.S +1969 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-armv8-linux.S +1967 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-armv8-win.S +1973 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-x86-apple.S +957 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-x86-linux.S +961 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-x86_64-apple.S +1608 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha-x86_64-linux.S +1611 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_armv8-apple.S +3010 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_armv8-linux.S +3008 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_armv8-win.S +3014 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_x86_64-apple.S +8903 -0
- package/runtime/third_party/boringssl/gen/crypto/chacha20_poly1305_x86_64-linux.S +8940 -0
- package/runtime/third_party/boringssl/gen/crypto/err_data.cc +1578 -0
- package/runtime/third_party/boringssl/gen/crypto/md5-586-apple.S +684 -0
- package/runtime/third_party/boringssl/gen/crypto/md5-586-linux.S +686 -0
- package/runtime/third_party/boringssl/gen/crypto/md5-x86_64-apple.S +690 -0
- package/runtime/third_party/boringssl/gen/crypto/md5-x86_64-linux.S +695 -0
- package/runtime/third_party/boringssl/include/openssl/aead.h +650 -0
- package/runtime/third_party/boringssl/include/openssl/aes.h +173 -0
- package/runtime/third_party/boringssl/include/openssl/arm_arch.h +24 -0
- package/runtime/third_party/boringssl/include/openssl/asm_base.h +219 -0
- package/runtime/third_party/boringssl/include/openssl/asn1.h +2002 -0
- package/runtime/third_party/boringssl/include/openssl/asn1_mac.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/asn1t.h +584 -0
- package/runtime/third_party/boringssl/include/openssl/base.h +548 -0
- package/runtime/third_party/boringssl/include/openssl/base64.h +156 -0
- package/runtime/third_party/boringssl/include/openssl/bio.h +1061 -0
- package/runtime/third_party/boringssl/include/openssl/blake2.h +63 -0
- package/runtime/third_party/boringssl/include/openssl/blowfish.h +58 -0
- package/runtime/third_party/boringssl/include/openssl/bn.h +986 -0
- package/runtime/third_party/boringssl/include/openssl/buf.h +95 -0
- package/runtime/third_party/boringssl/include/openssl/buffer.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/bytestring.h +798 -0
- package/runtime/third_party/boringssl/include/openssl/cast.h +91 -0
- package/runtime/third_party/boringssl/include/openssl/chacha.h +47 -0
- package/runtime/third_party/boringssl/include/openssl/cipher.h +819 -0
- package/runtime/third_party/boringssl/include/openssl/cmac.h +91 -0
- package/runtime/third_party/boringssl/include/openssl/cms.h +147 -0
- package/runtime/third_party/boringssl/include/openssl/conf.h +136 -0
- package/runtime/third_party/boringssl/include/openssl/configuration.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/cpu.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/crypto.h +235 -0
- package/runtime/third_party/boringssl/include/openssl/ctrdrbg.h +116 -0
- package/runtime/third_party/boringssl/include/openssl/curve25519.h +309 -0
- package/runtime/third_party/boringssl/include/openssl/des.h +134 -0
- package/runtime/third_party/boringssl/include/openssl/dh.h +336 -0
- package/runtime/third_party/boringssl/include/openssl/digest.h +399 -0
- package/runtime/third_party/boringssl/include/openssl/dsa.h +392 -0
- package/runtime/third_party/boringssl/include/openssl/dtls1.h +16 -0
- package/runtime/third_party/boringssl/include/openssl/e_os2.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/ec.h +530 -0
- package/runtime/third_party/boringssl/include/openssl/ec_key.h +358 -0
- package/runtime/third_party/boringssl/include/openssl/ecdh.h +67 -0
- package/runtime/third_party/boringssl/include/openssl/ecdsa.h +242 -0
- package/runtime/third_party/boringssl/include/openssl/engine.h +109 -0
- package/runtime/third_party/boringssl/include/openssl/err.h +416 -0
- package/runtime/third_party/boringssl/include/openssl/evp.h +1645 -0
- package/runtime/third_party/boringssl/include/openssl/evp_errors.h +66 -0
- package/runtime/third_party/boringssl/include/openssl/ex_data.h +117 -0
- package/runtime/third_party/boringssl/include/openssl/hkdf.h +68 -0
- package/runtime/third_party/boringssl/include/openssl/hmac.h +151 -0
- package/runtime/third_party/boringssl/include/openssl/hpke.h +456 -0
- package/runtime/third_party/boringssl/include/openssl/hrss.h +108 -0
- package/runtime/third_party/boringssl/include/openssl/is_boringssl.h +16 -0
- package/runtime/third_party/boringssl/include/openssl/kdf.h +92 -0
- package/runtime/third_party/boringssl/include/openssl/lhash.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/md4.h +73 -0
- package/runtime/third_party/boringssl/include/openssl/md5.h +67 -0
- package/runtime/third_party/boringssl/include/openssl/mem.h +215 -0
- package/runtime/third_party/boringssl/include/openssl/mldsa.h +486 -0
- package/runtime/third_party/boringssl/include/openssl/mlkem.h +222 -0
- package/runtime/third_party/boringssl/include/openssl/nid.h +5561 -0
- package/runtime/third_party/boringssl/include/openssl/obj.h +225 -0
- package/runtime/third_party/boringssl/include/openssl/obj_mac.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/objects.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/opensslconf.h +108 -0
- package/runtime/third_party/boringssl/include/openssl/opensslv.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/ossl_typ.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/params.h +42 -0
- package/runtime/third_party/boringssl/include/openssl/pem.h +769 -0
- package/runtime/third_party/boringssl/include/openssl/pkcs12.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/pkcs7.h +239 -0
- package/runtime/third_party/boringssl/include/openssl/pkcs8.h +267 -0
- package/runtime/third_party/boringssl/include/openssl/poly1305.h +52 -0
- package/runtime/third_party/boringssl/include/openssl/pool.h +137 -0
- package/runtime/third_party/boringssl/include/openssl/posix_time.h +51 -0
- package/runtime/third_party/boringssl/include/openssl/prefix_symbols.h +8000 -0
- package/runtime/third_party/boringssl/include/openssl/prefix_symbols_internal_S.h +633 -0
- package/runtime/third_party/boringssl/include/openssl/prefix_symbols_internal_c.h +329 -0
- package/runtime/third_party/boringssl/include/openssl/rand.h +138 -0
- package/runtime/third_party/boringssl/include/openssl/rc4.h +54 -0
- package/runtime/third_party/boringssl/include/openssl/ripemd.h +71 -0
- package/runtime/third_party/boringssl/include/openssl/rsa.h +893 -0
- package/runtime/third_party/boringssl/include/openssl/safestack.h +16 -0
- package/runtime/third_party/boringssl/include/openssl/service_indicator.h +19 -0
- package/runtime/third_party/boringssl/include/openssl/sha.h +108 -0
- package/runtime/third_party/boringssl/include/openssl/sha2.h +201 -0
- package/runtime/third_party/boringssl/include/openssl/siphash.h +37 -0
- package/runtime/third_party/boringssl/include/openssl/slhdsa.h +250 -0
- package/runtime/third_party/boringssl/include/openssl/span.h +376 -0
- package/runtime/third_party/boringssl/include/openssl/srtp.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/ssl.h +7211 -0
- package/runtime/third_party/boringssl/include/openssl/ssl3.h +171 -0
- package/runtime/third_party/boringssl/include/openssl/stack.h +688 -0
- package/runtime/third_party/boringssl/include/openssl/target.h +246 -0
- package/runtime/third_party/boringssl/include/openssl/thread.h +114 -0
- package/runtime/third_party/boringssl/include/openssl/time.h +22 -0
- package/runtime/third_party/boringssl/include/openssl/tls1.h +263 -0
- package/runtime/third_party/boringssl/include/openssl/tls_prf.h +47 -0
- package/runtime/third_party/boringssl/include/openssl/trust_token.h +349 -0
- package/runtime/third_party/boringssl/include/openssl/type_check.h +37 -0
- package/runtime/third_party/boringssl/include/openssl/types.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/x509.h +5404 -0
- package/runtime/third_party/boringssl/include/openssl/x509_vfy.h +18 -0
- package/runtime/third_party/boringssl/include/openssl/x509v3.h +63 -0
- package/runtime/third_party/boringssl/include/openssl/x509v3_errors.h +84 -0
- package/runtime/third_party/boringssl/include/openssl/xwing.h +115 -0
- package/runtime/third_party/boringssl/sources.json +696 -0
- package/runtime/third_party/boringssl/ssl/bio_ssl.cc +196 -0
- package/runtime/third_party/boringssl/ssl/d1_both.cc +1137 -0
- package/runtime/third_party/boringssl/ssl/d1_lib.cc +245 -0
- package/runtime/third_party/boringssl/ssl/d1_pkt.cc +322 -0
- package/runtime/third_party/boringssl/ssl/d1_srtp.cc +128 -0
- package/runtime/third_party/boringssl/ssl/dtls_method.cc +216 -0
- package/runtime/third_party/boringssl/ssl/dtls_record.cc +586 -0
- package/runtime/third_party/boringssl/ssl/encrypted_client_hello.cc +1110 -0
- package/runtime/third_party/boringssl/ssl/extensions.cc +5368 -0
- package/runtime/third_party/boringssl/ssl/handoff.cc +625 -0
- package/runtime/third_party/boringssl/ssl/handshake.cc +694 -0
- package/runtime/third_party/boringssl/ssl/handshake_client.cc +1958 -0
- package/runtime/third_party/boringssl/ssl/handshake_server.cc +1875 -0
- package/runtime/third_party/boringssl/ssl/internal.h +4506 -0
- package/runtime/third_party/boringssl/ssl/s3_both.cc +555 -0
- package/runtime/third_party/boringssl/ssl/s3_lib.cc +88 -0
- package/runtime/third_party/boringssl/ssl/s3_pkt.cc +396 -0
- package/runtime/third_party/boringssl/ssl/ssl_aead_ctx.cc +416 -0
- package/runtime/third_party/boringssl/ssl/ssl_asn1.cc +851 -0
- package/runtime/third_party/boringssl/ssl/ssl_buffer.cc +304 -0
- package/runtime/third_party/boringssl/ssl/ssl_cert.cc +723 -0
- package/runtime/third_party/boringssl/ssl/ssl_cipher.cc +1762 -0
- package/runtime/third_party/boringssl/ssl/ssl_credential.cc +913 -0
- package/runtime/third_party/boringssl/ssl/ssl_file.cc +375 -0
- package/runtime/third_party/boringssl/ssl/ssl_key_share.cc +445 -0
- package/runtime/third_party/boringssl/ssl/ssl_lib.cc +4132 -0
- package/runtime/third_party/boringssl/ssl/ssl_privkey.cc +973 -0
- package/runtime/third_party/boringssl/ssl/ssl_session.cc +1273 -0
- package/runtime/third_party/boringssl/ssl/ssl_stat.cc +162 -0
- package/runtime/third_party/boringssl/ssl/ssl_transcript.cc +224 -0
- package/runtime/third_party/boringssl/ssl/ssl_versions.cc +436 -0
- package/runtime/third_party/boringssl/ssl/ssl_x509.cc +1229 -0
- package/runtime/third_party/boringssl/ssl/t1_enc.cc +266 -0
- package/runtime/third_party/boringssl/ssl/tls13_both.cc +764 -0
- package/runtime/third_party/boringssl/ssl/tls13_client.cc +1325 -0
- package/runtime/third_party/boringssl/ssl/tls13_enc.cc +746 -0
- package/runtime/third_party/boringssl/ssl/tls13_server.cc +1623 -0
- package/runtime/third_party/boringssl/ssl/tls_method.cc +266 -0
- package/runtime/third_party/boringssl/ssl/tls_record.cc +524 -0
- package/runtime/third_party/boringssl/third_party/fiat/asm/fiat_curve25519_adx_mul.S +178 -0
- package/runtime/third_party/boringssl/third_party/fiat/asm/fiat_curve25519_adx_square.S +146 -0
- package/runtime/third_party/boringssl/third_party/fiat/asm/fiat_p256_adx_mul.S +177 -0
- package/runtime/third_party/boringssl/third_party/fiat/asm/fiat_p256_adx_sqr.S +166 -0
- package/runtime/third_party/boringssl/third_party/fiat/bedrock_unverified_bareminimum.c.inc +47 -0
- package/runtime/third_party/boringssl/third_party/fiat/bedrock_unverified_platform.c.inc +137 -0
- package/runtime/third_party/boringssl/third_party/fiat/curve25519_32.h +1571 -0
- package/runtime/third_party/boringssl/third_party/fiat/curve25519_64.h +978 -0
- package/runtime/third_party/boringssl/third_party/fiat/curve25519_64_adx.h +700 -0
- package/runtime/third_party/boringssl/third_party/fiat/curve25519_64_msvc.h +1281 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_32.h +4760 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_64.h +1984 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_64_msvc.h +1939 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_field.c.inc +26 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_field_32.br.c.inc +71 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_field_64.br.c.inc +84 -0
- package/runtime/third_party/boringssl/third_party/fiat/p256_point.br.c.inc +112 -0
- package/runtime/third_party/v8-ieee754/README.md +2 -1
- package/runtime/third_party/v8-ieee754/convert.py +4 -0
- package/runtime/third_party/v8-ieee754/ieee754.c +1 -1
- package/runtime/third_party/bearssl/LICENSE.txt +0 -21
- package/runtime/third_party/bearssl/README.txt +0 -136
- package/runtime/third_party/bearssl/VERSION +0 -1
- package/runtime/third_party/bearssl/inc/bearssl.h +0 -183
- package/runtime/third_party/bearssl/inc/bearssl_aead.h +0 -1059
- package/runtime/third_party/bearssl/inc/bearssl_block.h +0 -2618
- package/runtime/third_party/bearssl/inc/bearssl_ec.h +0 -967
- package/runtime/third_party/bearssl/inc/bearssl_hash.h +0 -1346
- package/runtime/third_party/bearssl/inc/bearssl_hmac.h +0 -241
- package/runtime/third_party/bearssl/inc/bearssl_kdf.h +0 -284
- package/runtime/third_party/bearssl/inc/bearssl_pem.h +0 -294
- package/runtime/third_party/bearssl/inc/bearssl_prf.h +0 -150
- package/runtime/third_party/bearssl/inc/bearssl_rand.h +0 -397
- package/runtime/third_party/bearssl/inc/bearssl_rsa.h +0 -1655
- package/runtime/third_party/bearssl/inc/bearssl_ssl.h +0 -4296
- package/runtime/third_party/bearssl/inc/bearssl_x509.h +0 -1474
- package/runtime/third_party/bearssl/src/aead/ccm.c +0 -346
- package/runtime/third_party/bearssl/src/aead/eax.c +0 -525
- package/runtime/third_party/bearssl/src/aead/gcm.c +0 -318
- package/runtime/third_party/bearssl/src/codec/ccopy.c +0 -44
- package/runtime/third_party/bearssl/src/codec/dec16be.c +0 -38
- package/runtime/third_party/bearssl/src/codec/dec16le.c +0 -38
- package/runtime/third_party/bearssl/src/codec/dec32be.c +0 -38
- package/runtime/third_party/bearssl/src/codec/dec32le.c +0 -38
- package/runtime/third_party/bearssl/src/codec/dec64be.c +0 -38
- package/runtime/third_party/bearssl/src/codec/dec64le.c +0 -38
- package/runtime/third_party/bearssl/src/codec/enc16be.c +0 -38
- package/runtime/third_party/bearssl/src/codec/enc16le.c +0 -38
- package/runtime/third_party/bearssl/src/codec/enc32be.c +0 -38
- package/runtime/third_party/bearssl/src/codec/enc32le.c +0 -38
- package/runtime/third_party/bearssl/src/codec/enc64be.c +0 -38
- package/runtime/third_party/bearssl/src/codec/enc64le.c +0 -38
- package/runtime/third_party/bearssl/src/codec/pemdec.c +0 -526
- package/runtime/third_party/bearssl/src/codec/pemdec.t0 +0 -314
- package/runtime/third_party/bearssl/src/codec/pemenc.c +0 -173
- package/runtime/third_party/bearssl/src/config.h +0 -247
- package/runtime/third_party/bearssl/src/ec/ec_all_m15.c +0 -121
- package/runtime/third_party/bearssl/src/ec/ec_all_m31.c +0 -171
- package/runtime/third_party/bearssl/src/ec/ec_c25519_i15.c +0 -398
- package/runtime/third_party/bearssl/src/ec/ec_c25519_i31.c +0 -390
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m15.c +0 -1478
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m31.c +0 -800
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m62.c +0 -605
- package/runtime/third_party/bearssl/src/ec/ec_c25519_m64.c +0 -831
- package/runtime/third_party/bearssl/src/ec/ec_curve25519.c +0 -46
- package/runtime/third_party/bearssl/src/ec/ec_default.c +0 -36
- package/runtime/third_party/bearssl/src/ec/ec_keygen.c +0 -86
- package/runtime/third_party/bearssl/src/ec/ec_p256_m15.c +0 -2124
- package/runtime/third_party/bearssl/src/ec/ec_p256_m31.c +0 -1469
- package/runtime/third_party/bearssl/src/ec/ec_p256_m62.c +0 -1765
- package/runtime/third_party/bearssl/src/ec/ec_p256_m64.c +0 -1781
- package/runtime/third_party/bearssl/src/ec/ec_prime_i15.c +0 -824
- package/runtime/third_party/bearssl/src/ec/ec_prime_i31.c +0 -826
- package/runtime/third_party/bearssl/src/ec/ec_pubkey.c +0 -85
- package/runtime/third_party/bearssl/src/ec/ec_secp256r1.c +0 -51
- package/runtime/third_party/bearssl/src/ec/ec_secp384r1.c +0 -57
- package/runtime/third_party/bearssl/src/ec/ec_secp521r1.c +0 -64
- package/runtime/third_party/bearssl/src/ec/ecdsa_atr.c +0 -134
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_asn1.c +0 -36
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_sign_raw.c +0 -36
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_asn1.c +0 -36
- package/runtime/third_party/bearssl/src/ec/ecdsa_default_vrfy_raw.c +0 -36
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_bits.c +0 -47
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_asn1.c +0 -45
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_sign_raw.c +0 -174
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_asn1.c +0 -48
- package/runtime/third_party/bearssl/src/ec/ecdsa_i15_vrfy_raw.c +0 -166
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_bits.c +0 -47
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_asn1.c +0 -45
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_sign_raw.c +0 -173
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_asn1.c +0 -48
- package/runtime/third_party/bearssl/src/ec/ecdsa_i31_vrfy_raw.c +0 -165
- package/runtime/third_party/bearssl/src/ec/ecdsa_rta.c +0 -121
- package/runtime/third_party/bearssl/src/hash/dig_oid.c +0 -84
- package/runtime/third_party/bearssl/src/hash/dig_size.c +0 -50
- package/runtime/third_party/bearssl/src/hash/ghash_ctmul.c +0 -345
- package/runtime/third_party/bearssl/src/hash/ghash_ctmul32.c +0 -251
- package/runtime/third_party/bearssl/src/hash/ghash_ctmul64.c +0 -154
- package/runtime/third_party/bearssl/src/hash/ghash_pclmul.c +0 -389
- package/runtime/third_party/bearssl/src/hash/ghash_pwr8.c +0 -411
- package/runtime/third_party/bearssl/src/hash/md5.c +0 -208
- package/runtime/third_party/bearssl/src/hash/md5sha1.c +0 -141
- package/runtime/third_party/bearssl/src/hash/mgf1.c +0 -56
- package/runtime/third_party/bearssl/src/hash/multihash.c +0 -166
- package/runtime/third_party/bearssl/src/hash/sha1.c +0 -191
- package/runtime/third_party/bearssl/src/hash/sha2big.c +0 -285
- package/runtime/third_party/bearssl/src/hash/sha2small.c +0 -341
- package/runtime/third_party/bearssl/src/inner.h +0 -2577
- package/runtime/third_party/bearssl/src/int/i15_add.c +0 -46
- package/runtime/third_party/bearssl/src/int/i15_bitlen.c +0 -44
- package/runtime/third_party/bearssl/src/int/i15_decmod.c +0 -124
- package/runtime/third_party/bearssl/src/int/i15_decode.c +0 -56
- package/runtime/third_party/bearssl/src/int/i15_decred.c +0 -100
- package/runtime/third_party/bearssl/src/int/i15_encode.c +0 -56
- package/runtime/third_party/bearssl/src/int/i15_fmont.c +0 -59
- package/runtime/third_party/bearssl/src/int/i15_iszero.c +0 -39
- package/runtime/third_party/bearssl/src/int/i15_moddiv.c +0 -465
- package/runtime/third_party/bearssl/src/int/i15_modpow.c +0 -50
- package/runtime/third_party/bearssl/src/int/i15_modpow2.c +0 -160
- package/runtime/third_party/bearssl/src/int/i15_montmul.c +0 -184
- package/runtime/third_party/bearssl/src/int/i15_mulacc.c +0 -61
- package/runtime/third_party/bearssl/src/int/i15_muladd.c +0 -173
- package/runtime/third_party/bearssl/src/int/i15_ninv15.c +0 -38
- package/runtime/third_party/bearssl/src/int/i15_reduce.c +0 -66
- package/runtime/third_party/bearssl/src/int/i15_rshift.c +0 -47
- package/runtime/third_party/bearssl/src/int/i15_sub.c +0 -46
- package/runtime/third_party/bearssl/src/int/i15_tmont.c +0 -36
- package/runtime/third_party/bearssl/src/int/i31_add.c +0 -46
- package/runtime/third_party/bearssl/src/int/i31_bitlen.c +0 -44
- package/runtime/third_party/bearssl/src/int/i31_decmod.c +0 -124
- package/runtime/third_party/bearssl/src/int/i31_decode.c +0 -57
- package/runtime/third_party/bearssl/src/int/i31_decred.c +0 -103
- package/runtime/third_party/bearssl/src/int/i31_encode.c +0 -79
- package/runtime/third_party/bearssl/src/int/i31_fmont.c +0 -60
- package/runtime/third_party/bearssl/src/int/i31_iszero.c +0 -39
- package/runtime/third_party/bearssl/src/int/i31_moddiv.c +0 -488
- package/runtime/third_party/bearssl/src/int/i31_modpow.c +0 -65
- package/runtime/third_party/bearssl/src/int/i31_modpow2.c +0 -160
- package/runtime/third_party/bearssl/src/int/i31_montmul.c +0 -127
- package/runtime/third_party/bearssl/src/int/i31_mulacc.c +0 -74
- package/runtime/third_party/bearssl/src/int/i31_muladd.c +0 -157
- package/runtime/third_party/bearssl/src/int/i31_ninv31.c +0 -39
- package/runtime/third_party/bearssl/src/int/i31_reduce.c +0 -66
- package/runtime/third_party/bearssl/src/int/i31_rshift.c +0 -47
- package/runtime/third_party/bearssl/src/int/i31_sub.c +0 -46
- package/runtime/third_party/bearssl/src/int/i31_tmont.c +0 -36
- package/runtime/third_party/bearssl/src/int/i32_add.c +0 -51
- package/runtime/third_party/bearssl/src/int/i32_bitlen.c +0 -44
- package/runtime/third_party/bearssl/src/int/i32_decmod.c +0 -77
- package/runtime/third_party/bearssl/src/int/i32_decode.c +0 -63
- package/runtime/third_party/bearssl/src/int/i32_decred.c +0 -107
- package/runtime/third_party/bearssl/src/int/i32_div32.c +0 -56
- package/runtime/third_party/bearssl/src/int/i32_encode.c +0 -72
- package/runtime/third_party/bearssl/src/int/i32_fmont.c +0 -60
- package/runtime/third_party/bearssl/src/int/i32_iszero.c +0 -39
- package/runtime/third_party/bearssl/src/int/i32_modpow.c +0 -65
- package/runtime/third_party/bearssl/src/int/i32_montmul.c +0 -69
- package/runtime/third_party/bearssl/src/int/i32_mulacc.c +0 -56
- package/runtime/third_party/bearssl/src/int/i32_muladd.c +0 -138
- package/runtime/third_party/bearssl/src/int/i32_ninv32.c +0 -39
- package/runtime/third_party/bearssl/src/int/i32_reduce.c +0 -66
- package/runtime/third_party/bearssl/src/int/i32_sub.c +0 -51
- package/runtime/third_party/bearssl/src/int/i32_tmont.c +0 -36
- package/runtime/third_party/bearssl/src/int/i62_modpow2.c +0 -493
- package/runtime/third_party/bearssl/src/kdf/hkdf.c +0 -107
- package/runtime/third_party/bearssl/src/kdf/shake.c +0 -590
- package/runtime/third_party/bearssl/src/mac/hmac.c +0 -122
- package/runtime/third_party/bearssl/src/mac/hmac_ct.c +0 -193
- package/runtime/third_party/bearssl/src/rand/aesctr_drbg.c +0 -206
- package/runtime/third_party/bearssl/src/rand/hmac_drbg.c +0 -157
- package/runtime/third_party/bearssl/src/rand/sysrng.c +0 -252
- package/runtime/third_party/bearssl/src/rsa/rsa_default_keygen.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_modulus.c +0 -36
- package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_decrypt.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_oaep_encrypt.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_sign.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pkcs1_vrfy.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_priv.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_privexp.c +0 -36
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_sign.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pss_vrfy.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pub.c +0 -38
- package/runtime/third_party/bearssl/src/rsa/rsa_default_pubexp.c +0 -36
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_keygen.c +0 -583
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_modulus.c +0 -99
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_decrypt.c +0 -41
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_oaep_encrypt.c +0 -44
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_sign.c +0 -37
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pkcs1_vrfy.c +0 -43
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_priv.c +0 -209
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_privexp.c +0 -320
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_sign.c +0 -40
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pss_vrfy.c +0 -44
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pub.c +0 -113
- package/runtime/third_party/bearssl/src/rsa/rsa_i15_pubexp.c +0 -152
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen.c +0 -37
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_keygen_inner.c +0 -608
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_modulus.c +0 -99
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_decrypt.c +0 -41
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_oaep_encrypt.c +0 -44
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_sign.c +0 -37
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pkcs1_vrfy.c +0 -43
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_priv.c +0 -203
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_privexp.c +0 -318
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_sign.c +0 -40
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pss_vrfy.c +0 -44
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pub.c +0 -106
- package/runtime/third_party/bearssl/src/rsa/rsa_i31_pubexp.c +0 -152
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_decrypt.c +0 -41
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_oaep_encrypt.c +0 -44
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_sign.c +0 -37
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pkcs1_vrfy.c +0 -43
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_priv.c +0 -160
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_sign.c +0 -40
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pss_vrfy.c +0 -44
- package/runtime/third_party/bearssl/src/rsa/rsa_i32_pub.c +0 -77
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_keygen.c +0 -57
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_decrypt.c +0 -61
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_oaep_encrypt.c +0 -64
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_sign.c +0 -57
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pkcs1_vrfy.c +0 -63
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_priv.c +0 -223
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_sign.c +0 -60
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pss_vrfy.c +0 -64
- package/runtime/third_party/bearssl/src/rsa/rsa_i62_pub.c +0 -125
- package/runtime/third_party/bearssl/src/rsa/rsa_oaep_pad.c +0 -112
- package/runtime/third_party/bearssl/src/rsa/rsa_oaep_unpad.c +0 -145
- package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_pad.c +0 -100
- package/runtime/third_party/bearssl/src/rsa/rsa_pkcs1_sig_unpad.c +0 -121
- package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_pad.c +0 -106
- package/runtime/third_party/bearssl/src/rsa/rsa_pss_sig_unpad.c +0 -121
- package/runtime/third_party/bearssl/src/rsa/rsa_ssl_decrypt.c +0 -52
- package/runtime/third_party/bearssl/src/settings.c +0 -306
- package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcdec.c +0 -69
- package/runtime/third_party/bearssl/src/symcipher/aes_big_cbcenc.c +0 -67
- package/runtime/third_party/bearssl/src/symcipher/aes_big_ctr.c +0 -84
- package/runtime/third_party/bearssl/src/symcipher/aes_big_ctrcbc.c +0 -142
- package/runtime/third_party/bearssl/src/symcipher/aes_big_dec.c +0 -254
- package/runtime/third_party/bearssl/src/symcipher/aes_big_enc.c +0 -157
- package/runtime/third_party/bearssl/src/symcipher/aes_common.c +0 -112
- package/runtime/third_party/bearssl/src/symcipher/aes_ct.c +0 -328
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64.c +0 -398
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcdec.c +0 -104
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_cbcenc.c +0 -81
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctr.c +0 -114
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_ctrcbc.c +0 -433
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_dec.c +0 -159
- package/runtime/third_party/bearssl/src/symcipher/aes_ct64_enc.c +0 -115
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcdec.c +0 -111
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_cbcenc.c +0 -91
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctr.c +0 -116
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_ctrcbc.c +0 -422
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_dec.c +0 -170
- package/runtime/third_party/bearssl/src/symcipher/aes_ct_enc.c +0 -112
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8.c +0 -445
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcdec.c +0 -670
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_cbcenc.c +0 -417
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctr.c +0 -717
- package/runtime/third_party/bearssl/src/symcipher/aes_pwr8_ctrcbc.c +0 -946
- package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcdec.c +0 -69
- package/runtime/third_party/bearssl/src/symcipher/aes_small_cbcenc.c +0 -67
- package/runtime/third_party/bearssl/src/symcipher/aes_small_ctr.c +0 -84
- package/runtime/third_party/bearssl/src/symcipher/aes_small_ctrcbc.c +0 -142
- package/runtime/third_party/bearssl/src/symcipher/aes_small_dec.c +0 -176
- package/runtime/third_party/bearssl/src/symcipher/aes_small_enc.c +0 -129
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni.c +0 -240
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcdec.c +0 -223
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_cbcenc.c +0 -122
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctr.c +0 -211
- package/runtime/third_party/bearssl/src/symcipher/aes_x86ni_ctrcbc.c +0 -596
- package/runtime/third_party/bearssl/src/symcipher/chacha20_ct.c +0 -106
- package/runtime/third_party/bearssl/src/symcipher/chacha20_sse2.c +0 -237
- package/runtime/third_party/bearssl/src/symcipher/des_ct.c +0 -411
- package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcdec.c +0 -87
- package/runtime/third_party/bearssl/src/symcipher/des_ct_cbcenc.c +0 -69
- package/runtime/third_party/bearssl/src/symcipher/des_support.c +0 -166
- package/runtime/third_party/bearssl/src/symcipher/des_tab.c +0 -310
- package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcdec.c +0 -85
- package/runtime/third_party/bearssl/src/symcipher/des_tab_cbcenc.c +0 -67
- package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul.c +0 -260
- package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmul32.c +0 -297
- package/runtime/third_party/bearssl/src/symcipher/poly1305_ctmulq.c +0 -475
- package/runtime/third_party/bearssl/src/symcipher/poly1305_i15.c +0 -221
- package/runtime/third_party/bearssl/src/x509/asn1.t0 +0 -757
- package/runtime/third_party/bearssl/src/x509/asn1enc.c +0 -93
- package/runtime/third_party/bearssl/src/x509/encode_ec_pk8der.c +0 -110
- package/runtime/third_party/bearssl/src/x509/encode_ec_rawder.c +0 -161
- package/runtime/third_party/bearssl/src/x509/encode_rsa_pk8der.c +0 -97
- package/runtime/third_party/bearssl/src/x509/encode_rsa_rawder.c +0 -96
- package/runtime/third_party/bearssl/src/x509/skey_decoder.c +0 -653
- package/runtime/third_party/bearssl/src/x509/skey_decoder.t0 +0 -376
- package/runtime/third_party/bearssl/src/x509/x509_decoder.c +0 -776
- package/runtime/third_party/bearssl/src/x509/x509_decoder.t0 +0 -324
- package/runtime/third_party/bearssl/src/x509/x509_knownkey.c +0 -105
- package/runtime/third_party/bearssl/src/x509/x509_minimal.c +0 -1722
- package/runtime/third_party/bearssl/src/x509/x509_minimal.t0 +0 -1526
- package/runtime/third_party/bearssl/src/x509/x509_minimal_full.c +0 -59
|
@@ -0,0 +1,2907 @@
|
|
|
1
|
+
// This file is generated from a similarly-named Perl script in the BoringSSL
|
|
2
|
+
// source tree. Do not edit by hand.
|
|
3
|
+
|
|
4
|
+
#include <openssl/asm_base.h>
|
|
5
|
+
|
|
6
|
+
#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_AARCH64) && defined(__ELF__)
|
|
7
|
+
#if __ARM_MAX_ARCH__ >= 8
|
|
8
|
+
.arch armv8.2-a+crypto+sha3
|
|
9
|
+
.text
|
|
10
|
+
.globl aes_gcm_enc_kernel
|
|
11
|
+
.hidden aes_gcm_enc_kernel
|
|
12
|
+
.type aes_gcm_enc_kernel,%function
|
|
13
|
+
.align 4
|
|
14
|
+
aes_gcm_enc_kernel:
|
|
15
|
+
AARCH64_SIGN_LINK_REGISTER
|
|
16
|
+
stp x29, x30, [sp, #-224]!
|
|
17
|
+
mov x29, sp
|
|
18
|
+
ld1 { v0.16b}, [x4] // .Load initial counter block
|
|
19
|
+
stp x19, x20, [sp, #16]
|
|
20
|
+
mov v1.16b, v0.16b // Initialize ctr1-3 from ctr0
|
|
21
|
+
mov v2.16b, v0.16b
|
|
22
|
+
mov v3.16b, v0.16b
|
|
23
|
+
mov x16, x4 // Pointer to counter block in memory
|
|
24
|
+
mov x8, x5 // Pointer to AES key schedule context
|
|
25
|
+
stp x21, x22, [sp, #32]
|
|
26
|
+
// [sp, #48] is unused but allocated to align the stack layout with aes_gcm_dec_kernel
|
|
27
|
+
stp d8, d9, [sp, #64] // Save Neon registers
|
|
28
|
+
stp d10, d11, [sp, #80]
|
|
29
|
+
stp d12, d13, [sp, #96]
|
|
30
|
+
stp d14, d15, [sp, #112]
|
|
31
|
+
ldr w17, [x8, #240] // .Load number of AES rounds
|
|
32
|
+
add x7, x8, x17, lsl #4 // Calculate pointer to the last round key
|
|
33
|
+
ldp x13, x14, [x7] // load round N key (for final XOR)
|
|
34
|
+
ldr q31, [x7, #-16] // load round N-1 key
|
|
35
|
+
add x4, x0, x1, lsr #3 // Calculate end of input
|
|
36
|
+
lsr x5, x1, #3 // Total byte length
|
|
37
|
+
mov x15, x5
|
|
38
|
+
ldr w12, [x16, #12] // .Load counter's low 32 bits
|
|
39
|
+
sub x5, x5, #1 // byte_len - 1
|
|
40
|
+
ldr q18, [x8, #0] // load rk0
|
|
41
|
+
and x5, x5, #0xffffffffffffffc0 // Align main loop end to a multiple of 64 bytes
|
|
42
|
+
add x5, x5, x0
|
|
43
|
+
rev w12, w12 // Reverse for big-endian increment
|
|
44
|
+
uxtw x10, w12 // Zero extend reversed w12 into x10 for final counter update
|
|
45
|
+
// Pre-compute this value instead of using two instructions to reconstruct it every iteration
|
|
46
|
+
mov x21, #0xc200000000000000 // GHASH reduction constant
|
|
47
|
+
str x21, [sp, #128]
|
|
48
|
+
// We maintain four copies of ctr values on the stack. Each loop iteration we
|
|
49
|
+
// store the updated ctr value to the last four bytes (e.g., 160 + 12).
|
|
50
|
+
// We then load the four values. This avoids a singificant number of
|
|
51
|
+
// expensive GPR->NEON and NEON->NEON moves. To avoid LDST forwarding we
|
|
52
|
+
// calculate and store the values one iteration ahead so they have time to
|
|
53
|
+
// drain before we load them.
|
|
54
|
+
str q0, [sp, #160] // Store base counter for block 0-3
|
|
55
|
+
str q0, [sp, #176]
|
|
56
|
+
str q0, [sp, #192]
|
|
57
|
+
str q0, [sp, #208]
|
|
58
|
+
// Since we need the values right away don't go through the stack this first
|
|
59
|
+
// time. Manually insert the incremented big-endian counter values.
|
|
60
|
+
rev w20, w12
|
|
61
|
+
mov v0.s[3], w20 // ctr0 + 0
|
|
62
|
+
add w20, w12, #1
|
|
63
|
+
rev w20, w20
|
|
64
|
+
mov v1.s[3], w20 // ctr0 + 1
|
|
65
|
+
add w20, w12, #2
|
|
66
|
+
rev w20, w20
|
|
67
|
+
mov v2.s[3], w20 // ctr0 + 2
|
|
68
|
+
add w20, w12, #3
|
|
69
|
+
rev w20, w20
|
|
70
|
+
mov v3.s[3], w20 // ctr0 + 3
|
|
71
|
+
// Calculate the ctr values for the *next* (not current) group of four
|
|
72
|
+
// blocks. Store the incremented parts to the stack.
|
|
73
|
+
add w20, w12, #4
|
|
74
|
+
rev w20, w20
|
|
75
|
+
str w20, [sp, #172] // ctr0 + 4 for next iter
|
|
76
|
+
add w20, w12, #5
|
|
77
|
+
rev w20, w20
|
|
78
|
+
str w20, [sp, #188] // ctr0 + 5 for next iter
|
|
79
|
+
add w20, w12, #6
|
|
80
|
+
rev w20, w20
|
|
81
|
+
str w20, [sp, #204] // ctr0 + 6 for next iter
|
|
82
|
+
add w20, w12, #7
|
|
83
|
+
rev w20, w20
|
|
84
|
+
str w20, [sp, #220] // ctr0 + 7 for next iter
|
|
85
|
+
add w12, w12, #8 // Advance counter past these two sets
|
|
86
|
+
// --- Start AES for first 4 blocks ---
|
|
87
|
+
aese v0.16b, v18.16b
|
|
88
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 0
|
|
89
|
+
ldp q19, q20, [x8, #16] // load rk1, rk2
|
|
90
|
+
aese v1.16b, v18.16b
|
|
91
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 0
|
|
92
|
+
ldp q21, q22, [x8, #48] // load rk3, rk4
|
|
93
|
+
aese v2.16b, v18.16b
|
|
94
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 0
|
|
95
|
+
ldp q23, q24, [x8, #80] // load rk5, rk6
|
|
96
|
+
aese v3.16b, v18.16b
|
|
97
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 0
|
|
98
|
+
ldp q13, q14, [x6, #32] // load H2, H3 (GHASH keys)
|
|
99
|
+
aese v0.16b, v19.16b
|
|
100
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 1
|
|
101
|
+
ldp q25, q26, [x8, #112] // load rk7, rk8
|
|
102
|
+
aese v1.16b, v19.16b
|
|
103
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 1
|
|
104
|
+
aese v2.16b, v19.16b
|
|
105
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 1
|
|
106
|
+
aese v3.16b, v19.16b
|
|
107
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 1
|
|
108
|
+
aese v0.16b, v20.16b
|
|
109
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 2
|
|
110
|
+
ext v14.16b, v14.16b, v14.16b, #8 // Byte swap H3 for GHASH
|
|
111
|
+
aese v1.16b, v20.16b
|
|
112
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 2
|
|
113
|
+
ext v13.16b, v13.16b, v13.16b, #8 // Byte swap H2 for GHASH
|
|
114
|
+
aese v2.16b, v20.16b
|
|
115
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 2
|
|
116
|
+
ldr q15, [x6, #80] // load H4
|
|
117
|
+
aese v3.16b, v20.16b
|
|
118
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 2
|
|
119
|
+
ext v15.16b, v15.16b, v15.16b, #8 // Byte swap H4 for GHASH
|
|
120
|
+
aese v0.16b, v21.16b
|
|
121
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 3
|
|
122
|
+
ld1 { v11.16b}, [x3] // .Load initial GHASH accumulator (T)
|
|
123
|
+
aese v1.16b, v21.16b
|
|
124
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 3
|
|
125
|
+
ext v11.16b, v11.16b, v11.16b, #8 // Byte swap T for GHASH
|
|
126
|
+
aese v2.16b, v21.16b
|
|
127
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 3
|
|
128
|
+
rev64 v11.16b, v11.16b // Correct byte order within 64-bit lanes
|
|
129
|
+
aese v3.16b, v21.16b
|
|
130
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 3
|
|
131
|
+
trn2 v17.2d, v14.2d, v15.2d // Karatsuba key: H4_low | H3_low
|
|
132
|
+
aese v0.16b, v22.16b
|
|
133
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 4
|
|
134
|
+
ldr q12, [x6] // load H1
|
|
135
|
+
aese v1.16b, v22.16b
|
|
136
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 4
|
|
137
|
+
ext v12.16b, v12.16b, v12.16b, #8 // Byte swap H1 for GHASH
|
|
138
|
+
aese v2.16b, v22.16b
|
|
139
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 4
|
|
140
|
+
trn1 v9.2d, v14.2d, v15.2d // Karatsuba key: H4_high | H3_high
|
|
141
|
+
aese v3.16b, v22.16b
|
|
142
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 4
|
|
143
|
+
trn2 v16.2d, v12.2d, v13.2d // Karatsuba key: H2_low | H1_low
|
|
144
|
+
aese v0.16b, v23.16b
|
|
145
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 5
|
|
146
|
+
ldr q30, [x7] // Preload round N key for final EOR
|
|
147
|
+
aese v1.16b, v23.16b
|
|
148
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 5
|
|
149
|
+
aese v3.16b, v23.16b
|
|
150
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 5
|
|
151
|
+
aese v2.16b, v23.16b
|
|
152
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 5
|
|
153
|
+
aese v0.16b, v24.16b
|
|
154
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 6
|
|
155
|
+
aese v1.16b, v24.16b
|
|
156
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 6
|
|
157
|
+
aese v2.16b, v24.16b
|
|
158
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 6
|
|
159
|
+
aese v3.16b, v24.16b
|
|
160
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 6
|
|
161
|
+
aese v0.16b, v25.16b
|
|
162
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 7
|
|
163
|
+
aese v1.16b, v25.16b
|
|
164
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 7
|
|
165
|
+
aese v2.16b, v25.16b
|
|
166
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 7
|
|
167
|
+
aese v3.16b, v25.16b
|
|
168
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 7
|
|
169
|
+
aese v0.16b, v26.16b
|
|
170
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 8
|
|
171
|
+
aese v1.16b, v26.16b
|
|
172
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 8
|
|
173
|
+
aese v2.16b, v26.16b
|
|
174
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 8
|
|
175
|
+
aese v3.16b, v26.16b
|
|
176
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 8
|
|
177
|
+
cmp x17, #12 // setup flags for AES-128/192/256 check
|
|
178
|
+
b.lt .Lenc_finish_first_blocks // branch if AES-128
|
|
179
|
+
ldp q27, q28, [x8, #144] // load rk9, rk10
|
|
180
|
+
aese v1.16b, v27.16b
|
|
181
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 9
|
|
182
|
+
aese v2.16b, v27.16b
|
|
183
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 9
|
|
184
|
+
aese v3.16b, v27.16b
|
|
185
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 9
|
|
186
|
+
aese v0.16b, v27.16b
|
|
187
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 9
|
|
188
|
+
aese v1.16b, v28.16b
|
|
189
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 10
|
|
190
|
+
aese v2.16b, v28.16b
|
|
191
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 10
|
|
192
|
+
aese v3.16b, v28.16b
|
|
193
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 10
|
|
194
|
+
aese v0.16b, v28.16b
|
|
195
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 10
|
|
196
|
+
b.eq .Lenc_finish_first_blocks // branch if AES-192
|
|
197
|
+
ldp q27, q28, [x8, #176] // load rk11, rk12
|
|
198
|
+
aese v1.16b, v27.16b
|
|
199
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 11
|
|
200
|
+
aese v2.16b, v27.16b
|
|
201
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 11
|
|
202
|
+
aese v3.16b, v27.16b
|
|
203
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 11
|
|
204
|
+
aese v0.16b, v27.16b
|
|
205
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 11
|
|
206
|
+
aese v1.16b, v28.16b
|
|
207
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 12
|
|
208
|
+
aese v2.16b, v28.16b
|
|
209
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 12
|
|
210
|
+
aese v3.16b, v28.16b
|
|
211
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 12
|
|
212
|
+
aese v0.16b, v28.16b
|
|
213
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 12
|
|
214
|
+
.Lenc_finish_first_blocks:
|
|
215
|
+
cmp x0, x5 // check if we have <= 4 blocks to process in the tail
|
|
216
|
+
eor v17.16b, v17.16b, v9.16b // Karatsuba key: H3^H4
|
|
217
|
+
aese v0.16b, v31.16b // AES block 0 - round N-1
|
|
218
|
+
aese v1.16b, v31.16b // AES block 1 - round N-1
|
|
219
|
+
aese v2.16b, v31.16b // AES block 2 - round N-1
|
|
220
|
+
aese v3.16b, v31.16b // AES block 3 - round N-1
|
|
221
|
+
trn1 v8.2d, v12.2d, v13.2d // Karatsuba key: H2_high | H1_high
|
|
222
|
+
eor v16.16b, v16.16b, v8.16b // Karatsuba key: H1^H2
|
|
223
|
+
b.ge .Lenc_tail // handle tail if no more full 4-block sets
|
|
224
|
+
ldp q6, q7, [x0, #32] // AES blocks 2,3 load plaintext
|
|
225
|
+
ldp q4, q5, [x0], #64 // AES blocks 0,1 load plaintext
|
|
226
|
+
// Compute and store first 4 ciphertext blocks
|
|
227
|
+
eor v4.16b, v4.16b, v30.16b
|
|
228
|
+
eor v4.16b, v4.16b, v0.16b // AES block 0 - result = PT ^ AES(ctr0)
|
|
229
|
+
eor v5.16b, v5.16b, v30.16b
|
|
230
|
+
eor v5.16b, v5.16b, v1.16b // AES block 1 - result = PT ^ AES(ctr1)
|
|
231
|
+
eor v6.16b, v6.16b, v30.16b
|
|
232
|
+
eor v6.16b, v6.16b, v2.16b // AES block 2 - result = PT ^ AES(ctr2)
|
|
233
|
+
eor v7.16b, v7.16b, v30.16b
|
|
234
|
+
eor v7.16b, v7.16b, v3.16b // AES block 3 - result = PT ^ AES(ctr3)
|
|
235
|
+
st1 { v4.16b, v5.16b, v6.16b, v7.16b}, [x2], #64 // AES blocks 0-3 - store result
|
|
236
|
+
// Load counter values for the second iteration from the stack
|
|
237
|
+
ldp q0, q1, [sp, #160]
|
|
238
|
+
ldp q2, q3, [sp, #192]
|
|
239
|
+
// Prepare and store counter values for the third iteration
|
|
240
|
+
rev w20, w12
|
|
241
|
+
str w20, [sp, #172] // ctr + 8
|
|
242
|
+
add w20, w12, #1
|
|
243
|
+
rev w20, w20
|
|
244
|
+
str w20, [sp, #188] // ctr + 9
|
|
245
|
+
add w20, w12, #2
|
|
246
|
+
rev w20, w20
|
|
247
|
+
str w20, [sp, #204] // ctr + 10
|
|
248
|
+
add w20, w12, #3
|
|
249
|
+
rev w20, w20
|
|
250
|
+
str w20, [sp, #220] // ctr + 11
|
|
251
|
+
add w12, w12, #4 // Advance counter base
|
|
252
|
+
cmp x0, x5 // check if we have <= 4 blocks remaining
|
|
253
|
+
b.ge .Lenc_prepretail // go to prepretail if < 2 full loops left
|
|
254
|
+
.Lenc_main_loop: // main loop start (processes 4 blocks per iteration)
|
|
255
|
+
// --- AES Pipeline for blocks 4k+4 to 4k+7 ---
|
|
256
|
+
aese v0.16b, v18.16b
|
|
257
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 0
|
|
258
|
+
aese v1.16b, v18.16b
|
|
259
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 0
|
|
260
|
+
aese v2.16b, v18.16b
|
|
261
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 0
|
|
262
|
+
aese v3.16b, v18.16b
|
|
263
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 0
|
|
264
|
+
ldr d8, [sp, #128] // .Load GHASH reduction constant
|
|
265
|
+
aese v0.16b, v19.16b
|
|
266
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 1
|
|
267
|
+
aese v1.16b, v19.16b
|
|
268
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 1
|
|
269
|
+
aese v2.16b, v19.16b
|
|
270
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 1
|
|
271
|
+
aese v3.16b, v19.16b
|
|
272
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 1
|
|
273
|
+
// --- GHASH Pipeline (interleaved with AES) for blocks 4k to 4k+3 ---
|
|
274
|
+
rev64 v4.16b, v4.16b // GHASH block 4k - Byte swap CT
|
|
275
|
+
rev64 v5.16b, v5.16b // GHASH block 4k+1 - Byte swap CT
|
|
276
|
+
rev64 v6.16b, v6.16b // GHASH block 4k+2 - Byte swap CT
|
|
277
|
+
rev64 v7.16b, v7.16b // GHASH block 4k+3 - Byte swap CT
|
|
278
|
+
aese v0.16b, v20.16b
|
|
279
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 2
|
|
280
|
+
ext v11.16b, v11.16b, v11.16b, #8 // GHASH - prepare acc for XOR
|
|
281
|
+
aese v1.16b, v20.16b
|
|
282
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 2
|
|
283
|
+
eor v4.16b, v4.16b, v11.16b // GHASH block 4k - Y_i = CT_i ^ Y_{i-1}
|
|
284
|
+
aese v2.16b, v20.16b
|
|
285
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 2
|
|
286
|
+
pmull v11.1q, v4.1d, v15.1d // GHASH block 4k - low
|
|
287
|
+
aese v3.16b, v20.16b
|
|
288
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 2
|
|
289
|
+
pmull2 v9.1q, v6.2d, v13.2d // GHASH block 4k+2 - high
|
|
290
|
+
aese v0.16b, v21.16b
|
|
291
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 3
|
|
292
|
+
mov d10, v17.d[1] // GHASH block 4k - mid Karatsuba key
|
|
293
|
+
aese v1.16b, v21.16b
|
|
294
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 3
|
|
295
|
+
mov d20, v4.d[1] // GHASH block 4k - mid
|
|
296
|
+
aese v2.16b, v21.16b
|
|
297
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 3
|
|
298
|
+
eor v20.8b, v20.8b, v4.8b // GHASH block 4k - mid
|
|
299
|
+
aese v3.16b, v21.16b
|
|
300
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 3
|
|
301
|
+
mov d21, v5.d[1] // GHASH block 4k+1 - mid
|
|
302
|
+
aese v0.16b, v22.16b
|
|
303
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 4
|
|
304
|
+
eor v21.8b, v21.8b, v5.8b // GHASH block 4k+1 - mid
|
|
305
|
+
aese v1.16b, v22.16b
|
|
306
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 4
|
|
307
|
+
pmull v10.1q, v20.1d, v10.1d // GHASH block 4k - mid
|
|
308
|
+
aese v2.16b, v22.16b
|
|
309
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 4
|
|
310
|
+
pmull v21.1q, v21.1d, v17.1d // GHASH block 4k+1 - mid
|
|
311
|
+
aese v3.16b, v22.16b
|
|
312
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 4
|
|
313
|
+
eor v10.16b, v10.16b, v21.16b // GHASH block 4k+1 - mid
|
|
314
|
+
aese v0.16b, v23.16b
|
|
315
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 5
|
|
316
|
+
ext v22.16b, v22.16b, v6.16b, #8 // GHASH block 4k+2 - mid
|
|
317
|
+
aese v1.16b, v23.16b
|
|
318
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 5
|
|
319
|
+
eor v22.16b, v22.16b, v6.16b // GHASH block 4k+2 - mid
|
|
320
|
+
aese v2.16b, v23.16b
|
|
321
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 5
|
|
322
|
+
pmull2 v22.1q, v22.2d, v16.2d // GHASH block 4k+2 - mid
|
|
323
|
+
aese v3.16b, v23.16b
|
|
324
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 5
|
|
325
|
+
mov d23, v7.d[1] // GHASH block 4k+3 - mid
|
|
326
|
+
aese v0.16b, v24.16b
|
|
327
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 6
|
|
328
|
+
eor v23.8b, v23.8b, v7.8b // GHASH block 4k+3 - mid
|
|
329
|
+
aese v1.16b, v24.16b
|
|
330
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 6
|
|
331
|
+
pmull v23.1q, v23.1d, v16.1d // GHASH block 4k+3 - mid
|
|
332
|
+
aese v2.16b, v24.16b
|
|
333
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 6
|
|
334
|
+
eor v10.16b, v10.16b, v22.16b
|
|
335
|
+
eor v10.16b, v10.16b, v23.16b // GHASH block 4k+2/3 - mid
|
|
336
|
+
aese v3.16b, v24.16b
|
|
337
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 6
|
|
338
|
+
pmull2 v22.1q, v4.2d, v15.2d // GHASH block 4k - high
|
|
339
|
+
aese v0.16b, v25.16b
|
|
340
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 7
|
|
341
|
+
pmull2 v21.1q, v7.2d, v12.2d // GHASH block 4k+3 - high
|
|
342
|
+
eor v22.16b, v22.16b, v21.16b // GHASH block 4k+3 - high
|
|
343
|
+
aese v1.16b, v25.16b
|
|
344
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 7
|
|
345
|
+
pmull2 v23.1q, v5.2d, v14.2d // GHASH block 4k+1 - high
|
|
346
|
+
aese v2.16b, v25.16b
|
|
347
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 7
|
|
348
|
+
pmull v21.1q, v6.1d, v13.1d // GHASH block 4k+2 - low
|
|
349
|
+
aese v3.16b, v25.16b
|
|
350
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 7
|
|
351
|
+
pmull v20.1q, v5.1d, v14.1d // GHASH block 4k+1 - low
|
|
352
|
+
eor v9.16b, v9.16b, v22.16b
|
|
353
|
+
eor v9.16b, v9.16b, v23.16b // GHASH block 4k/1/2/3 - high
|
|
354
|
+
pmull v22.1q, v7.1d, v12.1d // GHASH block 4k+3 - low
|
|
355
|
+
ldp q6, q7, [x0, #32]
|
|
356
|
+
ldp q4, q5, [x0], #64
|
|
357
|
+
eor v20.16b, v20.16b, v21.16b // GHASH block 4k+1 - low
|
|
358
|
+
aese v0.16b, v26.16b
|
|
359
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 8
|
|
360
|
+
eor v11.16b, v11.16b, v22.16b
|
|
361
|
+
eor v11.16b, v11.16b, v20.16b // GHASH block 4k/1/2/3 - low
|
|
362
|
+
aese v1.16b, v26.16b
|
|
363
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 8
|
|
364
|
+
eor v10.16b, v10.16b, v9.16b
|
|
365
|
+
eor v10.16b, v10.16b, v11.16b // MODULO - karatsuba tidy up
|
|
366
|
+
aese v2.16b, v26.16b
|
|
367
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 8
|
|
368
|
+
pmull v20.1q, v9.1d, v8.1d // MODULO - top 64b align with mid
|
|
369
|
+
aese v3.16b, v26.16b
|
|
370
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 8
|
|
371
|
+
cmp x17, #12 // setup flags for AES-128/192/256 check
|
|
372
|
+
b.lt .Lenc_main_loop_continue // branch if AES-128
|
|
373
|
+
ldp q27, q28, [x8, #144] // load rk9, rk10
|
|
374
|
+
aese v0.16b, v27.16b
|
|
375
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 9
|
|
376
|
+
aese v1.16b, v27.16b
|
|
377
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 9
|
|
378
|
+
aese v2.16b, v27.16b
|
|
379
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 9
|
|
380
|
+
aese v3.16b, v27.16b
|
|
381
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 9
|
|
382
|
+
aese v0.16b, v28.16b
|
|
383
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 10
|
|
384
|
+
aese v1.16b, v28.16b
|
|
385
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 10
|
|
386
|
+
aese v2.16b, v28.16b
|
|
387
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 10
|
|
388
|
+
aese v3.16b, v28.16b
|
|
389
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 10
|
|
390
|
+
b.eq .Lenc_main_loop_continue // branch if AES-192
|
|
391
|
+
ldp q27, q28, [x8, #176] // load rk11, rk12
|
|
392
|
+
aese v0.16b, v27.16b
|
|
393
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 11
|
|
394
|
+
aese v1.16b, v27.16b
|
|
395
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 11
|
|
396
|
+
aese v2.16b, v27.16b
|
|
397
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 11
|
|
398
|
+
aese v3.16b, v27.16b
|
|
399
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 11
|
|
400
|
+
aese v0.16b, v28.16b
|
|
401
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 12
|
|
402
|
+
aese v1.16b, v28.16b
|
|
403
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 12
|
|
404
|
+
aese v2.16b, v28.16b
|
|
405
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 12
|
|
406
|
+
aese v3.16b, v28.16b
|
|
407
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 12
|
|
408
|
+
.Lenc_main_loop_continue:
|
|
409
|
+
ext v9.16b, v9.16b, v9.16b, #8 // MODULO - other top alignment
|
|
410
|
+
eor v10.16b, v10.16b, v20.16b
|
|
411
|
+
eor v10.16b, v10.16b, v9.16b // MODULO - fold into mid
|
|
412
|
+
pmull v9.1q, v10.1d, v8.1d // MODULO - mid 64b align with low
|
|
413
|
+
ext v20.16b, v10.16b, v10.16b, #8 // MODULO - other mid alignment
|
|
414
|
+
eor v11.16b, v9.16b, v11.16b
|
|
415
|
+
eor v11.16b, v11.16b, v20.16b // MODULO - fold into low
|
|
416
|
+
aese v0.16b, v31.16b // AES block 4k+4 - round N-1
|
|
417
|
+
eor v4.16b, v4.16b, v30.16b
|
|
418
|
+
eor v4.16b, v4.16b, v0.16b // AES block 4k+4 - result
|
|
419
|
+
aese v1.16b, v31.16b // AES block 4k+5 - round N-1
|
|
420
|
+
eor v5.16b, v5.16b, v30.16b
|
|
421
|
+
eor v5.16b, v5.16b, v1.16b // AES block 4k+5 - result
|
|
422
|
+
aese v2.16b, v31.16b // AES block 4k+6 - round N-1
|
|
423
|
+
eor v6.16b, v6.16b, v30.16b
|
|
424
|
+
eor v6.16b, v6.16b, v2.16b // AES block 4k+6 - result
|
|
425
|
+
aese v3.16b, v31.16b // AES block 4k+7 - round N-1
|
|
426
|
+
eor v7.16b, v7.16b, v30.16b
|
|
427
|
+
eor v7.16b, v7.16b, v3.16b // AES block 4k+7 - result
|
|
428
|
+
ldp q0, q1, [sp, #160]
|
|
429
|
+
ldp q2, q3, [sp, #192]
|
|
430
|
+
// We used these registers as temporaries above so reload the RKs.
|
|
431
|
+
ldp q20, q21, [x8, #32] // load rk2, rk3
|
|
432
|
+
ldp q22, q23, [x8, #64] // load rk4, rk5
|
|
433
|
+
st1 { v4.16b, v5.16b, v6.16b, v7.16b}, [x2], #64 // AES blocks 4k+4-7 - store result
|
|
434
|
+
rev w20, w12
|
|
435
|
+
str w20, [sp, #172]
|
|
436
|
+
add w20, w12, #1
|
|
437
|
+
rev w20, w20
|
|
438
|
+
str w20, [sp, #188]
|
|
439
|
+
add w20, w12, #2
|
|
440
|
+
rev w20, w20
|
|
441
|
+
str w20, [sp, #204]
|
|
442
|
+
add w20, w12, #3
|
|
443
|
+
rev w20, w20
|
|
444
|
+
str w20, [sp, #220]
|
|
445
|
+
add w12, w12, #4
|
|
446
|
+
cmp x0, x5 // .LOOP CONTROL
|
|
447
|
+
b.lt .Lenc_main_loop
|
|
448
|
+
.Lenc_prepretail: // PREPRETAIL
|
|
449
|
+
aese v1.16b, v18.16b
|
|
450
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 0
|
|
451
|
+
rev64 v6.16b, v6.16b // GHASH block 2
|
|
452
|
+
aese v2.16b, v18.16b
|
|
453
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 0
|
|
454
|
+
aese v0.16b, v18.16b
|
|
455
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 0
|
|
456
|
+
rev64 v4.16b, v4.16b // GHASH block 0
|
|
457
|
+
ext v11.16b, v11.16b, v11.16b, #8 // PRE 0
|
|
458
|
+
aese v2.16b, v19.16b
|
|
459
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 1
|
|
460
|
+
aese v0.16b, v19.16b
|
|
461
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 1
|
|
462
|
+
eor v4.16b, v4.16b, v11.16b // PRE 1
|
|
463
|
+
rev64 v5.16b, v5.16b // GHASH block 1
|
|
464
|
+
aese v2.16b, v20.16b
|
|
465
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 2
|
|
466
|
+
aese v3.16b, v18.16b
|
|
467
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 0
|
|
468
|
+
mov d10, v17.d[1] // GHASH block 0 - mid Karatsuba key
|
|
469
|
+
aese v1.16b, v19.16b
|
|
470
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 1
|
|
471
|
+
pmull v11.1q, v4.1d, v15.1d // GHASH block 0 - low
|
|
472
|
+
mov d8, v4.d[1] // GHASH block 0 - mid
|
|
473
|
+
pmull2 v9.1q, v4.2d, v15.2d // GHASH block 0 - high
|
|
474
|
+
aese v2.16b, v21.16b
|
|
475
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 3
|
|
476
|
+
aese v1.16b, v20.16b
|
|
477
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 2
|
|
478
|
+
eor v8.8b, v8.8b, v4.8b // GHASH block 0 - mid
|
|
479
|
+
aese v0.16b, v20.16b
|
|
480
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 2
|
|
481
|
+
aese v3.16b, v19.16b
|
|
482
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 1
|
|
483
|
+
aese v1.16b, v21.16b
|
|
484
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 3
|
|
485
|
+
pmull v10.1q, v8.1d, v10.1d // GHASH block 0 - mid
|
|
486
|
+
pmull2 v4.1q, v5.2d, v14.2d // GHASH block 1 - high
|
|
487
|
+
pmull v8.1q, v5.1d, v14.1d // GHASH block 1 - low
|
|
488
|
+
aese v3.16b, v20.16b
|
|
489
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 2
|
|
490
|
+
eor v9.16b, v9.16b, v4.16b // GHASH block 1 - high
|
|
491
|
+
mov d4, v5.d[1] // GHASH block 1 - mid
|
|
492
|
+
aese v0.16b, v21.16b
|
|
493
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 3
|
|
494
|
+
eor v11.16b, v11.16b, v8.16b // GHASH block 1 - low
|
|
495
|
+
aese v3.16b, v21.16b
|
|
496
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 3
|
|
497
|
+
eor v4.8b, v4.8b, v5.8b // GHASH block 1 - mid
|
|
498
|
+
mov d8, v6.d[1] // GHASH block 2 - mid
|
|
499
|
+
aese v0.16b, v22.16b
|
|
500
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 4
|
|
501
|
+
rev64 v7.16b, v7.16b // GHASH block 3
|
|
502
|
+
aese v3.16b, v22.16b
|
|
503
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 4
|
|
504
|
+
pmull v4.1q, v4.1d, v17.1d // GHASH block 1 - mid
|
|
505
|
+
eor v8.8b, v8.8b, v6.8b // GHASH block 2 - mid
|
|
506
|
+
pmull v5.1q, v6.1d, v13.1d // GHASH block 2 - low
|
|
507
|
+
aese v3.16b, v23.16b
|
|
508
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 5
|
|
509
|
+
aese v2.16b, v22.16b
|
|
510
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 4
|
|
511
|
+
eor v10.16b, v10.16b, v4.16b // GHASH block 1 - mid
|
|
512
|
+
pmull2 v4.1q, v6.2d, v13.2d // GHASH block 2 - high
|
|
513
|
+
eor v11.16b, v11.16b, v5.16b // GHASH block 2 - low
|
|
514
|
+
ins v8.d[1], v8.d[0] // GHASH block 2 - mid
|
|
515
|
+
aese v2.16b, v23.16b
|
|
516
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 5
|
|
517
|
+
eor v9.16b, v9.16b, v4.16b // GHASH block 2 - high
|
|
518
|
+
mov d4, v7.d[1] // GHASH block 3 - mid
|
|
519
|
+
aese v1.16b, v22.16b
|
|
520
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 4
|
|
521
|
+
pmull2 v8.1q, v8.2d, v16.2d // GHASH block 2 - mid
|
|
522
|
+
eor v4.8b, v4.8b, v7.8b // GHASH block 3 - mid
|
|
523
|
+
pmull2 v5.1q, v7.2d, v12.2d // GHASH block 3 - high
|
|
524
|
+
aese v1.16b, v23.16b
|
|
525
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 5
|
|
526
|
+
pmull v4.1q, v4.1d, v16.1d // GHASH block 3 - mid
|
|
527
|
+
eor v10.16b, v10.16b, v8.16b // GHASH block 2 - mid
|
|
528
|
+
aese v0.16b, v23.16b
|
|
529
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 5
|
|
530
|
+
aese v1.16b, v24.16b
|
|
531
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 6
|
|
532
|
+
aese v2.16b, v24.16b
|
|
533
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 6
|
|
534
|
+
aese v0.16b, v24.16b
|
|
535
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 6
|
|
536
|
+
aese v3.16b, v24.16b
|
|
537
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 6
|
|
538
|
+
aese v1.16b, v25.16b
|
|
539
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 7
|
|
540
|
+
eor v9.16b, v9.16b, v5.16b // GHASH block 3 - high
|
|
541
|
+
aese v0.16b, v25.16b
|
|
542
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 7
|
|
543
|
+
aese v3.16b, v25.16b
|
|
544
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 7
|
|
545
|
+
ldr d8, [sp, #128]
|
|
546
|
+
aese v1.16b, v26.16b
|
|
547
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 8
|
|
548
|
+
eor v10.16b, v10.16b, v4.16b // GHASH block 3 - mid
|
|
549
|
+
pmull v6.1q, v7.1d, v12.1d // GHASH block 3 - low
|
|
550
|
+
aese v3.16b, v26.16b
|
|
551
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 8
|
|
552
|
+
cmp x17, #12 // setup flags for AES-128/192/256 check
|
|
553
|
+
aese v0.16b, v26.16b
|
|
554
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 8
|
|
555
|
+
eor v11.16b, v11.16b, v6.16b // GHASH block 3 - low
|
|
556
|
+
aese v2.16b, v25.16b
|
|
557
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 7
|
|
558
|
+
eor v10.16b, v10.16b, v9.16b // karatsuba tidy up
|
|
559
|
+
aese v2.16b, v26.16b
|
|
560
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 8
|
|
561
|
+
pmull v4.1q, v9.1d, v8.1d
|
|
562
|
+
ext v9.16b, v9.16b, v9.16b, #8
|
|
563
|
+
eor v10.16b, v10.16b, v11.16b
|
|
564
|
+
b.lt .Lenc_finish_prepretail // branch if AES-128
|
|
565
|
+
ldp q27, q28, [x8, #144] // load rk9, rk10
|
|
566
|
+
aese v0.16b, v27.16b
|
|
567
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 9
|
|
568
|
+
aese v1.16b, v27.16b
|
|
569
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 9
|
|
570
|
+
aese v2.16b, v27.16b
|
|
571
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 9
|
|
572
|
+
aese v3.16b, v27.16b
|
|
573
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 9
|
|
574
|
+
aese v0.16b, v28.16b
|
|
575
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 10
|
|
576
|
+
aese v1.16b, v28.16b
|
|
577
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 10
|
|
578
|
+
aese v2.16b, v28.16b
|
|
579
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 10
|
|
580
|
+
aese v3.16b, v28.16b
|
|
581
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 10
|
|
582
|
+
b.eq .Lenc_finish_prepretail // branch if AES-192
|
|
583
|
+
ldp q27, q28, [x8, #176] // load rk11, rk12
|
|
584
|
+
aese v0.16b, v27.16b
|
|
585
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 11
|
|
586
|
+
aese v1.16b, v27.16b
|
|
587
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 11
|
|
588
|
+
aese v2.16b, v27.16b
|
|
589
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 11
|
|
590
|
+
aese v3.16b, v27.16b
|
|
591
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 11
|
|
592
|
+
aese v0.16b, v28.16b
|
|
593
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 12
|
|
594
|
+
aese v1.16b, v28.16b
|
|
595
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 12
|
|
596
|
+
aese v2.16b, v28.16b
|
|
597
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 12
|
|
598
|
+
aese v3.16b, v28.16b
|
|
599
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 12
|
|
600
|
+
.Lenc_finish_prepretail:
|
|
601
|
+
aese v0.16b, v31.16b // AES block 0 - round N-1
|
|
602
|
+
aese v1.16b, v31.16b // AES block 1 - round N-1
|
|
603
|
+
aese v2.16b, v31.16b // AES block 2 - round N-1
|
|
604
|
+
aese v3.16b, v31.16b // AES block 3 - round N-1
|
|
605
|
+
eor v10.16b, v10.16b, v4.16b
|
|
606
|
+
eor v10.16b, v10.16b, v9.16b
|
|
607
|
+
pmull v4.1q, v10.1d, v8.1d
|
|
608
|
+
ext v10.16b, v10.16b, v10.16b, #8
|
|
609
|
+
eor v11.16b, v11.16b, v4.16b
|
|
610
|
+
eor v11.16b, v11.16b, v10.16b
|
|
611
|
+
.Lenc_tail: // TAIL: Process remaining 0 to 3 blocks
|
|
612
|
+
ext v8.16b, v11.16b, v11.16b, #8 // Save current GHASH state for partial tag feed-in
|
|
613
|
+
sub x5, x4, x0 // main_end_input_ptr is number of bytes left to process
|
|
614
|
+
ldp x6, x7, [x0], #16 // AES block 0 - load plaintext
|
|
615
|
+
eor x6, x6, x13 // AES block 0 - round N low
|
|
616
|
+
eor x7, x7, x14 // AES block 0 - round N high
|
|
617
|
+
cmp x5, #48
|
|
618
|
+
fmov d4, x6 // AES block 0 - mov low
|
|
619
|
+
fmov v4.d[1], x7 // AES block 0 - mov high
|
|
620
|
+
eor v5.16b, v4.16b, v0.16b // AES block 0 - result
|
|
621
|
+
b.gt .Lenc_blocks_more_than_3
|
|
622
|
+
cmp x5, #32
|
|
623
|
+
mov v3.16b, v2.16b
|
|
624
|
+
movi v11.8b, #0
|
|
625
|
+
movi v9.8b, #0
|
|
626
|
+
mov v2.16b, v1.16b
|
|
627
|
+
movi v10.8b, #0
|
|
628
|
+
b.gt .Lenc_blocks_more_than_2
|
|
629
|
+
mov v3.16b, v1.16b
|
|
630
|
+
cmp x5, #16
|
|
631
|
+
b.gt .Lenc_blocks_more_than_1
|
|
632
|
+
b .Lenc_blocks_less_than_1
|
|
633
|
+
.Lenc_blocks_more_than_3: // blocks left > 3
|
|
634
|
+
st1 { v5.16b}, [x2], #16 // AES final-2 block - store result
|
|
635
|
+
ldp x6, x7, [x0], #16 // AES final-2 block - load input low & high
|
|
636
|
+
rev64 v4.16b, v5.16b // GHASH final-3 block
|
|
637
|
+
eor x6, x6, x13 // AES final-2 block - round N low
|
|
638
|
+
eor v4.16b, v4.16b, v8.16b // feed in partial tag
|
|
639
|
+
eor x7, x7, x14 // AES final-2 block - round N high
|
|
640
|
+
mov d22, v4.d[1] // GHASH final-3 block - mid
|
|
641
|
+
fmov d5, x6 // AES final-2 block - mov low
|
|
642
|
+
fmov v5.d[1], x7 // AES final-2 block - mov high
|
|
643
|
+
eor v22.8b, v22.8b, v4.8b // GHASH final-3 block - mid
|
|
644
|
+
movi v8.8b, #0 // suppress further partial tag feed in
|
|
645
|
+
mov d10, v17.d[1] // GHASH final-3 block - mid
|
|
646
|
+
pmull v11.1q, v4.1d, v15.1d // GHASH final-3 block - low
|
|
647
|
+
pmull2 v9.1q, v4.2d, v15.2d // GHASH final-3 block - high
|
|
648
|
+
pmull v10.1q, v22.1d, v10.1d // GHASH final-3 block - mid
|
|
649
|
+
eor v5.16b, v5.16b, v1.16b // AES final-2 block - result
|
|
650
|
+
.Lenc_blocks_more_than_2: // blocks left > 2
|
|
651
|
+
st1 { v5.16b}, [x2], #16 // AES final-2 block - store result
|
|
652
|
+
ldp x6, x7, [x0], #16 // AES final-1 block - load input low & high
|
|
653
|
+
rev64 v4.16b, v5.16b // GHASH final-2 block
|
|
654
|
+
eor x6, x6, x13 // AES final-1 block - round N low
|
|
655
|
+
eor v4.16b, v4.16b, v8.16b // feed in partial tag
|
|
656
|
+
fmov d5, x6 // AES final-1 block - mov low
|
|
657
|
+
eor x7, x7, x14 // AES final-1 block - round N high
|
|
658
|
+
fmov v5.d[1], x7 // AES final-1 block - mov high
|
|
659
|
+
movi v8.8b, #0 // suppress further partial tag feed in
|
|
660
|
+
pmull2 v20.1q, v4.2d, v14.2d // GHASH final-2 block - high
|
|
661
|
+
mov d22, v4.d[1] // GHASH final-2 block - mid
|
|
662
|
+
pmull v21.1q, v4.1d, v14.1d // GHASH final-2 block - low
|
|
663
|
+
eor v22.8b, v22.8b, v4.8b // GHASH final-2 block - mid
|
|
664
|
+
eor v5.16b, v5.16b, v2.16b // AES final-1 block - result
|
|
665
|
+
eor v9.16b, v9.16b, v20.16b // GHASH final-2 block - high
|
|
666
|
+
pmull v22.1q, v22.1d, v17.1d // GHASH final-2 block - mid
|
|
667
|
+
eor v11.16b, v11.16b, v21.16b // GHASH final-2 block - low
|
|
668
|
+
eor v10.16b, v10.16b, v22.16b // GHASH final-2 block - mid
|
|
669
|
+
.Lenc_blocks_more_than_1: // blocks left > 1
|
|
670
|
+
st1 { v5.16b}, [x2], #16 // AES final-1 block - store result
|
|
671
|
+
rev64 v4.16b, v5.16b // GHASH final-1 block: Byte Swap CT
|
|
672
|
+
ldp x6, x7, [x0], #16 // AES final block - load plaintext
|
|
673
|
+
eor v4.16b, v4.16b, v8.16b // Feed in partial tag
|
|
674
|
+
movi v8.8b, #0 // Clear for next block
|
|
675
|
+
eor x6, x6, x13 // AES final block - round N low
|
|
676
|
+
mov d22, v4.d[1] // GHASH final-1 block - mid
|
|
677
|
+
pmull2 v20.1q, v4.2d, v13.2d // GHASH final-1 block - high
|
|
678
|
+
eor x7, x7, x14 // AES final block - round N high
|
|
679
|
+
eor v22.8b, v22.8b, v4.8b // GHASH final-1 block - mid
|
|
680
|
+
eor v9.16b, v9.16b, v20.16b // GHASH final-1 block - high
|
|
681
|
+
ins v22.d[1], v22.d[0] // GHASH final-1 block - mid
|
|
682
|
+
fmov d5, x6 // AES final block - mov low
|
|
683
|
+
fmov v5.d[1], x7 // AES final block - mov high
|
|
684
|
+
pmull2 v22.1q, v22.2d, v16.2d // GHASH final-1 block - mid
|
|
685
|
+
pmull v21.1q, v4.1d, v13.1d // GHASH final-1 block - low
|
|
686
|
+
eor v5.16b, v5.16b, v3.16b // AES final block - result
|
|
687
|
+
eor v10.16b, v10.16b, v22.16b // GHASH final-1 block - mid
|
|
688
|
+
eor v11.16b, v11.16b, v21.16b // GHASH final-1 block - low
|
|
689
|
+
.Lenc_blocks_less_than_1: // .Last partial block handling
|
|
690
|
+
add x10, x10, x1, lsr #7 // Calculate the updated counter based on the number of 16B chunks we processed
|
|
691
|
+
rev w10, w10
|
|
692
|
+
str w10, [x16, #12] // store the updated counter
|
|
693
|
+
and x1, x1, #127 // bit_length %= 128
|
|
694
|
+
mvn x13, xzr // Mask for low 64 bits
|
|
695
|
+
sub x1, x1, #128 //
|
|
696
|
+
neg x1, x1 // Valid bits in the last block (1-128)
|
|
697
|
+
ldr q18, [x2] // .Load destination for merging
|
|
698
|
+
mvn x14, xzr // Mask for high 64 bits
|
|
699
|
+
and x1, x1, #127 // bit_length %= 128
|
|
700
|
+
lsr x14, x14, x1 // rkN_h is mask for top 64b of last block
|
|
701
|
+
cmp x1, #64
|
|
702
|
+
csel x6, x13, x14, lt
|
|
703
|
+
csel x7, x14, xzr, lt
|
|
704
|
+
fmov d0, x6 // ctr0d is mask for last block
|
|
705
|
+
fmov v0.d[1], x7
|
|
706
|
+
and v5.16b, v5.16b, v0.16b // Mask out unused bits of the last CT block
|
|
707
|
+
rev64 v4.16b, v5.16b // GHASH final block - byte swap
|
|
708
|
+
eor v4.16b, v4.16b, v8.16b // Feed in partial tag
|
|
709
|
+
bif v5.16b, v18.16b, v0.16b // Bitwise Insert: merge with existing data at output_ptr
|
|
710
|
+
pmull2 v20.1q, v4.2d, v12.2d // GHASH final block - high
|
|
711
|
+
mov d8, v4.d[1] // GHASH final block - mid
|
|
712
|
+
pmull v21.1q, v4.1d, v12.1d // GHASH final block - low
|
|
713
|
+
eor v9.16b, v9.16b, v20.16b // GHASH final block - high
|
|
714
|
+
eor v8.8b, v8.8b, v4.8b // GHASH final block - mid
|
|
715
|
+
pmull v8.1q, v8.1d, v16.1d // GHASH final block - mid
|
|
716
|
+
eor v11.16b, v11.16b, v21.16b // GHASH final block - low
|
|
717
|
+
eor v10.16b, v10.16b, v8.16b // GHASH final block - mid
|
|
718
|
+
eor v4.16b, v11.16b, v9.16b // MODULO - karatsuba tidy up
|
|
719
|
+
fmov d8, x21
|
|
720
|
+
eor v10.16b, v10.16b, v4.16b // MODULO - karatsuba tidy up
|
|
721
|
+
pmull v7.1q, v9.1d, v8.1d // MODULO - top 64b align with mid
|
|
722
|
+
ext v9.16b, v9.16b, v9.16b, #8 // MODULO - other top alignment
|
|
723
|
+
eor v10.16b, v10.16b, v7.16b
|
|
724
|
+
eor v10.16b, v10.16b, v9.16b // MODULO - fold into mid
|
|
725
|
+
pmull v9.1q, v10.1d, v8.1d // MODULO - mid 64b align with low
|
|
726
|
+
ext v10.16b, v10.16b, v10.16b, #8 // MODULO - other mid alignment
|
|
727
|
+
st1 { v5.16b}, [x2] // store all 16B
|
|
728
|
+
eor v11.16b, v11.16b, v9.16b
|
|
729
|
+
eor v11.16b, v11.16b, v10.16b // MODULO - fold into low
|
|
730
|
+
ext v11.16b, v11.16b, v11.16b, #8 // Byte swap GHASH result
|
|
731
|
+
rev64 v11.16b, v11.16b // Final Tag
|
|
732
|
+
mov x0, x15
|
|
733
|
+
st1 { v11.16b }, [x3] // Store final tag
|
|
734
|
+
ldp x19, x20, [sp, #16]
|
|
735
|
+
ldp x21, x22, [sp, #32]
|
|
736
|
+
ldp d8, d9, [sp, #64]
|
|
737
|
+
ldp d10, d11, [sp, #80]
|
|
738
|
+
ldp d12, d13, [sp, #96]
|
|
739
|
+
ldp d14, d15, [sp, #112]
|
|
740
|
+
ldp x29, x30, [sp], #224
|
|
741
|
+
AARCH64_VALIDATE_LINK_REGISTER
|
|
742
|
+
ret
|
|
743
|
+
.size aes_gcm_enc_kernel,.-aes_gcm_enc_kernel
|
|
744
|
+
.globl aes_gcm_dec_kernel
|
|
745
|
+
.hidden aes_gcm_dec_kernel
|
|
746
|
+
.type aes_gcm_dec_kernel,%function
|
|
747
|
+
.align 4
|
|
748
|
+
aes_gcm_dec_kernel:
|
|
749
|
+
AARCH64_SIGN_LINK_REGISTER
|
|
750
|
+
stp x29, x30, [sp, #-224]!
|
|
751
|
+
mov x29, sp
|
|
752
|
+
stp x19, x20, [sp, #16]
|
|
753
|
+
ld1 { v0.16b}, [x4]
|
|
754
|
+
mov v1.16b, v0.16b
|
|
755
|
+
mov v2.16b, v0.16b
|
|
756
|
+
mov v3.16b, v0.16b
|
|
757
|
+
mov x16, x4
|
|
758
|
+
mov x8, x5
|
|
759
|
+
stp x21, x22, [sp, #32]
|
|
760
|
+
stp x23, x24, [sp, #48]
|
|
761
|
+
stp d8, d9, [sp, #64]
|
|
762
|
+
stp d10, d11, [sp, #80]
|
|
763
|
+
stp d12, d13, [sp, #96]
|
|
764
|
+
stp d14, d15, [sp, #112]
|
|
765
|
+
ldr w17, [x8, #240] // .Load number of AES rounds
|
|
766
|
+
add x19, x8, x17, lsl #4 // borrow input_l1 for last key
|
|
767
|
+
ldp x13, x14, [x19] // load round N keys
|
|
768
|
+
ldr q31, [x19, #-16] // load round N-1 keys
|
|
769
|
+
add x4, x0, x1, lsr #3 // end_input_ptr
|
|
770
|
+
lsr x5, x1, #3 // byte_len
|
|
771
|
+
mov x15, x5
|
|
772
|
+
ldr w9, [x16, #12] // .Load scalar 32-bit counter (CTR)
|
|
773
|
+
sub x5, x5, #1 // byte_len - 1
|
|
774
|
+
ldr q18, [x8, #0] // load rk0
|
|
775
|
+
and x5, x5, #0xffffffffffffffc0 // number of bytes to be processed in main loop (at least 1 byte must be handled by tail)
|
|
776
|
+
add x5, x5, x0
|
|
777
|
+
rev w9, w9 // Reverse it once for big-endian incrementing
|
|
778
|
+
uxtw x10, w9 // Zero extend reversed w9 into x10
|
|
779
|
+
str q0, [sp, #160]
|
|
780
|
+
str q0, [sp, #176]
|
|
781
|
+
str q0, [sp, #192]
|
|
782
|
+
str q0, [sp, #208]
|
|
783
|
+
rev w20, w9
|
|
784
|
+
mov v0.s[3], w20
|
|
785
|
+
add w20, w9, #1
|
|
786
|
+
rev w20, w20
|
|
787
|
+
mov v1.s[3], w20
|
|
788
|
+
add w20, w9, #2
|
|
789
|
+
rev w20, w20
|
|
790
|
+
mov v2.s[3], w20
|
|
791
|
+
add w20, w9, #3
|
|
792
|
+
rev w20, w20
|
|
793
|
+
mov v3.s[3], w20
|
|
794
|
+
add w20, w9, #4
|
|
795
|
+
rev w20, w20
|
|
796
|
+
str w20, [sp, #172]
|
|
797
|
+
add w20, w9, #5
|
|
798
|
+
rev w20, w20
|
|
799
|
+
str w20, [sp, #188]
|
|
800
|
+
add w20, w9, #6
|
|
801
|
+
rev w20, w20
|
|
802
|
+
str w20, [sp, #204]
|
|
803
|
+
add w20, w9, #7
|
|
804
|
+
rev w20, w20
|
|
805
|
+
str w20, [sp, #220]
|
|
806
|
+
add w9, w9, #8
|
|
807
|
+
// Pre-compute this value instead of using two instructions for moving and then shifting in the main loop
|
|
808
|
+
mov x21, #0xc200000000000000
|
|
809
|
+
str x21, [sp, #128]
|
|
810
|
+
aese v0.16b, v18.16b
|
|
811
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 0
|
|
812
|
+
ldp q19, q20, [x8, #16] // load rk1, rk2
|
|
813
|
+
aese v1.16b, v18.16b
|
|
814
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 0
|
|
815
|
+
ldp q21, q22, [x8, #48] // load rk3, rk4
|
|
816
|
+
aese v2.16b, v18.16b
|
|
817
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 0
|
|
818
|
+
ldp q23, q24, [x8, #80] // load rk5, rk6
|
|
819
|
+
aese v3.16b, v18.16b
|
|
820
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 0
|
|
821
|
+
ldp q13, q14, [x6, #32] // load h2, h3
|
|
822
|
+
aese v0.16b, v19.16b
|
|
823
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 1
|
|
824
|
+
ldp q25, q26, [x8, #112] // load rk7, rk8
|
|
825
|
+
aese v1.16b, v19.16b
|
|
826
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 1
|
|
827
|
+
aese v2.16b, v19.16b
|
|
828
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 1
|
|
829
|
+
aese v3.16b, v19.16b
|
|
830
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 1
|
|
831
|
+
aese v0.16b, v20.16b
|
|
832
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 2
|
|
833
|
+
ext v14.16b, v14.16b, v14.16b, #8
|
|
834
|
+
aese v1.16b, v20.16b
|
|
835
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 2
|
|
836
|
+
ext v13.16b, v13.16b, v13.16b, #8
|
|
837
|
+
ldr q15, [x6, #80] // load h4
|
|
838
|
+
aese v2.16b, v20.16b
|
|
839
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 2
|
|
840
|
+
aese v3.16b, v20.16b
|
|
841
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 2
|
|
842
|
+
ext v15.16b, v15.16b, v15.16b, #8
|
|
843
|
+
aese v0.16b, v21.16b
|
|
844
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 3
|
|
845
|
+
ld1 { v11.16b}, [x3]
|
|
846
|
+
aese v1.16b, v21.16b
|
|
847
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 3
|
|
848
|
+
ext v11.16b, v11.16b, v11.16b, #8
|
|
849
|
+
aese v2.16b, v21.16b
|
|
850
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 3
|
|
851
|
+
rev64 v11.16b, v11.16b
|
|
852
|
+
aese v3.16b, v21.16b
|
|
853
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 3
|
|
854
|
+
trn2 v17.2d, v14.2d, v15.2d // h4l | h3l
|
|
855
|
+
aese v0.16b, v22.16b
|
|
856
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 4
|
|
857
|
+
ldr q12, [x6] // load h1
|
|
858
|
+
aese v1.16b, v22.16b
|
|
859
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 4
|
|
860
|
+
ext v12.16b, v12.16b, v12.16b, #8
|
|
861
|
+
aese v2.16b, v22.16b
|
|
862
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 4
|
|
863
|
+
trn1 v9.2d, v14.2d, v15.2d // h4h | h3h
|
|
864
|
+
aese v3.16b, v22.16b
|
|
865
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 4
|
|
866
|
+
trn2 v16.2d, v12.2d, v13.2d // h2l | h1l
|
|
867
|
+
aese v0.16b, v23.16b
|
|
868
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 5
|
|
869
|
+
aese v1.16b, v23.16b
|
|
870
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 5
|
|
871
|
+
aese v3.16b, v23.16b
|
|
872
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 5
|
|
873
|
+
aese v2.16b, v23.16b
|
|
874
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 5
|
|
875
|
+
aese v0.16b, v24.16b
|
|
876
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 6
|
|
877
|
+
aese v1.16b, v24.16b
|
|
878
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 6
|
|
879
|
+
aese v2.16b, v24.16b
|
|
880
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 6
|
|
881
|
+
aese v3.16b, v24.16b
|
|
882
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 6
|
|
883
|
+
aese v0.16b, v25.16b
|
|
884
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 7
|
|
885
|
+
aese v1.16b, v25.16b
|
|
886
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 7
|
|
887
|
+
aese v2.16b, v25.16b
|
|
888
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 7
|
|
889
|
+
aese v3.16b, v25.16b
|
|
890
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 7
|
|
891
|
+
aese v0.16b, v26.16b
|
|
892
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 8
|
|
893
|
+
aese v1.16b, v26.16b
|
|
894
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 8
|
|
895
|
+
aese v2.16b, v26.16b
|
|
896
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 8
|
|
897
|
+
aese v3.16b, v26.16b
|
|
898
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 8
|
|
899
|
+
cmp x17, #12 // setup flags for AES-128/192/256 check
|
|
900
|
+
b.lt .Ldec_finish_first_blocks // branch if AES-128
|
|
901
|
+
ldp q27, q28, [x8, #144] // load rk9, rk10
|
|
902
|
+
aese v0.16b, v27.16b
|
|
903
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 9
|
|
904
|
+
aese v1.16b, v27.16b
|
|
905
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 9
|
|
906
|
+
aese v2.16b, v27.16b
|
|
907
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 9
|
|
908
|
+
aese v3.16b, v27.16b
|
|
909
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 9
|
|
910
|
+
aese v0.16b, v28.16b
|
|
911
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 10
|
|
912
|
+
aese v1.16b, v28.16b
|
|
913
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 10
|
|
914
|
+
aese v2.16b, v28.16b
|
|
915
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 10
|
|
916
|
+
aese v3.16b, v28.16b
|
|
917
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 10
|
|
918
|
+
b.eq .Ldec_finish_first_blocks // branch if AES-192
|
|
919
|
+
ldp q27, q28, [x8, #176] // load rk11, rk12
|
|
920
|
+
aese v0.16b, v27.16b
|
|
921
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 11
|
|
922
|
+
aese v1.16b, v27.16b
|
|
923
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 11
|
|
924
|
+
aese v2.16b, v27.16b
|
|
925
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 11
|
|
926
|
+
aese v3.16b, v27.16b
|
|
927
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 11
|
|
928
|
+
aese v0.16b, v28.16b
|
|
929
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 12
|
|
930
|
+
aese v1.16b, v28.16b
|
|
931
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 12
|
|
932
|
+
aese v2.16b, v28.16b
|
|
933
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 12
|
|
934
|
+
aese v3.16b, v28.16b
|
|
935
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 12
|
|
936
|
+
.Ldec_finish_first_blocks:
|
|
937
|
+
ldr q27, [x19] // load rkN
|
|
938
|
+
cmp x0, x5 // check if we have <= 4 blocks
|
|
939
|
+
eor v17.16b, v17.16b, v9.16b // h4k | h3k
|
|
940
|
+
aese v1.16b, v31.16b // AES block 1 - round N-1
|
|
941
|
+
aese v2.16b, v31.16b // AES block 2 - round N-1
|
|
942
|
+
aese v3.16b, v31.16b // AES block 3 - round N-1
|
|
943
|
+
aese v0.16b, v31.16b // AES block 0 - round N-1
|
|
944
|
+
trn1 v8.2d, v12.2d, v13.2d // h2h | h1h
|
|
945
|
+
eor v16.16b, v16.16b, v8.16b // h2k | h1k
|
|
946
|
+
b.ge .Ldec_tail // handle tail
|
|
947
|
+
// Setup for AES blocks 0-3 is done purely on NEON side instead of mixing NEON and scalar instructions.
|
|
948
|
+
// This is because the final result of the AES block needs to be EORd with the final round key
|
|
949
|
+
// value (v30). This avoids several fmovs.
|
|
950
|
+
ldp q6, q7, [x0, #32] // AES blocks 2,3 load ciphertext
|
|
951
|
+
ldp q4, q5, [x0], #64 // AES blocks 0,1 load ciphertext
|
|
952
|
+
eor v0.16b, v4.16b, v0.16b
|
|
953
|
+
eor v0.16b, v0.16b, v27.16b // AES block 0 - result
|
|
954
|
+
eor v1.16b, v5.16b, v1.16b
|
|
955
|
+
eor v1.16b, v1.16b, v27.16b // AES block 1 - result
|
|
956
|
+
eor v2.16b, v6.16b, v2.16b
|
|
957
|
+
eor v2.16b, v2.16b, v27.16b // AES block 2 - result
|
|
958
|
+
eor v3.16b, v7.16b, v3.16b
|
|
959
|
+
eor v3.16b, v3.16b, v27.16b // AES block 3 - result
|
|
960
|
+
st1 { v0.16b, v1.16b, v2.16b, v3.16b}, [x2], #64 // AES blocks 0-3 - store result
|
|
961
|
+
ldr q0, [sp, #160]
|
|
962
|
+
ldr q1, [sp, #176]
|
|
963
|
+
ldr q2, [sp, #192]
|
|
964
|
+
ldr q3, [sp, #208]
|
|
965
|
+
rev w20, w9
|
|
966
|
+
str w20, [sp, #172]
|
|
967
|
+
add w20, w9, #1
|
|
968
|
+
rev w20, w20
|
|
969
|
+
str w20, [sp, #188]
|
|
970
|
+
add w20, w9, #2
|
|
971
|
+
rev w20, w20
|
|
972
|
+
str w20, [sp, #204]
|
|
973
|
+
add w20, w9, #3
|
|
974
|
+
rev w20, w20
|
|
975
|
+
str w20, [sp, #220]
|
|
976
|
+
add w9, w9, #4
|
|
977
|
+
cmp x0, x5 // check if we have <= 4 blocks
|
|
978
|
+
b.ge .Ldec_prepretail // do prepretail
|
|
979
|
+
.Ldec_main_loop: // main loop start
|
|
980
|
+
aese v0.16b, v18.16b
|
|
981
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 0
|
|
982
|
+
aese v1.16b, v18.16b
|
|
983
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 0
|
|
984
|
+
aese v2.16b, v18.16b
|
|
985
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 0
|
|
986
|
+
aese v3.16b, v18.16b
|
|
987
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 0
|
|
988
|
+
aese v0.16b, v19.16b
|
|
989
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 1
|
|
990
|
+
aese v1.16b, v19.16b
|
|
991
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 1
|
|
992
|
+
aese v2.16b, v19.16b
|
|
993
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 1
|
|
994
|
+
aese v3.16b, v19.16b
|
|
995
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 1
|
|
996
|
+
rev64 v4.16b, v4.16b // GHASH block 4k
|
|
997
|
+
rev64 v5.16b, v5.16b // GHASH block 4k+1
|
|
998
|
+
rev64 v6.16b, v6.16b // GHASH block 4k+2
|
|
999
|
+
rev64 v7.16b, v7.16b // GHASH block 4k+3
|
|
1000
|
+
aese v0.16b, v20.16b
|
|
1001
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 2
|
|
1002
|
+
ext v11.16b, v11.16b, v11.16b, #8 // PRE 0
|
|
1003
|
+
aese v1.16b, v20.16b
|
|
1004
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 2
|
|
1005
|
+
eor v4.16b, v4.16b, v11.16b // PRE 1
|
|
1006
|
+
aese v2.16b, v20.16b
|
|
1007
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 2
|
|
1008
|
+
pmull v11.1q, v4.1d, v15.1d // GHASH block 4k - low
|
|
1009
|
+
aese v3.16b, v20.16b
|
|
1010
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 2
|
|
1011
|
+
pmull2 v9.1q, v4.2d, v15.2d // GHASH block 4k - high
|
|
1012
|
+
aese v0.16b, v21.16b
|
|
1013
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 3
|
|
1014
|
+
mov d10, v17.d[1] // GHASH block 4k - mid
|
|
1015
|
+
aese v1.16b, v21.16b
|
|
1016
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 3
|
|
1017
|
+
mov d8, v4.d[1] // GHASH block 4k - mid
|
|
1018
|
+
aese v2.16b, v21.16b
|
|
1019
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 3
|
|
1020
|
+
eor v8.8b, v8.8b, v4.8b // GHASH block 4k - mid
|
|
1021
|
+
aese v3.16b, v21.16b
|
|
1022
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 3
|
|
1023
|
+
aese v0.16b, v22.16b
|
|
1024
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 4
|
|
1025
|
+
pmull2 v4.1q, v5.2d, v14.2d // GHASH block 4k+1 - high
|
|
1026
|
+
aese v1.16b, v22.16b
|
|
1027
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 4
|
|
1028
|
+
eor v9.16b, v9.16b, v4.16b // GHASH block 4k+1 - high
|
|
1029
|
+
aese v2.16b, v22.16b
|
|
1030
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 4
|
|
1031
|
+
mov d4, v5.d[1] // GHASH block 4k+1 - mid
|
|
1032
|
+
aese v3.16b, v22.16b
|
|
1033
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 4
|
|
1034
|
+
pmull v10.1q, v8.1d, v10.1d // GHASH block 4k - mid
|
|
1035
|
+
aese v0.16b, v23.16b
|
|
1036
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 5
|
|
1037
|
+
pmull v8.1q, v5.1d, v14.1d // GHASH block 4k+1 - low
|
|
1038
|
+
aese v1.16b, v23.16b
|
|
1039
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 5
|
|
1040
|
+
eor v4.8b, v4.8b, v5.8b // GHASH block 4k+1 - mid
|
|
1041
|
+
aese v3.16b, v23.16b
|
|
1042
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 5
|
|
1043
|
+
aese v2.16b, v23.16b
|
|
1044
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 5
|
|
1045
|
+
pmull v5.1q, v6.1d, v13.1d // GHASH block 4k+2 - low
|
|
1046
|
+
aese v0.16b, v24.16b
|
|
1047
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 6
|
|
1048
|
+
eor v11.16b, v11.16b, v8.16b
|
|
1049
|
+
eor v11.16b, v11.16b, v5.16b // GHASH block 4k+1 - low & GHASH block 4k+2 - low
|
|
1050
|
+
aese v1.16b, v24.16b
|
|
1051
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 6
|
|
1052
|
+
mov d8, v6.d[1] // GHASH block 4k+2 - mid
|
|
1053
|
+
aese v2.16b, v24.16b
|
|
1054
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 6
|
|
1055
|
+
eor v8.8b, v8.8b, v6.8b // GHASH block 4k+2 - mid
|
|
1056
|
+
pmull v4.1q, v4.1d, v17.1d // GHASH block 4k+1 - mid
|
|
1057
|
+
ins v8.d[1], v8.d[0] // GHASH block 4k+2 - mid
|
|
1058
|
+
aese v3.16b, v24.16b
|
|
1059
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 6
|
|
1060
|
+
pmull2 v28.1q, v6.2d, v13.2d // GHASH block 4k+2 - high
|
|
1061
|
+
mov d6, v7.d[1] // GHASH block 4k+3 - mid
|
|
1062
|
+
aese v0.16b, v25.16b
|
|
1063
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 7
|
|
1064
|
+
pmull2 v8.1q, v8.2d, v16.2d // GHASH block 4k+2 - mid
|
|
1065
|
+
aese v1.16b, v25.16b
|
|
1066
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 7
|
|
1067
|
+
pmull v27.1q, v7.1d, v12.1d // GHASH block 4k+3 - low
|
|
1068
|
+
aese v2.16b, v25.16b
|
|
1069
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 7
|
|
1070
|
+
eor v10.16b, v10.16b, v4.16b
|
|
1071
|
+
eor v10.16b, v10.16b, v8.16b // GHASH block 4k+1 - mid & GHASH block 4k+2 - mid
|
|
1072
|
+
aese v3.16b, v25.16b
|
|
1073
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 7
|
|
1074
|
+
pmull2 v5.1q, v7.2d, v12.2d // GHASH block 4k+3 - high
|
|
1075
|
+
eor v6.8b, v6.8b, v7.8b // GHASH block 4k+3 - mid
|
|
1076
|
+
eor v9.16b, v9.16b, v28.16b
|
|
1077
|
+
eor v9.16b, v9.16b, v5.16b // GHASH block 4k+2 - high & GHASH block 4k+3 - high
|
|
1078
|
+
aese v0.16b, v26.16b
|
|
1079
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 8
|
|
1080
|
+
aese v1.16b, v26.16b
|
|
1081
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 8
|
|
1082
|
+
aese v2.16b, v26.16b
|
|
1083
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 8
|
|
1084
|
+
pmull v6.1q, v6.1d, v16.1d // GHASH block 4k+3 - mid
|
|
1085
|
+
ldr d8, [sp, #128]
|
|
1086
|
+
aese v3.16b, v26.16b
|
|
1087
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 8
|
|
1088
|
+
pmull v7.1q, v9.1d, v8.1d // MODULO - top 64b align with mid
|
|
1089
|
+
eor v10.16b, v10.16b, v6.16b
|
|
1090
|
+
eor v10.16b, v10.16b, v7.16b // GHASH block 4k+3 - mid & MODULO - fold into mid
|
|
1091
|
+
eor v11.16b, v11.16b, v27.16b // GHASH block 4k+3 - low
|
|
1092
|
+
eor v6.16b, v11.16b, v9.16b // MODULO - karatsuba tidy up
|
|
1093
|
+
ext v9.16b, v9.16b, v9.16b, #8 // MODULO - other top alignment
|
|
1094
|
+
eor v10.16b, v10.16b, v6.16b
|
|
1095
|
+
eor v10.16b, v10.16b, v9.16b // MODULO - karatsuba tidy up & MODULO - fold into mid
|
|
1096
|
+
pmull v8.1q, v10.1d, v8.1d // MODULO - mid 64b align with low
|
|
1097
|
+
ext v10.16b, v10.16b, v10.16b, #8 // MODULO - other mid alignment
|
|
1098
|
+
eor v11.16b, v11.16b, v8.16b
|
|
1099
|
+
eor v11.16b, v11.16b, v10.16b // MODULO - fold into low
|
|
1100
|
+
cmp w17, #12 // setup flags for AES-128/192/256 check
|
|
1101
|
+
b.lt .Ldec_main_loop_continue // branch if AES-128
|
|
1102
|
+
ldp q27, q28, [x8, #144] // load rk9, rk10
|
|
1103
|
+
aese v0.16b, v27.16b
|
|
1104
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 9
|
|
1105
|
+
aese v1.16b, v27.16b
|
|
1106
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 9
|
|
1107
|
+
aese v2.16b, v27.16b
|
|
1108
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 9
|
|
1109
|
+
aese v3.16b, v27.16b
|
|
1110
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 9
|
|
1111
|
+
aese v0.16b, v28.16b
|
|
1112
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 10
|
|
1113
|
+
aese v1.16b, v28.16b
|
|
1114
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 10
|
|
1115
|
+
aese v2.16b, v28.16b
|
|
1116
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 10
|
|
1117
|
+
aese v3.16b, v28.16b
|
|
1118
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 10
|
|
1119
|
+
b.eq .Ldec_main_loop_continue // branch if AES-192
|
|
1120
|
+
ldp q27, q28, [x8, #176] // load rk11, rk12
|
|
1121
|
+
aese v0.16b, v27.16b
|
|
1122
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 11
|
|
1123
|
+
aese v1.16b, v27.16b
|
|
1124
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 11
|
|
1125
|
+
aese v2.16b, v27.16b
|
|
1126
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 11
|
|
1127
|
+
aese v3.16b, v27.16b
|
|
1128
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 11
|
|
1129
|
+
aese v0.16b, v28.16b
|
|
1130
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 12
|
|
1131
|
+
aese v1.16b, v28.16b
|
|
1132
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 12
|
|
1133
|
+
aese v2.16b, v28.16b
|
|
1134
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 12
|
|
1135
|
+
aese v3.16b, v28.16b
|
|
1136
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 12
|
|
1137
|
+
.Ldec_main_loop_continue:
|
|
1138
|
+
ldr q27, [x19] // load rkN
|
|
1139
|
+
ldp q6, q7, [x0, #32] // AES blocks 2,3 load ciphertext
|
|
1140
|
+
ldp q4, q5, [x0], #64 // AES blocks 0,1 load ciphertext
|
|
1141
|
+
aese v0.16b, v31.16b // AES block 4k+4 - round N-1
|
|
1142
|
+
eor v0.16b, v4.16b, v0.16b
|
|
1143
|
+
eor v0.16b, v0.16b, v27.16b // AES block 4k+4 - result
|
|
1144
|
+
aese v1.16b, v31.16b // AES block 4k+5 - round N-1
|
|
1145
|
+
eor v1.16b, v5.16b, v1.16b
|
|
1146
|
+
eor v1.16b, v1.16b, v27.16b // AES block 4k+5 - result
|
|
1147
|
+
aese v2.16b, v31.16b // AES block 4k+6 - round N-1
|
|
1148
|
+
eor v2.16b, v6.16b, v2.16b
|
|
1149
|
+
eor v2.16b, v2.16b, v27.16b // AES block 4k+6 - result
|
|
1150
|
+
aese v3.16b, v31.16b // AES block 4k+7 - round N-1
|
|
1151
|
+
eor v3.16b, v7.16b, v3.16b
|
|
1152
|
+
eor v3.16b, v3.16b, v27.16b // AES block 4k+7 - result
|
|
1153
|
+
st1 { v0.16b, v1.16b, v2.16b, v3.16b}, [x2], #64 // AES blocks 4k+4-7 - store result
|
|
1154
|
+
ldr q0, [sp, #160]
|
|
1155
|
+
ldr q1, [sp, #176]
|
|
1156
|
+
ldr q2, [sp, #192]
|
|
1157
|
+
ldr q3, [sp, #208]
|
|
1158
|
+
rev w20, w9
|
|
1159
|
+
str w20, [sp, #172]
|
|
1160
|
+
add w20, w9, #1
|
|
1161
|
+
rev w20, w20
|
|
1162
|
+
str w20, [sp, #188]
|
|
1163
|
+
add w20, w9, #2
|
|
1164
|
+
rev w20, w20
|
|
1165
|
+
str w20, [sp, #204]
|
|
1166
|
+
add w20, w9, #3
|
|
1167
|
+
rev w20, w20
|
|
1168
|
+
str w20, [sp, #220]
|
|
1169
|
+
add w9, w9, #4
|
|
1170
|
+
cmp x0, x5
|
|
1171
|
+
b.lt .Ldec_main_loop
|
|
1172
|
+
.Ldec_prepretail: // PREPRETAIL
|
|
1173
|
+
rev64 v4.16b, v4.16b // GHASH block 0
|
|
1174
|
+
rev64 v5.16b, v5.16b // GHASH block 1
|
|
1175
|
+
ext v11.16b, v11.16b, v11.16b, #8 // PRE 0
|
|
1176
|
+
aese v0.16b, v18.16b
|
|
1177
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 0
|
|
1178
|
+
aese v1.16b, v18.16b
|
|
1179
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 0
|
|
1180
|
+
eor v4.16b, v4.16b, v11.16b // PRE 1
|
|
1181
|
+
rev64 v6.16b, v6.16b // GHASH block 2
|
|
1182
|
+
aese v1.16b, v19.16b
|
|
1183
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 1
|
|
1184
|
+
pmull v11.1q, v4.1d, v15.1d // GHASH block 0 - low
|
|
1185
|
+
mov d8, v4.d[1] // GHASH block 0 - mid
|
|
1186
|
+
pmull2 v9.1q, v4.2d, v15.2d // GHASH block 0 - high
|
|
1187
|
+
aese v2.16b, v18.16b
|
|
1188
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 0
|
|
1189
|
+
mov d10, v17.d[1] // GHASH block 0 - mid
|
|
1190
|
+
aese v0.16b, v19.16b
|
|
1191
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 1
|
|
1192
|
+
eor v8.8b, v8.8b, v4.8b // GHASH block 0 - mid
|
|
1193
|
+
pmull2 v4.1q, v5.2d, v14.2d // GHASH block 1 - high
|
|
1194
|
+
aese v2.16b, v19.16b
|
|
1195
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 1
|
|
1196
|
+
rev64 v7.16b, v7.16b // GHASH block 3
|
|
1197
|
+
aese v3.16b, v18.16b
|
|
1198
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 0
|
|
1199
|
+
pmull v10.1q, v8.1d, v10.1d // GHASH block 0 - mid
|
|
1200
|
+
eor v9.16b, v9.16b, v4.16b // GHASH block 1 - high
|
|
1201
|
+
pmull v8.1q, v5.1d, v14.1d // GHASH block 1 - low
|
|
1202
|
+
aese v3.16b, v19.16b
|
|
1203
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 1
|
|
1204
|
+
mov d4, v5.d[1] // GHASH block 1 - mid
|
|
1205
|
+
aese v0.16b, v20.16b
|
|
1206
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 2
|
|
1207
|
+
aese v1.16b, v20.16b
|
|
1208
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 2
|
|
1209
|
+
eor v11.16b, v11.16b, v8.16b // GHASH block 1 - low
|
|
1210
|
+
aese v2.16b, v20.16b
|
|
1211
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 2
|
|
1212
|
+
aese v0.16b, v21.16b
|
|
1213
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 3
|
|
1214
|
+
mov d8, v6.d[1] // GHASH block 2 - mid
|
|
1215
|
+
aese v3.16b, v20.16b
|
|
1216
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 2
|
|
1217
|
+
eor v4.8b, v4.8b, v5.8b // GHASH block 1 - mid
|
|
1218
|
+
pmull v5.1q, v6.1d, v13.1d // GHASH block 2 - low
|
|
1219
|
+
aese v0.16b, v22.16b
|
|
1220
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 4
|
|
1221
|
+
aese v3.16b, v21.16b
|
|
1222
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 3
|
|
1223
|
+
eor v8.8b, v8.8b, v6.8b // GHASH block 2 - mid
|
|
1224
|
+
pmull v4.1q, v4.1d, v17.1d // GHASH block 1 - mid
|
|
1225
|
+
aese v0.16b, v23.16b
|
|
1226
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 5
|
|
1227
|
+
eor v11.16b, v11.16b, v5.16b // GHASH block 2 - low
|
|
1228
|
+
aese v3.16b, v22.16b
|
|
1229
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 4
|
|
1230
|
+
pmull2 v5.1q, v7.2d, v12.2d // GHASH block 3 - high
|
|
1231
|
+
eor v10.16b, v10.16b, v4.16b // GHASH block 1 - mid
|
|
1232
|
+
pmull2 v4.1q, v6.2d, v13.2d // GHASH block 2 - high
|
|
1233
|
+
aese v3.16b, v23.16b
|
|
1234
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 5
|
|
1235
|
+
ins v8.d[1], v8.d[0] // GHASH block 2 - mid
|
|
1236
|
+
aese v2.16b, v21.16b
|
|
1237
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 3
|
|
1238
|
+
aese v1.16b, v21.16b
|
|
1239
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 3
|
|
1240
|
+
eor v9.16b, v9.16b, v4.16b
|
|
1241
|
+
eor v9.16b, v9.16b, v5.16b // GHASH block 2 - high & GHASH block 3 - high
|
|
1242
|
+
pmull v4.1q, v7.1d, v12.1d // GHASH block 3 - low
|
|
1243
|
+
aese v2.16b, v22.16b
|
|
1244
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 4
|
|
1245
|
+
mov d6, v7.d[1] // GHASH block 3 - mid
|
|
1246
|
+
aese v1.16b, v22.16b
|
|
1247
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 4
|
|
1248
|
+
pmull2 v8.1q, v8.2d, v16.2d // GHASH block 2 - mid
|
|
1249
|
+
aese v2.16b, v23.16b
|
|
1250
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 5
|
|
1251
|
+
eor v6.8b, v6.8b, v7.8b // GHASH block 3 - mid
|
|
1252
|
+
aese v1.16b, v23.16b
|
|
1253
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 5
|
|
1254
|
+
aese v3.16b, v24.16b
|
|
1255
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 6
|
|
1256
|
+
eor v10.16b, v10.16b, v8.16b // GHASH block 2 - mid
|
|
1257
|
+
aese v2.16b, v24.16b
|
|
1258
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 6
|
|
1259
|
+
aese v0.16b, v24.16b
|
|
1260
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 6
|
|
1261
|
+
movi v8.8b, #0xc2
|
|
1262
|
+
aese v1.16b, v24.16b
|
|
1263
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 6
|
|
1264
|
+
eor v11.16b, v11.16b, v4.16b // GHASH block 3 - low
|
|
1265
|
+
pmull v6.1q, v6.1d, v16.1d // GHASH block 3 - mid
|
|
1266
|
+
aese v3.16b, v25.16b
|
|
1267
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 7
|
|
1268
|
+
aese v1.16b, v25.16b
|
|
1269
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 7
|
|
1270
|
+
aese v0.16b, v25.16b
|
|
1271
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 7
|
|
1272
|
+
eor v10.16b, v10.16b, v6.16b // GHASH block 3 - mid
|
|
1273
|
+
aese v3.16b, v26.16b
|
|
1274
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 8
|
|
1275
|
+
aese v2.16b, v25.16b
|
|
1276
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 7
|
|
1277
|
+
eor v6.16b, v11.16b, v9.16b // MODULO - karatsuba tidy up
|
|
1278
|
+
aese v1.16b, v26.16b
|
|
1279
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 8
|
|
1280
|
+
aese v0.16b, v26.16b
|
|
1281
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 8
|
|
1282
|
+
shl d8, d8, #56 // mod_constant
|
|
1283
|
+
aese v2.16b, v26.16b
|
|
1284
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 8
|
|
1285
|
+
cmp w17, #12 // setup flags for AES-128/192/256 check
|
|
1286
|
+
b.lt .Ldec_finish_prepretail // branch if AES-128
|
|
1287
|
+
ldp q27, q28, [x8, #144] // load rk9, rk10
|
|
1288
|
+
aese v0.16b, v27.16b
|
|
1289
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 9
|
|
1290
|
+
aese v1.16b, v27.16b
|
|
1291
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 9
|
|
1292
|
+
aese v2.16b, v27.16b
|
|
1293
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 9
|
|
1294
|
+
aese v3.16b, v27.16b
|
|
1295
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 9
|
|
1296
|
+
aese v0.16b, v28.16b
|
|
1297
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 10
|
|
1298
|
+
aese v1.16b, v28.16b
|
|
1299
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 10
|
|
1300
|
+
aese v2.16b, v28.16b
|
|
1301
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 10
|
|
1302
|
+
aese v3.16b, v28.16b
|
|
1303
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 10
|
|
1304
|
+
b.eq .Ldec_finish_prepretail // branch if AES-192
|
|
1305
|
+
ldp q27, q28, [x8, #176] // load rk11, rk12
|
|
1306
|
+
aese v0.16b, v27.16b
|
|
1307
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 11
|
|
1308
|
+
aese v1.16b, v27.16b
|
|
1309
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 11
|
|
1310
|
+
aese v2.16b, v27.16b
|
|
1311
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 11
|
|
1312
|
+
aese v3.16b, v27.16b
|
|
1313
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 11
|
|
1314
|
+
aese v0.16b, v28.16b
|
|
1315
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 12
|
|
1316
|
+
aese v1.16b, v28.16b
|
|
1317
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 12
|
|
1318
|
+
aese v2.16b, v28.16b
|
|
1319
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 12
|
|
1320
|
+
aese v3.16b, v28.16b
|
|
1321
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 12
|
|
1322
|
+
.Ldec_finish_prepretail:
|
|
1323
|
+
eor v10.16b, v10.16b, v6.16b // MODULO - karatsuba tidy up
|
|
1324
|
+
pmull v7.1q, v9.1d, v8.1d // MODULO - top 64b align with mid
|
|
1325
|
+
ext v9.16b, v9.16b, v9.16b, #8 // MODULO - other top alignment
|
|
1326
|
+
eor v10.16b, v10.16b, v7.16b
|
|
1327
|
+
eor v10.16b, v10.16b, v9.16b // MODULO - fold into mid
|
|
1328
|
+
pmull v8.1q, v10.1d, v8.1d // MODULO - mid 64b align with low
|
|
1329
|
+
ext v10.16b, v10.16b, v10.16b, #8 // MODULO - other mid alignment
|
|
1330
|
+
eor v11.16b, v11.16b, v8.16b
|
|
1331
|
+
eor v11.16b, v11.16b, v10.16b // MODULO - fold into low
|
|
1332
|
+
aese v1.16b, v31.16b // AES block 1 - round N-1
|
|
1333
|
+
aese v0.16b, v31.16b // AES block 0 - round N-1
|
|
1334
|
+
aese v3.16b, v31.16b // AES block 3 - round N-1
|
|
1335
|
+
aese v2.16b, v31.16b // AES block 2 - round N-1
|
|
1336
|
+
.Ldec_tail: // TAIL
|
|
1337
|
+
sub x5, x4, x0 // main_end_input_ptr is number of bytes left to process
|
|
1338
|
+
ld1 { v5.16b}, [x0], #16 // AES block 0 - load ciphertext
|
|
1339
|
+
eor v0.16b, v5.16b, v0.16b // AES block 0 - result
|
|
1340
|
+
mov x6, v0.d[0] // AES block 0 - mov low
|
|
1341
|
+
mov x7, v0.d[1] // AES block 0 - mov high
|
|
1342
|
+
ext v8.16b, v11.16b, v11.16b, #8 // prepare final partial tag
|
|
1343
|
+
eor x6, x6, x13 // AES block 0 - round N low
|
|
1344
|
+
eor x7, x7, x14 // AES block 0 - round N high
|
|
1345
|
+
cmp x5, #48
|
|
1346
|
+
b.gt .Ldec_blocks_more_than_3
|
|
1347
|
+
mov v3.16b, v2.16b
|
|
1348
|
+
movi v10.8b, #0
|
|
1349
|
+
movi v11.8b, #0
|
|
1350
|
+
movi v9.8b, #0
|
|
1351
|
+
mov v2.16b, v1.16b
|
|
1352
|
+
cmp x5, #32
|
|
1353
|
+
b.gt .Ldec_blocks_more_than_2
|
|
1354
|
+
mov v3.16b, v1.16b
|
|
1355
|
+
cmp x5, #16
|
|
1356
|
+
b.gt .Ldec_blocks_more_than_1
|
|
1357
|
+
b .Ldec_blocks_less_than_1
|
|
1358
|
+
.Ldec_blocks_more_than_3: // blocks left > 3
|
|
1359
|
+
rev64 v4.16b, v5.16b // GHASH final-3 block
|
|
1360
|
+
ld1 { v5.16b}, [x0], #16 // AES final-2 block - load ciphertext
|
|
1361
|
+
stp x6, x7, [x2], #16 // AES final-3 block - store result
|
|
1362
|
+
mov d10, v17.d[1] // GHASH final-3 block - mid
|
|
1363
|
+
eor v4.16b, v4.16b, v8.16b // feed in partial tag
|
|
1364
|
+
eor v0.16b, v5.16b, v1.16b // AES final-2 block - result
|
|
1365
|
+
mov d22, v4.d[1] // GHASH final-3 block - mid
|
|
1366
|
+
mov x6, v0.d[0] // AES final-2 block - mov low
|
|
1367
|
+
mov x7, v0.d[1] // AES final-2 block - mov high
|
|
1368
|
+
eor v22.8b, v22.8b, v4.8b // GHASH final-3 block - mid
|
|
1369
|
+
movi v8.8b, #0 // suppress further partial tag feed in
|
|
1370
|
+
pmull2 v9.1q, v4.2d, v15.2d // GHASH final-3 block - high
|
|
1371
|
+
pmull v10.1q, v22.1d, v10.1d // GHASH final-3 block - mid
|
|
1372
|
+
eor x6, x6, x13 // AES final-2 block - round N low
|
|
1373
|
+
pmull v11.1q, v4.1d, v15.1d // GHASH final-3 block - low
|
|
1374
|
+
eor x7, x7, x14 // AES final-2 block - round N high
|
|
1375
|
+
.Ldec_blocks_more_than_2: // blocks left > 2
|
|
1376
|
+
rev64 v4.16b, v5.16b // GHASH final-2 block
|
|
1377
|
+
ld1 { v5.16b}, [x0], #16 // AES final-1 block - load ciphertext
|
|
1378
|
+
eor v4.16b, v4.16b, v8.16b // feed in partial tag
|
|
1379
|
+
stp x6, x7, [x2], #16 // AES final-2 block - store result
|
|
1380
|
+
eor v0.16b, v5.16b, v2.16b // AES final-1 block - result
|
|
1381
|
+
mov d22, v4.d[1] // GHASH final-2 block - mid
|
|
1382
|
+
pmull v21.1q, v4.1d, v14.1d // GHASH final-2 block - low
|
|
1383
|
+
pmull2 v20.1q, v4.2d, v14.2d // GHASH final-2 block - high
|
|
1384
|
+
eor v22.8b, v22.8b, v4.8b // GHASH final-2 block - mid
|
|
1385
|
+
mov x6, v0.d[0] // AES final-1 block - mov low
|
|
1386
|
+
mov x7, v0.d[1] // AES final-1 block - mov high
|
|
1387
|
+
eor v11.16b, v11.16b, v21.16b // GHASH final-2 block - low
|
|
1388
|
+
movi v8.8b, #0 // suppress further partial tag feed in
|
|
1389
|
+
pmull v22.1q, v22.1d, v17.1d // GHASH final-2 block - mid
|
|
1390
|
+
eor v9.16b, v9.16b, v20.16b // GHASH final-2 block - high
|
|
1391
|
+
eor x6, x6, x13 // AES final-1 block - round N low
|
|
1392
|
+
eor v10.16b, v10.16b, v22.16b // GHASH final-2 block - mid
|
|
1393
|
+
eor x7, x7, x14 // AES final-1 block - round N high
|
|
1394
|
+
.Ldec_blocks_more_than_1: // blocks left > 1
|
|
1395
|
+
stp x6, x7, [x2], #16 // AES final-1 block - store result
|
|
1396
|
+
rev64 v4.16b, v5.16b // GHASH final-1 block
|
|
1397
|
+
ld1 { v5.16b}, [x0], #16 // AES final block - load ciphertext
|
|
1398
|
+
eor v4.16b, v4.16b, v8.16b // feed in partial tag
|
|
1399
|
+
movi v8.8b, #0 // suppress further partial tag feed in
|
|
1400
|
+
mov d22, v4.d[1] // GHASH final-1 block - mid
|
|
1401
|
+
eor v0.16b, v5.16b, v3.16b // AES final block - result
|
|
1402
|
+
pmull2 v20.1q, v4.2d, v13.2d // GHASH final-1 block - high
|
|
1403
|
+
eor v22.8b, v22.8b, v4.8b // GHASH final-1 block - mid
|
|
1404
|
+
pmull v21.1q, v4.1d, v13.1d // GHASH final-1 block - low
|
|
1405
|
+
mov x6, v0.d[0] // AES final block - mov low
|
|
1406
|
+
ins v22.d[1], v22.d[0] // GHASH final-1 block - mid
|
|
1407
|
+
mov x7, v0.d[1] // AES final block - mov high
|
|
1408
|
+
pmull2 v22.1q, v22.2d, v16.2d // GHASH final-1 block - mid
|
|
1409
|
+
eor x6, x6, x13 // AES final block - round N low
|
|
1410
|
+
eor v11.16b, v11.16b, v21.16b // GHASH final-1 block - low
|
|
1411
|
+
eor v9.16b, v9.16b, v20.16b // GHASH final-1 block - high
|
|
1412
|
+
eor v10.16b, v10.16b, v22.16b // GHASH final-1 block - mid
|
|
1413
|
+
eor x7, x7, x14 // AES final block - round N high
|
|
1414
|
+
.Ldec_blocks_less_than_1: // blocks left <= 1
|
|
1415
|
+
add x10, x10, x1, lsr #7 // Calculate the updated counter based on the number of 16B chunks we processed
|
|
1416
|
+
rev w10, w10
|
|
1417
|
+
str w10, [x16, #12] // store the updated counter
|
|
1418
|
+
and x1, x1, #127 // bit_length %= 128
|
|
1419
|
+
mvn x14, xzr // rkN_h = 0xffffffffffffffff
|
|
1420
|
+
sub x1, x1, #128 // bit_length -= 128
|
|
1421
|
+
mvn x13, xzr // rkN_l = 0xffffffffffffffff
|
|
1422
|
+
ldp x4, x5, [x2] // load existing bytes we need to not overwrite
|
|
1423
|
+
neg x1, x1 // bit_length = 128 - #bits in input (in range [1,128])
|
|
1424
|
+
and x1, x1, #127 // bit_length %= 128
|
|
1425
|
+
lsr x14, x14, x1 // rkN_h is mask for top 64b of last block
|
|
1426
|
+
cmp x1, #64
|
|
1427
|
+
csel x9, x13, x14, lt
|
|
1428
|
+
csel x10, x14, xzr, lt
|
|
1429
|
+
fmov d0, x9 // ctr0b is mask for last block
|
|
1430
|
+
and x6, x6, x9
|
|
1431
|
+
mov v0.d[1], x10
|
|
1432
|
+
bic x4, x4, x9 // mask out low existing bytes
|
|
1433
|
+
bic x5, x5, x10 // mask out high existing bytes
|
|
1434
|
+
orr x6, x6, x4
|
|
1435
|
+
and x7, x7, x10
|
|
1436
|
+
orr x7, x7, x5
|
|
1437
|
+
and v5.16b, v5.16b, v0.16b // possibly partial last block has zeroes in highest bits
|
|
1438
|
+
rev64 v4.16b, v5.16b // GHASH final block
|
|
1439
|
+
eor v4.16b, v4.16b, v8.16b // feed in partial tag
|
|
1440
|
+
pmull v21.1q, v4.1d, v12.1d // GHASH final block - low
|
|
1441
|
+
mov d8, v4.d[1] // GHASH final block - mid
|
|
1442
|
+
eor v8.8b, v8.8b, v4.8b // GHASH final block - mid
|
|
1443
|
+
pmull2 v20.1q, v4.2d, v12.2d // GHASH final block - high
|
|
1444
|
+
pmull v8.1q, v8.1d, v16.1d // GHASH final block - mid
|
|
1445
|
+
eor v9.16b, v9.16b, v20.16b // GHASH final block - high
|
|
1446
|
+
eor v11.16b, v11.16b, v21.16b // GHASH final block - low
|
|
1447
|
+
eor v10.16b, v10.16b, v8.16b // GHASH final block - mid
|
|
1448
|
+
ldr d8, [sp, #128]
|
|
1449
|
+
eor v6.16b, v11.16b, v9.16b // MODULO - karatsuba tidy up
|
|
1450
|
+
eor v10.16b, v10.16b, v6.16b // MODULO - karatsuba tidy up
|
|
1451
|
+
pmull v7.1q, v9.1d, v8.1d // MODULO - top 64b align with mid
|
|
1452
|
+
ext v9.16b, v9.16b, v9.16b, #8 // MODULO - other top alignment
|
|
1453
|
+
eor v10.16b, v10.16b, v7.16b // MODULO - fold into mid
|
|
1454
|
+
eor v10.16b, v10.16b, v9.16b // MODULO - fold into mid
|
|
1455
|
+
pmull v8.1q, v10.1d, v8.1d // MODULO - mid 64b align with low
|
|
1456
|
+
ext v10.16b, v10.16b, v10.16b, #8 // MODULO - other mid alignment
|
|
1457
|
+
eor v11.16b, v11.16b, v8.16b // MODULO - fold into low
|
|
1458
|
+
stp x6, x7, [x2]
|
|
1459
|
+
eor v11.16b, v11.16b, v10.16b // MODULO - fold into low
|
|
1460
|
+
ext v11.16b, v11.16b, v11.16b, #8
|
|
1461
|
+
rev64 v11.16b, v11.16b // Final Tag
|
|
1462
|
+
mov x0, x15
|
|
1463
|
+
st1 { v11.16b }, [x3] // Store final tag
|
|
1464
|
+
ldp x19, x20, [sp, #16]
|
|
1465
|
+
ldp x21, x22, [sp, #32]
|
|
1466
|
+
ldp x23, x24, [sp, #48]
|
|
1467
|
+
ldp d8, d9, [sp, #64]
|
|
1468
|
+
ldp d10, d11, [sp, #80]
|
|
1469
|
+
ldp d12, d13, [sp, #96]
|
|
1470
|
+
ldp d14, d15, [sp, #112]
|
|
1471
|
+
ldp x29, x30, [sp], #224
|
|
1472
|
+
AARCH64_VALIDATE_LINK_REGISTER
|
|
1473
|
+
ret
|
|
1474
|
+
.size aes_gcm_dec_kernel,.-aes_gcm_dec_kernel
|
|
1475
|
+
|
|
1476
|
+
.globl aes_gcm_enc_kernel_eor3
|
|
1477
|
+
.hidden aes_gcm_enc_kernel_eor3
|
|
1478
|
+
.type aes_gcm_enc_kernel_eor3,%function
|
|
1479
|
+
.align 4
|
|
1480
|
+
aes_gcm_enc_kernel_eor3:
|
|
1481
|
+
AARCH64_SIGN_LINK_REGISTER
|
|
1482
|
+
stp x29, x30, [sp, #-224]!
|
|
1483
|
+
mov x29, sp
|
|
1484
|
+
ld1 { v0.16b}, [x4] // .Load initial counter block
|
|
1485
|
+
stp x19, x20, [sp, #16]
|
|
1486
|
+
mov v1.16b, v0.16b // Initialize ctr1-3 from ctr0
|
|
1487
|
+
mov v2.16b, v0.16b
|
|
1488
|
+
mov v3.16b, v0.16b
|
|
1489
|
+
mov x16, x4 // Pointer to counter block in memory
|
|
1490
|
+
mov x8, x5 // Pointer to AES key schedule context
|
|
1491
|
+
stp x21, x22, [sp, #32]
|
|
1492
|
+
// [sp, #48] is unused but allocated to align the stack layout with aes_gcm_dec_kernel_eor3
|
|
1493
|
+
stp d8, d9, [sp, #64] // Save Neon registers
|
|
1494
|
+
stp d10, d11, [sp, #80]
|
|
1495
|
+
stp d12, d13, [sp, #96]
|
|
1496
|
+
stp d14, d15, [sp, #112]
|
|
1497
|
+
ldr w17, [x8, #240] // .Load number of AES rounds
|
|
1498
|
+
add x7, x8, x17, lsl #4 // Calculate pointer to the last round key
|
|
1499
|
+
ldp x13, x14, [x7] // load round N key (for final XOR)
|
|
1500
|
+
ldr q31, [x7, #-16] // load round N-1 key
|
|
1501
|
+
add x4, x0, x1, lsr #3 // Calculate end of input
|
|
1502
|
+
lsr x5, x1, #3 // Total byte length
|
|
1503
|
+
mov x15, x5
|
|
1504
|
+
ldr w12, [x16, #12] // .Load counter's low 32 bits
|
|
1505
|
+
sub x5, x5, #1 // byte_len - 1
|
|
1506
|
+
ldr q18, [x8, #0] // load rk0
|
|
1507
|
+
and x5, x5, #0xffffffffffffffc0 // Align main loop end to a multiple of 64 bytes
|
|
1508
|
+
add x5, x5, x0
|
|
1509
|
+
rev w12, w12 // Reverse for big-endian increment
|
|
1510
|
+
uxtw x10, w12 // Zero extend reversed w12 into x10 for final counter update
|
|
1511
|
+
// Pre-compute this value instead of using two instructions to reconstruct it every iteration
|
|
1512
|
+
mov x21, #0xc200000000000000 // GHASH reduction constant
|
|
1513
|
+
str x21, [sp, #128]
|
|
1514
|
+
// We maintain four copies of ctr values on the stack. Each loop iteration we
|
|
1515
|
+
// store the updated ctr value to the last four bytes (e.g., 160 + 12).
|
|
1516
|
+
// We then load the four values. This avoids a singificant number of
|
|
1517
|
+
// expensive GPR->NEON and NEON->NEON moves. To avoid LDST forwarding we
|
|
1518
|
+
// calculate and store the values one iteration ahead so they have time to
|
|
1519
|
+
// drain before we load them.
|
|
1520
|
+
str q0, [sp, #160] // Store base counter for block 0-3
|
|
1521
|
+
str q0, [sp, #176]
|
|
1522
|
+
str q0, [sp, #192]
|
|
1523
|
+
str q0, [sp, #208]
|
|
1524
|
+
// Since we need the values right away don't go through the stack this first
|
|
1525
|
+
// time. Manually insert the incremented big-endian counter values.
|
|
1526
|
+
rev w20, w12
|
|
1527
|
+
mov v0.s[3], w20 // ctr0 + 0
|
|
1528
|
+
add w20, w12, #1
|
|
1529
|
+
rev w20, w20
|
|
1530
|
+
mov v1.s[3], w20 // ctr0 + 1
|
|
1531
|
+
add w20, w12, #2
|
|
1532
|
+
rev w20, w20
|
|
1533
|
+
mov v2.s[3], w20 // ctr0 + 2
|
|
1534
|
+
add w20, w12, #3
|
|
1535
|
+
rev w20, w20
|
|
1536
|
+
mov v3.s[3], w20 // ctr0 + 3
|
|
1537
|
+
// Calculate the ctr values for the *next* (not current) group of four
|
|
1538
|
+
// blocks. Store the incremented parts to the stack.
|
|
1539
|
+
add w20, w12, #4
|
|
1540
|
+
rev w20, w20
|
|
1541
|
+
str w20, [sp, #172] // ctr0 + 4 for next iter
|
|
1542
|
+
add w20, w12, #5
|
|
1543
|
+
rev w20, w20
|
|
1544
|
+
str w20, [sp, #188] // ctr0 + 5 for next iter
|
|
1545
|
+
add w20, w12, #6
|
|
1546
|
+
rev w20, w20
|
|
1547
|
+
str w20, [sp, #204] // ctr0 + 6 for next iter
|
|
1548
|
+
add w20, w12, #7
|
|
1549
|
+
rev w20, w20
|
|
1550
|
+
str w20, [sp, #220] // ctr0 + 7 for next iter
|
|
1551
|
+
add w12, w12, #8 // Advance counter past these two sets
|
|
1552
|
+
// --- Start AES for first 4 blocks ---
|
|
1553
|
+
aese v0.16b, v18.16b
|
|
1554
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 0
|
|
1555
|
+
ldp q19, q20, [x8, #16] // load rk1, rk2
|
|
1556
|
+
aese v1.16b, v18.16b
|
|
1557
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 0
|
|
1558
|
+
ldp q21, q22, [x8, #48] // load rk3, rk4
|
|
1559
|
+
aese v2.16b, v18.16b
|
|
1560
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 0
|
|
1561
|
+
ldp q23, q24, [x8, #80] // load rk5, rk6
|
|
1562
|
+
aese v3.16b, v18.16b
|
|
1563
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 0
|
|
1564
|
+
ldp q13, q14, [x6, #32] // load H2, H3 (GHASH keys)
|
|
1565
|
+
aese v0.16b, v19.16b
|
|
1566
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 1
|
|
1567
|
+
ldp q25, q26, [x8, #112] // load rk7, rk8
|
|
1568
|
+
aese v1.16b, v19.16b
|
|
1569
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 1
|
|
1570
|
+
aese v2.16b, v19.16b
|
|
1571
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 1
|
|
1572
|
+
aese v3.16b, v19.16b
|
|
1573
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 1
|
|
1574
|
+
aese v0.16b, v20.16b
|
|
1575
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 2
|
|
1576
|
+
ext v14.16b, v14.16b, v14.16b, #8 // Byte swap H3 for GHASH
|
|
1577
|
+
aese v1.16b, v20.16b
|
|
1578
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 2
|
|
1579
|
+
ext v13.16b, v13.16b, v13.16b, #8 // Byte swap H2 for GHASH
|
|
1580
|
+
aese v2.16b, v20.16b
|
|
1581
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 2
|
|
1582
|
+
ldr q15, [x6, #80] // load H4
|
|
1583
|
+
aese v3.16b, v20.16b
|
|
1584
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 2
|
|
1585
|
+
ext v15.16b, v15.16b, v15.16b, #8 // Byte swap H4 for GHASH
|
|
1586
|
+
aese v0.16b, v21.16b
|
|
1587
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 3
|
|
1588
|
+
ld1 { v11.16b}, [x3] // .Load initial GHASH accumulator (T)
|
|
1589
|
+
aese v1.16b, v21.16b
|
|
1590
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 3
|
|
1591
|
+
ext v11.16b, v11.16b, v11.16b, #8 // Byte swap T for GHASH
|
|
1592
|
+
aese v2.16b, v21.16b
|
|
1593
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 3
|
|
1594
|
+
rev64 v11.16b, v11.16b // Correct byte order within 64-bit lanes
|
|
1595
|
+
aese v3.16b, v21.16b
|
|
1596
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 3
|
|
1597
|
+
trn2 v17.2d, v14.2d, v15.2d // Karatsuba key: H4_low | H3_low
|
|
1598
|
+
aese v0.16b, v22.16b
|
|
1599
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 4
|
|
1600
|
+
ldr q12, [x6] // load H1
|
|
1601
|
+
aese v1.16b, v22.16b
|
|
1602
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 4
|
|
1603
|
+
ext v12.16b, v12.16b, v12.16b, #8 // Byte swap H1 for GHASH
|
|
1604
|
+
aese v2.16b, v22.16b
|
|
1605
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 4
|
|
1606
|
+
trn1 v9.2d, v14.2d, v15.2d // Karatsuba key: H4_high | H3_high
|
|
1607
|
+
aese v3.16b, v22.16b
|
|
1608
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 4
|
|
1609
|
+
trn2 v16.2d, v12.2d, v13.2d // Karatsuba key: H2_low | H1_low
|
|
1610
|
+
aese v0.16b, v23.16b
|
|
1611
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 5
|
|
1612
|
+
ldr q30, [x7] // Preload round N key for final EOR
|
|
1613
|
+
aese v1.16b, v23.16b
|
|
1614
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 5
|
|
1615
|
+
aese v3.16b, v23.16b
|
|
1616
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 5
|
|
1617
|
+
aese v2.16b, v23.16b
|
|
1618
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 5
|
|
1619
|
+
aese v0.16b, v24.16b
|
|
1620
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 6
|
|
1621
|
+
aese v1.16b, v24.16b
|
|
1622
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 6
|
|
1623
|
+
aese v2.16b, v24.16b
|
|
1624
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 6
|
|
1625
|
+
aese v3.16b, v24.16b
|
|
1626
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 6
|
|
1627
|
+
aese v0.16b, v25.16b
|
|
1628
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 7
|
|
1629
|
+
aese v1.16b, v25.16b
|
|
1630
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 7
|
|
1631
|
+
aese v2.16b, v25.16b
|
|
1632
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 7
|
|
1633
|
+
aese v3.16b, v25.16b
|
|
1634
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 7
|
|
1635
|
+
aese v0.16b, v26.16b
|
|
1636
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 8
|
|
1637
|
+
aese v1.16b, v26.16b
|
|
1638
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 8
|
|
1639
|
+
aese v2.16b, v26.16b
|
|
1640
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 8
|
|
1641
|
+
aese v3.16b, v26.16b
|
|
1642
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 8
|
|
1643
|
+
cmp x17, #12 // setup flags for AES-128/192/256 check
|
|
1644
|
+
b.lt .Lenc_finish_first_blocks_eor3 // branch if AES-128
|
|
1645
|
+
ldp q27, q28, [x8, #144] // load rk9, rk10
|
|
1646
|
+
aese v1.16b, v27.16b
|
|
1647
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 9
|
|
1648
|
+
aese v2.16b, v27.16b
|
|
1649
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 9
|
|
1650
|
+
aese v3.16b, v27.16b
|
|
1651
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 9
|
|
1652
|
+
aese v0.16b, v27.16b
|
|
1653
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 9
|
|
1654
|
+
aese v1.16b, v28.16b
|
|
1655
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 10
|
|
1656
|
+
aese v2.16b, v28.16b
|
|
1657
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 10
|
|
1658
|
+
aese v3.16b, v28.16b
|
|
1659
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 10
|
|
1660
|
+
aese v0.16b, v28.16b
|
|
1661
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 10
|
|
1662
|
+
b.eq .Lenc_finish_first_blocks_eor3 // branch if AES-192
|
|
1663
|
+
ldp q27, q28, [x8, #176] // load rk11, rk12
|
|
1664
|
+
aese v1.16b, v27.16b
|
|
1665
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 11
|
|
1666
|
+
aese v2.16b, v27.16b
|
|
1667
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 11
|
|
1668
|
+
aese v3.16b, v27.16b
|
|
1669
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 11
|
|
1670
|
+
aese v0.16b, v27.16b
|
|
1671
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 11
|
|
1672
|
+
aese v1.16b, v28.16b
|
|
1673
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 12
|
|
1674
|
+
aese v2.16b, v28.16b
|
|
1675
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 12
|
|
1676
|
+
aese v3.16b, v28.16b
|
|
1677
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 12
|
|
1678
|
+
aese v0.16b, v28.16b
|
|
1679
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 12
|
|
1680
|
+
.Lenc_finish_first_blocks_eor3:
|
|
1681
|
+
cmp x0, x5 // check if we have <= 4 blocks to process in the tail
|
|
1682
|
+
eor v17.16b, v17.16b, v9.16b // Karatsuba key: H3^H4
|
|
1683
|
+
aese v0.16b, v31.16b // AES block 0 - round N-1
|
|
1684
|
+
aese v1.16b, v31.16b // AES block 1 - round N-1
|
|
1685
|
+
aese v2.16b, v31.16b // AES block 2 - round N-1
|
|
1686
|
+
aese v3.16b, v31.16b // AES block 3 - round N-1
|
|
1687
|
+
trn1 v8.2d, v12.2d, v13.2d // Karatsuba key: H2_high | H1_high
|
|
1688
|
+
eor v16.16b, v16.16b, v8.16b // Karatsuba key: H1^H2
|
|
1689
|
+
b.ge .Lenc_tail_eor3 // handle tail if no more full 4-block sets
|
|
1690
|
+
ldp q6, q7, [x0, #32] // AES blocks 2,3 load plaintext
|
|
1691
|
+
ldp q4, q5, [x0], #64 // AES blocks 0,1 load plaintext
|
|
1692
|
+
// Compute and store first 4 ciphertext blocks
|
|
1693
|
+
eor3 v4.16b, v4.16b, v30.16b, v0.16b // AES block 0 - result = PT ^ AES(ctr0)
|
|
1694
|
+
eor3 v5.16b, v5.16b, v30.16b, v1.16b // AES block 1 - result = PT ^ AES(ctr1)
|
|
1695
|
+
eor3 v6.16b, v6.16b, v30.16b, v2.16b // AES block 2 - result = PT ^ AES(ctr2)
|
|
1696
|
+
eor3 v7.16b, v7.16b, v30.16b, v3.16b // AES block 3 - result = PT ^ AES(ctr3)
|
|
1697
|
+
st1 { v4.16b, v5.16b, v6.16b, v7.16b}, [x2], #64 // AES blocks 0-3 - store result
|
|
1698
|
+
// Load counter values for the second iteration from the stack
|
|
1699
|
+
ldp q0, q1, [sp, #160]
|
|
1700
|
+
ldp q2, q3, [sp, #192]
|
|
1701
|
+
// Prepare and store counter values for the third iteration
|
|
1702
|
+
rev w20, w12
|
|
1703
|
+
str w20, [sp, #172] // ctr + 8
|
|
1704
|
+
add w20, w12, #1
|
|
1705
|
+
rev w20, w20
|
|
1706
|
+
str w20, [sp, #188] // ctr + 9
|
|
1707
|
+
add w20, w12, #2
|
|
1708
|
+
rev w20, w20
|
|
1709
|
+
str w20, [sp, #204] // ctr + 10
|
|
1710
|
+
add w20, w12, #3
|
|
1711
|
+
rev w20, w20
|
|
1712
|
+
str w20, [sp, #220] // ctr + 11
|
|
1713
|
+
add w12, w12, #4 // Advance counter base
|
|
1714
|
+
cmp x0, x5 // check if we have <= 4 blocks remaining
|
|
1715
|
+
b.ge .Lenc_prepretail_eor3 // go to prepretail if < 2 full loops left
|
|
1716
|
+
.Lenc_main_loop_eor3: // main loop start (processes 4 blocks per iteration)
|
|
1717
|
+
// --- AES Pipeline for blocks 4k+4 to 4k+7 ---
|
|
1718
|
+
aese v0.16b, v18.16b
|
|
1719
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 0
|
|
1720
|
+
aese v1.16b, v18.16b
|
|
1721
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 0
|
|
1722
|
+
aese v2.16b, v18.16b
|
|
1723
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 0
|
|
1724
|
+
aese v3.16b, v18.16b
|
|
1725
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 0
|
|
1726
|
+
ldr d8, [sp, #128] // .Load GHASH reduction constant
|
|
1727
|
+
aese v0.16b, v19.16b
|
|
1728
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 1
|
|
1729
|
+
aese v1.16b, v19.16b
|
|
1730
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 1
|
|
1731
|
+
aese v2.16b, v19.16b
|
|
1732
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 1
|
|
1733
|
+
aese v3.16b, v19.16b
|
|
1734
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 1
|
|
1735
|
+
// --- GHASH Pipeline (interleaved with AES) for blocks 4k to 4k+3 ---
|
|
1736
|
+
rev64 v4.16b, v4.16b // GHASH block 4k - Byte swap CT
|
|
1737
|
+
rev64 v5.16b, v5.16b // GHASH block 4k+1 - Byte swap CT
|
|
1738
|
+
rev64 v6.16b, v6.16b // GHASH block 4k+2 - Byte swap CT
|
|
1739
|
+
rev64 v7.16b, v7.16b // GHASH block 4k+3 - Byte swap CT
|
|
1740
|
+
aese v0.16b, v20.16b
|
|
1741
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 2
|
|
1742
|
+
ext v11.16b, v11.16b, v11.16b, #8 // GHASH - prepare acc for XOR
|
|
1743
|
+
aese v1.16b, v20.16b
|
|
1744
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 2
|
|
1745
|
+
eor v4.16b, v4.16b, v11.16b // GHASH block 4k - Y_i = CT_i ^ Y_{i-1}
|
|
1746
|
+
aese v2.16b, v20.16b
|
|
1747
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 2
|
|
1748
|
+
pmull v11.1q, v4.1d, v15.1d // GHASH block 4k - low
|
|
1749
|
+
aese v3.16b, v20.16b
|
|
1750
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 2
|
|
1751
|
+
pmull2 v9.1q, v6.2d, v13.2d // GHASH block 4k+2 - high
|
|
1752
|
+
aese v0.16b, v21.16b
|
|
1753
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 3
|
|
1754
|
+
mov d10, v17.d[1] // GHASH block 4k - mid Karatsuba key
|
|
1755
|
+
aese v1.16b, v21.16b
|
|
1756
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 3
|
|
1757
|
+
mov d20, v4.d[1] // GHASH block 4k - mid
|
|
1758
|
+
aese v2.16b, v21.16b
|
|
1759
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 3
|
|
1760
|
+
eor v20.8b, v20.8b, v4.8b // GHASH block 4k - mid
|
|
1761
|
+
aese v3.16b, v21.16b
|
|
1762
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 3
|
|
1763
|
+
mov d21, v5.d[1] // GHASH block 4k+1 - mid
|
|
1764
|
+
aese v0.16b, v22.16b
|
|
1765
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 4
|
|
1766
|
+
eor v21.8b, v21.8b, v5.8b // GHASH block 4k+1 - mid
|
|
1767
|
+
aese v1.16b, v22.16b
|
|
1768
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 4
|
|
1769
|
+
pmull v10.1q, v20.1d, v10.1d // GHASH block 4k - mid
|
|
1770
|
+
aese v2.16b, v22.16b
|
|
1771
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 4
|
|
1772
|
+
pmull v21.1q, v21.1d, v17.1d // GHASH block 4k+1 - mid
|
|
1773
|
+
aese v3.16b, v22.16b
|
|
1774
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 4
|
|
1775
|
+
eor v10.16b, v10.16b, v21.16b // GHASH block 4k+1 - mid
|
|
1776
|
+
aese v0.16b, v23.16b
|
|
1777
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 5
|
|
1778
|
+
ext v22.16b, v22.16b, v6.16b, #8 // GHASH block 4k+2 - mid
|
|
1779
|
+
aese v1.16b, v23.16b
|
|
1780
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 5
|
|
1781
|
+
eor v22.16b, v22.16b, v6.16b // GHASH block 4k+2 - mid
|
|
1782
|
+
aese v2.16b, v23.16b
|
|
1783
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 5
|
|
1784
|
+
pmull2 v22.1q, v22.2d, v16.2d // GHASH block 4k+2 - mid
|
|
1785
|
+
aese v3.16b, v23.16b
|
|
1786
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 5
|
|
1787
|
+
mov d23, v7.d[1] // GHASH block 4k+3 - mid
|
|
1788
|
+
aese v0.16b, v24.16b
|
|
1789
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 6
|
|
1790
|
+
eor v23.8b, v23.8b, v7.8b // GHASH block 4k+3 - mid
|
|
1791
|
+
aese v1.16b, v24.16b
|
|
1792
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 6
|
|
1793
|
+
pmull v23.1q, v23.1d, v16.1d // GHASH block 4k+3 - mid
|
|
1794
|
+
aese v2.16b, v24.16b
|
|
1795
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 6
|
|
1796
|
+
eor3 v10.16b, v10.16b, v22.16b, v23.16b // GHASH block 4k+2/3 - mid
|
|
1797
|
+
aese v3.16b, v24.16b
|
|
1798
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 6
|
|
1799
|
+
pmull2 v22.1q, v4.2d, v15.2d // GHASH block 4k - high
|
|
1800
|
+
aese v0.16b, v25.16b
|
|
1801
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 7
|
|
1802
|
+
pmull2 v21.1q, v7.2d, v12.2d // GHASH block 4k+3 - high
|
|
1803
|
+
eor v22.16b, v22.16b, v21.16b // GHASH block 4k+3 - high
|
|
1804
|
+
aese v1.16b, v25.16b
|
|
1805
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 7
|
|
1806
|
+
pmull2 v23.1q, v5.2d, v14.2d // GHASH block 4k+1 - high
|
|
1807
|
+
aese v2.16b, v25.16b
|
|
1808
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 7
|
|
1809
|
+
pmull v21.1q, v6.1d, v13.1d // GHASH block 4k+2 - low
|
|
1810
|
+
aese v3.16b, v25.16b
|
|
1811
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 7
|
|
1812
|
+
pmull v20.1q, v5.1d, v14.1d // GHASH block 4k+1 - low
|
|
1813
|
+
eor3 v9.16b, v9.16b, v22.16b, v23.16b // GHASH block 4k/1/2/3 - high
|
|
1814
|
+
pmull v22.1q, v7.1d, v12.1d // GHASH block 4k+3 - low
|
|
1815
|
+
ldp q6, q7, [x0, #32]
|
|
1816
|
+
ldp q4, q5, [x0], #64
|
|
1817
|
+
eor v20.16b, v20.16b, v21.16b // GHASH block 4k+1 - low
|
|
1818
|
+
aese v0.16b, v26.16b
|
|
1819
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 8
|
|
1820
|
+
eor3 v11.16b, v11.16b, v22.16b, v20.16b // GHASH block 4k/1/2/3 - low
|
|
1821
|
+
aese v1.16b, v26.16b
|
|
1822
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 8
|
|
1823
|
+
eor3 v10.16b, v10.16b, v9.16b, v11.16b // MODULO - karatsuba tidy up
|
|
1824
|
+
aese v2.16b, v26.16b
|
|
1825
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 8
|
|
1826
|
+
pmull v20.1q, v9.1d, v8.1d // MODULO - top 64b align with mid
|
|
1827
|
+
aese v3.16b, v26.16b
|
|
1828
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 8
|
|
1829
|
+
cmp x17, #12 // setup flags for AES-128/192/256 check
|
|
1830
|
+
b.lt .Lenc_main_loop_continue_eor3 // branch if AES-128
|
|
1831
|
+
ldp q27, q28, [x8, #144] // load rk9, rk10
|
|
1832
|
+
aese v0.16b, v27.16b
|
|
1833
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 9
|
|
1834
|
+
aese v1.16b, v27.16b
|
|
1835
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 9
|
|
1836
|
+
aese v2.16b, v27.16b
|
|
1837
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 9
|
|
1838
|
+
aese v3.16b, v27.16b
|
|
1839
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 9
|
|
1840
|
+
aese v0.16b, v28.16b
|
|
1841
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 10
|
|
1842
|
+
aese v1.16b, v28.16b
|
|
1843
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 10
|
|
1844
|
+
aese v2.16b, v28.16b
|
|
1845
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 10
|
|
1846
|
+
aese v3.16b, v28.16b
|
|
1847
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 10
|
|
1848
|
+
b.eq .Lenc_main_loop_continue_eor3 // branch if AES-192
|
|
1849
|
+
ldp q27, q28, [x8, #176] // load rk11, rk12
|
|
1850
|
+
aese v0.16b, v27.16b
|
|
1851
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 11
|
|
1852
|
+
aese v1.16b, v27.16b
|
|
1853
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 11
|
|
1854
|
+
aese v2.16b, v27.16b
|
|
1855
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 11
|
|
1856
|
+
aese v3.16b, v27.16b
|
|
1857
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 11
|
|
1858
|
+
aese v0.16b, v28.16b
|
|
1859
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 12
|
|
1860
|
+
aese v1.16b, v28.16b
|
|
1861
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 12
|
|
1862
|
+
aese v2.16b, v28.16b
|
|
1863
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 12
|
|
1864
|
+
aese v3.16b, v28.16b
|
|
1865
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 12
|
|
1866
|
+
.Lenc_main_loop_continue_eor3:
|
|
1867
|
+
ext v9.16b, v9.16b, v9.16b, #8 // MODULO - other top alignment
|
|
1868
|
+
eor3 v10.16b, v10.16b, v20.16b, v9.16b // MODULO - fold into mid
|
|
1869
|
+
pmull v9.1q, v10.1d, v8.1d // MODULO - mid 64b align with low
|
|
1870
|
+
ext v20.16b, v10.16b, v10.16b, #8 // MODULO - other mid alignment
|
|
1871
|
+
eor3 v11.16b, v9.16b, v11.16b, v20.16b // MODULO - fold into low
|
|
1872
|
+
aese v0.16b, v31.16b // AES block 4k+4 - round N-1
|
|
1873
|
+
eor3 v4.16b, v4.16b, v30.16b, v0.16b // AES block 4k+4 - result
|
|
1874
|
+
aese v1.16b, v31.16b // AES block 4k+5 - round N-1
|
|
1875
|
+
eor3 v5.16b, v5.16b, v30.16b, v1.16b // AES block 4k+5 - result
|
|
1876
|
+
aese v2.16b, v31.16b // AES block 4k+6 - round N-1
|
|
1877
|
+
eor3 v6.16b, v6.16b, v30.16b, v2.16b // AES block 4k+6 - result
|
|
1878
|
+
aese v3.16b, v31.16b // AES block 4k+7 - round N-1
|
|
1879
|
+
eor3 v7.16b, v7.16b, v30.16b, v3.16b // AES block 4k+7 - result
|
|
1880
|
+
ldp q0, q1, [sp, #160]
|
|
1881
|
+
ldp q2, q3, [sp, #192]
|
|
1882
|
+
// We used these registers as temporaries above so reload the RKs.
|
|
1883
|
+
ldp q20, q21, [x8, #32] // load rk2, rk3
|
|
1884
|
+
ldp q22, q23, [x8, #64] // load rk4, rk5
|
|
1885
|
+
st1 { v4.16b, v5.16b, v6.16b, v7.16b}, [x2], #64 // AES blocks 4k+4-7 - store result
|
|
1886
|
+
rev w20, w12
|
|
1887
|
+
str w20, [sp, #172]
|
|
1888
|
+
add w20, w12, #1
|
|
1889
|
+
rev w20, w20
|
|
1890
|
+
str w20, [sp, #188]
|
|
1891
|
+
add w20, w12, #2
|
|
1892
|
+
rev w20, w20
|
|
1893
|
+
str w20, [sp, #204]
|
|
1894
|
+
add w20, w12, #3
|
|
1895
|
+
rev w20, w20
|
|
1896
|
+
str w20, [sp, #220]
|
|
1897
|
+
add w12, w12, #4
|
|
1898
|
+
cmp x0, x5 // .LOOP_eor3 CONTROL
|
|
1899
|
+
b.lt .Lenc_main_loop_eor3
|
|
1900
|
+
.Lenc_prepretail_eor3: // PREPRETAIL
|
|
1901
|
+
aese v1.16b, v18.16b
|
|
1902
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 0
|
|
1903
|
+
rev64 v6.16b, v6.16b // GHASH block 2
|
|
1904
|
+
aese v2.16b, v18.16b
|
|
1905
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 0
|
|
1906
|
+
aese v0.16b, v18.16b
|
|
1907
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 0
|
|
1908
|
+
rev64 v4.16b, v4.16b // GHASH block 0
|
|
1909
|
+
ext v11.16b, v11.16b, v11.16b, #8 // PRE 0
|
|
1910
|
+
aese v2.16b, v19.16b
|
|
1911
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 1
|
|
1912
|
+
aese v0.16b, v19.16b
|
|
1913
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 1
|
|
1914
|
+
eor v4.16b, v4.16b, v11.16b // PRE 1
|
|
1915
|
+
rev64 v5.16b, v5.16b // GHASH block 1
|
|
1916
|
+
aese v2.16b, v20.16b
|
|
1917
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 2
|
|
1918
|
+
aese v3.16b, v18.16b
|
|
1919
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 0
|
|
1920
|
+
mov d10, v17.d[1] // GHASH block 0 - mid Karatsuba key
|
|
1921
|
+
aese v1.16b, v19.16b
|
|
1922
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 1
|
|
1923
|
+
pmull v11.1q, v4.1d, v15.1d // GHASH block 0 - low
|
|
1924
|
+
mov d8, v4.d[1] // GHASH block 0 - mid
|
|
1925
|
+
pmull2 v9.1q, v4.2d, v15.2d // GHASH block 0 - high
|
|
1926
|
+
aese v2.16b, v21.16b
|
|
1927
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 3
|
|
1928
|
+
aese v1.16b, v20.16b
|
|
1929
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 2
|
|
1930
|
+
eor v8.8b, v8.8b, v4.8b // GHASH block 0 - mid
|
|
1931
|
+
aese v0.16b, v20.16b
|
|
1932
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 2
|
|
1933
|
+
aese v3.16b, v19.16b
|
|
1934
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 1
|
|
1935
|
+
aese v1.16b, v21.16b
|
|
1936
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 3
|
|
1937
|
+
pmull v10.1q, v8.1d, v10.1d // GHASH block 0 - mid
|
|
1938
|
+
pmull2 v4.1q, v5.2d, v14.2d // GHASH block 1 - high
|
|
1939
|
+
pmull v8.1q, v5.1d, v14.1d // GHASH block 1 - low
|
|
1940
|
+
aese v3.16b, v20.16b
|
|
1941
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 2
|
|
1942
|
+
eor v9.16b, v9.16b, v4.16b // GHASH block 1 - high
|
|
1943
|
+
mov d4, v5.d[1] // GHASH block 1 - mid
|
|
1944
|
+
aese v0.16b, v21.16b
|
|
1945
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 3
|
|
1946
|
+
eor v11.16b, v11.16b, v8.16b // GHASH block 1 - low
|
|
1947
|
+
aese v3.16b, v21.16b
|
|
1948
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 3
|
|
1949
|
+
eor v4.8b, v4.8b, v5.8b // GHASH block 1 - mid
|
|
1950
|
+
mov d8, v6.d[1] // GHASH block 2 - mid
|
|
1951
|
+
aese v0.16b, v22.16b
|
|
1952
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 4
|
|
1953
|
+
rev64 v7.16b, v7.16b // GHASH block 3
|
|
1954
|
+
aese v3.16b, v22.16b
|
|
1955
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 4
|
|
1956
|
+
pmull v4.1q, v4.1d, v17.1d // GHASH block 1 - mid
|
|
1957
|
+
eor v8.8b, v8.8b, v6.8b // GHASH block 2 - mid
|
|
1958
|
+
pmull v5.1q, v6.1d, v13.1d // GHASH block 2 - low
|
|
1959
|
+
aese v3.16b, v23.16b
|
|
1960
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 5
|
|
1961
|
+
aese v2.16b, v22.16b
|
|
1962
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 4
|
|
1963
|
+
eor v10.16b, v10.16b, v4.16b // GHASH block 1 - mid
|
|
1964
|
+
pmull2 v4.1q, v6.2d, v13.2d // GHASH block 2 - high
|
|
1965
|
+
eor v11.16b, v11.16b, v5.16b // GHASH block 2 - low
|
|
1966
|
+
ins v8.d[1], v8.d[0] // GHASH block 2 - mid
|
|
1967
|
+
aese v2.16b, v23.16b
|
|
1968
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 5
|
|
1969
|
+
eor v9.16b, v9.16b, v4.16b // GHASH block 2 - high
|
|
1970
|
+
mov d4, v7.d[1] // GHASH block 3 - mid
|
|
1971
|
+
aese v1.16b, v22.16b
|
|
1972
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 4
|
|
1973
|
+
pmull2 v8.1q, v8.2d, v16.2d // GHASH block 2 - mid
|
|
1974
|
+
eor v4.8b, v4.8b, v7.8b // GHASH block 3 - mid
|
|
1975
|
+
pmull2 v5.1q, v7.2d, v12.2d // GHASH block 3 - high
|
|
1976
|
+
aese v1.16b, v23.16b
|
|
1977
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 5
|
|
1978
|
+
pmull v4.1q, v4.1d, v16.1d // GHASH block 3 - mid
|
|
1979
|
+
eor v10.16b, v10.16b, v8.16b // GHASH block 2 - mid
|
|
1980
|
+
aese v0.16b, v23.16b
|
|
1981
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 5
|
|
1982
|
+
aese v1.16b, v24.16b
|
|
1983
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 6
|
|
1984
|
+
aese v2.16b, v24.16b
|
|
1985
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 6
|
|
1986
|
+
aese v0.16b, v24.16b
|
|
1987
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 6
|
|
1988
|
+
aese v3.16b, v24.16b
|
|
1989
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 6
|
|
1990
|
+
aese v1.16b, v25.16b
|
|
1991
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 7
|
|
1992
|
+
eor v9.16b, v9.16b, v5.16b // GHASH block 3 - high
|
|
1993
|
+
aese v0.16b, v25.16b
|
|
1994
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 7
|
|
1995
|
+
aese v3.16b, v25.16b
|
|
1996
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 7
|
|
1997
|
+
ldr d8, [sp, #128]
|
|
1998
|
+
aese v1.16b, v26.16b
|
|
1999
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 8
|
|
2000
|
+
eor v10.16b, v10.16b, v4.16b // GHASH block 3 - mid
|
|
2001
|
+
pmull v6.1q, v7.1d, v12.1d // GHASH block 3 - low
|
|
2002
|
+
aese v3.16b, v26.16b
|
|
2003
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 8
|
|
2004
|
+
cmp x17, #12 // setup flags for AES-128/192/256 check
|
|
2005
|
+
aese v0.16b, v26.16b
|
|
2006
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 8
|
|
2007
|
+
eor v11.16b, v11.16b, v6.16b // GHASH block 3 - low
|
|
2008
|
+
aese v2.16b, v25.16b
|
|
2009
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 7
|
|
2010
|
+
eor v10.16b, v10.16b, v9.16b // karatsuba tidy up
|
|
2011
|
+
aese v2.16b, v26.16b
|
|
2012
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 8
|
|
2013
|
+
pmull v4.1q, v9.1d, v8.1d
|
|
2014
|
+
ext v9.16b, v9.16b, v9.16b, #8
|
|
2015
|
+
eor v10.16b, v10.16b, v11.16b
|
|
2016
|
+
b.lt .Lenc_finish_prepretail_eor3 // branch if AES-128
|
|
2017
|
+
ldp q27, q28, [x8, #144] // load rk9, rk10
|
|
2018
|
+
aese v0.16b, v27.16b
|
|
2019
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 9
|
|
2020
|
+
aese v1.16b, v27.16b
|
|
2021
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 9
|
|
2022
|
+
aese v2.16b, v27.16b
|
|
2023
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 9
|
|
2024
|
+
aese v3.16b, v27.16b
|
|
2025
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 9
|
|
2026
|
+
aese v0.16b, v28.16b
|
|
2027
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 10
|
|
2028
|
+
aese v1.16b, v28.16b
|
|
2029
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 10
|
|
2030
|
+
aese v2.16b, v28.16b
|
|
2031
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 10
|
|
2032
|
+
aese v3.16b, v28.16b
|
|
2033
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 10
|
|
2034
|
+
b.eq .Lenc_finish_prepretail_eor3 // branch if AES-192
|
|
2035
|
+
ldp q27, q28, [x8, #176] // load rk11, rk12
|
|
2036
|
+
aese v0.16b, v27.16b
|
|
2037
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 11
|
|
2038
|
+
aese v1.16b, v27.16b
|
|
2039
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 11
|
|
2040
|
+
aese v2.16b, v27.16b
|
|
2041
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 11
|
|
2042
|
+
aese v3.16b, v27.16b
|
|
2043
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 11
|
|
2044
|
+
aese v0.16b, v28.16b
|
|
2045
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 12
|
|
2046
|
+
aese v1.16b, v28.16b
|
|
2047
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 12
|
|
2048
|
+
aese v2.16b, v28.16b
|
|
2049
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 12
|
|
2050
|
+
aese v3.16b, v28.16b
|
|
2051
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 12
|
|
2052
|
+
.Lenc_finish_prepretail_eor3:
|
|
2053
|
+
aese v0.16b, v31.16b // AES block 0 - round N-1
|
|
2054
|
+
aese v1.16b, v31.16b // AES block 1 - round N-1
|
|
2055
|
+
aese v2.16b, v31.16b // AES block 2 - round N-1
|
|
2056
|
+
aese v3.16b, v31.16b // AES block 3 - round N-1
|
|
2057
|
+
eor3 v10.16b, v10.16b, v4.16b, v9.16b
|
|
2058
|
+
pmull v4.1q, v10.1d, v8.1d
|
|
2059
|
+
ext v10.16b, v10.16b, v10.16b, #8
|
|
2060
|
+
eor3 v11.16b, v11.16b, v4.16b, v10.16b
|
|
2061
|
+
.Lenc_tail_eor3: // TAIL: Process remaining 0 to 3 blocks
|
|
2062
|
+
ext v8.16b, v11.16b, v11.16b, #8 // Save current GHASH state for partial tag feed-in
|
|
2063
|
+
sub x5, x4, x0 // main_end_input_ptr is number of bytes left to process
|
|
2064
|
+
ldp x6, x7, [x0], #16 // AES block 0 - load plaintext
|
|
2065
|
+
eor x6, x6, x13 // AES block 0 - round N low
|
|
2066
|
+
eor x7, x7, x14 // AES block 0 - round N high
|
|
2067
|
+
cmp x5, #48
|
|
2068
|
+
fmov d4, x6 // AES block 0 - mov low
|
|
2069
|
+
fmov v4.d[1], x7 // AES block 0 - mov high
|
|
2070
|
+
eor v5.16b, v4.16b, v0.16b // AES block 0 - result
|
|
2071
|
+
b.gt .Lenc_blocks_more_than_3_eor3
|
|
2072
|
+
cmp x5, #32
|
|
2073
|
+
mov v3.16b, v2.16b
|
|
2074
|
+
movi v11.8b, #0
|
|
2075
|
+
movi v9.8b, #0
|
|
2076
|
+
mov v2.16b, v1.16b
|
|
2077
|
+
movi v10.8b, #0
|
|
2078
|
+
b.gt .Lenc_blocks_more_than_2_eor3
|
|
2079
|
+
mov v3.16b, v1.16b
|
|
2080
|
+
cmp x5, #16
|
|
2081
|
+
b.gt .Lenc_blocks_more_than_1_eor3
|
|
2082
|
+
b .Lenc_blocks_less_than_1_eor3
|
|
2083
|
+
.Lenc_blocks_more_than_3_eor3: // blocks left > 3
|
|
2084
|
+
st1 { v5.16b}, [x2], #16 // AES final-2 block - store result
|
|
2085
|
+
ldp x6, x7, [x0], #16 // AES final-2 block - load input low & high
|
|
2086
|
+
rev64 v4.16b, v5.16b // GHASH final-3 block
|
|
2087
|
+
eor x6, x6, x13 // AES final-2 block - round N low
|
|
2088
|
+
eor v4.16b, v4.16b, v8.16b // feed in partial tag
|
|
2089
|
+
eor x7, x7, x14 // AES final-2 block - round N high
|
|
2090
|
+
mov d22, v4.d[1] // GHASH final-3 block - mid
|
|
2091
|
+
fmov d5, x6 // AES final-2 block - mov low
|
|
2092
|
+
fmov v5.d[1], x7 // AES final-2 block - mov high
|
|
2093
|
+
eor v22.8b, v22.8b, v4.8b // GHASH final-3 block - mid
|
|
2094
|
+
movi v8.8b, #0 // suppress further partial tag feed in
|
|
2095
|
+
mov d10, v17.d[1] // GHASH final-3 block - mid
|
|
2096
|
+
pmull v11.1q, v4.1d, v15.1d // GHASH final-3 block - low
|
|
2097
|
+
pmull2 v9.1q, v4.2d, v15.2d // GHASH final-3 block - high
|
|
2098
|
+
pmull v10.1q, v22.1d, v10.1d // GHASH final-3 block - mid
|
|
2099
|
+
eor v5.16b, v5.16b, v1.16b // AES final-2 block - result
|
|
2100
|
+
.Lenc_blocks_more_than_2_eor3: // blocks left > 2
|
|
2101
|
+
st1 { v5.16b}, [x2], #16 // AES final-2 block - store result
|
|
2102
|
+
ldp x6, x7, [x0], #16 // AES final-1 block - load input low & high
|
|
2103
|
+
rev64 v4.16b, v5.16b // GHASH final-2 block
|
|
2104
|
+
eor x6, x6, x13 // AES final-1 block - round N low
|
|
2105
|
+
eor v4.16b, v4.16b, v8.16b // feed in partial tag
|
|
2106
|
+
fmov d5, x6 // AES final-1 block - mov low
|
|
2107
|
+
eor x7, x7, x14 // AES final-1 block - round N high
|
|
2108
|
+
fmov v5.d[1], x7 // AES final-1 block - mov high
|
|
2109
|
+
movi v8.8b, #0 // suppress further partial tag feed in
|
|
2110
|
+
pmull2 v20.1q, v4.2d, v14.2d // GHASH final-2 block - high
|
|
2111
|
+
mov d22, v4.d[1] // GHASH final-2 block - mid
|
|
2112
|
+
pmull v21.1q, v4.1d, v14.1d // GHASH final-2 block - low
|
|
2113
|
+
eor v22.8b, v22.8b, v4.8b // GHASH final-2 block - mid
|
|
2114
|
+
eor v5.16b, v5.16b, v2.16b // AES final-1 block - result
|
|
2115
|
+
eor v9.16b, v9.16b, v20.16b // GHASH final-2 block - high
|
|
2116
|
+
pmull v22.1q, v22.1d, v17.1d // GHASH final-2 block - mid
|
|
2117
|
+
eor v11.16b, v11.16b, v21.16b // GHASH final-2 block - low
|
|
2118
|
+
eor v10.16b, v10.16b, v22.16b // GHASH final-2 block - mid
|
|
2119
|
+
.Lenc_blocks_more_than_1_eor3: // blocks left > 1
|
|
2120
|
+
st1 { v5.16b}, [x2], #16 // AES final-1 block - store result
|
|
2121
|
+
rev64 v4.16b, v5.16b // GHASH final-1 block: Byte Swap CT
|
|
2122
|
+
ldp x6, x7, [x0], #16 // AES final block - load plaintext
|
|
2123
|
+
eor v4.16b, v4.16b, v8.16b // Feed in partial tag
|
|
2124
|
+
movi v8.8b, #0 // Clear for next block
|
|
2125
|
+
eor x6, x6, x13 // AES final block - round N low
|
|
2126
|
+
mov d22, v4.d[1] // GHASH final-1 block - mid
|
|
2127
|
+
pmull2 v20.1q, v4.2d, v13.2d // GHASH final-1 block - high
|
|
2128
|
+
eor x7, x7, x14 // AES final block - round N high
|
|
2129
|
+
eor v22.8b, v22.8b, v4.8b // GHASH final-1 block - mid
|
|
2130
|
+
eor v9.16b, v9.16b, v20.16b // GHASH final-1 block - high
|
|
2131
|
+
ins v22.d[1], v22.d[0] // GHASH final-1 block - mid
|
|
2132
|
+
fmov d5, x6 // AES final block - mov low
|
|
2133
|
+
fmov v5.d[1], x7 // AES final block - mov high
|
|
2134
|
+
pmull2 v22.1q, v22.2d, v16.2d // GHASH final-1 block - mid
|
|
2135
|
+
pmull v21.1q, v4.1d, v13.1d // GHASH final-1 block - low
|
|
2136
|
+
eor v5.16b, v5.16b, v3.16b // AES final block - result
|
|
2137
|
+
eor v10.16b, v10.16b, v22.16b // GHASH final-1 block - mid
|
|
2138
|
+
eor v11.16b, v11.16b, v21.16b // GHASH final-1 block - low
|
|
2139
|
+
.Lenc_blocks_less_than_1_eor3: // .Last partial block handling
|
|
2140
|
+
add x10, x10, x1, lsr #7 // Calculate the updated counter based on the number of 16B chunks we processed
|
|
2141
|
+
rev w10, w10
|
|
2142
|
+
str w10, [x16, #12] // store the updated counter
|
|
2143
|
+
and x1, x1, #127 // bit_length %= 128
|
|
2144
|
+
mvn x13, xzr // Mask for low 64 bits
|
|
2145
|
+
sub x1, x1, #128 //
|
|
2146
|
+
neg x1, x1 // Valid bits in the last block (1-128)
|
|
2147
|
+
ldr q18, [x2] // .Load destination for merging
|
|
2148
|
+
mvn x14, xzr // Mask for high 64 bits
|
|
2149
|
+
and x1, x1, #127 // bit_length %= 128
|
|
2150
|
+
lsr x14, x14, x1 // rkN_h is mask for top 64b of last block
|
|
2151
|
+
cmp x1, #64
|
|
2152
|
+
csel x6, x13, x14, lt
|
|
2153
|
+
csel x7, x14, xzr, lt
|
|
2154
|
+
fmov d0, x6 // ctr0d is mask for last block
|
|
2155
|
+
fmov v0.d[1], x7
|
|
2156
|
+
and v5.16b, v5.16b, v0.16b // Mask out unused bits of the last CT block
|
|
2157
|
+
rev64 v4.16b, v5.16b // GHASH final block - byte swap
|
|
2158
|
+
eor v4.16b, v4.16b, v8.16b // Feed in partial tag
|
|
2159
|
+
bif v5.16b, v18.16b, v0.16b // Bitwise Insert: merge with existing data at output_ptr
|
|
2160
|
+
pmull2 v20.1q, v4.2d, v12.2d // GHASH final block - high
|
|
2161
|
+
mov d8, v4.d[1] // GHASH final block - mid
|
|
2162
|
+
pmull v21.1q, v4.1d, v12.1d // GHASH final block - low
|
|
2163
|
+
eor v9.16b, v9.16b, v20.16b // GHASH final block - high
|
|
2164
|
+
eor v8.8b, v8.8b, v4.8b // GHASH final block - mid
|
|
2165
|
+
pmull v8.1q, v8.1d, v16.1d // GHASH final block - mid
|
|
2166
|
+
eor v11.16b, v11.16b, v21.16b // GHASH final block - low
|
|
2167
|
+
eor v10.16b, v10.16b, v8.16b // GHASH final block - mid
|
|
2168
|
+
eor v4.16b, v11.16b, v9.16b // MODULO - karatsuba tidy up
|
|
2169
|
+
fmov d8, x21
|
|
2170
|
+
eor v10.16b, v10.16b, v4.16b // MODULO - karatsuba tidy up
|
|
2171
|
+
pmull v7.1q, v9.1d, v8.1d // MODULO - top 64b align with mid
|
|
2172
|
+
ext v9.16b, v9.16b, v9.16b, #8 // MODULO - other top alignment
|
|
2173
|
+
eor3 v10.16b, v10.16b, v7.16b, v9.16b // MODULO - fold into mid
|
|
2174
|
+
pmull v9.1q, v10.1d, v8.1d // MODULO - mid 64b align with low
|
|
2175
|
+
ext v10.16b, v10.16b, v10.16b, #8 // MODULO - other mid alignment
|
|
2176
|
+
st1 { v5.16b}, [x2] // store all 16B
|
|
2177
|
+
eor3 v11.16b, v11.16b, v9.16b, v10.16b // MODULO - fold into low
|
|
2178
|
+
ext v11.16b, v11.16b, v11.16b, #8 // Byte swap GHASH result
|
|
2179
|
+
rev64 v11.16b, v11.16b // Final Tag
|
|
2180
|
+
mov x0, x15
|
|
2181
|
+
st1 { v11.16b }, [x3] // Store final tag
|
|
2182
|
+
ldp x19, x20, [sp, #16]
|
|
2183
|
+
ldp x21, x22, [sp, #32]
|
|
2184
|
+
ldp d8, d9, [sp, #64]
|
|
2185
|
+
ldp d10, d11, [sp, #80]
|
|
2186
|
+
ldp d12, d13, [sp, #96]
|
|
2187
|
+
ldp d14, d15, [sp, #112]
|
|
2188
|
+
ldp x29, x30, [sp], #224
|
|
2189
|
+
AARCH64_VALIDATE_LINK_REGISTER
|
|
2190
|
+
ret
|
|
2191
|
+
.size aes_gcm_enc_kernel_eor3,.-aes_gcm_enc_kernel_eor3
|
|
2192
|
+
.globl aes_gcm_dec_kernel_eor3
|
|
2193
|
+
.hidden aes_gcm_dec_kernel_eor3
|
|
2194
|
+
.type aes_gcm_dec_kernel_eor3,%function
|
|
2195
|
+
.align 4
|
|
2196
|
+
aes_gcm_dec_kernel_eor3:
|
|
2197
|
+
AARCH64_SIGN_LINK_REGISTER
|
|
2198
|
+
stp x29, x30, [sp, #-224]!
|
|
2199
|
+
mov x29, sp
|
|
2200
|
+
stp x19, x20, [sp, #16]
|
|
2201
|
+
ld1 { v0.16b}, [x4]
|
|
2202
|
+
mov v1.16b, v0.16b
|
|
2203
|
+
mov v2.16b, v0.16b
|
|
2204
|
+
mov v3.16b, v0.16b
|
|
2205
|
+
mov x16, x4
|
|
2206
|
+
mov x8, x5
|
|
2207
|
+
stp x21, x22, [sp, #32]
|
|
2208
|
+
stp x23, x24, [sp, #48]
|
|
2209
|
+
stp d8, d9, [sp, #64]
|
|
2210
|
+
stp d10, d11, [sp, #80]
|
|
2211
|
+
stp d12, d13, [sp, #96]
|
|
2212
|
+
stp d14, d15, [sp, #112]
|
|
2213
|
+
ldr w17, [x8, #240] // .Load number of AES rounds
|
|
2214
|
+
add x19, x8, x17, lsl #4 // borrow input_l1 for last key
|
|
2215
|
+
ldp x13, x14, [x19] // load round N keys
|
|
2216
|
+
ldr q31, [x19, #-16] // load round N-1 keys
|
|
2217
|
+
add x4, x0, x1, lsr #3 // end_input_ptr
|
|
2218
|
+
lsr x5, x1, #3 // byte_len
|
|
2219
|
+
mov x15, x5
|
|
2220
|
+
ldr w9, [x16, #12] // .Load scalar 32-bit counter (CTR)
|
|
2221
|
+
sub x5, x5, #1 // byte_len - 1
|
|
2222
|
+
ldr q18, [x8, #0] // load rk0
|
|
2223
|
+
and x5, x5, #0xffffffffffffffc0 // number of bytes to be processed in main loop (at least 1 byte must be handled by tail)
|
|
2224
|
+
add x5, x5, x0
|
|
2225
|
+
rev w9, w9 // Reverse it once for big-endian incrementing
|
|
2226
|
+
uxtw x10, w9 // Zero extend reversed w9 into x10
|
|
2227
|
+
str q0, [sp, #160]
|
|
2228
|
+
str q0, [sp, #176]
|
|
2229
|
+
str q0, [sp, #192]
|
|
2230
|
+
str q0, [sp, #208]
|
|
2231
|
+
rev w20, w9
|
|
2232
|
+
mov v0.s[3], w20
|
|
2233
|
+
add w20, w9, #1
|
|
2234
|
+
rev w20, w20
|
|
2235
|
+
mov v1.s[3], w20
|
|
2236
|
+
add w20, w9, #2
|
|
2237
|
+
rev w20, w20
|
|
2238
|
+
mov v2.s[3], w20
|
|
2239
|
+
add w20, w9, #3
|
|
2240
|
+
rev w20, w20
|
|
2241
|
+
mov v3.s[3], w20
|
|
2242
|
+
add w20, w9, #4
|
|
2243
|
+
rev w20, w20
|
|
2244
|
+
str w20, [sp, #172]
|
|
2245
|
+
add w20, w9, #5
|
|
2246
|
+
rev w20, w20
|
|
2247
|
+
str w20, [sp, #188]
|
|
2248
|
+
add w20, w9, #6
|
|
2249
|
+
rev w20, w20
|
|
2250
|
+
str w20, [sp, #204]
|
|
2251
|
+
add w20, w9, #7
|
|
2252
|
+
rev w20, w20
|
|
2253
|
+
str w20, [sp, #220]
|
|
2254
|
+
add w9, w9, #8
|
|
2255
|
+
// Pre-compute this value instead of using two instructions for moving and then shifting in the main loop
|
|
2256
|
+
mov x21, #0xc200000000000000
|
|
2257
|
+
str x21, [sp, #128]
|
|
2258
|
+
aese v0.16b, v18.16b
|
|
2259
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 0
|
|
2260
|
+
ldp q19, q20, [x8, #16] // load rk1, rk2
|
|
2261
|
+
aese v1.16b, v18.16b
|
|
2262
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 0
|
|
2263
|
+
ldp q21, q22, [x8, #48] // load rk3, rk4
|
|
2264
|
+
aese v2.16b, v18.16b
|
|
2265
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 0
|
|
2266
|
+
ldp q23, q24, [x8, #80] // load rk5, rk6
|
|
2267
|
+
aese v3.16b, v18.16b
|
|
2268
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 0
|
|
2269
|
+
ldp q13, q14, [x6, #32] // load h2, h3
|
|
2270
|
+
aese v0.16b, v19.16b
|
|
2271
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 1
|
|
2272
|
+
ldp q25, q26, [x8, #112] // load rk7, rk8
|
|
2273
|
+
aese v1.16b, v19.16b
|
|
2274
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 1
|
|
2275
|
+
aese v2.16b, v19.16b
|
|
2276
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 1
|
|
2277
|
+
aese v3.16b, v19.16b
|
|
2278
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 1
|
|
2279
|
+
aese v0.16b, v20.16b
|
|
2280
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 2
|
|
2281
|
+
ext v14.16b, v14.16b, v14.16b, #8
|
|
2282
|
+
aese v1.16b, v20.16b
|
|
2283
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 2
|
|
2284
|
+
ext v13.16b, v13.16b, v13.16b, #8
|
|
2285
|
+
ldr q15, [x6, #80] // load h4
|
|
2286
|
+
aese v2.16b, v20.16b
|
|
2287
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 2
|
|
2288
|
+
aese v3.16b, v20.16b
|
|
2289
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 2
|
|
2290
|
+
ext v15.16b, v15.16b, v15.16b, #8
|
|
2291
|
+
aese v0.16b, v21.16b
|
|
2292
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 3
|
|
2293
|
+
ld1 { v11.16b}, [x3]
|
|
2294
|
+
aese v1.16b, v21.16b
|
|
2295
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 3
|
|
2296
|
+
ext v11.16b, v11.16b, v11.16b, #8
|
|
2297
|
+
aese v2.16b, v21.16b
|
|
2298
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 3
|
|
2299
|
+
rev64 v11.16b, v11.16b
|
|
2300
|
+
aese v3.16b, v21.16b
|
|
2301
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 3
|
|
2302
|
+
trn2 v17.2d, v14.2d, v15.2d // h4l | h3l
|
|
2303
|
+
aese v0.16b, v22.16b
|
|
2304
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 4
|
|
2305
|
+
ldr q12, [x6] // load h1
|
|
2306
|
+
aese v1.16b, v22.16b
|
|
2307
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 4
|
|
2308
|
+
ext v12.16b, v12.16b, v12.16b, #8
|
|
2309
|
+
aese v2.16b, v22.16b
|
|
2310
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 4
|
|
2311
|
+
trn1 v9.2d, v14.2d, v15.2d // h4h | h3h
|
|
2312
|
+
aese v3.16b, v22.16b
|
|
2313
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 4
|
|
2314
|
+
trn2 v16.2d, v12.2d, v13.2d // h2l | h1l
|
|
2315
|
+
aese v0.16b, v23.16b
|
|
2316
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 5
|
|
2317
|
+
aese v1.16b, v23.16b
|
|
2318
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 5
|
|
2319
|
+
aese v3.16b, v23.16b
|
|
2320
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 5
|
|
2321
|
+
aese v2.16b, v23.16b
|
|
2322
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 5
|
|
2323
|
+
aese v0.16b, v24.16b
|
|
2324
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 6
|
|
2325
|
+
aese v1.16b, v24.16b
|
|
2326
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 6
|
|
2327
|
+
aese v2.16b, v24.16b
|
|
2328
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 6
|
|
2329
|
+
aese v3.16b, v24.16b
|
|
2330
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 6
|
|
2331
|
+
aese v0.16b, v25.16b
|
|
2332
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 7
|
|
2333
|
+
aese v1.16b, v25.16b
|
|
2334
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 7
|
|
2335
|
+
aese v2.16b, v25.16b
|
|
2336
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 7
|
|
2337
|
+
aese v3.16b, v25.16b
|
|
2338
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 7
|
|
2339
|
+
aese v0.16b, v26.16b
|
|
2340
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 8
|
|
2341
|
+
aese v1.16b, v26.16b
|
|
2342
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 8
|
|
2343
|
+
aese v2.16b, v26.16b
|
|
2344
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 8
|
|
2345
|
+
aese v3.16b, v26.16b
|
|
2346
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 8
|
|
2347
|
+
cmp x17, #12 // setup flags for AES-128/192/256 check
|
|
2348
|
+
b.lt .Ldec_finish_first_blocks_eor3 // branch if AES-128
|
|
2349
|
+
ldp q27, q28, [x8, #144] // load rk9, rk10
|
|
2350
|
+
aese v0.16b, v27.16b
|
|
2351
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 9
|
|
2352
|
+
aese v1.16b, v27.16b
|
|
2353
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 9
|
|
2354
|
+
aese v2.16b, v27.16b
|
|
2355
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 9
|
|
2356
|
+
aese v3.16b, v27.16b
|
|
2357
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 9
|
|
2358
|
+
aese v0.16b, v28.16b
|
|
2359
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 10
|
|
2360
|
+
aese v1.16b, v28.16b
|
|
2361
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 10
|
|
2362
|
+
aese v2.16b, v28.16b
|
|
2363
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 10
|
|
2364
|
+
aese v3.16b, v28.16b
|
|
2365
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 10
|
|
2366
|
+
b.eq .Ldec_finish_first_blocks_eor3 // branch if AES-192
|
|
2367
|
+
ldp q27, q28, [x8, #176] // load rk11, rk12
|
|
2368
|
+
aese v0.16b, v27.16b
|
|
2369
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 11
|
|
2370
|
+
aese v1.16b, v27.16b
|
|
2371
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 11
|
|
2372
|
+
aese v2.16b, v27.16b
|
|
2373
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 11
|
|
2374
|
+
aese v3.16b, v27.16b
|
|
2375
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 11
|
|
2376
|
+
aese v0.16b, v28.16b
|
|
2377
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 12
|
|
2378
|
+
aese v1.16b, v28.16b
|
|
2379
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 12
|
|
2380
|
+
aese v2.16b, v28.16b
|
|
2381
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 12
|
|
2382
|
+
aese v3.16b, v28.16b
|
|
2383
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 12
|
|
2384
|
+
.Ldec_finish_first_blocks_eor3:
|
|
2385
|
+
ldr q27, [x19] // load rkN
|
|
2386
|
+
cmp x0, x5 // check if we have <= 4 blocks
|
|
2387
|
+
eor v17.16b, v17.16b, v9.16b // h4k | h3k
|
|
2388
|
+
aese v1.16b, v31.16b // AES block 1 - round N-1
|
|
2389
|
+
aese v2.16b, v31.16b // AES block 2 - round N-1
|
|
2390
|
+
aese v3.16b, v31.16b // AES block 3 - round N-1
|
|
2391
|
+
aese v0.16b, v31.16b // AES block 0 - round N-1
|
|
2392
|
+
trn1 v8.2d, v12.2d, v13.2d // h2h | h1h
|
|
2393
|
+
eor v16.16b, v16.16b, v8.16b // h2k | h1k
|
|
2394
|
+
b.ge .Ldec_tail_eor3 // handle tail
|
|
2395
|
+
// Setup for AES blocks 0-3 is done purely on NEON side instead of mixing NEON and scalar instructions.
|
|
2396
|
+
// This is because the final result of the AES block needs to be EORd with the final round key
|
|
2397
|
+
// value (v30). This avoids several fmovs.
|
|
2398
|
+
ldp q6, q7, [x0, #32] // AES blocks 2,3 load ciphertext
|
|
2399
|
+
ldp q4, q5, [x0], #64 // AES blocks 0,1 load ciphertext
|
|
2400
|
+
eor3 v0.16b, v4.16b, v0.16b, v27.16b // AES block 0 - result
|
|
2401
|
+
eor3 v1.16b, v5.16b, v1.16b, v27.16b // AES block 1 - result
|
|
2402
|
+
eor3 v2.16b, v6.16b, v2.16b, v27.16b // AES block 2 - result
|
|
2403
|
+
eor3 v3.16b, v7.16b, v3.16b, v27.16b // AES block 3 - result
|
|
2404
|
+
st1 { v0.16b, v1.16b, v2.16b, v3.16b}, [x2], #64 // AES blocks 0-3 - store result
|
|
2405
|
+
ldr q0, [sp, #160]
|
|
2406
|
+
ldr q1, [sp, #176]
|
|
2407
|
+
ldr q2, [sp, #192]
|
|
2408
|
+
ldr q3, [sp, #208]
|
|
2409
|
+
rev w20, w9
|
|
2410
|
+
str w20, [sp, #172]
|
|
2411
|
+
add w20, w9, #1
|
|
2412
|
+
rev w20, w20
|
|
2413
|
+
str w20, [sp, #188]
|
|
2414
|
+
add w20, w9, #2
|
|
2415
|
+
rev w20, w20
|
|
2416
|
+
str w20, [sp, #204]
|
|
2417
|
+
add w20, w9, #3
|
|
2418
|
+
rev w20, w20
|
|
2419
|
+
str w20, [sp, #220]
|
|
2420
|
+
add w9, w9, #4
|
|
2421
|
+
cmp x0, x5 // check if we have <= 4 blocks
|
|
2422
|
+
b.ge .Ldec_prepretail_eor3 // do prepretail
|
|
2423
|
+
.Ldec_main_loop_eor3: // main loop start
|
|
2424
|
+
aese v0.16b, v18.16b
|
|
2425
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 0
|
|
2426
|
+
aese v1.16b, v18.16b
|
|
2427
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 0
|
|
2428
|
+
aese v2.16b, v18.16b
|
|
2429
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 0
|
|
2430
|
+
aese v3.16b, v18.16b
|
|
2431
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 0
|
|
2432
|
+
aese v0.16b, v19.16b
|
|
2433
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 1
|
|
2434
|
+
aese v1.16b, v19.16b
|
|
2435
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 1
|
|
2436
|
+
aese v2.16b, v19.16b
|
|
2437
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 1
|
|
2438
|
+
aese v3.16b, v19.16b
|
|
2439
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 1
|
|
2440
|
+
rev64 v4.16b, v4.16b // GHASH block 4k
|
|
2441
|
+
rev64 v5.16b, v5.16b // GHASH block 4k+1
|
|
2442
|
+
rev64 v6.16b, v6.16b // GHASH block 4k+2
|
|
2443
|
+
rev64 v7.16b, v7.16b // GHASH block 4k+3
|
|
2444
|
+
aese v0.16b, v20.16b
|
|
2445
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 2
|
|
2446
|
+
ext v11.16b, v11.16b, v11.16b, #8 // PRE 0
|
|
2447
|
+
aese v1.16b, v20.16b
|
|
2448
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 2
|
|
2449
|
+
eor v4.16b, v4.16b, v11.16b // PRE 1
|
|
2450
|
+
aese v2.16b, v20.16b
|
|
2451
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 2
|
|
2452
|
+
pmull v11.1q, v4.1d, v15.1d // GHASH block 4k - low
|
|
2453
|
+
aese v3.16b, v20.16b
|
|
2454
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 2
|
|
2455
|
+
pmull2 v9.1q, v4.2d, v15.2d // GHASH block 4k - high
|
|
2456
|
+
aese v0.16b, v21.16b
|
|
2457
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 3
|
|
2458
|
+
mov d10, v17.d[1] // GHASH block 4k - mid
|
|
2459
|
+
aese v1.16b, v21.16b
|
|
2460
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 3
|
|
2461
|
+
mov d8, v4.d[1] // GHASH block 4k - mid
|
|
2462
|
+
aese v2.16b, v21.16b
|
|
2463
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 3
|
|
2464
|
+
eor v8.8b, v8.8b, v4.8b // GHASH block 4k - mid
|
|
2465
|
+
aese v3.16b, v21.16b
|
|
2466
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 3
|
|
2467
|
+
aese v0.16b, v22.16b
|
|
2468
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 4
|
|
2469
|
+
pmull2 v4.1q, v5.2d, v14.2d // GHASH block 4k+1 - high
|
|
2470
|
+
aese v1.16b, v22.16b
|
|
2471
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 4
|
|
2472
|
+
eor v9.16b, v9.16b, v4.16b // GHASH block 4k+1 - high
|
|
2473
|
+
aese v2.16b, v22.16b
|
|
2474
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 4
|
|
2475
|
+
mov d4, v5.d[1] // GHASH block 4k+1 - mid
|
|
2476
|
+
aese v3.16b, v22.16b
|
|
2477
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 4
|
|
2478
|
+
pmull v10.1q, v8.1d, v10.1d // GHASH block 4k - mid
|
|
2479
|
+
aese v0.16b, v23.16b
|
|
2480
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 5
|
|
2481
|
+
pmull v8.1q, v5.1d, v14.1d // GHASH block 4k+1 - low
|
|
2482
|
+
aese v1.16b, v23.16b
|
|
2483
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 5
|
|
2484
|
+
eor v4.8b, v4.8b, v5.8b // GHASH block 4k+1 - mid
|
|
2485
|
+
aese v3.16b, v23.16b
|
|
2486
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 5
|
|
2487
|
+
aese v2.16b, v23.16b
|
|
2488
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 5
|
|
2489
|
+
pmull v5.1q, v6.1d, v13.1d // GHASH block 4k+2 - low
|
|
2490
|
+
aese v0.16b, v24.16b
|
|
2491
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 6
|
|
2492
|
+
eor3 v11.16b, v11.16b, v8.16b, v5.16b // GHASH block 4k+1 - low & GHASH block 4k+2 - low
|
|
2493
|
+
aese v1.16b, v24.16b
|
|
2494
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 6
|
|
2495
|
+
mov d8, v6.d[1] // GHASH block 4k+2 - mid
|
|
2496
|
+
aese v2.16b, v24.16b
|
|
2497
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 6
|
|
2498
|
+
eor v8.8b, v8.8b, v6.8b // GHASH block 4k+2 - mid
|
|
2499
|
+
pmull v4.1q, v4.1d, v17.1d // GHASH block 4k+1 - mid
|
|
2500
|
+
ins v8.d[1], v8.d[0] // GHASH block 4k+2 - mid
|
|
2501
|
+
aese v3.16b, v24.16b
|
|
2502
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 6
|
|
2503
|
+
pmull2 v28.1q, v6.2d, v13.2d // GHASH block 4k+2 - high
|
|
2504
|
+
mov d6, v7.d[1] // GHASH block 4k+3 - mid
|
|
2505
|
+
aese v0.16b, v25.16b
|
|
2506
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 7
|
|
2507
|
+
pmull2 v8.1q, v8.2d, v16.2d // GHASH block 4k+2 - mid
|
|
2508
|
+
aese v1.16b, v25.16b
|
|
2509
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 7
|
|
2510
|
+
pmull v27.1q, v7.1d, v12.1d // GHASH block 4k+3 - low
|
|
2511
|
+
aese v2.16b, v25.16b
|
|
2512
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 7
|
|
2513
|
+
eor3 v10.16b, v10.16b, v4.16b, v8.16b // GHASH block 4k+1 - mid & GHASH block 4k+2 - mid
|
|
2514
|
+
aese v3.16b, v25.16b
|
|
2515
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 7
|
|
2516
|
+
pmull2 v5.1q, v7.2d, v12.2d // GHASH block 4k+3 - high
|
|
2517
|
+
eor v6.8b, v6.8b, v7.8b // GHASH block 4k+3 - mid
|
|
2518
|
+
eor3 v9.16b, v9.16b, v28.16b, v5.16b // GHASH block 4k+2 - high & GHASH block 4k+3 - high
|
|
2519
|
+
aese v0.16b, v26.16b
|
|
2520
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 8
|
|
2521
|
+
aese v1.16b, v26.16b
|
|
2522
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 8
|
|
2523
|
+
aese v2.16b, v26.16b
|
|
2524
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 8
|
|
2525
|
+
pmull v6.1q, v6.1d, v16.1d // GHASH block 4k+3 - mid
|
|
2526
|
+
ldr d8, [sp, #128]
|
|
2527
|
+
aese v3.16b, v26.16b
|
|
2528
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 8
|
|
2529
|
+
pmull v7.1q, v9.1d, v8.1d // MODULO - top 64b align with mid
|
|
2530
|
+
eor3 v10.16b, v10.16b, v6.16b, v7.16b // GHASH block 4k+3 - mid & MODULO - fold into mid
|
|
2531
|
+
eor v11.16b, v11.16b, v27.16b // GHASH block 4k+3 - low
|
|
2532
|
+
eor v6.16b, v11.16b, v9.16b // MODULO - karatsuba tidy up
|
|
2533
|
+
ext v9.16b, v9.16b, v9.16b, #8 // MODULO - other top alignment
|
|
2534
|
+
eor3 v10.16b, v10.16b, v6.16b, v9.16b // MODULO - karatsuba tidy up & MODULO - fold into mid
|
|
2535
|
+
pmull v8.1q, v10.1d, v8.1d // MODULO - mid 64b align with low
|
|
2536
|
+
ext v10.16b, v10.16b, v10.16b, #8 // MODULO - other mid alignment
|
|
2537
|
+
eor3 v11.16b, v11.16b, v8.16b, v10.16b // MODULO - fold into low
|
|
2538
|
+
cmp w17, #12 // setup flags for AES-128/192/256 check
|
|
2539
|
+
b.lt .Ldec_main_loop_continue_eor3 // branch if AES-128
|
|
2540
|
+
ldp q27, q28, [x8, #144] // load rk9, rk10
|
|
2541
|
+
aese v0.16b, v27.16b
|
|
2542
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 9
|
|
2543
|
+
aese v1.16b, v27.16b
|
|
2544
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 9
|
|
2545
|
+
aese v2.16b, v27.16b
|
|
2546
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 9
|
|
2547
|
+
aese v3.16b, v27.16b
|
|
2548
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 9
|
|
2549
|
+
aese v0.16b, v28.16b
|
|
2550
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 10
|
|
2551
|
+
aese v1.16b, v28.16b
|
|
2552
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 10
|
|
2553
|
+
aese v2.16b, v28.16b
|
|
2554
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 10
|
|
2555
|
+
aese v3.16b, v28.16b
|
|
2556
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 10
|
|
2557
|
+
b.eq .Ldec_main_loop_continue_eor3 // branch if AES-192
|
|
2558
|
+
ldp q27, q28, [x8, #176] // load rk11, rk12
|
|
2559
|
+
aese v0.16b, v27.16b
|
|
2560
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 11
|
|
2561
|
+
aese v1.16b, v27.16b
|
|
2562
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 11
|
|
2563
|
+
aese v2.16b, v27.16b
|
|
2564
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 11
|
|
2565
|
+
aese v3.16b, v27.16b
|
|
2566
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 11
|
|
2567
|
+
aese v0.16b, v28.16b
|
|
2568
|
+
aesmc v0.16b, v0.16b // AES block 4k+4 - round 12
|
|
2569
|
+
aese v1.16b, v28.16b
|
|
2570
|
+
aesmc v1.16b, v1.16b // AES block 4k+5 - round 12
|
|
2571
|
+
aese v2.16b, v28.16b
|
|
2572
|
+
aesmc v2.16b, v2.16b // AES block 4k+6 - round 12
|
|
2573
|
+
aese v3.16b, v28.16b
|
|
2574
|
+
aesmc v3.16b, v3.16b // AES block 4k+7 - round 12
|
|
2575
|
+
.Ldec_main_loop_continue_eor3:
|
|
2576
|
+
ldr q27, [x19] // load rkN
|
|
2577
|
+
ldp q6, q7, [x0, #32] // AES blocks 2,3 load ciphertext
|
|
2578
|
+
ldp q4, q5, [x0], #64 // AES blocks 0,1 load ciphertext
|
|
2579
|
+
aese v0.16b, v31.16b // AES block 4k+4 - round N-1
|
|
2580
|
+
eor3 v0.16b, v4.16b, v0.16b, v27.16b // AES block 4k+4 - result
|
|
2581
|
+
aese v1.16b, v31.16b // AES block 4k+5 - round N-1
|
|
2582
|
+
eor3 v1.16b, v5.16b, v1.16b, v27.16b // AES block 4k+5 - result
|
|
2583
|
+
aese v2.16b, v31.16b // AES block 4k+6 - round N-1
|
|
2584
|
+
eor3 v2.16b, v6.16b, v2.16b, v27.16b // AES block 4k+6 - result
|
|
2585
|
+
aese v3.16b, v31.16b // AES block 4k+7 - round N-1
|
|
2586
|
+
eor3 v3.16b, v7.16b, v3.16b, v27.16b // AES block 4k+7 - result
|
|
2587
|
+
st1 { v0.16b, v1.16b, v2.16b, v3.16b}, [x2], #64 // AES blocks 4k+4-7 - store result
|
|
2588
|
+
ldr q0, [sp, #160]
|
|
2589
|
+
ldr q1, [sp, #176]
|
|
2590
|
+
ldr q2, [sp, #192]
|
|
2591
|
+
ldr q3, [sp, #208]
|
|
2592
|
+
rev w20, w9
|
|
2593
|
+
str w20, [sp, #172]
|
|
2594
|
+
add w20, w9, #1
|
|
2595
|
+
rev w20, w20
|
|
2596
|
+
str w20, [sp, #188]
|
|
2597
|
+
add w20, w9, #2
|
|
2598
|
+
rev w20, w20
|
|
2599
|
+
str w20, [sp, #204]
|
|
2600
|
+
add w20, w9, #3
|
|
2601
|
+
rev w20, w20
|
|
2602
|
+
str w20, [sp, #220]
|
|
2603
|
+
add w9, w9, #4
|
|
2604
|
+
cmp x0, x5
|
|
2605
|
+
b.lt .Ldec_main_loop_eor3
|
|
2606
|
+
.Ldec_prepretail_eor3: // PREPRETAIL
|
|
2607
|
+
rev64 v4.16b, v4.16b // GHASH block 0
|
|
2608
|
+
rev64 v5.16b, v5.16b // GHASH block 1
|
|
2609
|
+
ext v11.16b, v11.16b, v11.16b, #8 // PRE 0
|
|
2610
|
+
aese v0.16b, v18.16b
|
|
2611
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 0
|
|
2612
|
+
aese v1.16b, v18.16b
|
|
2613
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 0
|
|
2614
|
+
eor v4.16b, v4.16b, v11.16b // PRE 1
|
|
2615
|
+
rev64 v6.16b, v6.16b // GHASH block 2
|
|
2616
|
+
aese v1.16b, v19.16b
|
|
2617
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 1
|
|
2618
|
+
pmull v11.1q, v4.1d, v15.1d // GHASH block 0 - low
|
|
2619
|
+
mov d8, v4.d[1] // GHASH block 0 - mid
|
|
2620
|
+
pmull2 v9.1q, v4.2d, v15.2d // GHASH block 0 - high
|
|
2621
|
+
aese v2.16b, v18.16b
|
|
2622
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 0
|
|
2623
|
+
mov d10, v17.d[1] // GHASH block 0 - mid
|
|
2624
|
+
aese v0.16b, v19.16b
|
|
2625
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 1
|
|
2626
|
+
eor v8.8b, v8.8b, v4.8b // GHASH block 0 - mid
|
|
2627
|
+
pmull2 v4.1q, v5.2d, v14.2d // GHASH block 1 - high
|
|
2628
|
+
aese v2.16b, v19.16b
|
|
2629
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 1
|
|
2630
|
+
rev64 v7.16b, v7.16b // GHASH block 3
|
|
2631
|
+
aese v3.16b, v18.16b
|
|
2632
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 0
|
|
2633
|
+
pmull v10.1q, v8.1d, v10.1d // GHASH block 0 - mid
|
|
2634
|
+
eor v9.16b, v9.16b, v4.16b // GHASH block 1 - high
|
|
2635
|
+
pmull v8.1q, v5.1d, v14.1d // GHASH block 1 - low
|
|
2636
|
+
aese v3.16b, v19.16b
|
|
2637
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 1
|
|
2638
|
+
mov d4, v5.d[1] // GHASH block 1 - mid
|
|
2639
|
+
aese v0.16b, v20.16b
|
|
2640
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 2
|
|
2641
|
+
aese v1.16b, v20.16b
|
|
2642
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 2
|
|
2643
|
+
eor v11.16b, v11.16b, v8.16b // GHASH block 1 - low
|
|
2644
|
+
aese v2.16b, v20.16b
|
|
2645
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 2
|
|
2646
|
+
aese v0.16b, v21.16b
|
|
2647
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 3
|
|
2648
|
+
mov d8, v6.d[1] // GHASH block 2 - mid
|
|
2649
|
+
aese v3.16b, v20.16b
|
|
2650
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 2
|
|
2651
|
+
eor v4.8b, v4.8b, v5.8b // GHASH block 1 - mid
|
|
2652
|
+
pmull v5.1q, v6.1d, v13.1d // GHASH block 2 - low
|
|
2653
|
+
aese v0.16b, v22.16b
|
|
2654
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 4
|
|
2655
|
+
aese v3.16b, v21.16b
|
|
2656
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 3
|
|
2657
|
+
eor v8.8b, v8.8b, v6.8b // GHASH block 2 - mid
|
|
2658
|
+
pmull v4.1q, v4.1d, v17.1d // GHASH block 1 - mid
|
|
2659
|
+
aese v0.16b, v23.16b
|
|
2660
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 5
|
|
2661
|
+
eor v11.16b, v11.16b, v5.16b // GHASH block 2 - low
|
|
2662
|
+
aese v3.16b, v22.16b
|
|
2663
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 4
|
|
2664
|
+
pmull2 v5.1q, v7.2d, v12.2d // GHASH block 3 - high
|
|
2665
|
+
eor v10.16b, v10.16b, v4.16b // GHASH block 1 - mid
|
|
2666
|
+
pmull2 v4.1q, v6.2d, v13.2d // GHASH block 2 - high
|
|
2667
|
+
aese v3.16b, v23.16b
|
|
2668
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 5
|
|
2669
|
+
ins v8.d[1], v8.d[0] // GHASH block 2 - mid
|
|
2670
|
+
aese v2.16b, v21.16b
|
|
2671
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 3
|
|
2672
|
+
aese v1.16b, v21.16b
|
|
2673
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 3
|
|
2674
|
+
eor3 v9.16b, v9.16b, v4.16b, v5.16b // GHASH block 2 - high & GHASH block 3 - high
|
|
2675
|
+
pmull v4.1q, v7.1d, v12.1d // GHASH block 3 - low
|
|
2676
|
+
aese v2.16b, v22.16b
|
|
2677
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 4
|
|
2678
|
+
mov d6, v7.d[1] // GHASH block 3 - mid
|
|
2679
|
+
aese v1.16b, v22.16b
|
|
2680
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 4
|
|
2681
|
+
pmull2 v8.1q, v8.2d, v16.2d // GHASH block 2 - mid
|
|
2682
|
+
aese v2.16b, v23.16b
|
|
2683
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 5
|
|
2684
|
+
eor v6.8b, v6.8b, v7.8b // GHASH block 3 - mid
|
|
2685
|
+
aese v1.16b, v23.16b
|
|
2686
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 5
|
|
2687
|
+
aese v3.16b, v24.16b
|
|
2688
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 6
|
|
2689
|
+
eor v10.16b, v10.16b, v8.16b // GHASH block 2 - mid
|
|
2690
|
+
aese v2.16b, v24.16b
|
|
2691
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 6
|
|
2692
|
+
aese v0.16b, v24.16b
|
|
2693
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 6
|
|
2694
|
+
movi v8.8b, #0xc2
|
|
2695
|
+
aese v1.16b, v24.16b
|
|
2696
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 6
|
|
2697
|
+
eor v11.16b, v11.16b, v4.16b // GHASH block 3 - low
|
|
2698
|
+
pmull v6.1q, v6.1d, v16.1d // GHASH block 3 - mid
|
|
2699
|
+
aese v3.16b, v25.16b
|
|
2700
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 7
|
|
2701
|
+
aese v1.16b, v25.16b
|
|
2702
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 7
|
|
2703
|
+
aese v0.16b, v25.16b
|
|
2704
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 7
|
|
2705
|
+
eor v10.16b, v10.16b, v6.16b // GHASH block 3 - mid
|
|
2706
|
+
aese v3.16b, v26.16b
|
|
2707
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 8
|
|
2708
|
+
aese v2.16b, v25.16b
|
|
2709
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 7
|
|
2710
|
+
eor v6.16b, v11.16b, v9.16b // MODULO - karatsuba tidy up
|
|
2711
|
+
aese v1.16b, v26.16b
|
|
2712
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 8
|
|
2713
|
+
aese v0.16b, v26.16b
|
|
2714
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 8
|
|
2715
|
+
shl d8, d8, #56 // mod_constant
|
|
2716
|
+
aese v2.16b, v26.16b
|
|
2717
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 8
|
|
2718
|
+
cmp w17, #12 // setup flags for AES-128/192/256 check
|
|
2719
|
+
b.lt .Ldec_finish_prepretail_eor3 // branch if AES-128
|
|
2720
|
+
ldp q27, q28, [x8, #144] // load rk9, rk10
|
|
2721
|
+
aese v0.16b, v27.16b
|
|
2722
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 9
|
|
2723
|
+
aese v1.16b, v27.16b
|
|
2724
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 9
|
|
2725
|
+
aese v2.16b, v27.16b
|
|
2726
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 9
|
|
2727
|
+
aese v3.16b, v27.16b
|
|
2728
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 9
|
|
2729
|
+
aese v0.16b, v28.16b
|
|
2730
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 10
|
|
2731
|
+
aese v1.16b, v28.16b
|
|
2732
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 10
|
|
2733
|
+
aese v2.16b, v28.16b
|
|
2734
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 10
|
|
2735
|
+
aese v3.16b, v28.16b
|
|
2736
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 10
|
|
2737
|
+
b.eq .Ldec_finish_prepretail_eor3 // branch if AES-192
|
|
2738
|
+
ldp q27, q28, [x8, #176] // load rk11, rk12
|
|
2739
|
+
aese v0.16b, v27.16b
|
|
2740
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 11
|
|
2741
|
+
aese v1.16b, v27.16b
|
|
2742
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 11
|
|
2743
|
+
aese v2.16b, v27.16b
|
|
2744
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 11
|
|
2745
|
+
aese v3.16b, v27.16b
|
|
2746
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 11
|
|
2747
|
+
aese v0.16b, v28.16b
|
|
2748
|
+
aesmc v0.16b, v0.16b // AES block 0 - round 12
|
|
2749
|
+
aese v1.16b, v28.16b
|
|
2750
|
+
aesmc v1.16b, v1.16b // AES block 1 - round 12
|
|
2751
|
+
aese v2.16b, v28.16b
|
|
2752
|
+
aesmc v2.16b, v2.16b // AES block 2 - round 12
|
|
2753
|
+
aese v3.16b, v28.16b
|
|
2754
|
+
aesmc v3.16b, v3.16b // AES block 3 - round 12
|
|
2755
|
+
.Ldec_finish_prepretail_eor3:
|
|
2756
|
+
eor v10.16b, v10.16b, v6.16b // MODULO - karatsuba tidy up
|
|
2757
|
+
pmull v7.1q, v9.1d, v8.1d // MODULO - top 64b align with mid
|
|
2758
|
+
ext v9.16b, v9.16b, v9.16b, #8 // MODULO - other top alignment
|
|
2759
|
+
eor3 v10.16b, v10.16b, v7.16b, v9.16b // MODULO - fold into mid
|
|
2760
|
+
pmull v8.1q, v10.1d, v8.1d // MODULO - mid 64b align with low
|
|
2761
|
+
ext v10.16b, v10.16b, v10.16b, #8 // MODULO - other mid alignment
|
|
2762
|
+
eor3 v11.16b, v11.16b, v8.16b, v10.16b // MODULO - fold into low
|
|
2763
|
+
aese v1.16b, v31.16b // AES block 1 - round N-1
|
|
2764
|
+
aese v0.16b, v31.16b // AES block 0 - round N-1
|
|
2765
|
+
aese v3.16b, v31.16b // AES block 3 - round N-1
|
|
2766
|
+
aese v2.16b, v31.16b // AES block 2 - round N-1
|
|
2767
|
+
.Ldec_tail_eor3: // TAIL
|
|
2768
|
+
sub x5, x4, x0 // main_end_input_ptr is number of bytes left to process
|
|
2769
|
+
ld1 { v5.16b}, [x0], #16 // AES block 0 - load ciphertext
|
|
2770
|
+
eor v0.16b, v5.16b, v0.16b // AES block 0 - result
|
|
2771
|
+
mov x6, v0.d[0] // AES block 0 - mov low
|
|
2772
|
+
mov x7, v0.d[1] // AES block 0 - mov high
|
|
2773
|
+
ext v8.16b, v11.16b, v11.16b, #8 // prepare final partial tag
|
|
2774
|
+
eor x6, x6, x13 // AES block 0 - round N low
|
|
2775
|
+
eor x7, x7, x14 // AES block 0 - round N high
|
|
2776
|
+
cmp x5, #48
|
|
2777
|
+
b.gt .Ldec_blocks_more_than_3_eor3
|
|
2778
|
+
mov v3.16b, v2.16b
|
|
2779
|
+
movi v10.8b, #0
|
|
2780
|
+
movi v11.8b, #0
|
|
2781
|
+
movi v9.8b, #0
|
|
2782
|
+
mov v2.16b, v1.16b
|
|
2783
|
+
cmp x5, #32
|
|
2784
|
+
b.gt .Ldec_blocks_more_than_2_eor3
|
|
2785
|
+
mov v3.16b, v1.16b
|
|
2786
|
+
cmp x5, #16
|
|
2787
|
+
b.gt .Ldec_blocks_more_than_1_eor3
|
|
2788
|
+
b .Ldec_blocks_less_than_1_eor3
|
|
2789
|
+
.Ldec_blocks_more_than_3_eor3: // blocks left > 3
|
|
2790
|
+
rev64 v4.16b, v5.16b // GHASH final-3 block
|
|
2791
|
+
ld1 { v5.16b}, [x0], #16 // AES final-2 block - load ciphertext
|
|
2792
|
+
stp x6, x7, [x2], #16 // AES final-3 block - store result
|
|
2793
|
+
mov d10, v17.d[1] // GHASH final-3 block - mid
|
|
2794
|
+
eor v4.16b, v4.16b, v8.16b // feed in partial tag
|
|
2795
|
+
eor v0.16b, v5.16b, v1.16b // AES final-2 block - result
|
|
2796
|
+
mov d22, v4.d[1] // GHASH final-3 block - mid
|
|
2797
|
+
mov x6, v0.d[0] // AES final-2 block - mov low
|
|
2798
|
+
mov x7, v0.d[1] // AES final-2 block - mov high
|
|
2799
|
+
eor v22.8b, v22.8b, v4.8b // GHASH final-3 block - mid
|
|
2800
|
+
movi v8.8b, #0 // suppress further partial tag feed in
|
|
2801
|
+
pmull2 v9.1q, v4.2d, v15.2d // GHASH final-3 block - high
|
|
2802
|
+
pmull v10.1q, v22.1d, v10.1d // GHASH final-3 block - mid
|
|
2803
|
+
eor x6, x6, x13 // AES final-2 block - round N low
|
|
2804
|
+
pmull v11.1q, v4.1d, v15.1d // GHASH final-3 block - low
|
|
2805
|
+
eor x7, x7, x14 // AES final-2 block - round N high
|
|
2806
|
+
.Ldec_blocks_more_than_2_eor3: // blocks left > 2
|
|
2807
|
+
rev64 v4.16b, v5.16b // GHASH final-2 block
|
|
2808
|
+
ld1 { v5.16b}, [x0], #16 // AES final-1 block - load ciphertext
|
|
2809
|
+
eor v4.16b, v4.16b, v8.16b // feed in partial tag
|
|
2810
|
+
stp x6, x7, [x2], #16 // AES final-2 block - store result
|
|
2811
|
+
eor v0.16b, v5.16b, v2.16b // AES final-1 block - result
|
|
2812
|
+
mov d22, v4.d[1] // GHASH final-2 block - mid
|
|
2813
|
+
pmull v21.1q, v4.1d, v14.1d // GHASH final-2 block - low
|
|
2814
|
+
pmull2 v20.1q, v4.2d, v14.2d // GHASH final-2 block - high
|
|
2815
|
+
eor v22.8b, v22.8b, v4.8b // GHASH final-2 block - mid
|
|
2816
|
+
mov x6, v0.d[0] // AES final-1 block - mov low
|
|
2817
|
+
mov x7, v0.d[1] // AES final-1 block - mov high
|
|
2818
|
+
eor v11.16b, v11.16b, v21.16b // GHASH final-2 block - low
|
|
2819
|
+
movi v8.8b, #0 // suppress further partial tag feed in
|
|
2820
|
+
pmull v22.1q, v22.1d, v17.1d // GHASH final-2 block - mid
|
|
2821
|
+
eor v9.16b, v9.16b, v20.16b // GHASH final-2 block - high
|
|
2822
|
+
eor x6, x6, x13 // AES final-1 block - round N low
|
|
2823
|
+
eor v10.16b, v10.16b, v22.16b // GHASH final-2 block - mid
|
|
2824
|
+
eor x7, x7, x14 // AES final-1 block - round N high
|
|
2825
|
+
.Ldec_blocks_more_than_1_eor3: // blocks left > 1
|
|
2826
|
+
stp x6, x7, [x2], #16 // AES final-1 block - store result
|
|
2827
|
+
rev64 v4.16b, v5.16b // GHASH final-1 block
|
|
2828
|
+
ld1 { v5.16b}, [x0], #16 // AES final block - load ciphertext
|
|
2829
|
+
eor v4.16b, v4.16b, v8.16b // feed in partial tag
|
|
2830
|
+
movi v8.8b, #0 // suppress further partial tag feed in
|
|
2831
|
+
mov d22, v4.d[1] // GHASH final-1 block - mid
|
|
2832
|
+
eor v0.16b, v5.16b, v3.16b // AES final block - result
|
|
2833
|
+
pmull2 v20.1q, v4.2d, v13.2d // GHASH final-1 block - high
|
|
2834
|
+
eor v22.8b, v22.8b, v4.8b // GHASH final-1 block - mid
|
|
2835
|
+
pmull v21.1q, v4.1d, v13.1d // GHASH final-1 block - low
|
|
2836
|
+
mov x6, v0.d[0] // AES final block - mov low
|
|
2837
|
+
ins v22.d[1], v22.d[0] // GHASH final-1 block - mid
|
|
2838
|
+
mov x7, v0.d[1] // AES final block - mov high
|
|
2839
|
+
pmull2 v22.1q, v22.2d, v16.2d // GHASH final-1 block - mid
|
|
2840
|
+
eor x6, x6, x13 // AES final block - round N low
|
|
2841
|
+
eor v11.16b, v11.16b, v21.16b // GHASH final-1 block - low
|
|
2842
|
+
eor v9.16b, v9.16b, v20.16b // GHASH final-1 block - high
|
|
2843
|
+
eor v10.16b, v10.16b, v22.16b // GHASH final-1 block - mid
|
|
2844
|
+
eor x7, x7, x14 // AES final block - round N high
|
|
2845
|
+
.Ldec_blocks_less_than_1_eor3: // blocks left <= 1
|
|
2846
|
+
add x10, x10, x1, lsr #7 // Calculate the updated counter based on the number of 16B chunks we processed
|
|
2847
|
+
rev w10, w10
|
|
2848
|
+
str w10, [x16, #12] // store the updated counter
|
|
2849
|
+
and x1, x1, #127 // bit_length %= 128
|
|
2850
|
+
mvn x14, xzr // rkN_h = 0xffffffffffffffff
|
|
2851
|
+
sub x1, x1, #128 // bit_length -= 128
|
|
2852
|
+
mvn x13, xzr // rkN_l = 0xffffffffffffffff
|
|
2853
|
+
ldp x4, x5, [x2] // load existing bytes we need to not overwrite
|
|
2854
|
+
neg x1, x1 // bit_length = 128 - #bits in input (in range [1,128])
|
|
2855
|
+
and x1, x1, #127 // bit_length %= 128
|
|
2856
|
+
lsr x14, x14, x1 // rkN_h is mask for top 64b of last block
|
|
2857
|
+
cmp x1, #64
|
|
2858
|
+
csel x9, x13, x14, lt
|
|
2859
|
+
csel x10, x14, xzr, lt
|
|
2860
|
+
fmov d0, x9 // ctr0b is mask for last block
|
|
2861
|
+
and x6, x6, x9
|
|
2862
|
+
mov v0.d[1], x10
|
|
2863
|
+
bic x4, x4, x9 // mask out low existing bytes
|
|
2864
|
+
bic x5, x5, x10 // mask out high existing bytes
|
|
2865
|
+
orr x6, x6, x4
|
|
2866
|
+
and x7, x7, x10
|
|
2867
|
+
orr x7, x7, x5
|
|
2868
|
+
and v5.16b, v5.16b, v0.16b // possibly partial last block has zeroes in highest bits
|
|
2869
|
+
rev64 v4.16b, v5.16b // GHASH final block
|
|
2870
|
+
eor v4.16b, v4.16b, v8.16b // feed in partial tag
|
|
2871
|
+
pmull v21.1q, v4.1d, v12.1d // GHASH final block - low
|
|
2872
|
+
mov d8, v4.d[1] // GHASH final block - mid
|
|
2873
|
+
eor v8.8b, v8.8b, v4.8b // GHASH final block - mid
|
|
2874
|
+
pmull2 v20.1q, v4.2d, v12.2d // GHASH final block - high
|
|
2875
|
+
pmull v8.1q, v8.1d, v16.1d // GHASH final block - mid
|
|
2876
|
+
eor v9.16b, v9.16b, v20.16b // GHASH final block - high
|
|
2877
|
+
eor v11.16b, v11.16b, v21.16b // GHASH final block - low
|
|
2878
|
+
eor v10.16b, v10.16b, v8.16b // GHASH final block - mid
|
|
2879
|
+
ldr d8, [sp, #128]
|
|
2880
|
+
eor v6.16b, v11.16b, v9.16b // MODULO - karatsuba tidy up
|
|
2881
|
+
eor v10.16b, v10.16b, v6.16b // MODULO - karatsuba tidy up
|
|
2882
|
+
pmull v7.1q, v9.1d, v8.1d // MODULO - top 64b align with mid
|
|
2883
|
+
ext v9.16b, v9.16b, v9.16b, #8 // MODULO - other top alignment
|
|
2884
|
+
eor v10.16b, v10.16b, v7.16b // MODULO - fold into mid
|
|
2885
|
+
eor v10.16b, v10.16b, v9.16b // MODULO - fold into mid
|
|
2886
|
+
pmull v8.1q, v10.1d, v8.1d // MODULO - mid 64b align with low
|
|
2887
|
+
ext v10.16b, v10.16b, v10.16b, #8 // MODULO - other mid alignment
|
|
2888
|
+
eor v11.16b, v11.16b, v8.16b // MODULO - fold into low
|
|
2889
|
+
stp x6, x7, [x2]
|
|
2890
|
+
eor v11.16b, v11.16b, v10.16b // MODULO - fold into low
|
|
2891
|
+
ext v11.16b, v11.16b, v11.16b, #8
|
|
2892
|
+
rev64 v11.16b, v11.16b // Final Tag
|
|
2893
|
+
mov x0, x15
|
|
2894
|
+
st1 { v11.16b }, [x3] // Store final tag
|
|
2895
|
+
ldp x19, x20, [sp, #16]
|
|
2896
|
+
ldp x21, x22, [sp, #32]
|
|
2897
|
+
ldp x23, x24, [sp, #48]
|
|
2898
|
+
ldp d8, d9, [sp, #64]
|
|
2899
|
+
ldp d10, d11, [sp, #80]
|
|
2900
|
+
ldp d12, d13, [sp, #96]
|
|
2901
|
+
ldp d14, d15, [sp, #112]
|
|
2902
|
+
ldp x29, x30, [sp], #224
|
|
2903
|
+
AARCH64_VALIDATE_LINK_REGISTER
|
|
2904
|
+
ret
|
|
2905
|
+
.size aes_gcm_dec_kernel_eor3,.-aes_gcm_dec_kernel_eor3
|
|
2906
|
+
#endif // __ARM_MAX_ARCH__ >= 8
|
|
2907
|
+
#endif // !OPENSSL_NO_ASM && defined(OPENSSL_AARCH64) && defined(__ELF__)
|