Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update BoringSSL #80

Merged
merged 203 commits into from
Feb 14, 2022
Merged

Update BoringSSL #80

merged 203 commits into from
Feb 14, 2022

Commits on Jul 16, 2021

  1. Document that SSL_PRIVATE_KEY_METHOD should configure signing prefs.

    Otherwise BoringSSL may select one the private key does not support.
    
    Change-Id: Ia0a57657bd6dedaa6653c23cc850bb6b6fa8f219
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48525
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Jul 16, 2021
    Configuration menu
    Copy the full SHA
    6191cc9 View commit details
    Browse the repository at this point in the history
  2. Add convenience functions to malloc EVP_HPKE_CTX and EVP_HPKE_KEY.

    Some callers want the value to be heap-allocated. It's a little annoying
    that this returns an empty value (if we only supported heap-allocated
    ones, I'd have merged init into new), but since we have multiple
    constructor functions, this is probably the least fuss.
    
    Change-Id: I42f586e39850954fb6743f8be50a7cfffa0755ba
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48526
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Jul 16, 2021
    Configuration menu
    Copy the full SHA
    897a2ca View commit details
    Browse the repository at this point in the history

Commits on Jul 20, 2021

  1. Check strtoul return for overflow error in GetUnsigned()

    Currently, GetUnsigned() calls strtoul and checks whether the resulting
    unsigned long int is greater than UINT_MAX. This implicitly assumes that
    UINT_MAX < ULONG_MAX.
    
    Problematically, `unsigned long int` and `unsigned` have the same size
    on Windows [0] and on 32-bit architectures.
    
    For correctness, we now check whether strtoul failed because it would
    overflow the unsigned long int before checking whether the value fits in
    an unsigned type.
    
    [0]: https://docs.microsoft.com/en-us/cpp/cpp/data-type-ranges?view=msvc-160
    
    Change-Id: I49702febf4543bfb7991592717443e0b2adb954f
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48545
    Commit-Queue: Dan McArdle <dmcardle@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    dmcardle authored and Boringssl LUCI CQ committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    17be387 View commit details
    Browse the repository at this point in the history
  2. Don't enable atomics in NO_THREADS configurations.

    In configurations without threads, we're not thread-safe anyway. Instead
    use the refcount_lock.c implementation which, in turn, calls into
    thread_none.c, so this turns into a plain refcount.
    
    This avoids a build issue on platforms which define NO_THREADS, use C11,
    lack C11 atomics, and are missing a __STDC_NO_ATOMICS__ definition. The
    platforms ought to define __STDC_NO_ATOMICS__ or implement them, but
    atomics are also unnecessary overheard in NO_THREADS configurations
    anyway.
    
    Change-Id: I927e1825dd6474d95226b93dad704594f120450a
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48565
    Commit-Queue: David Benjamin <davidben@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    e38cf79 View commit details
    Browse the repository at this point in the history
  3. Add 'generate-ech' command to bssl tool

    The tool generates three files: an ECHConfig, its corresponding private
    key, and the ECHConfig wrapped in an ECHConfigList.
    
    For example, the following invocation generates the files:
    
        bssl generate-ech \
          -out-ech-config-list ech_config_list.data \
          -out-ech-config ech_config.data \
          -out-private-key ech.key \
          -public-name foo.example \
          -config-id 0
    
    Now, we can pass the ECHConfig and private key into the 'server' and
    'client' commands:
    
        bssl server -accept 4430 \
            -ech-config ech_config.data \
            -ech-key    ech.key
    
        bssl client -connect localhost:4430 \
            -ech-config-list ech_config_list.data
    
    Bug: 275
    Change-Id: Id4342855483fb01aa956f9aff356105c4a8ca4f6
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48466
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    dmcardle authored and Boringssl LUCI CQ committed Jul 20, 2021
    Configuration menu
    Copy the full SHA
    7a817f4 View commit details
    Browse the repository at this point in the history

Commits on Jul 23, 2021

  1. acvp: add HKDF support.

    Change-Id: I26251ce85f2cb1b441ae415b1506161a90bd3efa
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48585
    Reviewed-by: David Benjamin <davidben@google.com>
    Adam Langley authored and agl committed Jul 23, 2021
    Configuration menu
    Copy the full SHA
    c1571fe View commit details
    Browse the repository at this point in the history

Commits on Jul 28, 2021

  1. Revert "Revert "Revert "Disable check that X.509 extensions implies v…

    …3."""
    
    This reverts commit be9a86f. Let's try
    this again.
    
    Bug: 375
    Change-Id: Ie01cced8017835b2cc6d80e5e81a4508a37fbbaf
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48625
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    d422d2c View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2021

  1. acvp: recognise another style of JSON.

    Some JSON files have a header, but without a URL. Thus consider a block
    that doesn't contain an algorithm to also be a header.
    
    Change-Id: Ic35a827843e9d0169ba8398df69c46a5baeffb44
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48605
    Reviewed-by: David Benjamin <davidben@google.com>
    Adam Langley authored and agl committed Jul 29, 2021
    Configuration menu
    Copy the full SHA
    5799ebf View commit details
    Browse the repository at this point in the history

Commits on Aug 2, 2021

  1. Don't overread in poly_Rq_mul

    The polynomials have 701, 16-bit values. But poly_Rq_mul was reading 32
    bytes at offset 1384 in order to get the last 18 of them. This silently
    worked for a long time, but when 7153013 switched to keeping
    variables on the stack it was noticed by Valgrind.
    
    This change fixes the overread. Setting watchpoints at the ends of the
    two inputs (and one output) now shows no overreads nor overwrites.
    
    BUG=424
    
    Change-Id: Id86c1407ffce66593541c10feee47213f4b95c5d
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48645
    Reviewed-by: David Benjamin <davidben@google.com>
    Adam Langley committed Aug 2, 2021
    Configuration menu
    Copy the full SHA
    f1d153d View commit details
    Browse the repository at this point in the history
  2. generate_ech.cc: include needed headers

    Change-Id: I04c8bb68801aeb0938e5b038b98811ca4ffe50f0
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48685
    Commit-Queue: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Aug 2, 2021
    Configuration menu
    Copy the full SHA
    0768d42 View commit details
    Browse the repository at this point in the history

Commits on Aug 3, 2021

  1. Clarify BIO_new_mum_buf's lifetime rules.

    It is not obvious from "It does not take ownership of |buf|" whether the
    function makes a copy or not. It does not make a copy (maybe it
    should...), so callers are obligated to manage their lifetimes.
    
    Change-Id: I7df9a5814321fd833fcb8d009d9e0318d6668dd4
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48669
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 3, 2021
    Configuration menu
    Copy the full SHA
    e9fae77 View commit details
    Browse the repository at this point in the history
  2. Document another batch of functions.

    This covers most of the ASN.1 time functions and a handful more of
    x509.h. Also remove some code under #if 0.
    
    I'm running out of a easy ones to do, which is probably a good thing.
    
    Change-Id: I085b1e2a54d191a7a5f18c801b3c135cfda7bd88
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48665
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 3, 2021
    Configuration menu
    Copy the full SHA
    116d925 View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2021

  1. Remove ASN1_STRING_FLAG_MSTRING.

    This flag is set when an ASN1_STRING is created from a codepath that is
    aware it is an "mstring" (CHOICE of multiple string or string-like
    types). With setters like X509_set_notBefore, it is very easy to
    accidentally lose the flag on some field that normally has it.
    
    The only place the flag is checked is X509_time_adj_ex. X509_time_adj_ex
    usually transparently picks UTCTime vs GeneralizedTime, as in the X.509
    CHOICE type. But if writing to an existing object AND if the object
    lacks the flag, it will lock to whichever type the object was
    previously. It is likely any caller hitting this codepath is doing so
    unintentionally and has a latent bug that won't trip until 2050.
    
    In fact, one of the ways callers might accidentally lose the
    ASN1_STRING_FLAG_MSTRING flag is by using X509_time_adj_ex!
    X509_time_adj_ex(NULL) does not use an mstring-aware constructor. This
    CL avoids needing such a notion in the first place.
    
    Looking through callers, the one place that wants the old behavior is a
    call site within OpenSSL, to set the producedAt field in OCSP. That
    field is a GeneralizedTime, rather than a UTCTime/GeneralizedTime
    CHOICE. We dropped that code, but I'm making a note of it to remember
    when filing upstream.
    
    Update-Note: ASN1_STRING_FLAG_MSTRING is no longer defined and
    X509_time_adj_ex now behaves more predictably. Callers that actually
    wanted to lock to a specific type should call ASN1_UTCTIME_adj or
    ASN1_GENERALIZEDTIME_adj instead.
    
    Change-Id: Ib9e1c9dbd0c694e1e69f938da3992d1ffc9bd060
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48668
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    046fc13 View commit details
    Browse the repository at this point in the history
  2. Add some tests for time_t to ASN1_TIME conversions.

    Change-Id: I7712f66e16b761ee23292980cff039e62d29b22f
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48666
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    46e0523 View commit details
    Browse the repository at this point in the history
  3. Reject years outside 0000-9999 in ASN1_GENERALIZEDTIME_adj.

    They would previously output syntax errors.
    
    Change-Id: I7817a91d0c8ed8d6ac6a5a1fd9c9ed1223c5960e
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48667
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 4, 2021
    Configuration menu
    Copy the full SHA
    ead57c3 View commit details
    Browse the repository at this point in the history

Commits on Aug 5, 2021

  1. Avoid double-expanding variables in CMake.

    CMake's language is rather fragile and unsound. For the most part, it is
    a shell script with more parentheses. That is, it simply expands command
    arguments into a list of strings and then evaluates it, complete with
    shell-style differences between "${FOO}" and ${FOO}.
    
    The if() command is special and internally also expands variables. That
    is why things like if(FOO STREQUAL "BAR") work. CMake interprets "FOO"
    as a variable if it can find a variable, or a string otherwise. In
    addition to getting very confused on typos, it means that
    if("${FOO}" STREQUAL "BAR") will double-expand, and it will do strange
    things if BAR is a variable.
    
    CMP0054 patches this (which we set by minimum version) so that if() only
    expands if the token was unquoted. This fixes
    if("${FOO}" STREQUAL "BAR"). However, if(${FOO} STREQUAL "BAR")
    continues to double-expand FOO.
    
    We had a mix of all three of FOO, ${FOO}, and "${FOO}". It's not clear
    which is the canonical spelling at this point, but CMake own files
    (mostly) use FOO, as do most of our lines, so I've standardized on that.
    It's a little unsatisfying if we typo a variable, but I suppose ${FOO}
    also silently ignores unset variables.
    
    Bug: 423
    Change-Id: Ib6baa27f4065eed159e8fb28820b71a0c99e0db0
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48705
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 5, 2021
    Configuration menu
    Copy the full SHA
    7e26597 View commit details
    Browse the repository at this point in the history

Commits on Aug 6, 2021

  1. Align with upstream on 'close STDOUT' lines.

    When upstreaming c1d8c5b as
    openssl/openssl#10883 and then
    openssl/openssl#10930, we ended up diverging
    slightly: in the upstream version, I ended up applying the same change
    to the xlate files. Upstream also suggested "error closing STDOUT: $!".
    
    Apply the same changes here.
    
    Change-Id: I8a8cbc3944432e94a8844f9f628a900edfe77b30
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48725
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 6, 2021
    Configuration menu
    Copy the full SHA
    549e4e7 View commit details
    Browse the repository at this point in the history

Commits on Aug 9, 2021

  1. Update ghashv8-armx.pl from upstream.

    This syncs this file up to e7ff223a20697e5a401d2d9bb7a75e699ed46633 from
    upstream's OpenSSL_1_1_1-stable branch. The main change of note is the
    4x loop from upstream's 7ff2fa4b9281232f0ca1db03d42a954c462ef77d,
    9ee020f8dc7813db82a119058d8f57e70e7e8904,
    aa7bf316980259a11dcbaf6128ed86d33dc24b97, and
    603ebe03529101424670051aa0c616dc6e037b28.
    
    Benchmarks on a Pixel 4a.
    
    Before:
    Did 14069000 AES-128-GCM (16 bytes) seal operations in 2000042us (112.5 MB/sec)
    Did 6768000 AES-128-GCM (256 bytes) seal operations in 2000182us (866.2 MB/sec)
    Did 1902000 AES-128-GCM (1350 bytes) seal operations in 2000479us (1283.5 MB/sec)
    Did 359000 AES-128-GCM (8192 bytes) seal operations in 2003942us (1467.6 MB/sec)
    Did 182000 AES-128-GCM (16384 bytes) seal operations in 2002245us (1489.3 MB/sec)
    Did 13388000 AES-256-GCM (16 bytes) seal operations in 2000144us (107.1 MB/sec)
    Did 6069000 AES-256-GCM (256 bytes) seal operations in 2000276us (776.7 MB/sec)
    Did 1638000 AES-256-GCM (1350 bytes) seal operations in 2001076us (1105.1 MB/sec)
    Did 305000 AES-256-GCM (8192 bytes) seal operations in 2000040us (1249.3 MB/sec)
    Did 155000 AES-256-GCM (16384 bytes) seal operations in 2009398us (1263.8 MB/sec)
    
    After:
    Did 13837000 AES-128-GCM (16 bytes) seal operations in 2000131us (110.7 MB/sec) [-1.7%]
    Did 7506000 AES-128-GCM (256 bytes) seal operations in 2000197us (960.7 MB/sec) [+10.9%]
    Did 2289000 AES-128-GCM (1350 bytes) seal operations in 2000734us (1544.5 MB/sec) [+20.3%]
    Did 443000 AES-128-GCM (8192 bytes) seal operations in 2000321us (1814.2 MB/sec) [+23.6%]
    Did 225000 AES-128-GCM (16384 bytes) seal operations in 2002308us (1841.1 MB/sec) [+23.6%]
    Did 13280000 AES-256-GCM (16 bytes) seal operations in 2000011us (106.2 MB/sec) [-0.8%]
    Did 6630000 AES-256-GCM (256 bytes) seal operations in 2000229us (848.5 MB/sec) [+9.2%]
    Did 1916000 AES-256-GCM (1350 bytes) seal operations in 2000373us (1293.1 MB/sec) [+17.0%]
    Did 365000 AES-256-GCM (8192 bytes) seal operations in 2001519us (1493.9 MB/sec) [+19.6%]
    Did 185000 AES-256-GCM (16384 bytes) seal operations in 2006588us (1510.5 MB/sec) [+19.5%]
    
    (See cl/387919990 for some notes I made in reviewing, though likely
    future me will find them incomprehensible anyway.)
    
    Change-Id: Id386e80143611487e07b2fbfda15d0abc54ea145
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48726
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 9, 2021
    Configuration menu
    Copy the full SHA
    47c5f9d View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2021

  1. Document ASN1_mbstring_copy.

    Change-Id: Ia2cb9d969b25d1815d8157dd74125d60b138138f
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48765
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    6d84569 View commit details
    Browse the repository at this point in the history
  2. Always use an ASN1_STRING_TABLE global mask of UTF8String.

    ASN1_STRING_set_by_NID is very complex and depends on a "global mask"
    for most NIDs. (Some NIDs use a single type and use STABLE_NO_MASK to
    disable the global mask.) Historically, it defaulted to allowing all
    types, but it switched to UTF8String in OpenSSL 1.0.2.
    
    Updating the global mask is not thread-safe, and it's 2021. Let's just
    always use UTF-8. The only callers I found set it to UTF-8 anyway (with
    the exception of some test script we don't use, and some code that
    wasn't compiled). No-op writes in the C/C++ memory model are still race
    conditions, so this CL fixes some bugs in those callers.
    
    Update-Note: The global mask for ASN1_STRING_set_by_NID is now always
    UTF-8. Callers that want another type should reconsider and, if UTF-8 is
    still unsuitable, just pass the actual desired type into
    ASN1_mbstring_copy, X509_NAME_ENTRY_set_data, etc
    
    Change-Id: I679e99c57da9a48c805460abcb3af5b2f938c93f
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48766
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    f8b3961 View commit details
    Browse the repository at this point in the history
  3. Unexport ub_* constants.

    These constants aren't suitably namespaced and, moreover, are redefined
    in a_strnid.c. (The constants aren't especially useful because an
    X509_NAME doesn't check the upper bound.)
    
    Update-Note: Removed some unnamespaced constants.
    
    Change-Id: I7d15ae731628d3665119081289947600e7f38065
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48768
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    11a24ae View commit details
    Browse the repository at this point in the history
  4. Unexport BIT_STRING_BITNAME.

    This type does not appear in any public APIs.
    
    Change-Id: Ie57c7662e691ea05ff2133beda9760832ea0d0de
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48769
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    8627e97 View commit details
    Browse the repository at this point in the history
  5. Move X509_ALGOR to x509.h.

    This matches OpenSSL and the name. Also accessors like X509_ALGOR_get0
    are in x509.h.
    
    Change-Id: Ic7583edcf04627cbfae822df11e75eebdd9ad7aa
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48770
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    28d7252 View commit details
    Browse the repository at this point in the history
  6. Remove OPENSSL_NO_FP_API ifdefs.

    We've never tested this and plenty of files depend on FILE* APIs without
    ifdefs.
    
    Change-Id: I8c51c043e068b30bdde1723c3810d3e890eabfca
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48771
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    b9ec9de View commit details
    Browse the repository at this point in the history
  7. Implement ASN1_STRING_print_ex_fp, etc., with file BIOs.

    No sense in implementing a BIO/FILE abstraction when BIO is itself a
    FILE abstraction. Follow-up CLs will unwind the char_io abstraction and
    then split the ASN1 and X509 bits of this file.
    
    Change-Id: I00aaf2fbab44abdd88252ceb5feb071ad126a0b2
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48772
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    7a6066c View commit details
    Browse the repository at this point in the history
  8. Unwind io_ch abstraction in print functions.

    Change-Id: Ib342ce1acf7ea4fcff012bf149cf699807ddc0fa
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48773
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    1201c9a View commit details
    Browse the repository at this point in the history
  9. Move a_strex.c back to asn1, split X509_NAME bits out.

    With io_ch unwound, X509_NAME_print_ex just calls ASN1_STRING_print_ex,
    so we can put all the code in the right directories. We need to
    duplicate maybe_write, but it's a one-line function.
    
    Change-Id: Ifaa9f1a24ee609cbaa24f93eb992f7d911f1b4a0
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48774
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    0dcbc6e View commit details
    Browse the repository at this point in the history
  10. Move some ASN1 printing functions to crypto/asn1.

    For some reason, ASN1_STRING_print was not in the same file as
    ASN1_STRING_print_ex, but X509_print. Although it also behaves very
    differently from ASN1_STRING_print_ex, so that's a little interesting.
    
    Change-Id: I3f88f8943c8e36426eedafa7e350a787881d0c74
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48775
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 10, 2021
    Configuration menu
    Copy the full SHA
    07a6628 View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2021

  1. Document ASN.1 printing functions.

    ASN1_STRING_print_ex is extremely complex and attempting to implement
    RFC2253, so write some tests for it. Along the way, unexport
    CHARTYPE_*, which are internal book-keeping used in
    ASN1_STRING_print_ex.
    
    Change-Id: Idb27cd40fb66dc099d1fd6d039a00404608c2063
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48776
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 11, 2021
    Configuration menu
    Copy the full SHA
    4c993da View commit details
    Browse the repository at this point in the history
  2. Check i2d_ASN1_TYPE's return value in ASN1_STRING_print_ex.

    Also use the simpler single-call variant.
    
    Change-Id: I3834a798549f12a9dcdec6a357d2380085baf940
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48777
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 11, 2021
    Configuration menu
    Copy the full SHA
    e3a3655 View commit details
    Browse the repository at this point in the history
  3. Fix ASN1_STRING_print_ex with negative integers.

    ASN1_STRING and ASN1_TYPE type values almost line up, but not quite.
    Negative INTEGERs are not possible in X509_NAME (tag2bit maps INTEGER to
    0), but negative ENUMERATEDs are (tag2bit maps ENUMERATED to
    B_ASN1_UNKNOWN). See https://crbug.com/boringssl/412 for some notes on
    this mess. Either way, the library will freely produce ASN1_STRING
    INTEGERs and ENUMERATEDs in non-MSTRING contexts, so get this case
    right.
    
    Change-Id: Ica537f4d683e7a6becc96e2eee3cb66e53372124
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48785
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 11, 2021
    Configuration menu
    Copy the full SHA
    b319e3b View commit details
    Browse the repository at this point in the history
  4. Remove ASN1_TFLG_SET_ORDER.

    ASN1_TFLG_SET_ORDER was used in OpenSSL's CMS and PKCS#7
    implementations, which we've removed. Fields that use it not only get
    the DER SET sorting but, when serialized, go back and mutate the
    original object to match.
    
    This is unused, so remove it. This removes one of the sources of
    non-const behavior in i2d functions.
    
    Bug: 407
    Change-Id: I6b2bf8d11c30a41b53d14ad475c26a1a30dfd31f
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48786
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 11, 2021
    Configuration menu
    Copy the full SHA
    eb17de4 View commit details
    Browse the repository at this point in the history
  5. Add a test for ASN1_mbstring_copy and clean up.

    In writing the tests, I noticed that the documentation was wrong. First,
    the maximum lengths are measured in codepoints, not bytes.
    
    Second, the TODO was wrong. We actually do handle this correctly,
    *almost*. Rather, the bug is that the function assumes |mask| contains
    no extraneous bits. If it does, all extraneous bits are interpreted as
    B_ASN1_UTF8STRING. This seems like a bug, so I've gone ahead and fixed
    that, with a test.
    
    Change-Id: I7ba8fa700a8e21e6d25cb7ce879dace685eecf7e
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48825
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 11, 2021
    Configuration menu
    Copy the full SHA
    1b2db8c View commit details
    Browse the repository at this point in the history
  6. Fix negative ENUMERATED values in multi-strings.

    I noticed this while I was reading through the encoder. OpenSSL's ASN.1
    library is very sloppy when it comes to reusing enums. It has...
    
    - Universal tag numbers. These are just tag numbers from ASN.1
    
    - utype. These are used in the ASN1_TYPE type field, as well as the
      ASN1_ITEM utype fields They are the same as universal tag numbers,
      except non-universal types map to V_ASN1_OTHER. I believe ASN1_TYPE
      types and ASN1_ITEM utypes are the same, but I am not positive.
    
    - ASN1_STRING types. These are the same as utypes, except V_ASN1_OTHER
      appears to only be possible when embedded inside ASN1_TYPE, and
      negative INTEGER and ENUMERATED values get mapped to
      V_ASN1_NEG_INTEGER and V_ASN1_NEG_ENUMERATED. Additionally, some
      values like V_ASN1_OBJECT are possible in a utype but not possible in
      an ASN1_STRING (and will cause lots of problems if ever placed in
      one).
    
    - Sometimes one of these enums is augmented with V_ASN1_UNDEF and/or
      V_ASN1_APP_CHOOSE for extra behaviors.
    
    - Probably others I'm missing.
    
    These get mixed up all the time. asn1_ex_i2c's MSTRING path converts
    from ASN1_STRING type to utype and forgets to normalize V_ASN1_NEG_*.
    This means that negative INTEGERs and ENUMERATEDs in MSTRINGs do not get
    encoded right.
    
    The negative INTEGER case is unreachable (unless the caller passes
    the wrong ASN1_STRING to an MSTRING i2d function, but mismatching i2d
    functions generally does wrong things), but the negative ENUMERATED case
    is reachable. Fix this and add a test.
    
    Change-Id: I762d482e72ebf03fd64bba291e751ab0b51af2a9
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48805
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 11, 2021
    Configuration menu
    Copy the full SHA
    b9ee7b1 View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2021

  1. Fix some error returns from SSL_read and SSL_write.

    It's a bit of a mess, but BIO-like APIs typically return -1 on error and
    0 for EOF.
    
    Change-Id: Ibdcb70e1009ffebf6cc6df40804dc4a178c7199e
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48845
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    69ec7c8 View commit details
    Browse the repository at this point in the history
  2. Simplify built-in BIOs slightly.

    The free callbacks can assume their inputs are non-NULL. They're only
    called from BIOs of the corresponding method, which means the BIO must
    exist. Also new callbacks that leave everything zero-initialized are
    no-ops and can be omitted.
    
    This removes the weird thing where the built-in free functions were
    fallible. Although the int return is still necessary for compatibility
    with external BIOs.
    
    Change-Id: I91e2101efc7c77c703cb649df1490bc9f515f0fd
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48846
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 13, 2021
    Configuration menu
    Copy the full SHA
    2e68a05 View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2021

  1. Add Span::first() and Span::last().

    absl::Span, base::span, and std::span have first() and last() methods
    which give prefixes and suffixes. first() just saves 5 characters, but
    last() is nicer to write than subspan() for suffixes.
    
    Unlike subspan(), they also do not have clipping behavior, so we're
    guaranteed the length is correct. The clipping behavior comes from
    absl::Span::subspan() and is not present in std::span or base::span.
    I've left it in, in case we switch to absl::Span in the future, but I
    imagine absl::Span will need to migrate this at some point.
    
    Change-Id: I042dd6c566b6d753ec6de9d84e8c09ac7c270267
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48905
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 16, 2021
    Configuration menu
    Copy the full SHA
    006f20a View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2021

  1. Bump minimum GCC version and note impending VS2015 deprecation.

    GCC 6.1 was released more than five years ago, April 27, 2016. We can
    thus drop some bits in the CMake files.
    
    https://gcc.gnu.org/releases.html
    https://gcc.gnu.org/develop.html#num_scheme
    
    Also note in BUILDING.md that VS2015 will no longer be supported next
    year. Then we can cycle our CQ to testing VS2017 + VS2019. (We're
    currently not testing VS2019 at all, though so far it hasn't been an
    issue.) I've been running into some VS2015-only C++ issues around
    conversions, so once we stop testing it, I expect it'll break.
    
    Change-Id: I7a3020df2acd61d57409108aa4d99c840b5ca994
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48925
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    a603c82 View commit details
    Browse the repository at this point in the history
  2. Guard use of sdallocx with BORINGSSL_SDALLOCX

    See comment in change and grpc/grpc#25450
    
    Update-note: consumers may wish to define BORINGSSL_SDALLOCX if using
    tcmalloc.
    
    Change-Id: I123fe31a6c4013f1ce0c056f82a316c71df84939
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48885
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    80df739 View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2021

  1. Process the TLS 1.3 cipher suite in one place.

    The cipher suite, like the version, is determined by the first server
    message, independent of whether it's ServerHello or HelloRetryRequest.
    We can simplify this by just processing it before we branch on which it
    was.
    
    Change-Id: I747f515e9e5b05a42cbed6e7844808d0fc79a30b
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48906
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 18, 2021
    Configuration menu
    Copy the full SHA
    05ce773 View commit details
    Browse the repository at this point in the history
  2. runner: Test session IDs over 32 bytes.

    The session ID field cannot exceed 32 bytes, and we size various buffers
    based on this. Test that our parsers correctly handle this.
    
    Also fix the -wait-for-debugger flag. I broke it recently by removing
    the statusShimStarted message.
    
    Change-Id: I29bb177f29a79bb4904fb5ba3cedfb0b6b856061
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48907
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 18, 2021
    Configuration menu
    Copy the full SHA
    16c3e3a View commit details
    Browse the repository at this point in the history

Commits on Aug 20, 2021

  1. Refer to RFCs consistently.

    We were a mix of "RFC1234" and "RFC 1234". Apparently there is actually
    an answer for this, which is with a space textually and without a space
    in the citation/reference tag:
    https://datatracker.ietf.org/doc/html/rfc7322#section-3.5
    
    Change-Id: I0c44023163fe3a2a3ffe28cbc644d4c952dc8f1e
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48965
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 20, 2021
    Configuration menu
    Copy the full SHA
    8648c53 View commit details
    Browse the repository at this point in the history
  2. Linkify RFCs in documentation.

    Change-Id: If42bc55c1381dc50dd1125c2780edc6cafa964cb
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48966
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 20, 2021
    Configuration menu
    Copy the full SHA
    047ff64 View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2021

  1. Add a CBB_add_zeros helper.

    We fill in placeholder values of all zeros fairly often in TLS now,
    as workarounds for messages being constructed in the wrong order.
    draft-12 of ECH adds even more of these. Add a helper so we don't need
    to interrupt an || chain with a memset.
    
    Change-Id: Id4f9d988ee67598645a01637cc9515b475c1aec2
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48909
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 24, 2021
    Configuration menu
    Copy the full SHA
    9545062 View commit details
    Browse the repository at this point in the history
  2. Do not rely on ASN1_STRING being NUL-terminated.

    This imports part of the fix for CVE-2021-3712, commits
    d9d838ddc0ed083fb4c26dd067e71aad7c65ad16,
    5f54e57406ca17731b9ade3afd561d3c652e07f2,
    23446958685a593d4d9434475734b99138902ed2,
    and bb4d2ed4091408404e18b3326e3df67848ef63d0 from upstream. The
    others will be imported in follow-up CLs.
    
    Change-Id: Ic35aeb3895935ee94b82a295efade32782e8d1bc
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49005
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 24, 2021
    Configuration menu
    Copy the full SHA
    4f9a7ba View commit details
    Browse the repository at this point in the history
  3. Fix i2v_GENERAL_NAME to not assume NUL terminated strings

    See also 174ba8048a7f2f5e1fca31cfb93b1730d9db8300 from upstream. This
    differs from the upstream CL in that:
    
    - We don't silently drop trailing NULs.
    
    - As a NUL-terminated C string, the empty string is a non-NULL pointer
      to an array containing a zero byte. Use the latter consistently.
    
    Change-Id: I99c6c4c26be5a1771c56c6ab356425f1b85be41d
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49006
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 24, 2021
    Configuration menu
    Copy the full SHA
    2d10c18 View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2021

  1. Add some tests for name constraints.

    Change-Id: I51606bb7e4674716ffb6688b3a8e69db3f014546
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49007
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    04601b0 View commit details
    Browse the repository at this point in the history
  2. Rewrite name constraints matching with CBS.

    See also 8393de42498f8be75cf0353f5c9f906a43a748d2 from upstream and
    CBS-2021-3712. But rather than do that, I've rewritten it with CBS, so
    it's a bit clearer. The previous commit added tests.
    
    Change-Id: Ie52e28f07b9bf805c8730eab7be5d40cb5d558b6
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49008
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    b27438e View commit details
    Browse the repository at this point in the history
  3. OPENSSL_strndup should not return NULL given {NULL, 0}.

    The NUL-terminated representation of the empty string is a non-NULL
    one-byte array, not NULL. This fills in the last of the empty string
    cases in https://boringssl-review.googlesource.com/c/boringssl/+/49006/
    
    Change-Id: I66c09dc3223f762b708612987b26c90e41e27c4a
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49009
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    5984cfe View commit details
    Browse the repository at this point in the history
  4. Fix typo.

    Subsequent CLs will add some fuzzers, etc., that'll help with catching
    this.
    
    Change-Id: I10a8e4b2f23ffd07b124e725c1f7454e7ea6f2dd
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49025
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    4bf0a19 View commit details
    Browse the repository at this point in the history
  5. Fix some error-handling in i2v functions.

    See upstream commits:
    32f3b98d1302d4c0950dc1bf94b50269b6edbd95
    432f8688bb72e21939845ac7a69359ca718c6676
    7bb50cbc4af78a0c8d36fdf2c141ad1330125e2f
    8c74c9d1ade0fbdab5b815ddb747351b8b839641
    
    Change-Id: Iff614260c1b1582856edb4ae7a226f2e07537698
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49045
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    cdfc259 View commit details
    Browse the repository at this point in the history
  6. Run X509_print in the certificate fuzzer.

    Given the error handling issues in the previous CL, we'll probably be
    chasing down bugs in there for a while.
    
    Change-Id: I7a219e0fe2496f602d38b4bd0fcd5585ebd72cb7
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49046
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    6038ac5 View commit details
    Browse the repository at this point in the history
  7. Merge in OpenSSL's X.509 corpus.

    Ran the following command at OpenSSL commit
    18622c7625436d7f99c0f51895c4d3cea233c62e:
    
    ./build-fuzz/fuzz/cert -merge=1 -max_len=10000 fuzz/cert_corpus/ ~/openssl/fuzz/corpora/x509
    
    Change-Id: I22c4051351138736a0fa0202c0977ca9afc6924c
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49047
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    61f3208 View commit details
    Browse the repository at this point in the history
  8. Deduplicate our three ServerHello parsers.

    We do this enough that it's worth extracting a common parser. And this
    gives a struct we can pass around. Note this moves the server extensions
    block parsing out of ssl_scan_serverhello_tlsext.
    
    I've also consolidated a few error conditions to tighten the code up a
    bit: the TLS 1.2 code distinguishes unknown from unadvertised cipher,
    while the TLS 1.3 code didn't. And seeing the wrong legacy version
    number in TLS 1.3 is really just a syntax error since it's not the
    version field anymore. (RFC8446 specifies the value.)
    
    Change-Id: Ia2f44ff9a3899b5a594569f1b258f2b487930496
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48908
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    e2cb423 View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2021

  1. Make ssl_parse_extensions a little easier to use.

    std::initializer_list appears to work by instantiating a T[N] at the
    call site (which is what we were doing anyway), so I don't believe there
    is a runtime dependency.
    
    This also adds a way for individual entries to turn themselves off,
    which means we don't need to manually check for some unsolicited
    extensions.
    
    Change-Id: I40f79b6a0e9c005fc621f4a798fe201bfbf08411
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48910
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 26, 2021
    Configuration menu
    Copy the full SHA
    a75027b View commit details
    Browse the repository at this point in the history
  2. Avoid re-hashing the transcript multiple times.

    tls13_init_key_schedule calls InitHash internally, but we also call
    InitHash earlier at various times. On the client, we do it early to
    handle HelloRetryRequest and 0-RTT. ECH draft-12 will also need to do it
    early. Apparently we do it early on the server too.
    
    Probably tls13_init_key_schedule doesn't need to call InitHash, but for
    now, it is an easy check in SSLTranscript.
    
    Change-Id: I5473047c1f29bdeb60901e4e6e80979e592bd6e9
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48911
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 26, 2021
    Configuration menu
    Copy the full SHA
    d55f450 View commit details
    Browse the repository at this point in the history
  3. Work around yet another MSVC 2015 SFINAE bug.

    Although we defined a CBS -> Span<const uint8_t> conversion, MSVC 2015
    keeps trying to call the Span(const Container&) constructor. It seems to
    not correctly SFINAE the existence of data() and size() members unless
    the expression is inlined into the default template argument.
    
    Change-Id: I4e88f820b78ce72ad1b014b5bae0830bc7d099d4
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48945
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 26, 2021
    Configuration menu
    Copy the full SHA
    c6d3fd1 View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2021

  1. Benchmark RSA private key parsing.

    We do non-trivial work when parsing RSA private keys (RSA_check_key)
    and, in some consumers, this is performance-sensitive.
    
    Bug: b/192484677
    Change-Id: Ic27f5f11d8bd030de77dd500a826fb2dd7c5b75d
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49105
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 30, 2021
    Configuration menu
    Copy the full SHA
    417010f View commit details
    Browse the repository at this point in the history
  2. Make RSA_check_key more than 2x as fast.

    The bulk of RSA_check_key is spent in bn_div_consttime, which is a naive
    but constant-time long-division algorithm for the few places that divide
    by a secret even divisor: RSA keygen and RSA import. RSA import is
    somewhat performance-sensitive, so pick some low-hanging fruit:
    
    The main observation is that, in all but one call site, the bit width of
    the divisor is public. That means, for an N-bit divisor, we can skip the
    first N-1 iterations of long division because an N-1-bit remainder
    cannot exceed the N-bit divisor.
    
    One minor nuisance is bn_lcm_consttime, used in RSA keygen has a case
    that does *not* have a public bit width. Apply the optimization there
    would leak information. I've implemented this as an optional public
    lower bound on num_bits(divisor), which all but that call fills in.
    
    Before:
    Did 5060 RSA 2048 private key parse operations in 1058526us (4780.2 ops/sec)
    Did 1551 RSA 4096 private key parse operations in 1082343us (1433.0 ops/sec)
    
    After:
    Did 11532 RSA 2048 private key parse operations in 1084145us (10637.0 ops/sec) [+122.5%]
    Did 3542 RSA 4096 private key parse operations in 1036374us (3417.7 ops/sec) [+138.5%]
    
    Bug: b/192484677
    Change-Id: I893ebb8886aeb8200a1a365673b56c49774221a2
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49106
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 30, 2021
    Configuration menu
    Copy the full SHA
    c65543b View commit details
    Browse the repository at this point in the history
  3. NUL is not printable.

    strchr is interprets the trailing NUL as part of the string, so
    is_printable thought NUL was allowed. Just write the code in the obvious
    way and let the compiler figure it out. (It seems to make a clever
    bitmask or something.)
    
    Update-Note: ASN1_mbstring_ncopy will no longer allow PrintableString
    for strings containing NUL.
    
    Change-Id: I3675191ceb44c06f0ac7b430f88272cabf392d35
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49065
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 30, 2021
    Configuration menu
    Copy the full SHA
    9618128 View commit details
    Browse the repository at this point in the history
  4. Include SHA512-256 in EVP_get_digestbyname and EVP_MD_do_all.

    Change-Id: I25a1a58589ec8843da4d1955d8fec38561f13ec9
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49125
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Aug 30, 2021
    Configuration menu
    Copy the full SHA
    31f462a View commit details
    Browse the repository at this point in the history
  5. Rewrite ASN1_PRINTABLE_type and add tests.

    The old loop read one byte past the length. It also stopped the loop
    too early on interior NUL. See also upstream's
    openssl/openssl#16433, though I've opted to
    rewrite the function entirely rather than use their fix.
    
    Also deduplicate the PrintableString check.
    
    Change-Id: Ia8bd282047c2a2ed1d5e71a68a3947c7c108df95
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49066
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 30, 2021
    Configuration menu
    Copy the full SHA
    6b7525a View commit details
    Browse the repository at this point in the history
  6. Remove V_ASN1_APP_CHOOSE.

    V_ASN1_APP_CHOOSE has been discouraged by OpenSSL since 2000:
    https://git.openssl.org/gitweb/?p=openssl.git;a=blob;f=CHANGES;h=824f421b8d331ba2a2009dbda333a57493bedb1e;hb=fb047ebc87b18bdc4cf9ddee9ee1f5ed93e56aff#l10848
    
    Instead, upstream recommends an MBSTRING_* constant.
    https://www.openssl.org/docs/man1.1.1/man3/X509_NAME_add_entry_by_NID.html
    
    This function is a bit overloaded:
    
    MBSTRING_* means "Decode my input from this format and then re-encode it
    using whatever string type best suits the NID (usually UTF8String, but
    some NIDs require PrintableString)".
    
    V_ASN1_APP_CHOOSE means "This is a Latin-1 string. Without looking at
    the NID, pick one of PrintableString, IA5String, or T61String".
    
    The latter is almost certainly not what callers want. If they want a
    particular type, they can always force it by passing a particular
    V_ASN1_* constant. This removes the only use of ASN1_PRINTABLE_type
    within the library, though there is one external use still.
    
    Update-Note: V_ASN1_APP_CHOOSE is removed. I only found one use, which
    has been fixed.
    
    Change-Id: Id36376dd0ec68559bbbb366e2305d42be5ddac67
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49067
    Reviewed-by: Adam Langley <agl@google.com>
    davidben committed Aug 30, 2021
    Configuration menu
    Copy the full SHA
    59aff62 View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2021

  1. Make most of crypto/x509 opaque.

    This unexports X509, X509_CINF, X509_NAME_ENTRY, X509_NAME, X509_OBJECT,
    X509_LOOKUP_METHOD, X509_STORE, X509_LOOKUP, and X509_STORE_CTX.
    
    Note this means X509_STORE_CTX can no longer be stack-allocated.
    
    Update-Note: Patch cl/390055173 into the roll that includes this. This
    unexports most of the X.509 structs, aligning with OpenSSL. Use the
    accessor APIs instead.
    
    Bug: 425
    Change-Id: I53e915bfae3b8dc4b67642279d0e54dc606f2297
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48985
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Aug 31, 2021
    Configuration menu
    Copy the full SHA
    dddb60e View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2021

  1. Remove SSL_set_verify_result.

    Follow-up from https://boringssl-review.googlesource.com/10485 that I
    forgot about. It's been removed from netty-tcnative.
    
    Change-Id: Ic4b97b30787962b78a69911a6e3cd28647546f59
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49145
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    07b365f View commit details
    Browse the repository at this point in the history
  2. Reword SSL_get0_ech_name_override documentation.

    Hopefully it's a little clearer that this may be called whether or not
    ECH is offered. (And whether or not it's a server.)
    
    Bug: 275
    Change-Id: I39c8ce5758543a0cfda84652b3fc0a5b9669fd0a
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49165
    Reviewed-by: Matt Mueller <mattm@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    37a3c70 View commit details
    Browse the repository at this point in the history
  3. Update to draft-ietf-tls-esni-13.

    Later CLs will clean up the ClientHello construction a bit (draft-12
    avoids computing ClientHelloOuter twice). I suspect the transcript
    handling on the client can also be simpler, but I'll see what's
    convenient after I've changed how ClientHelloOuter is constructed.
    
    Changes of note between draft-10 and draft-13:
    
    - There is now an ECH confirmation signal in both HRR and SH. We don't
      actually make much use of this in our client right now, but it
      resolves a bunch of weird issues around HRR, including edge cases if
      HRR applies to one ClientHello but not the other.
    
    - The confirmation signal no longer depends on key_share and PSK, so we
      don't have to work around a weird ordering issue.
    
    - ech_is_inner is now folded into the main encrypted_client_hello code
      point. This works better with some stuff around HRR.
    
    - Padding is moved from the padding extension, computed with
      ClientHelloInner, to something we fill in afterwards. This makes it
      easier to pad up the whole thing to a multiple of 32. I've accordingly
      updated to the latest recommended padding construction, and updated
      the GREASE logic to match.
    
    - ech_outer_extensions is much easier to process because the order is
      required to be consistent. We were doing that anyway, and now a simple
      linear scan works.
    
    - ClientHelloOuterAAD now uses an all zero placeholder payload of the
      same length. This lets us simplify the server code, but, for now, I've
      kept the client code the same. I'll follow this up with a CL to avoid
      computing ClientHelloOuter twice.
    
    - ClientHelloOuterAAD is allowed to contain a placeholder PSK. I haven't
      filled that in and will do it in a follow-up CL.
    
    Bug: 275
    Change-Id: I7464345125c53968b2fe692f9268e392120fc2eb
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/48912
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 1, 2021
    Configuration menu
    Copy the full SHA
    18b6836 View commit details
    Browse the repository at this point in the history

Commits on Sep 2, 2021

  1. Fix calculation of draft-13 ECH confirmation signal.

    Apparently both we and Go flipped the parameter order for HKDF-Extract
    relative to the HKDF spec. (The spec orders the salt before the key.)
    Not sure how that happened.
    
    Found doing interop testing with Stephen Farrell's implementation.
    
    https://pkg.go.dev/golang.org/x/crypto/hkdf#Extract
    https://datatracker.ietf.org/doc/html/rfc5869#section-2.2
    https://datatracker.ietf.org/doc/html/draft-ietf-tls-esni-13#section-7.2
    
    Bug: 275
    Change-Id: I40a7d53b45cb548e93e6a7ae235e98e55dec4a7a
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49185
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Sep 2, 2021
    Configuration menu
    Copy the full SHA
    19fe794 View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2021

  1. Revert "Guard use of sdallocx with BORINGSSL_SDALLOCX"

    This reverts commit 80df739.
    
    See grpc/grpc#25450 (comment)
    
    Even if we want to do this, turns out that we still need the weak symbol
    in order to work in important environments.
    
    Change-Id: I50b9aef0cfe7ed70bda433c3046d46f194636d54
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49205
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    agl authored and Boringssl LUCI CQ committed Sep 3, 2021
    Configuration menu
    Copy the full SHA
    b49b78e View commit details
    Browse the repository at this point in the history
  2. Switch to the new, simpler WHATWG URL formulation.

    In light of
    https://groups.google.com/a/chromium.org/g/blink-dev/c/7QN5nxjwIfM/m/q9dw9MxoAwAJ,
    the WHATWG URL parser is now more restrictive about which strings are
    valid DNS names. The final component may not be numeric. Align the
    ECHConfig validator with this.
    
    Bug: 275
    Change-Id: Iea2a3d9a7fee5bffc683da99274c54d60379be9e
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49225
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Sep 3, 2021
    Configuration menu
    Copy the full SHA
    1a668b3 View commit details
    Browse the repository at this point in the history
  3. Silence a GCC false positive warning.

    GCC 11.2.1 reportedly warns that CTR_DRBG_init may be passed an
    uninitialized personalization buffer. This appears to be a false
    positive, because personalization_len will be zero. But it's easy enough
    to zero-initialize it, so silence the warning.
    
    Bug: 432
    Change-Id: I20f6b74e09f19962e8cae37d45090ff3d1c0215d
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49245
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 3, 2021
    Configuration menu
    Copy the full SHA
    c0fcb4e View commit details
    Browse the repository at this point in the history

Commits on Sep 7, 2021

  1. Update comment for ECH draft-13.

    Bug: 275
    Change-Id: I66c0d099f9fe6172c60cbf1f512b90f3b2bbb897
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49285
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    0fa3030 View commit details
    Browse the repository at this point in the history
  2. Check for __TRUSTY__ instead of TRUSTY.

    Meant to do this shortly after filing the bug but forgot.
    
    Bug: 377
    Change-Id: Ic5a5c167a7b6745599e3a32c4792b66ebbb2dee0
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49265
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    a03c34c View commit details
    Browse the repository at this point in the history
  3. acvptool: add hmacDRBG support

    Change-Id: I63ecaaaa8ec339688c586a4b2d44e4b91b910b8f
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49305
    Commit-Queue: Adam Langley <agl@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Sep 7, 2021
    Configuration menu
    Copy the full SHA
    2577343 View commit details
    Browse the repository at this point in the history

Commits on Sep 8, 2021

  1. Correctly propagate errors in i2d functions.

    tasn_enc.c was missing lots of error checks and mixed up 0 and -1
    returns. Document all the internal calling conventions, as best as I can
    tell, and fix things up.
    
    There are also error cases it forgets to check (it generally does not
    notice missing non-OPTIONAL fields). This CL only addresses errors it
    already tries to report. Subsequent CLs will add in the missing error
    cases. And then if it all sticks, I'm hoping we can rewrite this with
    CBB. Rewriting tsan_dec.c to CBS would also be good, but that will be
    more difficult as we need to clear out BER first.
    
    Update-Note: Some error cases which were silently misinterpreted as
    missing OPTIONAL elements will now cause encoding to fail.
    
    Bug: 429
    Change-Id: Ibbb3eba08eb8f8f878930c9456edc8c74479aade
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49345
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    27b31cf View commit details
    Browse the repository at this point in the history
  2. Fix x509_name_ex_i2d error-handling.

    This function forgot to handle errors in ASN1_item_ex_i2d. It also
    checked x509_name_canon for ret < 0, when x509_name_canon returns a
    boolean. For consistency, I've switched to x509_name_encode to return a
    boolean as well. It doesn't actually need to return a length because
    it's responsible for filling in a->bytes.
    
    (This is also far from thread-safe, but I'll figure out what to do there
    separately.)
    
    Bug: 429
    Change-Id: I1dddeab320018be4b837f95001cbeeba4e25f0a1
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49346
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    3b6cebb View commit details
    Browse the repository at this point in the history
  3. Check for invalid CHOICE selectors in i2d functions.

    This handles normal CHOICE types. A follow-up CL will handle MSTRING and
    ANY types.
    
    Update-Note: An invalid CHOICE object (e.g. GENERAL_NAME) will now fail
    when encoded, rather than be silently omitted. In particular, CHOICE
    objects are default-initialized by tasn_new.c in an empty -1 state.
    Structures containing a required CHOICE field can no longer be encoded
    without filling in the CHOICE.
    
    Bug: 429
    Change-Id: I7011deadf518ddc344a56b07a0e268ceaae17fe0
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49347
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    248ab81 View commit details
    Browse the repository at this point in the history
  4. Correctly handle invalid ASN1_OBJECTs when encoding.

    asn1_ex_i2c actually does have an error condition, it just wasn't being
    handled.
    
    628b3c7, imported from upstream's
    f3f8e72f494b36d05e0d04fe418f92b692fbb261, tried to check for OID-less
    ASN1_OBJECTs and return an error. But it and the upstream change didn't
    actually work. -1 in this function means to omit the object, so OpenSSL
    was silently misinterpreting the input structure.
    
    This changes the calling convention for asn1_ex_i2c to support this. It
    is, unfortunately, a little messy because:
    
    1. One cannot check for object presense without walking the
       ASN1_ITEM/ASN1_TEMPLATE structures. You can *almost* check if *pval
       is NULL, but ASN1_BOOLEAN is an int with -1 to indicate an omitted
       optional. There are also FBOOLEAN/TBOOLEAN types that omit FALSE/TRUE
       for DEFAULT. Thus, without more invasive changes, asn1_ex_i2c must be
       able to report an omitted element.
    
    2. While the i2d functions report an omitted element by successfully
       writing zero bytes, i2c only writes the contents. It thus must
       distinguish between an omitted element and an element with
       zero-length contents.
    
    3. i2c_ASN1_INTEGER and i2c_ASN1_BIT_STRING return zero on error rather
       than -1. Those error paths are not actually reachable because they
       only check for NULL. In fact, OpenSSL has even unexported them. But I
       found a few callers. Rather than unwind all this and change the
       calling convention, I've just made it handle 0 and map to -1 for now.
       It's all a no-op anyway, and hopefully we can redo all this with CBB
       later.
    
    I've just added an output parameter for now.
    
    In writing tests, I also noticed that the hand-written i2d_ASN1_OBJECT
    and i2d_ASN1_BOOLEAN return the wrong value for errors, so I've fixed
    that.
    
    Update-Note: A default-constructed object with a required ASN1_OBJECT
    field can no longer be encoded without initializing the ASN1_OBJECT.
    Note this affects X509: the signature algorithm is an ASN1_OBJECT. Tests
    that try to serialize an X509_new() must fill in all required fields.
    (Production code is unlikely to be affected because the output was
    unparsable anyway, while tests sometimes wouldn't notice.)
    
    Bug: 429
    Change-Id: I04417f5ad6b994cc5ccca540c8a7714b9b3af33d
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49348
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 8, 2021
    Configuration menu
    Copy the full SHA
    6e70be0 View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2021

  1. Reject -1 types in ASN1_TYPE and MSTRINGs when encoding.

    See openssl/openssl#16538
    
    Update-Note: A default-constructed object with a required ANY or
    string-like CHOICE field cannot be encoded until the field is specified.
    Note this affects i2d_X509: notBefore and notAfter are string-like
    CHOICEs in OpenSSL.
    
    Bug: 429
    Change-Id: I97d971fa588ab72be25a4c1eb7310ed330f16c4f
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49349
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 9, 2021
    Configuration menu
    Copy the full SHA
    c9b75af View commit details
    Browse the repository at this point in the history
  2. Reject missing required fields in i2d functions.

    See also 006906cddda37e24a66443199444ef4476697477 from OpenSSL, though
    this CL uses a different strategy from upstream. Upstream makes
    ASN1_item_ex_i2d continue to allow optionals and checks afterwards at
    every non-optional call site. This CL pushes down an optional parameter
    and says functions cannot omit items unless explicitly allowed.
    
    I think this is a better default, though it is a larger change. Fields
    are only optional when they come from an ASN1_TEMPLATE with the OPTIONAL
    flag. Upstream's strategy misses top-level calls.
    
    This CL additionally adds checks for optional ASN1_TEMPLATEs in contexts
    where it doesn't make sense. Only fields of SEQUENCEs and SETs may be
    OPTIONAL, but the ASN1_ITEM/ASN1_TEMPLATE split doesn't quite match
    ASN.1 itself. ASN1_TEMPLATE is additionally responsible for
    explicit/implicit tagging, and SEQUENCE/SET OF. That means CHOICE arms
    and the occasional top-level type (ASN1_ITEM_TEMPLATE) use ASN1_TEMPLATE
    but will get confused if marked optional.
    
    As part of this, i2d_FOO(NULL) now returns -1 rather than "successfully"
    writing 0 bytes. If we want to allow NULL at the top-level, that's not
    too hard to arrange, but our CBB-based i2d functions do not.
    
    Update-Note: Structures with missing mandatory fields can no longer be
    encoded. Note that, apart from the cases already handled by preceding
    CLs, tasn_new.c will fill in non-NULL empty objects everywhere. The main
    downstream impact I've seen of this particular change is in combination
    with other bugs. Consider a caller that does:
    
      GENERAL_NAME *name = GENERAL_NAME_new();
      name->type = GEN_DNS;
      name->d.dNSName = DoSomethingComplicated(...);
    
    Suppose DoSomethingComplicated() was actually fallible and returned
    NULL, but the caller forgot to check. They'd now construct a
    GENERAL_NAME with a missing field. Previously, this would silently
    serialize some garbage (omitted field) or empty string. Now we fail to
    encode, but the true error was the uncaught DoSomethingComplicated()
    failure. (Which likely was itself a bug.)
    
    Bug: 429
    Change-Id: I37fe618761be64a619be9fdc8d416f24ecbb8c46
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49350
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 9, 2021
    Configuration menu
    Copy the full SHA
    866cccc View commit details
    Browse the repository at this point in the history
  3. Don't read it->funcs without checking it->itype.

    it->funcs is only an ASN1_AUX for ASN1_ITYPE_SEQUENCE and
    ASN1_ITYPE_CHOICE. Fortunately, the other possible types for it->funcs
    are larger than ASN1_AUX and we don't touch the result when we
    shouldn't, so this is merely a strict aliasing violation.
    
    Change-Id: I29e94249e0b137fe8df0b16254366ae6705c8784
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49351
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 9, 2021
    Configuration menu
    Copy the full SHA
    afed9f7 View commit details
    Browse the repository at this point in the history
  4. Remove ASN1_OP_I2D_* callbacks.

    These are a little odd with the ASN1_ENCODING paths. And there were some
    bugs previously around CHOICE types. Nothing defines them, inside or
    outside BoringSSL, so remove them.
    
    Change-Id: Id2954fef8ee9637f36f7511b51dc0adc2557e3ba
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49352
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 9, 2021
    Configuration menu
    Copy the full SHA
    ed5f4e8 View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2021

  1. Add maskHash to RSA_PSS_PARAMS for compat

    This CL adds a maskHash member to the rsa_pss_params_st struct for
    increased compatibility with OpenSSL: https://source.chromium.org/chromium/chromium/src/+/main:third_party/perl/c/include/openssl/rsa.h;l=282-289
    
    Node.js recently began to make use of this member in nodejs/node#39851
    and without this member Electron sees compilation errors.
    
    Change-Id: Ibd18a31605b0a715edb279a3bca4b4f05e679767
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49365
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    codebytere authored and Boringssl LUCI CQ committed Sep 10, 2021
    Configuration menu
    Copy the full SHA
    0446b59 View commit details
    Browse the repository at this point in the history

Commits on Sep 13, 2021

  1. Fix BN_prime_checks_for_validation to align with false-positive rate.

    This doesn't affect RSA key generation, which uses
    BN_prime_checks_for_generation.
    
    Change-Id: Ibf32c0c4bc9fed369e8f8a1efea72c5bd39185a9
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49426
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    jakemas authored and Boringssl LUCI CQ committed Sep 13, 2021
    Configuration menu
    Copy the full SHA
    019cc62 View commit details
    Browse the repository at this point in the history
  2. Clarify that TLS sessions are not application sessions.

    Having APIs named "session" and "ID" appears to be far too tempting for
    developers, mistaking it as some application-level notion of session.
    Update the documentation, in hopes of discouraging this mistake.
    
    Change-Id: Ifd9516287092371d4701114771eff6640df1bcb0
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49405
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Sep 13, 2021
    Configuration menu
    Copy the full SHA
    62c4f15 View commit details
    Browse the repository at this point in the history
  3. Fix the TLS fuzzers for ECH draft-13.

    Replace the hardcoded ECH config, which wasn't updated for draft-13,
    with a call to SSL_marshal_ech_config.
    
    Bug: 275, oss-fuzz:38054
    Change-Id: I10c12b22015c9c0cb90dd6185eb375153a2531f4
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49445
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Sep 13, 2021
    Configuration menu
    Copy the full SHA
    27a3328 View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2021

  1. Refresh fuzzer corpus for ECH draft-13.

    Bug: 275
    Change-Id: I3a89bd31b6198c9cb2e40835219fa9f248a69c9b
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49446
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 14, 2021
    Configuration menu
    Copy the full SHA
    cd32fd3 View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2021

  1. Add FIPS counters for AES-GCM in EVP_AEAD.

    BUG=b/158221316
    
    Change-Id: I42693f760aa2852902d72622e109c5d9cac2c4d9
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49485
    Commit-Queue: Adam Langley <agl@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Sep 15, 2021
    Configuration menu
    Copy the full SHA
    1c2473e View commit details
    Browse the repository at this point in the history

Commits on Sep 16, 2021

  1. Ignore SIGPIPE in the bssl tool.

    Bug: 435
    Change-Id: I0ed94d40d04ebc26c9996dfe2b947a6e2f140a89
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49465
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Sep 16, 2021
    Configuration menu
    Copy the full SHA
    41adb34 View commit details
    Browse the repository at this point in the history
  2. acvptool: add CS3 support.

    CS3 is ciphertext-stealing variant three from SP 800-38A.
    
    Change-Id: I992dc22778c91efad361f25ff65ae5966fc447c6
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49505
    Commit-Queue: Adam Langley <agl@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Sep 16, 2021
    Configuration menu
    Copy the full SHA
    f3e5941 View commit details
    Browse the repository at this point in the history

Commits on Sep 20, 2021

  1. Unwind remnants of ASN1_TFLG_NDEF.

    The i2d functions internally take a tag/class pair of parameters. If tag
    is not -1, we override the tag with (tag, class). Otherwise, class is
    ignored. (class is inconsistently called aclass or iclass.)
    
    Historically, the remaning bits of class were repurposed to pass extra
    flags down the structure. These had to be preserved in all recursive
    calls, so the functions take apart and reassemble the two halves of
    aclass/iclass. The only such flag was ASN1_TFLG_NDEF, which on certain
    types, caused OpenSSL to encode indefinite-length encoding. We removed
    this in https://boringssl-review.googlesource.com/c/boringssl/+/43889.
    
    Due to these flags, if tag == -1, class should default to zero. However,
    X509_NAME's callbacks pass -1, -1, instead of -1, 0, effectively setting
    all flags. This wasn't noticed because none of the types below X509_NAME
    pay attention to ASN1_TFLG_NDEF.
    
    This CL does two things: First, it unwinds the remainder of the flags
    machinery. If we ever need flags, we should pass it as a distinct
    argument. Second, it fixes the X509_NAME calls and asserts that -1 is
    always paired with 0.
    
    Change-Id: I285a73a06ad16980617fe23d5ea7f260fc5dbf16
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49385
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 20, 2021
    Configuration menu
    Copy the full SHA
    4937f05 View commit details
    Browse the repository at this point in the history

Commits on Sep 22, 2021

  1. Speed up constant-time base64 decoding.

    I was inspired to look at this again recently and noticed we could do a
    bit better. Instead of a tower of selects, rely on all the cases being
    mutually exclusive and use the ret |= mask & value formulation without
    loss in clarity. We do need to fixup the invalid case slightly, but
    since that computation is mostly independent, I'm guessing the CPU and
    compiler are able to schedule it effectively.
    
    Before:
    Did 251000 base64 decode operations in 2002569us (159.4 MB/sec)
    After:
    Did 346000 base64 decode operations in 2005426us (219.5 MB/sec) [+37.7%]
    
    Change-Id: I542167202fd4e94c93dd5a2519a97bc388072c89
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49525
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Sep 22, 2021
    Configuration menu
    Copy the full SHA
    f958727 View commit details
    Browse the repository at this point in the history
  2. Allow PKCS7_sign to work for signing kernel modules.

    Linux module signing uses PKCS#7 / CMS because everything is awful and
    broken. In order to make the lives of kernel developers easier, support
    the calling pattern that the kernel uses to sign modules.
    
    The kernel utility was written at a time when PKCS#7 was hard coded to
    use SHA-1 for signing in OpenSSL and it reflects this: you can only
    specify “sha1” on the command line, for example. As of OpenSSL 1.1.1, at
    least, OpenSSL uses SHA-256 and thus so does this change.
    
    Change-Id: I32b036123a0d8b272ec9e1c0130c45bf3ed0d2c7
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49545
    Commit-Queue: Adam Langley <agl@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Sep 22, 2021
    Configuration menu
    Copy the full SHA
    66e61c5 View commit details
    Browse the repository at this point in the history

Commits on Sep 23, 2021

  1. aarch64: Add missing LR validation in 'vpaes_cbc_encrypt'

    There is an obvious bug there: upon entry to 'vpaes_cbc_encrypt'
    LR may get signed. However, on the 'cbc_abort' path the LR is
    not going to be unsigned before 'ret' is executed.
    
    Found by manual code inspection.
    
    Co-authored-by: Russ Butler <russ.butler@arm.com>
    
    Change-Id: I646cdfaee28db59aafbbd412d4bb6ba022eff15b
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49605
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    tamaspetz authored and Boringssl LUCI CQ committed Sep 23, 2021
    Configuration menu
    Copy the full SHA
    dedd23e View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2021

  1. Keep EVP_CIPHER/EVP_MD lookup and do_all functions in sync

    Node seems uncommonly sensitive to this, so let's write these functions
    in a way that stays in sync and test this. See also
    https://boringssl-review.googlesource.com/c/boringssl/+/49585
    
    This does incur a cost across all BoringSSL consumers that use these
    functions: as a result of Node indiscriminately exposing every cipher,
    we end up pulling more and more ciphers into these getters. But that
    ship sailed long ago, so, instead, document that EVP_get_cipherby*
    should not be used by size-conscious callers.
    
    EVP_get_digestby* probably should have the same warning, but I've left
    it alone for now because we don't quite have the same proliferation of
    digests as ciphers. (Though there are things in there, like MD4, that
    ought to be better disconnected.)
    
    Change-Id: I61ca406c146279bd05a52bed6c57200d1619c5da
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49625
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 24, 2021
    Configuration menu
    Copy the full SHA
    03cae7a View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2021

  1. Fix CRYPTO_malloc, etc., definitions.

    In upstream, these functions take file and line number arguments. Update
    ours to match. Guessing almost no one uses these, or we'd have caught
    this earlier.
    
    Change-Id: Ic09f8d8274065ac02efa78e70c215b87fa765b9f
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49665
    Reviewed-by: Adam Langley <agl@google.com>
    Reviewed-by: Benjamin Brittain <bwb@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Sep 28, 2021
    Configuration menu
    Copy the full SHA
    551ccd7 View commit details
    Browse the repository at this point in the history
  2. Add log tag for Trusty.

    Trusty's TLOGE macro nowadays expects TLOG_TAG to be defined
    as the log tag to use.
    
    Change-Id: I18121287ba51698d354323027d5382c8406f0b99
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49685
    Commit-Queue: Pete Bentley <prb@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    prbprbprb authored and Boringssl LUCI CQ committed Sep 28, 2021
    Configuration menu
    Copy the full SHA
    cc509bd View commit details
    Browse the repository at this point in the history

Commits on Sep 29, 2021

  1. Add note to HMAC test vectors from NIST

    All the test vectors testing key length greater than the block length
    were mislabelled as key length being equal to the block length. Add a
    note to these test vectors indicating they are directly from the NIST
    tests with the misleading input intact.
    
    Change-Id: I9fe87971265ad48e9b835fccbe92306e1670b4d6
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49705
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    kruton authored and Boringssl LUCI CQ committed Sep 29, 2021
    Configuration menu
    Copy the full SHA
    87f316d View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2021

  1. Switch x509_test.cc to modify the existing X509_VERIFY_PARAM.

    There are two ways to configure an X509_STORE_CTX after
    X509_STORE_CTX_init. One can either modify the already initialized
    X509_VERIFY_PARAM or replace it. Modifying the existing one is more
    common. Replacing it actually misses some defaults. (See issue #441 for
    details.)
    
    In preparation for actually being able to test changes to the default,
    switch tests to that model. In doing so, no longer need to explicitly
    configure the depth and can test that default. (Though we should write
    tests for the depth at some point.)
    
    Bug: 439, 441
    Change-Id: I254a82585d70d44eb94920f604891ebfbff4af4c
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49745
    Commit-Queue: David Benjamin <davidben@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 1, 2021
    Configuration menu
    Copy the full SHA
    2bde936 View commit details
    Browse the repository at this point in the history
  2. Enable X509_V_FLAG_TRUSTED_FIRST by default.

    The OpenSSL X.509 verifier lacks a proper path builder. When there are
    two paths available for a certificate, we pick one without looking at
    expiry, etc.
    
    In scenarios like one below, X509_V_FLAG_TRUSTED_FIRST will prefer
    Leaf -> Intermediate -> Root1. Otherwise, we will prefer
    Leaf -> Intermediate -> Root1Cross -> Root2:
    
                 Root2
                   |
     Root1     Root1Cross
        \         /
        Intermediate
             |
           Leaf
    
    If Root2 is expired, as with Let's Encrypt, X509_V_FLAG_TRUSTED_FIRST
    will find the path we want. Same if Root1Cross is expired. (Meanwhile,
    if Root1 is expired, TRUSTED_FIRST will break and leaving it off works.
    TRUSTED_FIRST does not actually select chains with validity in mind. It
    just changes the semi-arbitrary decision.)
    
    OpenSSL 1.1.x now defaults to X509_V_FLAG_TRUSTED_FIRST by default, so
    match them. Hopefully the shorter chain is more likely to be correct.
    
    Update-Note: X509_verify_cert will now build slightly different chains
    by default. Hopefully, this fixes more issues than it causes, but there
    is a risk of trusted_first breaking other scenarios. Those scenarios
    will also break OpenSSL 1.1.x defaults, so hopefully this is fine.
    
    Bug: 439
    Change-Id: Ie624f1f7e85a9e8c283f1caf24729aef9206ea16
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49746
    Reviewed-by: Adam Langley <agl@google.com>
    Reviewed-by: Ryan Sleevi <rsleevi@chromium.org>
    davidben authored and agl committed Oct 1, 2021
    Configuration menu
    Copy the full SHA
    8f5eb80 View commit details
    Browse the repository at this point in the history
  3. Remove X509_STORE_set0_additional_untrusted.

    This was added in
    https://boringssl-review.googlesource.com/c/boringssl/+/12980/, but does
    not appear to be used anymore. The corresponding function does not exist
    in OpenSSL.
    
    This simplifies the tests slightly, some of which were inadvertently
    specifying the boolean and some weren't.
    
    Change-Id: I9b956dcd9f7151910f93f377d207c88273bd9ccf
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49747
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 1, 2021
    Configuration menu
    Copy the full SHA
    523d6c7 View commit details
    Browse the repository at this point in the history

Commits on Oct 5, 2021

  1. Extract common rotl/rotr functions.

    We have a ton of per-file rotation functions, often with generic names
    that do not tell you whether they are uint32_t vs uint64_t, or rotl vs
    rotr.
    
    Additionally, (x >> r) | (x << (32 - r)) is UB at r = 0.
    (x >> r) | (x << ((-r) & 31)) works for 0 <= r < 32, which is what
    cast.c does. GCC and Clang recognize this pattern as a rotate, but MSVC
    doesn't. MSVC does, however, provide functions for this.
    
    We usually rotate by a non-zero constant, which makes this moot, but
    rotation comes up often enough that it's worth extracting out. Some
    particular changes to call out:
    
    - I've switched sha256.c from rotl to rotr. There was a comment
      explaining why it differed from the specification. Now that we have
      both functions, it's simpler to just match the specification.
    
    - I've dropped all the inline assembly from sha512.c. Compilers should
      be able to recognize rotations in 2021.
    
    Change-Id: Ia1030e8bfe94dad92514ed1c28777447c48b82f9
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49765
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 5, 2021
    Configuration menu
    Copy the full SHA
    fa6ced9 View commit details
    Browse the repository at this point in the history
  2. Test that built-in ASN1_STRING_TABLEs are sorted.

    There's a test in the file under ifdef, but that is not wired up into
    the build.
    
    Change-Id: Iec09277c7ce948c33303d12c325207de2188d908
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49766
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 5, 2021
    Configuration menu
    Copy the full SHA
    a50f24c View commit details
    Browse the repository at this point in the history
  3. Test ASN1_STRING_set_by_NID with built-in NIDs.

    Change-Id: I58a3fba79b03058aaff37bb3e83f971a4ecd2e99
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49767
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 5, 2021
    Configuration menu
    Copy the full SHA
    db93c25 View commit details
    Browse the repository at this point in the history
  4. Test ASN1_STRING_set_by_NID with custom NIDs.

    Callers may as well use ASN1_mbstring_ncopy directly, but some code uses
    this, so test it. I've intentionally not tested updating entries because
    it crashes if you use a built-in one, and updating a dynamic one seems
    unnecessary.
    
    Change-Id: If760a751fbdcd1a2f14d5dcb08de2b0f2a8d3549
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49768
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 5, 2021
    Configuration menu
    Copy the full SHA
    38890fd View commit details
    Browse the repository at this point in the history
  5. Make ASN1_STRING_TABLE_add thread-safe and document.

    This function is a little awkward. It mutates global data, so if two
    libraries in the address space both attempt to define a custom OID, they
    will conflict. But some existing code uses it so, as long as it does so,
    we should make it thread-safe.
    
    Along the way, I've switched it to a hash table and removed the ability
    to overwrite existing entries. Previously, overwriting a built-in table
    would crash (on platforms where const structures are write-protected).
    Overwriting a dynamic table implemented this weird merging algorithm.
    The one caller I've seen does not appear to need this feature.
    
    I've also switched ASN1_STRING_TABLE_cleanup to a no-op, matching our
    other global cleanup functions. This function is not safe to call
    without global knowledge of all other uses of the library.
    
    Update-Note: ASN1_STRING_TABLE_add no longer allows overwrite existing
    entries. In most cases, this would crash or trigger a race condition
    anyway.
    
    Bug: 426
    Change-Id: Ie024cca87feaef3ff10064b452f3a860844544da
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49769
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 5, 2021
    Configuration menu
    Copy the full SHA
    f61997b View commit details
    Browse the repository at this point in the history
  6. Fold x509_vfy.h into x509.h.

    The two headers already circularly import each other, and even have to
    inspect each others' header guards to manage this. Keeping them
    separate does not reduce include sizes. Fold them together so their
    header guards are more conventional.
    
    Bug: 426
    Change-Id: Iaf96f5b2c8adb899d9c4a5b5094ed36fcb16de16
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49770
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 5, 2021
    Configuration menu
    Copy the full SHA
    c31a8a6 View commit details
    Browse the repository at this point in the history
  7. Remove remnants of ASN.1 print function generators.

    This was removed in
    https://boringssl-review.googlesource.com/c/boringssl/+/8242/, but I
    missed the function declaration macros.
    
    Change-Id: I1caca90b8d2fa95791402de32ff2be4a6f4fbe75
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49785
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 5, 2021
    Configuration menu
    Copy the full SHA
    f5e6012 View commit details
    Browse the repository at this point in the history
  8. Make ASN1_NULL an opaque pointer.

    crypto/asn1 represents an ASN.1 NULL value as a non-null ASN1_NULL*
    pointer, (ASN1_NULL*)1. It is a non-null pointer because a null pointer
    represents an omitted OPTIONAL NULL. It is an opaque pointer because
    there is no sense in allocating anything.
    
    This pointer cannot be dereferenced, yet ASN1_NULL is a typedef for int.
    This is confusing and probably undefined behavior. (N1548, 6.3.2.3,
    clause 7 requires pointer conversions between two pointer types be
    correctly aligned, even if the pointer is never dereferenced. Strangely,
    clause 5 above does not impose the same requirement when converting from
    integer to pointer, though it mostly punts to the implementation
    definition.) Of course, all of tasn_*.c is a giant strict aliasing
    violation anyway, but an opaque struct pointer is a slightly better
    choice here.
    
    (Note that, although ASN1_BOOLEAN is also a typedef for int, that
    situation is different: the ASN1_BOOLEAN representation is a plain
    ASN1_BOOLEAN, not ASN1_BOOLEAN*, while the ASN1_NULL representation is a
    pointer. ASN1_NULL could have had the same treatment and even used a
    little less memory, but changing that would break the API.)
    
    Update-Note: Code that was assuming ASN1_NULL was an int typedef will
    fail to compile. Given this was never dereferencable, it is hard to
    imagine anything relying on this.
    
    Bug: 438
    Change-Id: Ia0c652eed66e76f82a3843af1fc877f06c8d5e8f
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49805
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 5, 2021
    Configuration menu
    Copy the full SHA
    a406ad7 View commit details
    Browse the repository at this point in the history

Commits on Oct 6, 2021

  1. Fix BN_CTX usage in BN_mod_sqrt malloc error paths.

    Bug: 442
    Change-Id: I925eb8d4c4e60dd58d8aaf6010df9783e6ba0837
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49825
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 6, 2021
    Configuration menu
    Copy the full SHA
    0524538 View commit details
    Browse the repository at this point in the history

Commits on Oct 7, 2021

  1. Forward-declare SSL_CLIENT_HELLO.

    Change-Id: I6b5be7ccdabec943fc836cbb67d73d3551cb149d
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49845
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 7, 2021
    Configuration menu
    Copy the full SHA
    45c8be9 View commit details
    Browse the repository at this point in the history

Commits on Oct 12, 2021

  1. Use typedefs in i2d and d2i_ASN1_BOOLEAN.

    This makes it slightly clearer which ints are lengths and which are
    substituting for T*. (ASN1_BOOLEAN is weird. It is the one non-pointer
    representation in crypto/asn1.)
    
    Change-Id: I93ff87264835e64c9f8613edae63e93731e77548
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49865
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 12, 2021
    Configuration menu
    Copy the full SHA
    2f8bf10 View commit details
    Browse the repository at this point in the history
  2. Check tag class and constructed bit in d2i_ASN1_BOOLEAN.

    d2i_ASN1_BOOLEAN and i2d_ASN1_BOOLEAN don't go through the macros
    because ASN1_BOOLEAN is a slightly weird type (int instead of pointer).
    Their tag checks were missing a few bits.
    
    This does not affect any other d2i functions. Those already go through
    the ASN1_ITEM machinery.
    
    Change-Id: Ic892cd2a8b8f9ceb11e43d931f8aa6df921997d3
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49866
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 12, 2021
    Configuration menu
    Copy the full SHA
    f6ef1c5 View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2021

  1. Deduplicate d2i and i2d documentation.

    There are a lot of d2i and i2d functions, and there will be even more
    once asn1.h and x509.h are properly documented. We currently replicate
    the text in each, but as a result a miss a few points:
    
    - The i2d outp != NULL, *outp == NULL case isn't documented at all.
    
    - We should call out what to do with *inp after d2i.
    
    - Unlike our rewritten functions, object reuse is still quite rampant
      with the asn1.h functions. I hope we can get rid of that but, until we
      can, it would be nice to describe it in one place.
    
    While I'm here, update a few references to the latest PKCS#1 RFC, and
    try to align how we reference ASN.1 structures a bit. The d2i/i2d
    functions say "ASN.1, DER-encoded RSA private key" while the CBS/CBB
    functions say "DER-encoded RSAPrivateKey structure".
    
    Bug: 426
    Change-Id: I8d9a7b0aef3d6d9c8240136053c3b1704b09fd41
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49906
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    cfafcd4 View commit details
    Browse the repository at this point in the history
  2. Tidy up SSLTest.SetVersion.

    There is a long outdated comment that TLS 1.3 is disabled by default,
    which is no longer true. While I'm here, run through all TLS and DTLS
    versions, now that we have that table.
    
    Change-Id: I7b813111ad3be295cc5a7e0eb0c7088e40df2a35
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49905
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    7a4df8e View commit details
    Browse the repository at this point in the history
  3. Start documenting ASN1_ITEM.

    I've intentionally not discussed defining ASN1_ITEM, because I'm hoping
    we can limit that to libdecrepit and users of asn1t.h. I suspect we
    can't avoid ASN1_ITEM itself, but we may be able to replace it with an
    internal new/free/d2i/i2d vtable someday.
    
    Bug: 426
    Change-Id: Iebd5a8f5ab7078d14131f869b98cdb79b56884ff
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49907
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    b415602 View commit details
    Browse the repository at this point in the history
  4. Const-correct the low-level ASN1 i2d functions.

    This is completely unchecked for now, as it all goes through tasn_enc.c.
    But the only non-const encoders now are X509_NAME, and the functions
    that call into it, so we can fix up the ones at the bottom.
    
    I haven't done the macros that use the "name" or "fname" variants. The
    set of macros for const are a little weird. But before expanding the
    header macros out, I wanted to change the signatures on the macro side
    once, so the compiler checks they're expanded correctly.
    
    Update-Note: The type signature of some i2d functions, such as
    i2d_ASN1_OCTET_STRING, is now const-correct.
    
    Bug: 407
    Change-Id: I03988f5591191b41ab4e7f014bd8d41cb071b39a
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49908
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    c11fcb0 View commit details
    Browse the repository at this point in the history
  5. Document ASN1_NULL.

    This starts expanding out the DECLARE_* macros in asn1.h. It also
    documents some ways in which ASN1_NULL is odd.
    
    Bug: 426
    Change-Id: Ie166861d91ce78901c76b85de79dcc683e480275
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49909
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    a78e324 View commit details
    Browse the repository at this point in the history
  6. Document new/free/d2i/i2d for singly-typed ASN1_STRINGs.

    This is a bit verbose, since it expands out the macros, but I think this
    is more understandable in the long run than figuring out which of the
    three name parameters here goes in which spot:
    
    DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
    
    This CL leaves ASN1_TYPE and mstrings for later.
    
    Bug: 426
    Change-Id: I942eb4f9fd5fbb6d30106eac2c667e28615f5199
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49910
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    370a3c2 View commit details
    Browse the repository at this point in the history
  7. Fix up some doc.go nits in asn1.h.

    Not quite ready to add it to doc.config, but this fixes up the different
    C++ guard styles, and a few mistakes in the comments.
    
    Bug: 426
    Change-Id: I027f14b2f79861e510bfa7a958604f47ae78dda1
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49911
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    8a5ec72 View commit details
    Browse the repository at this point in the history
  8. Move M_ASN1_* to the deprecated section.

    Bug: 426
    Change-Id: I2ad5bc87f6988d16bd8a9611fc2e69eeb66e4a27
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49913
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    bb88f52 View commit details
    Browse the repository at this point in the history

Commits on Oct 18, 2021

  1. Reword ASN1_BOOLEAN exception.

    There are potentially more than three ASN1_BOOLEAN ASN1_ITEMs.
    ASN1_BOOLEAN may be wrapped by explicit or implicit tagging into another
    ASN1_ITEM. (I also suspect SEQUENCE OF BOOLEAN is just unrepresentable
    in this library, but I will leave that rabbithole alone.)
    
    Bug: 426
    Change-Id: I3e58bfb63ee5c7a6d112b4a16e0f13fbacaea93a
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49925
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 18, 2021
    Configuration menu
    Copy the full SHA
    7c1f40f View commit details
    Browse the repository at this point in the history
  2. Document some more ASN1_ITEM-associated functions.

    In doing so, fix ASN1_item_pack to not use the ASN1_OCTET_STRING
    typedef. The function makes an untyped ASN1_STRING.
    
    With all these caveats, one might think that ASN1_BOOLEAN ASN1_ITEMs are
    pretty useless. This is about right. They're really only usable embedded
    as a field in another struct.
    
    Bug: 426
    Change-Id: Id7830b91b2d011038ce79ec848e17ad6241423e1
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49926
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 18, 2021
    Configuration menu
    Copy the full SHA
    141472c View commit details
    Browse the repository at this point in the history
  3. Rewrite ASN1_item_pack and ASN1_item_unpack.

    ASN1_item_unpack was missing checks for trailing data. ASN1_item_pack's
    error handling was all wrong. (Leaking the temporary on error, checking
    the the wrong return value for i2d, would-be redundant check for NULL,
    were the other check not wrong.)
    
    Update-Note: ASN1_item_unpack now checks for trailing data.
    
    Change-Id: Ibaa19ba2b264fca36dd21109e66f9558d373c58b
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49927
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 18, 2021
    Configuration menu
    Copy the full SHA
    4298fce View commit details
    Browse the repository at this point in the history
  4. Fix BIT STRING comparison in ASN1_STRING_cmp.

    The comparison should notice differences in bit count.
    
    Update-Note: ASN1_STRING_cmp no longer incorrectly treats BIT STRINGs
    with different padding bits as equal.
    
    Bug: 446
    Change-Id: I22b3fcc5d369540d029ca234e9b3b02402cec4c3
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49928
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 18, 2021
    Configuration menu
    Copy the full SHA
    a7e8074 View commit details
    Browse the repository at this point in the history
  5. Fold i2a_ASN1_ENUMERATED into i2a_ASN1_INTEGER.

    They do the same thing, except i2a_ASN1_ENUMERATED has a bug and doesn't
    handle negative values.
    
    Change-Id: Ifb22aa4e4d6c441a39cf6b3702cce7f6d12a94ae
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49929
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 18, 2021
    Configuration menu
    Copy the full SHA
    2dc2f10 View commit details
    Browse the repository at this point in the history
  6. Document i2a_ASN1_* functions.

    Bug: 426
    Change-Id: I41d8d4f4f8220b7996f45e04cc77096505523907
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49930
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 18, 2021
    Configuration menu
    Copy the full SHA
    ae274a2 View commit details
    Browse the repository at this point in the history
  7. Fix error-handling for i2a_ASN1_OBJECT.

    Some BIO_write failures weren't handled. Otherwise would successfully
    write truncated results. The other i2a functions all report -1 on
    truncation, so match. While I'm here, write a test to make sure I didn't
    break this.
    
    Change-Id: If17d0209e75c15b3f37bceb1cdfb480fd2c62c4d
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49931
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 18, 2021
    Configuration menu
    Copy the full SHA
    686d05a View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2021

  1. Document and const-correct ASN1_TYPE functions.

    Also fill in docs for some easy ASN1_STRING wrappers while I'm here.
    (Not sure why they exist, but removing them is probably more trouble
    than is worth it.)
    
    Bug: 407, 426
    Change-Id: Id12c5fbc84982728435d105d66a3b63e5f3a1d15
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49945
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 19, 2021
    Configuration menu
    Copy the full SHA
    45608a1 View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2021

  1. Use C preprocessor comments in assembly headers.

    We generate .S files for assembly, which means they run through the C
    preprocessor first. In gas targets where # is the comment marker, there
    is a conflict with cpp directives.
    
    The comments actually rely on #This and #source not being directives. If
    I begin a line with "if", the build fails. Since the C preprocessor is
    responsible for removing C preprocessor comments, we should be able to
    safely use // everywhere with less ambiguity.
    
    (In fact, we were already relying on this for 32-bit ARM. The 32-bit ARM
    gas line comment marker is @. 64-bit ARM uses //, and x86/x86_64/ppc64
    use #.)
    
    This reportedly causes issues for goma. See
    https://bugs.chromium.org/p/boringssl/issues/detail?id=448#c3
    
    Bug: 448
    Change-Id: Ib58f3152691c1dbcccfc045f21f486b56824283d
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49965
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 20, 2021
    Configuration menu
    Copy the full SHA
    08dee19 View commit details
    Browse the repository at this point in the history
  2. Document low-level encoding functions in asn1.h.

    This is what crypto/asn1 uses instead of CBS and CBB. ASN1_get_object is
    particularly impressive.
    
    Bug: 426
    Change-Id: Ib11ace5448d596ec134ed77e60139c0e2d7e9d07
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49985
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 20, 2021
    Configuration menu
    Copy the full SHA
    471e631 View commit details
    Browse the repository at this point in the history
  3. Return 0x80 in all ASN1_get_object error paths.

    If the header is valid, but the body is truncated, ASN1_get_object
    intentionally preserves the indefinite-length and constructed output
    bits. This means callers who check for error with == 0x80 may read off
    the end of the buffer on accident.
    
    This is unlikely to break callers: 0x80 was already a possible error
    value, so callers already needed to handle it. The original function's
    aim in returning more information is unlikely to matter because callers
    cannot distinguish 0x80 (could not parse header) and 0x80 (header was
    valid, definite-length, and primitive, but length was too long).
    
    Update-Note: ASN1_get_object's calling convention is slightly
    simplified.
    
    Bug: 451
    Change-Id: If2b45c47e6b8864aef9fd5e04f313219639991ed
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50005
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 20, 2021
    Configuration menu
    Copy the full SHA
    efab69b View commit details
    Browse the repository at this point in the history
  4. Unexport ASN1_OBJECT_new.

    Outside the library, this function is practically useless. It creates an
    empty ASN1_OBJECT, which can never be filled in because the struct is
    private and there are no mutating setters.
    
    (See https://boringssl-review.googlesource.com/c/boringssl/+/46164 and
    https://boringssl-review.googlesource.com/c/boringssl/+/48326 for a
    discussion on why it's important ASN1_OBJECTs are immutable.)
    
    Update-Note: ASN1_OBJECT_new is no longer exported. While this function
    does remain in OpenSSL, it is extremely unlikely anyone has found a use
    for this function.
    
    Bug: 452
    Change-Id: I111a9a1ce3ca4d7aa717a3c3a03d34c05af8fdbd
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50025
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 20, 2021
    Configuration menu
    Copy the full SHA
    a259a54 View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2021

  1. Document ASN1_OBJECT, i2c, and c2i functions.

    Almost done with this header.
    
    Bug: 426
    Change-Id: I9d103460d0f59b56f8539f77420a779f850335f7
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50065
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 21, 2021
    Configuration menu
    Copy the full SHA
    d2d1d3c View commit details
    Browse the repository at this point in the history
  2. Fully unexport X509_VAL.

    After https://boringssl-review.googlesource.com/c/boringssl/+/45965,
    X509_VAL became largely unusable. While it did still exist as an
    ASN1_ITEM and we emitted d2i/i2d/new/free functions, there is no way to
    access its contents. Thus, hide it entirely.
    
    Interestingly, although we got that to stick a while ago, I missed that
    OpenSSL actually keeps X509_VAL exported, so it's possible we'll find 3p
    code that uses this later. Since a standalone X509_VAL isn't especially
    useful to construct or encode, this is most likely to come up in code
    defining new types with <openssl/asn1t.h>.
    
    Still, if we need to rexport this later (revert this *and* bring back
    the struct), it won't be a big deal. Nothing in the public API even
    constrains X509 to use X509_VAL.
    
    Update-Note: The last remnants of the now (barely usable) X509_VAL are
    no longer exported. It is unlikely anyone was relying on this.
    
    Bug: 425
    Change-Id: I90975f2f7ec27753675d2b5fa18b5cc4716319f4
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50085
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 21, 2021
    Configuration menu
    Copy the full SHA
    e1049fd View commit details
    Browse the repository at this point in the history
  3. Document and const-correct multi-string types.

    While I'm here, add missing parentheses around the B_ASN1_* bitmasks.
    I've tossed ASN1_PRINTABLE into the deprecated bucket, though X509_NAME
    relies on it, because it is a mess.
    
    Bug: 407, 426
    Change-Id: I287f60e98d6c9f237908011e1a816f4b4fb4433e
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50105
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 21, 2021
    Configuration menu
    Copy the full SHA
    1dcdbda View commit details
    Browse the repository at this point in the history
  4. Add magic tag to BoringSSL binaries.

    There are cases where people grep binaries for strings like OpenSSL
    version strings in order to detect when out-dated versions of libraries
    are being used. With BoringSSL you might find "OpenSSL 1.1.1
    (compatible; BoringSSL)", if the linker didn't discard it, but that's
    not very helpful for knowing how up-to-date BoringSSL is because we
    hardly ever change it.
    
    This change adds a distinct random value to search for that uniquely
    identifies BoringSSL and includes a rough guide to how old the BoringSSL
    copy is. The linker will hopefully not discard it because it's
    refereneced from |OPENSSL_malloc|.
    
    Change-Id: Ie2259fd17a55d249a538a8a161b0d755396dd7b8
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49885
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Oct 21, 2021
    Configuration menu
    Copy the full SHA
    89386ac View commit details
    Browse the repository at this point in the history
  5. Trim some undocumented symbols from asn1.h.

    ASN1_ENCODING can be unexported because all types using it are now
    hidden. This does mean external uses of <openssl/asn1t.h> can no longer
    use ASN1_SEQUENCE_enc, but there do not seem to be any such uses.
    
    ASN1_TLC and ASN1_TEMPLATE typedefs are only necessary for users of
    asn1t.h. I'm hopeful we can do away with ASN1_TLC once I get to
    reworking tasn_dec.c. ASN1_TEMPLATE is somewhat stuck, though all
    references should be hidden behind macros.
    
    ASN1_generate_* appear to only referenced within the library. Remove the
    unused one and move the other to x509/internal.h. (asn1_gen.c is
    currently in crypto/x509 rather than crypto/asn1, so I put it in
    x509/internal.h to match. I'll leave figuring out that file to later.)
    
    Annoyingly, asn1/internal.h now pulls in asn1t.h, but so it goes.
    
    Change-Id: I8b43de3fa9647883103006e27907730d5531fd7d
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50106
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 21, 2021
    Configuration menu
    Copy the full SHA
    2cbc39a View commit details
    Browse the repository at this point in the history
  6. Finish documenting asn1.h.

    One down, two more to go! As part of this, I've added it to doc.config,
    revised the note at the top, and moved the sample i2d/d2i functions
    here.
    
    Bug: 426
    Change-Id: I7bb9d56bf9ba58c921cfcf9626bf3647c6e5c7df
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50107
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 21, 2021
    Configuration menu
    Copy the full SHA
    28c48e3 View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2021

  1. Add CRYPTO_BUFFER_new_from_static_data_unsafe.

    When making a CRYPTO_BUFFER from a static, const buffer, there is no
    need to make a copy of the data. Instead, we can reference it directly.
    The hope is this will save a bit of memory in Chromium, since root store
    certs will already in static data.
    
    Moreover, by letting static CRYPTO_BUFFERs participate in pooling, we
    can extend the memory savings to yet other copies of these certs. For
    instance, if we make the root store updatable via component updater,
    most of the updated roots will likely already be in the binary's copy.
    Pooling will transparently dedup those and avoid retaining an extra
    copy.
    
    (I haven't gone as far as to give static CRYPTO_BUFFERs strong
    references from the pool, since that seems odd. But something like
    Chromium probably wants to intentionally leak the initial static ones so
    that, when all references go away, they're still available for pooling.)
    
    Change-Id: I05c25c5ff618f9f7a6ed21e4575cf659e7c32811
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50045
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 25, 2021
    Configuration menu
    Copy the full SHA
    7cac8fa View commit details
    Browse the repository at this point in the history
  2. Add a function to express the desired record version protocol.

    This function is currently a no-op, but could be made to do something in
    the future to ease the transition of deployments that extract keys from
    the handshake and drive the record protocol themselves.
    
    Change-Id: Ib1399e42442dad78173a6462980945559a88a2c7
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49886
    Commit-Queue: Adam Langley <agl@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Oct 25, 2021
    Configuration menu
    Copy the full SHA
    c2827d3 View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2021

  1. Match OPENSSL_EXPORT in ssl/internal.h friend declarations.

    After fixing up some issue with the BORINGSSL_IMPLEMENTATION define in
    Chromium builds (which used to work fine but, with the test that
    references ASN1_ITEM_rptr(BASIC_CONSTRAINTS), is a bit more strict),
    I'm running into this warning.
    
    ../../third_party/boringssl/src/ssl/internal.h(3695,15): error:
    'SSL_CTX_free' redeclared without 'dllimport' attribute: previous
    'dllimport' ignored [-Werror,-Winconsistent-dllimport]
      friend void SSL_CTX_free(SSL_CTX *);
                  ^
    
    Searching for friend.*EXPORT in Chromium shows they match exports in
    friend declarations, so I gather this is just how it works.
    
    Change-Id: I704686854c77406378882477a8bab3f1521e29e4
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50145
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 26, 2021
    Configuration menu
    Copy the full SHA
    69030a0 View commit details
    Browse the repository at this point in the history

Commits on Oct 27, 2021

  1. Switch DEPS actions on bots to Python 3.

    In doing so, I think this fixes a bug on Windows where extract.py was
    digesting the archive in text mode. (Doesn't particularly matter, though
    by using the correct digest, we will end up re-extracting the files
    once.)
    
    Change-Id: Ia7effe5f9c228c1a702cba8e6380975b59261808
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50166
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    17c38b3 View commit details
    Browse the repository at this point in the history
  2. Switch kModuleDigestSize to a macro.

    Although the compiler will hopefully optimize it out, this is
    technically a VLA. The new Android NDK now warns about this.
    
    Change-Id: Ib9f38dc73c40e90ab61105f29a635c453f1477a1
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50185
    Commit-Queue: David Benjamin <davidben@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 27, 2021
    Configuration menu
    Copy the full SHA
    91b8924 View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2021

  1. Fold x509v3/pcy_int.h into x509v3/internal.h.

    pcy_int.h was especially weird because it is even missing include guards
    and its dependencies.
    
    Change-Id: Idccfe23b74b47641bcfc802f78f3ee6fe479b781
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50245
    Commit-Queue: Adam Langley <agl@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Oct 29, 2021
    Configuration menu
    Copy the full SHA
    9fd1637 View commit details
    Browse the repository at this point in the history

Commits on Nov 1, 2021

  1. Update tools.

    We haven't done this in a while. This also tests more codepaths in
    in the previous Python 3 update.
    
    libc++ required a few more build tweaks. Also the CMake update was
    necessary to update the NDK. Older CMake cannot detect CMAKE_LINKER
    in the newer NDK.
    
    Change-Id: I59ab1c6b074b805dd4b8a6ab596c4cf469d5bfa9
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50167
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Nov 1, 2021
    Configuration menu
    Copy the full SHA
    16b3af7 View commit details
    Browse the repository at this point in the history
  2. Check for trailing data in extensions.

    X509V3_EXT_d2i should notice if an extension has extra data at the end.
    
    Update-Note: Some previously accepted invalid certicates may be
    rejected, either in certificate verification or in X509_get_ext_d2i.
    
    Bug: 352
    Change-Id: Iacbb74a52d15bf3318b4cb8271d44b0f0a2df137
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50285
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Nov 1, 2021
    Configuration menu
    Copy the full SHA
    491af10 View commit details
    Browse the repository at this point in the history
  3. Remove support for constructed strings in crypto/asn1.

    Constructed strings are a BER mechanism where a string type can be
    represented as a tree of constructed nodes and primitive leaves, that
    then have to be concatenated by the parser. This is prohibited in DER
    and a significant source of complexity in our parser.
    
    Note this change does not affect our PKCS#7 and PKCS#12 parsers (where
    BER is sadly necessary for interop) because those use CBS.
    
    Update-Note: Invalid certificates (and the few external structures using
    asn1t.h) with BER constructed strings will now be rejected.
    
    Bug: 354
    Change-Id: I5a8ee028ec89ed4f2d5c099a0588f2029b864580
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50286
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Nov 1, 2021
    Configuration menu
    Copy the full SHA
    a70edd4 View commit details
    Browse the repository at this point in the history
  4. Remove support for indefinite lengths in crypto/asn1.

    This simplifies the ASN1_get_object calling convention and removes
    another significant source of tasn_dec.c complexity. This change does
    not affect our PKCS#7 and PKCS#12 parsers.
    
    Update-Note: Invalid certificates (and the few external structures using
    asn1t.h) with BER indefinite lengths will now be rejected.
    
    Bug: 354
    Change-Id: I723036798fc3254d0a289c77b105fcbdcda309b2
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50287
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Nov 1, 2021
    Configuration menu
    Copy the full SHA
    ee510f5 View commit details
    Browse the repository at this point in the history
  5. Enforce DER rules for BIT STRING values.

    DER requires BIT STRING padding bits be zero.
    
    Bug: 354
    Change-Id: Id59154cc4e77f91df8b9ff1eb1b09514116808da
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50288
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Nov 1, 2021
    Configuration menu
    Copy the full SHA
    13c67c9 View commit details
    Browse the repository at this point in the history
  6. Don't parse constructed BIT STRINGs in crypto/bytestring

    Update-Note: PKCS#7 and PKCS#12 parsers will now reject BER constructed
    BIT STRINGs. We were previously misparsing them, as was OpenSSL. Given
    how long the incorrect parse has been out there, without anyone noticing
    (other parsers handle it correctly), it is unlikely these exist.
    
    Change-Id: I61d317461cc59480dc9f772f88edc7758206d20d
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50289
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Nov 1, 2021
    Configuration menu
    Copy the full SHA
    414a0f8 View commit details
    Browse the repository at this point in the history
  7. Check tag class and constructed bit in d2i_ASN1_OBJECT.

    d2i_ASN1_OBJECT had a similar set of bugs in as in
    https://boringssl-review.googlesource.com/c/boringssl/+/49866.
    
    This does not affect any other d2i functions. Those already go through
    the ASN1_ITEM machinery.
    
    Update-Note: d2i_ASN1_OBJECT will now notice more incorrect tags. It was
    already checking for tag number 6, so it is unlikely anyone was relying
    on this as a non-tag-checking parser.
    
    Change-Id: I30f9ad28e3859aeb7a38c0ea299cd2e30002abce
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50290
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Nov 1, 2021
    Configuration menu
    Copy the full SHA
    cf8d3ad View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2021

  1. Add missing assert.h include.

    Change-Id: I4af18ce3de2a01a8a5184096b07354bcbd24caf1
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50265
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Nov 4, 2021
    Configuration menu
    Copy the full SHA
    703cb72 View commit details
    Browse the repository at this point in the history
  2. Remove outdated comment in ECDSA implementation.

    As of https://boringssl-review.googlesource.com/26968, digest_to_scalar
    should output a fully-reduced value.
    
    Change-Id: I9fccc62413b17184eb3aa6fa5cd87d7e7849e2eb
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50325
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Nov 4, 2021
    Configuration menu
    Copy the full SHA
    ba20a75 View commit details
    Browse the repository at this point in the history
  3. No-op change to test the bots.

    Testing the Python 3 recipe migration.
    
    Change-Id: I428f08eaf426cf0bbd4b53f9f6932df7d15ad2ee
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50326
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Nov 4, 2021
    Configuration menu
    Copy the full SHA
    a9670a8 View commit details
    Browse the repository at this point in the history

Commits on Nov 15, 2021

  1. Add PKCS7_bundle_raw_certificates function which takes CRYPTO_BUFFERs

    Change-Id: I12ab8e9209bd5fdff75c42332d4d35a461302b61
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50425
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    matt-mueller authored and Boringssl LUCI CQ committed Nov 15, 2021
    Configuration menu
    Copy the full SHA
    27a6755 View commit details
    Browse the repository at this point in the history

Commits on Nov 18, 2021

  1. Add various OpenSSL compatibility functions.

    The non-_ex EVP_CIPHER_CTX Final functions are a bit interesting. Unlike
    EVP_DigestFinal(_ex), where the non-_ex version calls EVP_MD_CTX_cleanup
    for you, the EVP_CIPHER_CTX ones do not automatically cleanup.
    EVP_CipherFinal and EVP_CipherFinal_ex are identical in all releases
    where they exist.
    
    This appears to date to OpenSSL 0.9.7:
    
    Prior to OpenSSL 0.9.7, EVP_MD_CTX and EVP_CIPHER_CTX did not use void*
    data fields. Instead, they just had a union of context structures for
    every algorithm OpenSSL implemented.
    
    EVP_MD_CTX was truly cleanup-less. There were no EVP_MD_CTX_init or
    EVP_MD_CTX_cleanup functions at all. EVP_DigestInit filled things in
    without reference to the previous state. EVP_DigestFinal didn't cleanup
    because there was nothing to cleanup.
    
    EVP_CIPHER_CTX was also a union, but for some reason did include
    EVP_CIPHER_CTX_init and EVP_CIPHER_CTX_cleanup. EVP_CIPHER_CTX_init
    seemed to be optional: EVP_CipherInit with non-NULL EVP_CIPHER similarly
    didn't reference the previous state. EVP_CipherFinal did not call
    EVP_CIPHER_CTX_cleanup, but EVP_CIPHER_CTX_cleanup didn't do anything.
    It called an optional cleanup hook on the EVP_CIPHER, but as far as I
    can tell, no EVP_CIPHER implemented it.
    
    Then OpenSSL 0.9.7 introduced ENGINE. The union didn't work anymore, so
    EVP_MD_CTX and EVP_CIPHER_CTX contained void* with allocated
    type-specific data. The introduced EVP_MD_CTX_init and
    EVP_MD_CTX_cleanup. For (imperfect!) backwards compatibility,
    EVP_DigestInit and EVP_DigestFinal transparently called init/cleanup for
    you. EVP_DigestInit_ex and EVP_DigestFinal_ex became the more flexible
    versions that left init/cleanup to the caller.
    
    EVP_CIPHER_CTX got the same treatment with
    EVP_CipherInit/EVP_CipherInit_ex, but *not*
    EVP_CipherFinal/EVP_CipherFinal_ex. The latter did the same thing. The
    history seems to be that 581f1c84940d77451c2592e9fa470893f6c3c3eb
    introduced the Final/Final_ex split, with the former doing an
    auto-cleanup, then 544a2aea4ba1fad76f0802fb70d92a5a8e6ad85a undid it.
    Looks like the motivation is that EVP_CIPHER_CTX objects are often
    reused to do multiple operations with a single key. But they missed that
    the split functions are now unnecessary.
    
    Amusingly, OpenSSL's documentation incorrectly said that EVP_CipherFinal
    cleaned up after the call until it was fixed in
    538860a3ce0b9fd142a7f1a62e597cccb74475d3. The fix says that some
    releases cleaned up, but there were, as far as I can tell, no actual
    releases with that behavior.
    
    I've put the new Final functions in the deprecated section, purely
    because there is no sense in recommending two different versions of the
    same function to users, and Final_ex seems to be more popular. But there
    isn't actually anything wrong with plain Final.
    
    Change-Id: Ic2bfda48fdcf30f292141add8c5f745348036852
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50485
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Nov 18, 2021
    Configuration menu
    Copy the full SHA
    16a9493 View commit details
    Browse the repository at this point in the history
  2. Update HPKE test vectors.

    HPKE draft-12 has no changes from draft-08 except that the test vectors
    were refreshed and some fields in the JSON file renamed. Also fix the
    test vector reference to point to copy from the spec rather than the
    (identical) copy from the reference implementation.
    
    Change-Id: Icd4fd467672cc8701fcd2b262ac90c5adc05ac39
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50465
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Nov 18, 2021
    Configuration menu
    Copy the full SHA
    ea57bcb View commit details
    Browse the repository at this point in the history
  3. Add SSL_has_pending.

    This was added in OpenSSL 1.1.x. It is slightly different from
    SSL_pending in that it also reports buffered transport data.
    
    Change-Id: I81e217aad1ceb6f4c31c36634a546e12b6dc8dfc
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50445
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Nov 18, 2021
    Configuration menu
    Copy the full SHA
    b3ed071 View commit details
    Browse the repository at this point in the history

Commits on Nov 19, 2021

  1. Export PKCS12_DEFAULT_ITER.

    rust-openssl uses this constant to determine PKCS12_create's defaults.
    Define it so it does not need to be redefined in
    https://boringssl-review.googlesource.com/c/boringssl/+/49645
    
    Change-Id: Ife4a6597de430a411932096618406b9fcd721f43
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50505
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Nov 19, 2021
    Configuration menu
    Copy the full SHA
    e7fc7a7 View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2021

  1. Binary tag bump: 1 -> 2

    Change-Id: If115d3ab25e2e538447a130f469debe25a92ce5c
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50525
    Commit-Queue: David Benjamin <davidben@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Nov 22, 2021
    Configuration menu
    Copy the full SHA
    3a667d1 View commit details
    Browse the repository at this point in the history

Commits on Nov 29, 2021

  1. Remove X509_REVOKED.sequence.

    This is filled in by X509_CRL_sort but never used.
    
    Change-Id: Ifacd56fcc090386faa6c11b73b44191a31221ef8
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50545
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Nov 29, 2021
    Configuration menu
    Copy the full SHA
    d703d95 View commit details
    Browse the repository at this point in the history

Commits on Nov 30, 2021

  1. Add BN_GENCB_new, BN_GENCB_free, and RSA_test_flags.

    OpenSSL 1.1.0 made this structure opaque. I don't think we particularly
    need to make it opaque, but external code uses it. Also add
    RSA_test_flags.
    
    Change-Id: I136d38e72ec4664c78f4d1720ec691f5760090c1
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50605
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Nov 30, 2021
    Configuration menu
    Copy the full SHA
    cd0b767 View commit details
    Browse the repository at this point in the history
  2. Add ERR_set_error_data for compatibility.

    rust-openssl, rather than using Rust's existing error types, exposes the
    OpenSSL error queue as the error type in its public callback types.
    Supporting a simplified version of ERR_set_error_data is simple enough,
    so it's easiest just to add this function.
    
    Unlike OpenSSL's, we don't attempt to support non-string error data. We
    also don't try to retain borrowed pointers. If the caller did not pass
    ownership, make a copy internally.
    
    Change-Id: I909eebc2867ab1f3b9975546a106ee1f762bf516
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50625
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Nov 30, 2021
    Configuration menu
    Copy the full SHA
    731d6cb View commit details
    Browse the repository at this point in the history

Commits on Dec 7, 2021

  1. Add |SSL_set1_host| and |SSL_set_hostflags|.

    This allows code that uses OpenSSL's suggested pattern for 1.1.0 [1] to
    work.
    
    [1] https://wiki.openssl.org/index.php/Hostname_validation
    
    Change-Id: I6d1b983074d5ad8645400cef887c1cc20f7bf2a1
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50645
    Reviewed-by: David Benjamin <davidben@google.com>
    Adam Langley authored and agl committed Dec 7, 2021
    Configuration menu
    Copy the full SHA
    7e7e6b6 View commit details
    Browse the repository at this point in the history
  2. Document |SSL_set1_host| return values.

    Change-Id: I9ba12ad7b3cfc9a6d1015da728cec45e4b71dcc9
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50665
    Commit-Queue: Adam Langley <agl@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Dec 7, 2021
    Configuration menu
    Copy the full SHA
    7e2a957 View commit details
    Browse the repository at this point in the history

Commits on Dec 8, 2021

  1. Make X509_REVOKED opaque.

    I believe, with this, we have aligned with OpenSSL 1.1.x on the
    crypto/x509 and crypto/asn1 types that are now opaque. Strangely,
    OpenSSL kept X509_ALGOR public. We may wish to hide that one too later,
    but we can leave it for now.
    
    Update-Note: Use X509_REVOKED accessors rather than reaching into the
    struct.
    
    Bug: 425
    Change-Id: Ib47944648a8693ed7078ffe94f7b557022debe30
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50685
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Dec 8, 2021
    Configuration menu
    Copy the full SHA
    2042972 View commit details
    Browse the repository at this point in the history

Commits on Dec 13, 2021

  1. Remove non-standard X.509 DNS wildcard matching.

    Always enable X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS and never enable
    X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS.
    
    Update-Note: BoringSSL will no longer accept wildcard patterns like
    *www.example.com or www*.example.com. (It already did not accept
    ww*w.example.com.) X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS will also be
    ignored and can no longer be used to allow foo.bar.example.com to match
    *.example.com.
    
    Fixes: 462
    Change-Id: I004e087bf70f4c3f249235cd864d9e19cc9a5102
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50705
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Dec 13, 2021
    Configuration menu
    Copy the full SHA
    c3c540b View commit details
    Browse the repository at this point in the history
  2. Rewrite X.509 name-matching tests.

    This replaces v3name_test.cc which is rather difficult to follow.
    v3name_test.cc ran all pairs of names against each other, used a
    default case-insensitivity rule, and then had a list of string
    exceptions to that rule. This is hopefully easier for us to adjust
    later. It also fixes a testing bug we wouldn't notice if an expected
    "exception" didn't fire.
    
    Sadly, we cannot use designated initializers in C++ yet. MSVC does not
    support them until MSVC 2019.
    
    Change-Id: Ia8e3bf5f57d33a9bf1fc929ba1e8cd2a270a8a24
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50725
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Dec 13, 2021
    Configuration menu
    Copy the full SHA
    405c788 View commit details
    Browse the repository at this point in the history

Commits on Dec 14, 2021

  1. Remove non-standard wildcard input DNS names.

    Update-Note: ".example.com" as an input DNS name will no longer match
    "www.example.com" in a certificate. (Note this does not impact wildcard
    certificates. Rather, it removes a non-standard "reverse wildcard" that
    OpenSSL implemented.)
    
    Fixed: 463
    Change-Id: I627e1bd00b8e4b810e9bb756f424f6230a99496e
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50726
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Dec 14, 2021
    Configuration menu
    Copy the full SHA
    9631bc1 View commit details
    Browse the repository at this point in the history

Commits on Dec 15, 2021

  1. Add BIO_tell and BIO_seek wrappers.

    Change-Id: Ia5db220d13cf42fac6958a2c7416743ca2991479
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50745
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Dec 15, 2021
    Configuration menu
    Copy the full SHA
    e21f272 View commit details
    Browse the repository at this point in the history
  2. Fix the easy -Wformat-signedness errors.

    GCC has a warning that complains about even more type mismatches in
    printf. Some of these are a bit messy and will be fixed in separate CLs.
    This covers the easy ones.
    
    The .*s stuff is unfortunate, but printf has no size_t-clean string
    printer. ALPN protocol lengths are bound by uint8_t, so it doesn't
    really matter.
    
    The IPv6 printing one is obnoxious and arguably a false positive. It's
    really a C language flaw: all types smaller than int get converted to
    int when you do arithmetic. So something like this first doesn't
    overflow the shift because it computes over int, but then the result
    overall is stored as an int.
    
      uint8_t a, b;
      (a << 8) | b
    
    On the one hand, this fixes a "missing" cast to uint16_t before the
    shift. At the same time, the incorrect final type means passing it to
    %x, which expects unsigned int. The compiler has forgotten this value
    actually fits in uint16_t and flags a warning. Mitigate this by storing
    in a uint16_t first.
    
    The story doesn't quite end here. Arguments passed to variadic functions
    go through integer promotion[0], so the argument is still passed to
    snprintf as an int! But then va_arg allows for a signedness mismatch[1],
    provided the value is representable in both types. The combination means
    that %x, though actually paired with unsigned, also accept uint8_t and
    uint16_t, because those are guaranteed to promote to an int that meets
    [1]. GCC recognizes [1] applies here.
    
    (There's also PRI16x, but that's a bit tedious to use and, in glibc, is
    defined as plain "x" anyway.)
    
    [0] https://en.cppreference.com/w/c/language/conversion#Default_argument_promotions
    [1] https://en.cppreference.com/w/c/variadic/va_arg
    
    Bug: 450
    Change-Id: Ic1d41356755a18ab922956dd2e07b560470341f4
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50765
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    davidben authored and Boringssl LUCI CQ committed Dec 15, 2021
    Configuration menu
    Copy the full SHA
    4f1fae3 View commit details
    Browse the repository at this point in the history

Commits on Dec 16, 2021

  1. Don't print small, negative serial numbers in decimal.

    X509_print_ex tries to print negative serial numbers in decimal. In
    doing so, it ends up passing a signed long to %lx and trips
    -Wformat-signed.
    
    A minimal fix would be to cast to unsigned long, but this unsigned long
    is the absolute value of a signed long (l = -l). This is tricky because
    -LONG_MIN does not fit in long. It all works because the length check
    only allows one bit short of sizeof(long)*8 bits (ASN1_INTEGER is
    sign-and-magnitude).
    
    Still, this is a whole lot of subtlety to account for an invalid case.
    Instead, send negative serial numbers down the generic path.
    
    Bug: 450
    Change-Id: Ib215fd23863de27e01f7ededf95578f9c800da37
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50766
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Dec 16, 2021
    Configuration menu
    Copy the full SHA
    866b88d View commit details
    Browse the repository at this point in the history
  2. Silence -Wformat-signedness when printing X.509 versions.

    This fix isn't ideal, given the current space of possible version
    values. But rather than make the printing code complicated, we should
    make invalid versions impossible. I've left TODOs where that would be
    needed.
    
    Bug: 467, 450
    Change-Id: I6c9ae97b8454182b0c1ab6ba2e070dc6d7d8b3f4
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50767
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Dec 16, 2021
    Configuration menu
    Copy the full SHA
    94089a8 View commit details
    Browse the repository at this point in the history
  3. Fix X509_CRL_print error-handling.

    Change-Id: Id7ef442d23d36c3d28fb52cb5d813238ff7e963a
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50768
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Dec 16, 2021
    Configuration menu
    Copy the full SHA
    0664690 View commit details
    Browse the repository at this point in the history
  4. Rewrite bssl_shim command-line parser.

    The command-line parser is slightly showing its age: first, it is hard
    to add new integral types, such as uint16_t, which is getting in the way
    of fixing some of the -Wformat-signedness errors. Second, the parameter
    extraction logic and skipping logic is duplicated in every type.
    
    While I'm here, use a binary search to look up the flag, since we have
    rather a lot of them. With more C++ template tricks, we could avoid the
    std::function, but that seemed more trouble than was worth it,
    especially since, prior to C++17, it's a little hard to convince
    template argument deduction to infer one of the parameters.
    
    Change-Id: I208f89d46371b31fc8b44487725296bcd9d7c8e7
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50769
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Dec 16, 2021
    Configuration menu
    Copy the full SHA
    8ed06e0 View commit details
    Browse the repository at this point in the history
  5. Reorder flags to match TestConfig struct.

    Whether the order makes sense is another matter, but keep them aligned
    so future flags have an easier time with it.
    
    Change-Id: I3c3912039b593a55af86078b2e9768c76ee2ee14
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50770
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Dec 16, 2021
    Configuration menu
    Copy the full SHA
    203b92b View commit details
    Browse the repository at this point in the history
  6. Use uint16_t in TestConfig and enable -Wformat-signedness.

    This silences a pile of -Wformat-signedness warnings. We still need
    casts in a few places where the API gives int but really wanted
    uint16_t. There I cast to unsigned instead of uint16_t for the sake of
    not losing information.
    
    With that, we should be -Wformat-signedness-clean on GCC, so enable the
    warning.
    
    Bug: 450
    Change-Id: I3ab10348bb47d398b8b9b39acf360284a8ab04d7
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50771
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Dec 16, 2021
    Configuration menu
    Copy the full SHA
    d7936c2 View commit details
    Browse the repository at this point in the history

Commits on Dec 21, 2021

  1. Import a few test vectors from OpenSSL.

    Test vectors from
    openssl/openssl@e9e7265.
    We did not have assembly file in question, but import the test vectors
    anyway.
    
    Change-Id: Ia18698979bc0055bae9105280296891eb7faf9b5
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50785
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Dec 21, 2021
    Configuration menu
    Copy the full SHA
    9bcc12d View commit details
    Browse the repository at this point in the history

Commits on Jan 5, 2022

  1. Import sha512-armv8.pl transforms from upstream NEON code.

    We currently have two aarch64 SHA-256 implementations: one using
    general-purpose registers and one using the SHA-256 extensions.
    Upstream's 866e505e0d663158b0fe63a7fb7455eebacc6470 added a NEON
    version.
    
    This CL syncs the transforms at the bottom of the file, to avoid
    potential mistranslations in future imports. It doesn't change the
    output for our current assembly.
    
    Skips the NEON implementation itself for now. It only helps
    processors without SHA-256 instructions. While Android does not
    actually mandate the cryptography extensions on ARMv8, most devices
    have it.
    
    Additionally, this file does CPU dispatch in assembly, without taking
    advantage of static information. We'd end up shipping both fallback
    SHA-256 implementations. This is particularly silly because NEON is
    mandatory in ARMv8-A anyway. (Does anyone build us on -R or -M? Probably
    not?)
    
    (If we later have a reason to import it, the binary size cost isn't that
    significant. Moreover, the NEON fallback is actually slightly smaller
    than the non-NEON fallback, so if we move CPU dispatch to C, importing
    may even be worthwhile.)
    
    Change-Id: I3c8ca6e77e4e6d1299f975c407cbcf4c9c240523
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50805
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Jan 5, 2022
    Configuration menu
    Copy the full SHA
    e90cf82 View commit details
    Browse the repository at this point in the history
  2. Sync sha512-armv8.pl up to 753316232243ccbf86b96c1c51ffcb41651d9ad5.

    This imports 753316232243ccbf86b96c1c51ffcb41651d9ad5,
    46f4e1bec51dc96fa275c168752aa34359d9ee51, and
    32bbb62ea634239e7cb91d6450ba23517082bab6.
    
    The last commit fixes a detection of big-endian aarch64 in the kernel,
    which we do not support at all, but is imported to reduce the upstream
    diff. Though it points out a messy part of arm_arch.h: __ARMEL__ and
    __ARMEB__ are specific to 32-bit ARM. __AARCH64EB__ and __AARCH64EL__
    are the 64-bit ones. But OpenSSL's arm_arch.h defines __ARME[LB]__ for
    aarch64 and uses it in perlasm. We should fix the files upstream to
    look at the aarch64 ones. (Indeed our own base.h assumes __ARMEL__
    implies 32-bit ARM.)
    
    Change-Id: I6c2241e103a97e8c3599cdfa43dcc6f30d4a2581
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50806
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Jan 5, 2022
    Configuration menu
    Copy the full SHA
    af561c2 View commit details
    Browse the repository at this point in the history
  3. Enable SHA-512 ARM acceleration when available.

    This imports the changes to sha512-armv8.pl from
    upstream's af0fcf7b4668218b24d9250b95e0b96939ccb4d1.
    
    Tweaks needed:
    - Add an explicit .text because we put .LK$BITS in .rodata for XOM
    - .LK$bits and code are in separate sections, so use adrp/add instead of
      plain adr
    - Where glibc needs feature flags to *enable* pthread_rwlock, Apple
      interprets _XOPEN_SOURCE as a request to *disable* Apple extensions.
      Tighten the condition on the _XOPEN_SOURCE check.
    
    Added support for macOS and Linux, tested manually on an ARM Mac and a
    VM, respectively. Fuchsia and Windows do not currently have APIs to
    expose this bit, so I've left in TODOs. Benchmarks from an Apple M1 Max:
    
    Before:
    Did 4647000 SHA-512 (16 bytes) operations in 1000103us (74.3 MB/sec)
    Did 1614000 SHA-512 (256 bytes) operations in 1000379us (413.0 MB/sec)
    Did 439000 SHA-512 (1350 bytes) operations in 1001694us (591.6 MB/sec)
    Did 76000 SHA-512 (8192 bytes) operations in 1011821us (615.3 MB/sec)
    Did 39000 SHA-512 (16384 bytes) operations in 1024311us (623.8 MB/sec)
    
    After:
    Did 10369000 SHA-512 (16 bytes) operations in 1000088us (165.9 MB/sec) [+123.1%]
    Did 3650000 SHA-512 (256 bytes) operations in 1000079us (934.3 MB/sec) [+126.2%]
    Did 1029000 SHA-512 (1350 bytes) operations in 1000521us (1388.4 MB/sec) [+134.7%]
    Did 175000 SHA-512 (8192 bytes) operations in 1001874us (1430.9 MB/sec) [+132.5%]
    Did 89000 SHA-512 (16384 bytes) operations in 1010314us (1443.3 MB/sec) [+131.4%]
    
    (This doesn't seem to change the overall SHA-256 vs SHA-512 performance
    question on ARM, when hashing perf matters. SHA-256 on the same chip
    gets up to 2454.6 MB/s.)
    
    In terms of build coverage, for now, we'll have build coverage
    everywhere and test coverage on Chromium, which runs this code on macOS
    CI. We should request a macOS ARM64 bot for our standalone CI.  Longer
    term, we need a QEMU-based builder to test various features. QEMU seems
    to have pretty good coverage of all this, which will at least give us
    Linux.
    
    I haven't added an OPENSSL_STATIC_ARMCAP_SHA512 for now. Instead, we
    just look at the standard __ARM_FEATURE_SHA512 define. Strangely, the
    corresponding -march tag is not sha512. Neither GCC and nor Clang have
    -march=armv8-a+sha512. Instead, -march=armv8-a+sha3 implies both
    __ARM_FEATURE_SHA3 and __ARM_FEATURE_SHA512! Yet everything else seems
    to describe the SHA512 extension as separate from SHA3.
    https://developer.arm.com/architectures/system-architectures/software-standards/acle
    
    Update-Note: Consumers with a different build setup may need to
    limit -D_XOPEN_SOURCE=700 to Linux or non-Apple platforms. Otherwise,
    <sys/types.h> won't define some typedef needed by <sys/sysctl.h>. If you
    see a build error about u_char, etc., being undefined in some system
    header, that is probably the cause.
    
    Change-Id: Ia213d3796b84c71b7966bb68e0aec92e5d7d26f0
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50807
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Jan 5, 2022
    Configuration menu
    Copy the full SHA
    1e15682 View commit details
    Browse the repository at this point in the history
  4. Rename CPU feature files with underscores.

    We use underscores everywhere except these files, which use hyphens.
    Switch them to be consistent.
    
    Change-Id: I67eddbdae7caaf8405bdb4a0c1b65e6f3ca43916
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50808
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Jan 5, 2022
    Configuration menu
    Copy the full SHA
    295b313 View commit details
    Browse the repository at this point in the history

Commits on Jan 7, 2022

  1. Move public APIs from cpu.h to crypto.h.

    cpu.h contains almost entirely private symbols, which aren't reliably
    usable outside the library because they lack OPENSSL_EXPORT. (And can't
    have OPENSSL_EXPORT. The linker wants references to exported symbols to
    go through the GOT, and our assembly doesn't do that.) In preparation
    for unexporting them, move the few public APIs to crypto.h. They seem
    similar in spirit to functions like CRYPTO_has_asm.
    
    Update-Note: As part of this, I conditioned cpu-arm-linux.c on
    OPENSSL_LINUX, so that the header files can have accurate conditions.
    This means unrecognized ARM platforms that do not set
    OPENSSL_STATIC_ARMCAP will fail to build, where previously we defaulted
    to the Linux mechanisms. This matches cpu-aarch64-linux.c, which is
    already gated on OPENSSL_LINUX. (And the file is quite Linux-specific.
    Even if a non-Linux ELF target used getauxval for ARM capabilities, it's
    unlikely that our hardcoded constants and /proc behavior applies
    anyway.)
    
    Change-Id: I1ee9eb72097be619d3f28a51b1ea058b3c37d05a
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50845
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: Adam Langley <agl@google.com>
    davidben authored and agl committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    37faa93 View commit details
    Browse the repository at this point in the history
  2. Move CPU detection symbols to crypto/internal.h.

    These symbols were not marked OPENSSL_EXPORT, so they weren't really
    usable externally anyway. They're also very sensitive to various build
    configuration toggles, which don't always get reflected into projects
    that include our headers. Move them to crypto/internal.h.
    
    Change-Id: I79a1fcf0b24e398d75a9cc6473bae28ec85cb835
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50846
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    661266e View commit details
    Browse the repository at this point in the history
  3. Switch __ARM_FEATURE_CRYPTO to __ARM_FEATURE_{AES,SHA2}.

    The latest version of ACLE splits __ARM_FEATURE_CRYPTO into two defines
    to reflect that, starting ARMv8.2, the cryptography extension can
    include {AES,PMULL} and {SHA1,SHA256} separately.
    
    Also standardize on __ARM_NEON, which is the recommended symbol from
    ACLE, and the only one defined on non-Apple aarch64 targets. Digging
    through GCC history, __ARM_NEON__ is a bit older.  __ARM_NEON was added
    in GCC's 9e94a7fc5ab770928b9e6a2b74e292d35b4c94da from 2012, part of GCC
    4.8.0.
    
    I suspect we can stop paying attention to __ARM_NEON__ at this point,
    but I've left both working for now. __ARM_FEATURE_{AES,SHA2} is definite
    too new to fully replace __ARM_FEATURE_CRYPTO.
    
    Tested on Linux that -march=armv8-a+aes now also drops the fallback AES
    code. Previously, we would pick up -march=armv8-a+crypto, but not
    -march=armv8-a+aes. Also tested that, on an OPENSSL_STATIC_ARMCAP build,
    -march=armv8-a+sha2 sets the SHA-1 and SHA-256 features.
    
    Change-Id: I749bdbc501ba2da23177ddb823547efcd77e5c98
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50847
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    846a227 View commit details
    Browse the repository at this point in the history
  4. Don't use __ARMEL__/__ARMEB__ in aarch64 assembly

    GCC's __ARMEL__ and __ARMEB__ defines denote little- and big-endian arm,
    respectively. They are not defined on aarch64, which instead use
    __AARCH64EL__ and __AARCH64EB__.
    
    However, OpenSSL's assembly originally used the 32-bit defines on both
    platforms and even define __ARMEL__ and __ARMEB__ in arm_arch.h. This is
    less portable and can even interfere with other headers, which use
    __ARMEL__ to detect little-endian arm. (Our own base.h believes
    __ARMEL__ implies 32-bit arm. We just happen to check __AARCH64EL__
    first. base.h is probably also always included before arm_arch.h.)
    
    Over time, the aarch64 assembly has switched to the correct defines,
    such as in 32bbb62ea634239e7cb91d6450ba23517082bab6. This commit
    finishes the job.
    
    (There is an even more official endianness detector, __ARM_BIG_ENDIAN in
    the Arm C Language Extensions. But I've stuck with the GCC ones here as
    that would be a larger change.)
    
    See also openssl/openssl#17373
    
    Change-Id: Ic04ff85782e6599cdeaeb33d12c2fa8edc882224
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50848
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    a94c267 View commit details
    Browse the repository at this point in the history
  5. Simplify __ARM_ARCH__ definition.

    OpenSSL's assembly files have a few places where we condition code on
    __ARM_ARCH__, the minimum target ARM revision. It currently only
    controls some pre-ARMv7 code. This symbol has, from what I can tell, the
    same semantics as __ARM_ARCH, defined in Arm C Language Extensions, and
    added in GCC 4.8 and Clang 3.2:
    https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=9e94a7fc5ab770928b9e6a2b74e292d35b4c94da;hp=25bab91e017eb1d6d93117f3da96fa9b43703190
    llvm/llvm-project@e98c4db
    
    Those are over nine years old, so drop all the fallback code. Also fix
    arm_arch.h to be includable on non-ARM platforms. Some tools expect all
    public headers to be cleanly includable and arm_arch.h being "public"
    was getting in the way (see cl/416881417).
    
    Interestingly, arm_arch.h previously only computed __ARM_ARCH__ for
    __GNUC__ and Clang doesn't define __GNUC__ on Windows. That means we
    actually weren't defining __ARM_ARCH__ for Windows. But none of the
    aarch64 assembly has __ARM_ARCH__-gated code, so it works out. If it
    ever does, that CL smooths that over. I've gated the
    __ARM_(MAX_)_ARCH__ bits on __ASSEMBLER__ to avoid breaking no-asm
    Windows/aarch64 builds on MSVC. There aren't any uses in C.
    
    Update-Note: ARM assembly now requires the compiler define __ARM_ARCH.
    This is not expected to break Clang or GCC from the last 8 or 9 years.
    
    Change-Id: Id45e95406edeecf8dda11dce9e82418516e9de1f
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50849
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Jan 7, 2022
    Configuration menu
    Copy the full SHA
    d80f17d View commit details
    Browse the repository at this point in the history

Commits on Jan 10, 2022

  1. Version bump: 2 -> 3.

    Change-Id: Ic3305debe9c5d85b1c47be4ebcdfcbd0660f49af
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50865
    Commit-Queue: Adam Langley <agl@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Jan 10, 2022
    Configuration menu
    Copy the full SHA
    24e97fb View commit details
    Browse the repository at this point in the history
  2. Don't #include "internal.h" twice.

    Change-Id: If28138bbda4111b4a62f48cd30c7a71a675e44f7
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50885
    Commit-Queue: Adam Langley <agl@google.com>
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Jan 10, 2022
    Configuration menu
    Copy the full SHA
    0354b79 View commit details
    Browse the repository at this point in the history

Commits on Jan 13, 2022

  1. Ignore duplicates in |X509_STORE_add_*|

    This change imports upstream's
    openssl/openssl@c045224
    
    Change-Id: Ib50ff9eb8c48d9580aa2ffcae92d3990cc987e30
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50905
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Jan 13, 2022
    Configuration menu
    Copy the full SHA
    f797570 View commit details
    Browse the repository at this point in the history

Commits on Jan 14, 2022

  1. Zero out the values from the integrity check.

    140-3 says
    
    > the zeroisation of protected and unprotected SSPs
    > shall be performed in the following scenarios:
    >   ...
    >   For temporary value(s) generated during the integrity test of the
    >   module’s software or firmware upon completion of the integrity test.
    
    (IG 9.7.B)
    
    Change-Id: I911f294860bf33b13b2c997fc633c9bda777fc48
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50945
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    Adam Langley authored and Boringssl LUCI CQ committed Jan 14, 2022
    Configuration menu
    Copy the full SHA
    ec476ef View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2022

  1. Make EVP_AEAD_CTX_free accept NULL.

    This matches our other free functions.
    
    Fixed: 473
    Change-Id: Ie147995c2f5b429f78e95cfc9a08ed54181af94e
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/51005
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    davidben authored and Boringssl LUCI CQ committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    d1593f5 View commit details
    Browse the repository at this point in the history
  2. Add note about Gerrit account creation

    Description:
    Creating just a Gerrit password isn't enough.  Before you can push a
    change to Gerrit, you must also create/associate a Gerrit account with
    the google account used to create the password.
    
    This avoids "git push ..." rejections like this:
    
      remote: PERMISSION_DENIED: The caller does not have permission
      remote: [type.googleapis.com/google.rpc.LocalizedMessage]
      remote: locale: "en-US"
      remote: message: "\'git push\' requires a Gerrit user account."
    
    Change-Id: Id02c1a69ccb0c2b8bf4c63b77ed3064125966eb3
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50985
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    jamuir authored and Boringssl LUCI CQ committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    36a41bf View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2022

  1. Generates "low-level" bindings for Rust using bindgen

    This is designed to be the minimal infrastructure required to support
    using BoringSSL in the Rust ecosystem without fear of ABI drift. Bindgen
    is used to generate Rust bindings in lockstep with the rest of the
    build. `rust-openssl` can consume these generated bindings with minimal
    changes.
    
    Change-Id: I1dacd36a4131e22a930ebb01da00407e8465ad7e
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49645
    Reviewed-by: David Benjamin <davidben@google.com>
    Reviewed-by: Adam Langley <agl@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    benbrittain authored and Boringssl LUCI CQ committed Jan 19, 2022
    Configuration menu
    Copy the full SHA
    8d8d8f3 View commit details
    Browse the repository at this point in the history

Commits on Jan 20, 2022

  1. Add ARMV8_SHA512 detection for Fuchsia.

    See https://fuchsia-review.googlesource.com/c/fuchsia/+/624684. Also
    pick up the new, more specific, name for ZX_ARM64_FEATURE_ISA_SHA2.
    
    Update-Note: This CL is written assuming we can just rely on the SDK
    changes. Per go/fuchsia-sdk-age, this seems fairly safe. If this file
    fails to build due to missing symbols, update your project's Fuchsia
    SDK. If this blocks something, let us know.
    
    Change-Id: I28b0c234b577cc0de90e7ef096c15bb75a4ba501
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50926
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Jan 20, 2022
    Configuration menu
    Copy the full SHA
    be04c56 View commit details
    Browse the repository at this point in the history

Commits on Jan 21, 2022

  1. Put Rust binding generation behind an explicit flag and only build bi…

    …ndings for the targeted Arch
    
    Change-Id: I8ccd53bce0d73bd9d79f65770e544a75753ce4f8
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/51025
    Reviewed-by: David Benjamin <davidben@google.com>
    benbrittain authored and davidben committed Jan 21, 2022
    Configuration menu
    Copy the full SHA
    ea46caf View commit details
    Browse the repository at this point in the history

Commits on Jan 24, 2022

  1. Fix mac_arm64 builder.

    We were fetching the mac-amd64 package even on mac-arm64.
    
    Change-Id: Iad842ebd46d467c0def9bdbd14c77698a03f58d3
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/51045
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Jan 24, 2022
    Configuration menu
    Copy the full SHA
    960ddfe View commit details
    Browse the repository at this point in the history
  2. LSC: Apply clang-tidy's modernize-use-bool-literals to boringssl

    The check finds implicit conversions of integer literals to bools:
      bool b1 = 1;
      bool b2 = static_cast<bool>(1);
    and transforms them to:
      bool b1 = true;
      bool b2 = true;
    
    Bug: chromium:1290142
    Change-Id: I15579e28f544d07b331a230b70a8278e0651150d
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/51085
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    Anton Bikineev authored and Boringssl LUCI CQ committed Jan 24, 2022
    Configuration menu
    Copy the full SHA
    50e7ea5 View commit details
    Browse the repository at this point in the history
  3. Switch CRYPTO_BUFFER_POOL to SipHash-2-4.

    This hash table, in applications that use pooling, can dedup received
    certificates in memory and thus should use a keyed hash.
    
    Change-Id: Idc40dc8f7463025183121642b30ea0de43ebac0e
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/51125
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Jan 24, 2022
    Configuration menu
    Copy the full SHA
    345c86b View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2022

  1. Fix Unicode strings for C++20

    u8 strings in C++20 are char8_t instead of char; in order to compile on
    both C++17 and C++20 we need to remove the prefix.
    
    Change-Id: I85d1a9d72d24e8fa96ca22b1d99be9982fee8fb5
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/51065
    Reviewed-by: David Benjamin <davidben@google.com>
    Commit-Queue: David Benjamin <davidben@google.com>
    smikims authored and Boringssl LUCI CQ committed Jan 25, 2022
    Configuration menu
    Copy the full SHA
    c03e99a View commit details
    Browse the repository at this point in the history
  2. Limit _XOPEN_SOURCE to Linux.

    POSIX feature macros are a mess. Reportedly, FreeBSD also breaks with
    _XOPEN_SOURCE, so try leaving it unset by default.
    
    Update-Note: It's possible this will break yet another obscure UNIX.
    Hopefully we can eventually find a combination that works?
    
    Bug: 471
    Change-Id: I103f8093110d343789b9c5a22eb056ab78d9cd14
    Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/51145
    Reviewed-by: Adam Langley <agl@google.com>
    davidben authored and agl committed Jan 25, 2022
    Configuration menu
    Copy the full SHA
    387f820 View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2022

  1. Configuration menu
    Copy the full SHA
    32772ad View commit details
    Browse the repository at this point in the history