
This change adds a new one-shot AES-CBC API: crypto::aes_cbc::Encrypt() crypto::aes_cbc::Decrypt() As well as unit tests for same. This new API returns std::vectors for results, rather than taking output spans to write into. This was motivated by it being tricky to properly size the output buffer for client code - it is possible to always leave enough room for the PKCS#5 padding by adding one block worth of space, but the actual encrypt operation will not necessarily always use that space. It will instead round up to the next block size, which means client code either has to be aware of that behavior, or Encrypt() has to return a size which client code can clamp the output span to. This is annoying and could be error-prone, since if client code forgets to do it the balance of the ciphertext buffer will be random non-ciphertext and client code needs to know not to use it. To deal with that, this code just returns std::vectors and eats the extra allocations. Subsequent changes will migrate all users of Encryptor's AES-CBC mode to these functions. Bug: 372756046 Change-Id: I66f36a1e3541a6c78a3ebd85fbdf85692c2da604 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5941729 Reviewed-by: David Benjamin <davidben@chromium.org> Auto-Submit: Elly FJ <ellyjones@chromium.org> Commit-Queue: David Benjamin <davidben@chromium.org> Cr-Commit-Position: refs/heads/main@{#1372815}
Chromium
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead,
follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.