• Adam Langley's avatar
    crypto/x509: don't accept a root that already appears in a chain. · 07a31bc3
    Adam Langley authored
    Since a root certificate is self-signed, it's a valid child of itself.
    If a root certificate appeared both in the pool of intermediates and
    roots the verification code could find a chain which included it twice:
    first as an intermediate and then as a root. (Existing checks prevented
    the code from looping any more.)
    
    This change stops the exact same certificate from appearing twice in a
    chain. This simplifies the results in the face of the common
    configuration error of a TLS server returning a root certificate.
    
    (This should also stop two different versions of the “same” root
    appearing in a chain because the self-signature on one will not validate
    for the other.)
    
    Fixes #16800.
    
    Change-Id: I004853baa0eea27b44d47b9b34f96113a92ebac8
    Reviewed-on: https://go-review.googlesource.com/32121
    Run-TryBot: Adam Langley <agl@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    07a31bc3
Name
Last commit
Last update
..
pkix Loading commit data...
cert_pool.go Loading commit data...
example_test.go Loading commit data...
pem_decrypt.go Loading commit data...
pem_decrypt_test.go Loading commit data...
pkcs1.go Loading commit data...
pkcs8.go Loading commit data...
pkcs8_test.go Loading commit data...
root.go Loading commit data...
root_bsd.go Loading commit data...
root_cgo_darwin.go Loading commit data...
root_darwin.go Loading commit data...
root_darwin_arm_gen.go Loading commit data...
root_darwin_armx.go Loading commit data...
root_darwin_test.go Loading commit data...
root_linux.go Loading commit data...
root_nacl.go Loading commit data...
root_nocgo_darwin.go Loading commit data...
root_plan9.go Loading commit data...
root_solaris.go Loading commit data...
root_unix.go Loading commit data...
root_windows.go Loading commit data...
sec1.go Loading commit data...
sec1_test.go Loading commit data...
sha2_windows_test.go Loading commit data...
verify.go Loading commit data...
verify_test.go Loading commit data...
x509.go Loading commit data...
x509_test.go Loading commit data...
x509_test_import.go Loading commit data...