Age | Commit message (Collapse) | Author | Files | Lines |
|
Now that we don't depend on external CRYPTO_library_init calls or the
static initializer to initialize CPU capabilities, we can drop a ton of
code.
This makes CRYPTO_library_init, and all its wrappers, into no-ops and
drops the (non-FIPS) static initializer. I've added an internal
OPENSSL_init_cpuid function for the places where the library actually
needs to initialize the CPU vector.
Note this slightly changes the default, previously
static-initializer-full build: previously, CRYPTO_library_init was a
no-op and we relied on the static initializer. Now we uniformly use
CRYPTO_once. This should be an atomic read in the steady state and
essentially free. We can restore the static initializer by default if
this ends up being a problem, but having only one mode is more
straightforward. This also avoids problems if an application calls into
BoringSSL during its own static initializer. Static initializers are not
coherently ordered.
Update-Note: The BORINGSSL_NO_STATIC_INITIALIZER build option and
CRYPTO_library_init are now unnecessary. Once updating past this
revision, those options can now be cleaned up from downstream projects.
Fixed: 40644931
Change-Id: Idc2e6ea7a73d6352e0360fd886c46d88dba3568c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/69508
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
|
|
This reverts the following commits:
e1a860c3745c77cb83228dde1b73fa62eaf43930
a11277e187e407d0ef403b8a60d9a32eaab7d301
25cf1bb965ba9ae0302cbc6de4ff4dd6cdbbc016
There were a couple nuisances caused by this change, stemming from a
Rust language deficiency. If you move a method from a type to a trait,
this is a backwards-incompatible change that is visible to the caller.
That is, Rust does not allow introducing abstractions in a
backwars-compatible way!
This meant you had to import Algorithm to use a hash. This made updating
downstream code hard, but at least par for the course with Rust. It
seems Rust just isn't a language where API stability and library
evolution are possible.
However, even after we pay the transition costs, downstream code needed
to import WithOutputLength. This is too much of an implementation detail
to leak into the public API, so revert it for now. We'll need to find
some way to do this that keeps the public API reasonable.
Change-Id: I82d00b47a77fe77b5893b1e9b15faef727ef9866
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/69227
Reviewed-by: Bob Beck <bbe@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
|
|
Change-Id: I27d64f8f1654ed0399c09c48b9c41e84aac1aa3a
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/69047
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
|
|
These were introduced in https://boringssl-review.googlesource.com/c/boringssl/+/68748
and detected in our CI which runs against the boringssl
rust bindings at HEAD
Change-Id: I42b37e8738baadffbc0c58e0340144685dd04977
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/69007
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
|
|
This CL moves some methods that exist in every hashing algorithm
implementation to the `Algorithm` trait; namely, `new`, `update`,
and `digest`. This allows for clients to instantiate the hashing
algorithms, and to call `update` and `digest` on objects that
have this trait. It allows a generic representation of an algorithm
that can be used.
This CL also adds the block size as a const field in the `Algorithm`
trait.
Note: this specifically supports the hashing algorithm use in the
style of what is done in AOSP's
`packages/modules/Virtualization/libs/apkverify`, which was previously
using the rust openssl `Hasher` to instantiate algorithms specified
by their `MessageDigest`.
Change-Id: Ic47691ee2a4303923519b246de7d9724da90f60d
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/68748
Commit-Queue: Ellen Arteca <emarteca@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
|
|
This CL adds a re-export for `CBS_init` and
`CBS_len`, since these are declared as `OPENSSL_INLINE` and are
thus unavailable currently since inline support is not yet merged.
It also changes the existing wrappers for inline functions
to re-exports too.
Note: this is required to land the boringssl update in AOSP.
Test: m checkbuild
Change-Id: Ic6e2927d7a79b788a4ed0380cf27b3557b6f6f64
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/68327
Reviewed-by: David Benjamin <davidben@google.com>
Reviewed-by: Matthew Maurer <mmaurer@google.com>
Commit-Queue: Ellen Arteca <emarteca@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
|
|
Change-Id: I929b31f996c8b67b77286fe9f8eb1af73d2bbc72
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/68307
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
|
|
Change-Id: I34a326fb8c0e83c81380bc6608b7f0b52c63e7c0
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/67987
Reviewed-by: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
|
|
Android are currently using a sed line to replace our include! to a
module import. As those don't quite behave the same, and we don't want
to carry patches (even as sed lines) downstream like this, we need to
find a convention that works for everyone.
Most of the Rust world uses environment variables to communicate between
the build system and source. However, rather than principled convention,
where each target was passed in a separate environment variable, Rust
picked an inflexible convention of setting an OUT_DIR variable, and then
hardcoding everything else relative to it. It simply assumes the build
placed everything in that directory.
This is problematic for more complex build systems, which would now take
on I/O costs to copy files around into where Rust wants. It's also less
convenient for the build file author. So, instead we went with an
environment variable that carries the entire path. This has worked out,
except that Android's build tool, Soong, cannot express this! It has no
way to specify that some build product's path should be passed in via
some environment variable.
Soong does, however, have some (less preferred, less efficient) way to
emulate the OUT_DIR behavior, by copying files around until it's in the
place that the Rust convention expects. So introduce that option too,
gated on cfg(soong).
Update-Note: When this rolls into Android, remove the sed logic from
Android.bp and instead set up the OUT_DIR cargo emulation.
Bug: b:291253039
Change-Id: Id0afe9259f15f041c953dc5ad945cb9eda24ffc7
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/68048
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
|
|
https://boringssl-review.googlesource.com/c/boringssl/+/66288
allowed C++ runtime in libssl. The build script of bssl-sys crate
should indicate that the crate requires a C++ runtime. Use
libc++ on MacOS and libstdc++ on other unix like systems by
default. Introduce a new environment variable to configure C++
runtime to use.
Change-Id: Ib445955012126080dd03ad7b650287ea9dde10b0
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/67147
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
|
|
The doc test didn't compile and needs support for generating keys in
order to be a good example. Also bind all the AEADs that we support, and
have the encapsulated key be a second return value when creating a
sender, rather than carrying it in memory for the whole lifetime.
Change-Id: I1533560a925d4e239eedbfa0f4213d9e79085b77
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66527
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Adam Langley <agl@google.com>
|
|
As with all FFI libraries, the Rust conventions around safety don't
really work well. There's a ton of noise from bindgen needing to
conservatively mark everything unsafe, obscuring true safety sharp edges
like Rust's FFI-incompatible empty slice representation.
Change-Id: I2199e61b4900a01e3610772063765c5bb0cb493c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66287
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
|
|
R=agl@chromium.org
Bug: chromium:326247202
Change-Id: I6c1bb77da2ce428fd7c9be3c0ea542ca8c84d443
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66449
Reviewed-by: danakj <danakj@chromium.org>
Auto-Submit: Zequan Wu <zequanwu@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
|
|
Change-Id: I52a179005f889f96c7ec621757666d02da7f434c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66048
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
|
|
The latest Rust toolchain has started flagging these (correctly) as
unused.
Change-Id: I702e0ac7bfe47c7546e44debf7f53c4ade8e5dd6
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66328
Commit-Queue: Bob Beck <bbe@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Auto-Submit: Adam Langley <agl@google.com>
|
|
Due to https://github.com/rust-lang/rust-bindgen/issues/923, bindgen
does not evaluate constants correctly. This means arithemetic is done
with the wrong type, and more importantly the output has the wrong type.
Ultimately, this is a bug in bindgen, but as that's remains unfixed,
we'll have to work around it.
rust-openssl's bindgen mode works around this by using the build.rs
bindgen driver and registering a callback to fix the type. This won't
work for some of our consumers, which require a hermetic and
reproducible builds. Instead, apply bssl-sys's workaround at the lib.rs
level. This removes a divergence between bssl-sys and rust-openssl's
bindgen mode.
Fixing these types does not mean we recommending using all of these
constants! Many of the options here are ill-defined or produce even more
ambiguous output than most. XN_FLAG_COMPAT is especially fun because it
change the calling convention! The only option anyone should use is
XN_FLAG_RFC2253, as that's at least a well-defined output.
Fixed: 636
Change-Id: Id34b4a46e0cfd6dcb275477d9bb915bda66c787d
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66228
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
|
|
This removes the need to hand-write rust_wrapper.c, because bindgen can
generate it for us. bindgen 0.65 or later is needed. Earlier versions of
this were buggy.
I've also removed the claim that bssl-sys is somehow a solution for
version skew. That was the original thinking from Android, but it hasn't
worked out. The version skew solution is simply "use bindgen, don't
handwrite bindings".
Android are quite behind their originaly July timeline for adding the
build half of this mechanism, but as this is now in the way of other
work, we're going to proceed with using this now. There is now a
unsupported_inline_wrappers cfg that Android can set to use the old
mechanism.
Update-Note: Rust support now requires your build correctly handle
--wrap-static-fns. On Android, you will need to enable the
unsupported_inline_wrappers cfg option until b/290347127 is fixed.
Chromium doesn't actually use any of the inline functions yet, so we can
handle --wrap-static-fns asynchronously, but I have a CL ready to enable
that.
Fixed: 596
Change-Id: I51fd1108a8c17a06f1bdd9171ebf352cea871723
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/58985
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
|
|
I believe it is currently fine, but we probably should either box it, or
get to the point that the assumptions are less precarious. Rust FFI is
anything but safe.
Bug: 682
Change-Id: I4b45dd3c3f58fb0ce7c0b8b80b1e6d7d2f7f119f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65627
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
|
|
Someone _probably_ wouldn't copy–paste an example to the point of using
a zero key but, just in case, since we have `rand_array` now, we might
as well use it so that the examples are safe.
Change-Id: I289cb8f27894e8f0429fbbed37a1db3ea4295ffd
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65567
Reviewed-by: Bob Beck <bbe@google.com>
|
|
Given all the previous changes, the version should be bumped. Also
the license was wrong: new code in BoringSSL is ISC licensed and
the license at the top of the Rust files is the ISC license.
Change-Id: If8a5baa5b631145f85ec85b430dbfe8ffd2044bf
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65181
Reviewed-by: Bob Beck <bbe@google.com>
|
|
Change-Id: I87bcf08839c1c8e7cbdb8f5fdc3717b528a60de2
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65180
Reviewed-by: Bob Beck <bbe@google.com>
|
|
Change-Id: I4d62715e98176e83c9f4257fc9b0f4492bc9f090
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65179
Reviewed-by: Bob Beck <bbe@google.com>
|
|
Change-Id: I418b2f459b0b0f9854a6ec94231166cff7ed6946
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65178
Reviewed-by: Bob Beck <bbe@google.com>
|
|
Change-Id: Ie59326b9c987319dfbe4909955e2370384a7532f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65177
Reviewed-by: Bob Beck <bbe@google.com>
|
|
Change-Id: Iec534e48806ebbe533ccec4b6461a2f243e23411
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65176
Reviewed-by: Bob Beck <bbe@google.com>
|
|
Change-Id: I49e1b11b6eba1f2ddc190c5c070f133cce10b2f7
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65175
Reviewed-by: Bob Beck <bbe@google.com>
|
|
This change also adds scoped.rs, which contains scoped objects for
`EVP_PKEY` and `EC_KEY`, for when we're holding temporary objects of
those types.
Due to an accident with git rebase, it also renames `crypto_memcmp` to
`constant_time_compare` and promotes it to the top-level of the crate.
Change-Id: I629c051a244e3f9dcf64d8a36846528f10a31f50
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65174
Reviewed-by: Bob Beck <bbe@google.com>
|
|
This function took a `c_int` and checked that it was 1. But since
`initialized_struct_fallible` now expects a bool, this should too.
Change-Id: Ice7997c0847299f42fbc71fcc7b29acb66014bde
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65547
Reviewed-by: Bob Beck <bbe@google.com>
|
|
Change-Id: I4dc295906da0f0c7132a944176774c3472752c51
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65173
Reviewed-by: Bob Beck <bbe@google.com>
|
|
Change-Id: I2c7b0bb31ec0fae27d730e1a5295abc5f4a52dc8
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65172
Reviewed-by: Bob Beck <bbe@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
|
|
Change-Id: If67ca7892f418f1b80ba8e8425bdefa14921e8a2
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65171
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
|
|
Change-Id: I10052a0bf922ba6f68effdcebeca2c4da97345af
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65170
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Adam Langley <agl@google.com>
|
|
This is mostly what was used already, but not uniformly. This change
is exactly the result of running `cargo fmt` with the included
.rustfmt.toml.
Change-Id: Ib85687edffeecfb64938f556e54beb263f0b1d13
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65169
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Adam Langley <agl@google.com>
|
|
Change-Id: I43de22995908ea39b19aa03d167c62a9580ba7b1
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65168
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Maurice Lam <yukl@google.com>
|
|
Change-Id: Ib9fc874e1c5d540dda91a454681dad809e8d6d14
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65167
Reviewed-by: Bob Beck <bbe@google.com>
Reviewed-by: Maurice Lam <yukl@google.com>
Reviewed-by: Nabil Wadih <nwadih@google.com>
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
|
|
This is currently done by duplicating the list of constants. This was done for two reasons: 1) bindgen doesn't seem to do anything with bare-defines, 2) the list of defines appears to change incredibly rarely.
The `links` key is required in `Cargo.toml` to work around https://github.com/rust-lang/cargo/issues/3544
Change-Id: I11dca6e7eb62ab1b04053df654a4061cb5e25723
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/63305
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
|
|
Change-Id: I764551f842361b455f122287bcf7c4aef4b5cb82
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/63546
Auto-Submit: Cindy Lin <cinlin@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
|
|
- Create an internal `BlockCipher` trait similar to the existing
`StreamCipher` trait for AES-CBC.
- Create wrappers in the internal `Cipher` struct for one-shot
allocating encryption and decryption operations.
Change-Id: I17f667b3b92f907bc14c3454ee49b88cb91c49f3
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/63125
Commit-Queue: Bob Beck <bbe@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
|
|
Bug: 649
Change-Id: Ib47e843496e58a5cdb3cd04b3929e0a08ba09744
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/63145
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
|
|
Change-Id: Ifed7917ff1f54f2fbacf9abb967465d921fd7e3e
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/63045
Reviewed-by: Adam Langley <agl@google.com>
|
|
Bug: 285222831
Change-Id: I35219ac312fd97e7a51af8156c73fa7eb38c17c2
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60268
Commit-Queue: Bob Beck <bbe@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
|
|
Bug: 285223043
Change-Id: Ia997b9765476d05c58649ee49ebf04905e65c478
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60267
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
|
|
Change-Id: I94b32c9e2978691fdfa70b58432fffd501e0ba90
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/62885
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
|
|
Change-Id: If9b68dffc801f1d592dd0dff7d4e07fcc5eb76a7
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60445
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
|
|
Change-Id: I295b0142b4448a5ee10ca9b092a2c3eaa1fffc86
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60405
Reviewed-by: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
|
|
Implemented a generic Aead trait and struct against the EVP_AEAD
API's, which can be used to provide bindings to all of the AEAD's
provided by boringssl. Starting with AES_GCM_SIV, but will expand
to more AEAD's.
Change-Id: I7d4113f3d49ff40de3ccb76424f9a25d25797e82
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/59965
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
|
|
Change-Id: I203a19b59c23def9bca6f01c2b6e8c885b0c9c3f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/62205
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
Auto-Submit: Bob Beck <bbe@google.com>
|
|
Use CSlice instead of a regular Rust slice when passing pointers to C
FFI.
Change-Id: Iccd827f4c6f005d860993e97fef5e9caf514885b
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60525
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
|
|
Due to b/290792019 and b/290785937, we need them to actually exist at
the original symbols. For all of Rust's language-level safety benefits,
the ecosystem seems determined to undo it with patterns that are even
less safe than C.
This is not great and the bugs need to be fixed, but do this for now to
unblock the Android update.
Change-Id: Ia883336879779f652e7320cecdd5ca843996f6a3
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61525
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
|
|
Android have not updated their bindgen (see b/279198502), so they cannot
yet pick up inline functions automatically.
Bug: 596
Change-Id: I49d5adaaa3537ada545c9c6fce98ea2dbf2f40ae
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61165
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
|