[openssl-dev] verify depth behavior change from 1.0.2 to 1.1.0?

Benjamin Kaduk bkaduk at akamai.com
Mon Apr 3 20:26:08 UTC 2017


Hi all,

We noticed that the depth limit check seems to behave differently
between 1.0.2 and 1.1.0.

In particular, with a (1.1.0)

openssl/test$ ../util/shlib_wrap.sh ../apps/openssl s_server -port 8080
-cert certs/ee-cert.pem -certform PEM -key certs/ee-key.pem -keyform PEM
-no-CApath -CAfile certs/root-cert.pem -chainCAfile certs/ca-cert.pem

running, I can then go poke at it with s_client and look for the 'Verify
return code' output from:

openssl s_client -connect localhost:8080 -CAfile
teset/certs/root-cert.pem -verify_depth N

for N equal to 0, 1, or 2.

With a 1.0.2 s_client,

N=0 --> "Verify return code: 21 (unable to verify the first certificate)"
N=1 --> "Verify return code: 20 (unable to get local issuer certificate)"
N=2 --> "Verify return code: 0 (ok)"

But the 1.1.0 s_client shows:

N=0 --> "Verify return code: 22 (certificate chain too long)"
N=1 --> "Verify return code: 0 (ok)"
N=2 --> "Verify return code: 0 (ok)"

The new behavior (which does not consider the root to be part of the
chain for purposes of verification) seems to be intentional, and is
explicitly tested in test/recipes/25-test_verify.t:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Depth tests, note the depth limit bounds the number of CA certificates
# between the trust-anchor and the leaf, so, for example, with a
root->ca->leaf
# chain, depth = 1 is sufficient, but depth == 0 is not.
#
ok(verify("ee-cert", "sslserver", ["root-cert"], ["ca-cert"],
"-verify_depth", "2"),
   "accept chain with verify_depth 2");
ok(verify("ee-cert", "sslserver", ["root-cert"], ["ca-cert"],
"-verify_depth", "1"),
   "accept chain with verify_depth 1");
ok(!verify("ee-cert", "sslserver", ["root-cert"], ["ca-cert"],
"-verify_depth", "0"),
   "accept chain with verify_depth 0");
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

There was a fair amount of churn in x509_vfy.c with the inclusion of the
DANE stuff and whatnot, so it's not immediately clear to me when this
change actually happened.  I think there are good arguments for the
current 1.1.0 behavior and it doesn't really make sense to try to change
back to the historical behavior, but it would be good to know when the
change actually happened and that it is/was a known change.  Ideally we
could also document the different behavior between 1.0.x and 1.1.0
better; any thoughts about where to do so?

Thanks,

Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-dev/attachments/20170403/ce33b0a0/attachment.html>


More information about the openssl-dev mailing list