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

Port CRL test from boring crypto/x509/x509_test.cc; add fix to 1.1.0/master #1775

Closed
wants to merge 1 commit into from
Closed

Conversation

richsalz
Copy link
Contributor

To be ported to 1.1.0 and 1.0.2 Fails right now on master, needs to be investigated.

@richsalz richsalz added branch: master Merge to master branch branch: 1.0.2 Merge to OpenSSL_1_0_2-stable branch 1.1.0 labels Oct 24, 2016
@richsalz richsalz self-assigned this Oct 24, 2016
@FdaSilvaYY
Copy link
Contributor

Error is pretty clear ;

test/crltest.c:40:5: error: string length '1253' is greater than the length '509' ISO C90 compilers are required to support [-Werror=overlength-strings]

test/crltest.c:64:5: error: string length '1298' is greater than the length '509' ISO C90 compilers are required to support [-Werror=overlength-strings]

test/crltest.c:77:5: error: string length '629' is greater than the length '509' ISO C90 compilers are required to support [-Werror=overlength-strings]

test/crltest.c:91:5: error: string length '658' is greater than the length '509' ISO C90 compilers are required to support [-Werror=overlength-strings]

test/crltest.c:105:5: error: string length '666' is greater than the length '509' ISO C90 compilers are required to support [-Werror=overlength-strings]

test/crltest.c:123:5: error: string length '654' is greater than the length '509' ISO C90 compilers are required to support [-Werror=overlength-strings]

test/crltest.c:140:5: error: string length '658' is greater than the length '509' ISO C90 compilers are required to support [-Werror=overlength-strings]

test/crltest.c:158:5: error: string length '682' is greater than the length '509' ISO C90 compilers are required to support [-Werror=overlength-strings]

@richsalz
Copy link
Contributor Author

No, that's a build error which I did not see and which I will fix later. The run-time error is this:

CRL with unknown critical extension (2) was accepted.

@davidben
Copy link
Contributor

Please consider any work from BoringSSL included here to be covered by our existing CLA with OpenSSL.

I think the reason the test doesn't pass is because the fix didn't get applied to master (or 1.1.0), so the test is working. :-)

@davidben
Copy link
Contributor

By the way, in case you need to generate more of these or whatever, here's the private key corresponding to kCRLTestRoot:
https://boringssl.googlesource.com/boringssl/+/f9f312af61f9ba87896736620d1e4e568c4442bd
(That probably should have been in a comment. I'll go fix that...)

Also, shameless plug, but der-ascii is really handy for generating these kinds of things:
https://github.com/google/der-ascii
You can see notes on how I fixed the signatures in samples/certificates.md (documented because I can never remember the incant for signing things)

@richsalz richsalz added branch: 1.0.2 Merge to OpenSSL_1_0_2-stable branch and removed branch: 1.0.2 Merge to OpenSSL_1_0_2-stable branch labels Oct 26, 2016
@richsalz richsalz changed the title WIP Port CRL test from boring crypto/x509/x509_test.cc Port CRL test from boring crypto/x509/x509_test.cc; add fix to 1.1.0/master Oct 26, 2016
@richsalz
Copy link
Contributor Author

yes, right i forgot to push the commit with the fix. (appropriate smiley)
the test gets picked to 1.0.2
everything here goes to 1.1.0 and master.
no longer a WIP.
ping @levitte who asked me about this off-line :)

@kroeckx
Copy link
Member

kroeckx commented Oct 27, 2016

You know that there are problems reported by travis, like "crltest: corrupted double-linked list"?

@richsalz
Copy link
Contributor Author

No I did not notice the travis problems.

@richsalz
Copy link
Contributor Author

Added a commit taht should fix this. Thanks for pointing me to the problem.

retcode = X509_verify_cert(ctx);
/* Unset the CA and CRL stacks so they don't get free'd by us. */
X509_STORE_CTX_trusted_stack(ctx, NULL);
X509_STORE_CTX_set0_crls(ctx, NULL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not seeing where either of these fields are freed by X509_STORE_CTX_free, though perhaps I'm just not seeing it.

Anyway, this doesn't make sense. One would expect that either both X509_STORE_CTX_set0_crls and X509_STORE_CTX_free free the existing value or neither to.

That is, if ctx owns crls as a result of line 235, then ctx is responsible for freeing it in both set0_crls and free. If ctx doesn't own crls, then ctx should not free it in either function. (At least from inspection, it seems to be the latter.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

asan is complaining, so let's see what happens. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh, of course i wasn't making sense. :( backed it out. need to reproduce locally.

@kaduk kaduk mentioned this pull request Oct 28, 2016
3 tasks
@richsalz
Copy link
Contributor Author

found and fixed. pushing new version.
unclear if i will backport this to 1.0.2

@snhenson
Copy link
Contributor

snhenson commented Nov 6, 2016

You can avoid the PEM concatentation by using DER format and calling the relevant d2i function directly.

Copy link
Member

@levitte levitte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me at this point

@richsalz
Copy link
Contributor Author

ping @levitte to re-review. uses the test framework. for master only.

@richsalz richsalz removed branch: 1.0.2 Merge to OpenSSL_1_0_2-stable branch 1.1.0 labels Nov 28, 2016
@richsalz
Copy link
Contributor Author

ping @levitte please reconfirm since it uses the test harness now. updated/rebased commit pushed.


if (!X509_STORE_CTX_init(ctx, store, leaf, NULL))
goto err;
X509_STORE_CTX_trusted_stack(ctx, roots);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to:

    X509_STORE_CTX_set0_trusted_stack(ctx, roots);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(it will fix the Travis build issue)

More importantly, port CRL test from boringSSL crypto/x509/x509_test.cc
@richsalz
Copy link
Contributor Author

updated commit pushed.

@levitte levitte added the approval: done This pull request has the required number of approvals label Dec 14, 2016
levitte pushed a commit that referenced this pull request Dec 14, 2016
More importantly, port CRL test from boringSSL crypto/x509/x509_test.cc

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #1775)
levitte pushed a commit that referenced this pull request Dec 14, 2016
More importantly, port CRL test from boringSSL crypto/x509/x509_test.cc

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #1775)
(cherry picked from commit 2b40699)
@richsalz
Copy link
Contributor Author

2b40699 in master, 0baae1c in 1.1.0

@richsalz richsalz closed this Dec 14, 2016
@richsalz richsalz deleted the add-crltest branch December 22, 2016 15:20
@FdaSilvaYY
Copy link
Contributor

FdaSilvaYY commented Feb 17, 2017

This fix was not pushed into 1.0.2 branch, who still has the issue too.
Any reason ?

@richsalz
Copy link
Contributor Author

It was; see 3ade92e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval: done This pull request has the required number of approvals branch: master Merge to master branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants