923 Commits
Author SHA1 Message Date
Adam Langley f8c5f5668d Add utility for dumping raw jitter samples.
Change-Id: Idafa206d2d8b6e36d4e8333fba1bf96208fec2a9
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/80927
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2025-08-25 11:30:36 -07:00
David Benjamin a352ae6bae Unexport the Kyber implementation
Kyber was the prestandard version of ML-KEM. Callers should be using
ML-KEM now. For now, keep the implementation behind an internal header
for libssl, but we expect to remove that soon too.

Update-Note: <openssl/experimental/kyber.h> is gone. Use
<openssl/mlkem.h> instead.

Bug: 438787615
Change-Id: I02919e5d627dcbe863e70e433c79e360a556d462
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/81287
Reviewed-by: Lily Chen <chlily@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-08-18 09:23:13 -07:00
Adam Langley 8ef8f5838a Switch to using a derivation function in CTR-DRBG.
Upcoming NIST rule changes are expected to effectively require us to
pass in larger entropy inputs to the DRBG, which requires us to use the
"derivation function" option from 800-90A.

This change implements the derivation function and splits the entropy
and nonce arguments out, as needed for this style of DRBG.

Since we have external users of the existing CTR-DRBG mode, that is
still supported, but all internal uses will now use a derivation
function.

Change-Id: I8079e9f4c6238e91c68fef1e40189211f4142555
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/79768
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2025-08-13 11:36:32 -07:00
Adam Langley f479b0644b delocate: support 4-bit tweak immediates for AArch64.
See https://developer.arm.com/documentation/ddi0602/2025-06/SVE-Instructions/CNTB--CNTD--CNTH--CNTW--Set-scalar-to-multiple-of-predicate-constraint-element-count-

Change-Id: Ie0121609eb8ac1363c7738a1ed3ce6f06c38e8fa
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/81107
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2025-08-09 07:27:18 -07:00
Adam Langley ca1f86ca9a Add AES-CCM to test_fips.cc.
Change-Id: Ic6283bf9feacdf5a15435acccacdbb6c864d6a3f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/80769
Reviewed-by: Nick Harper <nharper@chromium.org>
Auto-Submit: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2025-07-28 11:31:15 -07:00
Adam Langley fd2208913f Add AES-KW(P) to test_fips.cc
These algorithms are implemented in the FIPS module we'll test them in
test_fips.cc

Change-Id: I3b83118a7a3c59b298c8e37854c9a8d29b008bad
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/80768
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2025-07-28 11:24:38 -07:00
Adam Langley d80a900231 Remove DES from test_fips.cc
It's not in the FIPS module any longer.

Change-Id: Ic89d4901705985e0fa4d97c35f84b7c9c5069848
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/80767
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2025-07-28 11:23:59 -07:00
Lily Chen 739613d2e6 Make checkout_rust in util/bot/DEPS also run hooks for clang
In 17164ff, it was asserted that checkout_rust did not need to actually
run util/bot/tools/clang/scripts/update.py, only to pull in the python
script.

This seems incorect after all, as bindgen must be able to find system
header files which it gets from libclang, so for consistency just run
the clang hook so that those header files are in a predictable location.

Change-Id: Ifc577d2847c5da2aa02f7a49b130243e599cb18c
Bug: 42290446
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/80787
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Auto-Submit: Lily Chen <chlily@google.com>
2025-07-28 05:38:50 -07:00
Lily Chen 17164fff9c Pull in Rust toolchain via util/bot/DEPS
Use gclient with the condition 'checkout_rust' to pull in the
update_rust.py script from Chromium. Add a hook to run update_rust.py
to download a copy of the Rust toolchain from GCS.

Because update_rust.py depends upon the tools/clang/scripts/update.py
script, this modifies the condition for boringssl/util/bot/tools/clang
to also fetch the clang script whenever we 'checkout_rust' (but it does
not need to actually run tools/clang/scripts/update.py).

Change-Id: I8e10d99ef6bdad04796eff4a0b98fdf5e0e7c6f0
Bug: 42290446
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/80507
Commit-Queue: David Benjamin <davidben@google.com>
Auto-Submit: Lily Chen <chlily@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2025-07-21 08:52:07 -07:00
Bas Westerbaan 1a95e2a1a8 Add ML-DSA-44
Change-Id: Ieb5c6019c75c809b47b3e7cb3ac6af35a082eeca
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/79947
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2025-07-09 10:49:58 -07:00
David Benjamin f3dcc4660d Update tools and prep for 0.20250701.0
Change-Id: Ib5ea19193fac2956d0b57117bbe0a7109b51fe21
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/80067
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
2025-07-01 10:17:32 -07:00
David Benjamin 4d937ae3df Add constants for special PSS salt length values
Align with OpenSSL for the names of the constants. -1 and -2 are too
confusing.

Change-Id: Ibd82361e81fe58f4a1006fc9f4c605c59b66ab12
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/79727
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
2025-06-17 09:25:21 -07:00
David Benjamin 02bc0949e5 Update most deps and bump version
I've kept the LLVM things back for now because Chrome seems to be in
some weird halfway point where libc++abi depends on a macro that libc++
doesn't have yet? I'm not really sure what's going on there and why it's
building for Chrome, but hopefully next time it will have settled.

I've also, for now, kept bazel at 7.5.0. We probably shouldn't update to
8.x on CI until that's our minimum version. There is a 7.6.1, but CIPD's
Bazel packages seem to only make a build for a version if newer than the
latest one, so all 7.x versions after 8.0.0's release are missing.

We may need to do something about this later, but ignoring the problem
for now.

Change-Id: Id17a3b394f68659e91a6dc563aaa40cd6912c1db
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/79327
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-05-14 15:04:40 -07:00
Gavin Mak aef0d16884 Remove --no_auth from download_from_google_storage hooks
The flag was deprecated by https://crrev.com/c/6414748 and
has no effect besides telling the user that it has no effect.

Bug: chromium:414826937
Change-Id: Ib290c9de23759c3fcf1fa03bc67713e4a3e301ee
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/79027
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-05-02 09:35:58 -07:00
David Benjamin ab301d01c2 delocate: Support more aarch64 load instructions with :lo12:
The compiler may want to load than one word. When loading into a
register of the same size, aarch64 mostly sticks to the LDR mnemonic,
but sometimes you need to load into a larger destination register. In
that case, there is a family of suffixed instructions.

(There is no LDRW because LDR W0 would be the same as LDRW X0. LDRSW X0
is needed because you might want to sign-extend instead of zero-extend.)

Change-Id: I1b6d9ab860b13c7ef91d4f9ee79b519367703ac0
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78967
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-04-30 13:14:22 -07:00
Brett McLarnon 34492c89a8 Expose P1363-based ECDSA sign/verify functions
Fixed: 411427388
Change-Id: I108eb20a55ea9c9e9ac31e85d1ede05df1116c3f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78807
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2025-04-25 11:47:49 -07:00
David Benjamin 3718975696 Make LHASH a completely internal type
The one remaining external reference was in an unused parameter where it
was impossible to obtain a non-null value. Remove the last of that
machinery from the public API. This leaves us free to completely rework
LHASH_OF(T) internally, including making it a template that understands
whether it owns its values.

(If we end up needing to revert it, we can still make the real
LHASH_OF(T) into a template. It just won't be called LHASH_OF(T)
anymore.)

Update-Note: Calling code which references LHASH_OF(T) will no longer
compile. We have had no public APIs that allow a caller to usefully
construct an LHASH_OF(T) for some time, so this only ever came up in odd
cases around bindings APIs.

Change-Id: I5a44310b04d8f8f3599f0f356b64786e62db5fbf
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78787
Reviewed-by: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-04-22 12:29:02 -07:00
David Benjamin ea482ed0e7 Switch a bit more of libcrypto to scopers
There was no real organization to which files I looked at here. Mostly
just bounced around. At some point we'll probably need to set up some
more infrastructure though:

- For functions to return UniquePtr, they need to stop being C linkage,
  which is something we want to do anyway.

- For types to use UniquePtr, we need to get them out of malloc/free and
  into the realm of constructors and destructors. That probably means
  moving some of the helpers from ssl/internal.h to crypto/internal.h.

- UniquePtr is not very good at buffers. We should probably move Array
  Vector, and InPlaceVector to crypto/internal.h.

Change-Id: I90ebc917051d354c0e447598f382db6b22eb8813
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78687
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-04-17 20:07:10 -07:00
Brian Orr 02a28c138f [acvptool] Fetch and upload arbitrary algortihms
Support fetching and uploading vectors and results for arbitrary NIST
algorithms. Enabled by removing the algorithm check when parsing the
middleware's advertised configuration. This check still exists prior to
sending test vectors to the middleware for execution.

Change-Id: I77212b414a8f880f57d9834427f98b303ef06e57
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/77648
Commit-Queue: Adam Langley <agl@google.com>
Commit-Queue: Brian Orr <brianorr@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-04-17 15:58:45 -07:00
David Benjamin a48a41a686 Flatten a few more inner CMake files
This moves test_fips and modulewrapper up to the build directory like
most of our other targets. Also integrate modulewrapper's source list
into build.json since it has more than one file.

Change-Id: I45335630c9bfe4be8293ce03dd3aef5c4963e3bf
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78609
Reviewed-by: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-04-17 13:48:36 -07:00
David Benjamin 641798f2d2 Honor the BUILD_TESTING option
This requires importing CTest to declare the BUILD_TESTING option (in
particular default it to ON). I've not registered our tests with CTest
or anything, though that may be something to explore and perhaps retire
all_tests.go.

Bug: 389897612
Change-Id: I5e9a853f6a5fea9229bcd3a2a202c91627f6d3de
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78608
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2025-04-17 13:36:05 -07:00
Adam Langley 269416b6e6 Update ACVP tests in light of 99bd1df99b
99bd1df99b removed MAC truncation from ACVP but the ACVP tests aren't
run on the commit queue and so I missed updating the tests accordingly.
This change fixes them.

NIST appears to include tests with huge messages and keys now, so the
trimming script it updated to ignore those so that we aren't checking in
megabytes of test vectors.

Change-Id: I09b0eae2fb9b4d5865d51e17e95b1e61e38a5726
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78628
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-04-16 17:35:09 -07:00
David Benjamin d9f5f88b87 Put all VS runtime dirs in PATH
This fixes the SDE builders after
https://boringssl-review.googlesource.com/c/boringssl/+/75008/

VS comes with some runtime dlls for things like the debug version of
their C runtime. These are not generally available on Windows machines
(notably not on our CI machines), so debug builds need to get them from
MSVC.

Annoyingly, those directories are not part of the SetEnv.{arch}.json
files in MSVC, so I had to put them in by hand elsewhere. I attempted to
match what the old package and the GN goop was doing, but it resulted in
a mysterious error on 64-bit debug builds. So the version I landed just
filtered by CPU.

This worked except that win64_sde broke with a different error. Looks
like the sde.exe launcher is 32-bit (though why it needs MSVC dlls, I'm
not sure).

After some more wrestling, it turns out the problem was the directory
order! Due to a bug and some incorrect sorting, I put them in order
sysarm64, sys64, sys32. The correct order is sys64, sys32, sysarm64.
The order is actually significant. There are some x86_64 dlls in
sysarm64 that confuse Windows. (arm64ec perhaps?)

Anyway, go back to putting them all in there. This is probably also
wrong, to be honest, but this matches what we were doing before. We can
dig into this further later.

Change-Id: Id8108f40baa761b50e30135f21a72345130ef729
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78547
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-04-15 11:09:55 -07:00
David Benjamin 45a865d668 Update tools, etc
Change-Id: I9427412327ee2fa02d585ccbc1dce62ac0333d78
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78507
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
2025-04-14 16:16:34 -07:00
David Benjamin c9edbaad1a Switch to the CIPD Windows SDK package
This isn't updated as frequently, but is much less of a hassle to use.
In particular, the vs_toolchain.py and depot_tools version seems to have
broken recently for some mysterious reason. Current theory is that
something about
https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6288233
broke, but given the report of bots with bad caches and past issues, I
think a CIPD package might be more straightforward.

There's a windows_sdk recipe module that we could use alongside it, but
then we cannot preview MSVC updates on the CQ, so I opted to keep our
goofy vs_env.py script. Also LUCI is very, very bad at atomic recipe +
code changes, so keeping it is convenient.

As a bonus, this removes the last Chromium license file in util/bot so
the LICENSE file can get a hair shorter. (Now the only source of
weirdness is ssl/test/runner.)

Change-Id: I2ec269c178829660978e6a9e1a9e14477382d82d
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/75008
Reviewed-by: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2025-04-14 16:16:31 -07:00
David Benjamin 34a1d37575 Implement functions to generate CMS external signatures
This implements just the small subset of OpenSSL's CMS API to support
the Linux kernel's sign-file.c tool. It is nowhere close to a full CMS
implementation and is not intended to become one. In particular, it does
not implement enough of CMS to support S/MIME. That requires much, much
more infrastructure than was implemented here.

CMS is, like PKCS#7, an over-engineered and cryptographically unsound
set of nestable combinators to support just about any configuration of
cryptographic operations. Profiling CMS down to a usable subset is, as a
result, more complicated, more risky, and less efficient than just
designing a bespoke structure for your use case. It is derived from
PKCS#7, and largely overlaps. However, both PKCS#7 and CMS use the v1
version number, but CMS made incompatible changes in some corner cases
that, so far, do not matter to us. (It is incompatible if you try to
layer SignedData atop another combinator, where the lack of proper
domain separation in this badly designed format is of extra risk.)

In the case of the kernel, sign-file.c wants an "external signature",
which is when the data to be signed lives elsewhere. This is, as a
result, a very, very inefficient way to concatenate an enum with a byte
string. But this is what the kernel chose, so here we are.

Because PKCS#7 and CMS are broadly the same structure, I've generalized
the internal PKCS#7 function rather than duplicating all this code. If
we ever hit the cases where PKCS#7 and CMS v1 are incompatible, plumbing
an extra boolean will be the least of our worries.

Test data was generated by compiling the actual sign-file.c against
OpenSSL and saving the output.

Change-Id: Idb0874d2b5294bfad564f3a00458c3fd044d9da5
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78452
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-04-14 13:44:28 -07:00
Adam Langley 99bd1df99b Remove MAC truncation from FIPS interface.
This is only valid in ACVP if the truncation occurs within the FIPS
module. But that's not a useful service: the caller can always discard a
few bytes and is better positioned to do so.

Change-Id: Id5e6459c9fa6d8b1b8f7a398feab6c4816adf8ab
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78247
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: Adam Langley <agl@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
2025-04-09 16:11:50 -07:00
Pete Bentley a553a9d65a Default to no target prefix when generating Android build files.
Rather than `None` :)

Change-Id: I8d7429746abb51c96b70b2e4cca21c0abe9cc40c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78227
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2025-04-03 09:28:05 -07:00
Dan Le Febvre a9993612fa upprev boringssl/util/bot/perl-win32 dep
(note, not actually win32)

Bug: b/403760204
Change-Id: Id89b03774024e9e2b5b3de8424b1da013c96dda3
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78167
Auto-Submit: Dan Le Febvre <dlf@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2025-03-27 06:29:20 -07:00
David Benjamin de614d8902 delocate: Preserve AVX-512 tokens when rewriting labels
Also fail closed, rather than failing open, when going through a
codepath that would silently discard such a token.

Change-Id: I31797445a9d8cfa02fe284aeab535efa545ba5f8
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/77807
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-03-18 11:31:11 -07:00
Moreno Ambrosin b7254f7c0b Add AES-EAX EVP_AEAD cipher
This is defined in https://doi.org/10.1007/978-3-540-25937-4_25.

Change-Id: I9173e7f6dda22681770a231d905fd5438cb7c187
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/77007
Auto-Submit: Moreno Ambrosin <ambrosin@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2025-03-11 14:19:33 -07:00
David Benjamin e1d6cd95a5 Migrate remaining uses of io/ioutil
See https://go.dev/doc/go1.16#ioutil

Change-Id: Ib0fa34a745f1d1515729a0eead96fe5dfcf86a21
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/77387
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-03-11 11:07:50 -07:00
David Benjamin d34af0a9ac acvptool: Disable GCS support by default
GCS support adds a ton of dependencies, so hide it behind a "gcs" build
tag. To build with GCS support, pass "-tags gcs" to "go build".

While I'm here, remove the old +build style of build constraint. We can
depend on go:build now.

Also while I'm here, fix some style issues with the GCS support: Go
style is "GCS" not "Gcs" for acronyms, and ioutil.ReadAll has been
replaced with io.ReadAll.

Change-Id: I409a87f3b7b0d99995fad55edc0d8e61ab77232d
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/77367
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-03-11 11:05:44 -07:00
David Benjamin 562ed3183a Update deps and tag a version for BCR
Also bump BORINGSSL_API_VERSION for draft-ietf-tls-cross-sni-resumption.

Change-Id: Ie71484f701d232e2138abef504aca95e1d58f23c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/77347
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-03-11 10:52:14 -07:00
Adam Langley 298ac78507 Update PQ ACVP to reflect NIST's breaking changes.
NIST have updated the ACVP protocol for SLH-DSA and ML-DSA in several
breaking ways. This change updates acvptool to reflect this.

Change-Id: Id6ea74e9272467cfa01b768eb3bde6bc0230fb88
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/77247
Reviewed-by: Bob Beck <bbe@google.com>
Auto-Submit: Adam Langley <agl@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
2025-03-10 13:45:55 -07:00
David Benjamin 90e641cefe delocate: Recognize msl as an ARMConstantTweak
MOVI has a form that's tagged MSL:

  MOVI <Vd>.<T>, #<imm8>, MSL #<amount>

Change-Id: Ib252966d46a890296aa429e7d6882ef45e8c40ab
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/77067
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
2025-03-05 18:49:39 -08:00
David Benjamin 783ffa84ec Add a pregenerated sources.mk
I'm hoping this can replace the make outputs in Android's build and
others.

Bug: 42290412
Change-Id: Idaa8415e52e92d238e195a8da4623b78a8eb3acb
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76887
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-03-05 10:29:48 -08:00
David Benjamin e1379ff5eb Add local targets to .set directives in delocate
Originally I thought the problem was that weak symbols need renaming,
but actually delocate is fine with those. The local_target business
(somewhat accidentally) routes around this problem.

The problem is that GCC emits C1 and C2 constructors for unique_ptr as
aliases of each other using .set foo, bar and we don't recognize that
pattern as defining a symbol.

The linker script version of this pipeline will need to do it with
renaming instead, but we'll get to that later. Renaming symbols is
actually quite annoying in delocate.

Fixed: 397980180
Change-Id: I378c759c07a41af1155acf3f41889a0bd52b002f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76967
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-03-04 13:03:16 -08:00
Adam Langley 2f81008a7d Use FIPS functions in modulewrapper where possible.
Change-Id: I5d60c101c7e1387f62416dc33e6bf0548c164ec3
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76953
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2025-03-04 11:35:11 -08:00
Adam Langley 784c2dbf5d Restore FIPS version check.
This check was incorrectly disabled for testing in 3494965215.

Change-Id: I8798df71e3cb9783111696cabfc64cf045711fd5
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76947
Auto-Submit: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2025-03-04 10:31:19 -08:00
Adam Langley 704dc8deff Add SLH-DSA self tests
Change-Id: I411bf8c2501f91f28f31e0da7a18025e2a47d756
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76389
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2025-03-03 16:56:12 -08:00
Adam Langley 3494965215 Add ML-DSA self tests.
Change-Id: I640b1f57de2544d9329cba83352d0d51debc092c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76388
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2025-03-03 16:07:04 -08:00
Adam Langley 5e73d0302c Add ML-KEM self-tests.
For some reason I had thought that NIST weren't doing this stuff for new
algorithms, but they are. The following quote is from IG 10.3.A:

> if the module implements ML-KEM decapsulation, the module shall have a CAST for the ML-KEM decapsulation mechanism. The decapsulation algorithm of ML-KEM accepts a decapsulation key (dk) and a ML-KEM ciphertext (c) as input, does not use any randomness, and outputs a shared secret (K’). The CAST shall use the ML-KEM decapsulation algorithm (i.e., Algorithm 21 in FIPS 203), and for a KAT, using fixed/predetermined dk and c values, to compare the resulting outputs to precomputed value of K'. Note21: The ML-KEM decapsulation CASTs shall cover both the implicit rejection and (unnamed) non-rejection paths.
>
> The above CASTs shall be performed on at least one of the following parameter-sets for MLKEM that are implemented in the approved mode: ML-KEM-512, ML-KEM-768, or ML-KEM-1024.
>
> if the module implements ML-KEM key generation, the module shall have an ML-KEM key generation CAST. The ML-KEM key generation does not take input and outputs an encapsulation key (ek) and a decapsulation key (dk). The CAST shall use the ML-KEM key generation algorithm (i.e., Algorithm 19 in FIPS 203), and for a KAT, using a fixed/predetermined random values (i.e., z and d), to compare the resulting outputs to the pre-computed values of ek and dk.
>
> For key pairs generated for use with approved KEMs in FIPS 203, the PCT (described by the tester in TE10.35.01) shall consist of applying the encapsulation key ek to encapsulate a shared secret K leading to ciphertext c, and then applying decapsulation key dk to retrieve the same shared secret K. The PCT passes if the two shared secret K values are equal.

Change-Id: Ic5704e1e59fb9876ce666a88518a37f61fd7d6b9
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76387
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2025-03-03 16:02:03 -08:00
David Benjamin 673e61fc21 delocate: remove the need to demangle local variables
We need to demangle because the backing storage for a delocated BSS
symbol is declared static. The compiler seems to be always give it a
C++-mangled name. But we relied on those names to infer the names of the
bss_get functions that the rest of the code wanted.

Instead, if we make the backing storage non-static, we get the name we
want. Ideally we would avoid having to extract those names (see
https://boringssl-review.googlesource.com/c/boringssl/+/70849), but
faking the linker script behavior in delocate seemed tricky, so I opted
to do this and then we can finish up the linker script version later.

While I'm here, prefix the underlying names with 'bcm_' so we're not
squatting as much of the namespace.

Change-Id: I1ce9a189e620c872511dbce09d23e655f1593d34
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76847
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
2025-02-28 15:12:34 -08:00
David Benjamin ab3647c5f0 Accept either | or ` in doc.go
This doesn't convert any of the existing ones, but may as well make them
both work.

Bug: 42290410
Change-Id: Ibb7764b1859e325244d767e3b98e16ceb813e0fa
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/75768
Reviewed-by: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2025-02-27 10:47:33 -08:00
David Benjamin f85903850b Remove OPENSSL_ia32cap_P and OPENSSL_armcap handling in delocate
We no longer reference these variables directly.

Bug: 42290548
Change-Id: Ie1709701e5f13ceff6d389ee3127ce9baba72ec7
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76547
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-02-27 10:36:15 -08:00
Joe Gardner 5aa02d024d Add --gcs option for uploading test results from GCS
Change-Id: Ib1eb9687642c32b4ad0548238a3f01eb5493b282
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76488
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Auto-Submit: Joe Gardner <joegar@google.com>
2025-02-25 08:33:16 -08:00
Stefano Duo 6a7f096275 Add a way to prefix Android targets names
Both Conscrypt (more correctly, //external/boringssl) and Cronet in AOSP
rely on generate_build_files.py to create their Android.bp. This results
in build target name clashes. Cronet currently solves this by
namespacing its own build target names, but this is not
common/recommended practice in AOSP.

By introducing a way to prefix the build target name, Cronet will be
able to generate build targets that differ from Conscrypt's.

Bug: b:396593141
Change-Id: I34971e8973d5215eb9bb18601c7940910033ce36
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76447
Commit-Queue: Stefano Duo <stefanoduo@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2025-02-19 13:01:41 -08:00
David Benjamin 9aa2f99097 Switch to Go standard library functions where available
Change-Id: I84c157f0a810a3d04e2f58b829073f6a49efdbd6
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76187
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
2025-02-13 11:14:54 -08:00
Filippo Valsorda b8291f83a1 Add ".git" hint to Go module name
Currently, trying to "go install" something from BoringSSL's Go module
fails because the proxy-reachable name is
boringssl.googlesource.com/boringssl.git, but the go.mod name is
boringssl.googlesource.com/boringssl.

$ go install -v boringssl.googlesource.com/boringssl.git/util/fipstools/acvp/acvptool@master
go: downloading boringssl.googlesource.com/boringssl.git v0.0.0-20250122182937-e056f59c7dfd
go: boringssl.googlesource.com/boringssl.git/util/fipstools/acvp/acvptool@master: version constraints conflict:
	boringssl.googlesource.com/boringssl.git@v0.0.0-20250122182937-e056f59c7dfd: parsing go.mod:
	module declares its path as: boringssl.googlesource.com/boringssl
	        but was required as: boringssl.googlesource.com/boringssl.git

Using boringssl.googlesource.com/boringssl fails because without the
.git hint, the go tool will fetch
https://boringssl.googlesource.com/boringssl/util/fipstools/acvp/acvptool?go-get=1
which is not implemented by gitiles.

Adding .git to the module name makes the first command work.

Change-Id: I6a6a4656a34fac424114a5d65d23df677ca7de47
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/76107
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
2025-02-13 10:12:55 -08:00