Skip to content

CAdES: implement CAdES-BES signed attributes validation #8098

Closed
FdaSilvaYY wants to merge 6 commits intoopenssl:masterfrom
FdaSilvaYY:add-cades-verify
Closed

CAdES: implement CAdES-BES signed attributes validation #8098
FdaSilvaYY wants to merge 6 commits intoopenssl:masterfrom
FdaSilvaYY:add-cades-verify

Conversation

@FdaSilvaYY
Copy link
Contributor

@FdaSilvaYY FdaSilvaYY commented Jan 27, 2019

CAdES-BES Signature Validation feature following #7893.

The core validation code comes from PR #771. this PR mostly shared and reuse its code.

Checklist
  • documentation is added or updated
  • tests are added or updated

@FdaSilvaYY FdaSilvaYY force-pushed the add-cades-verify branch 2 times, most recently from 1b03cee to 19626ad Compare January 28, 2019 00:08
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.

First quick read

@levitte
Copy link
Member

levitte commented Jan 28, 2019

Apart from my comment, can you have a look at Travis and figure out what's going on? Them are a few too many unresolved symbols for my comfort...

@FdaSilvaYY FdaSilvaYY force-pushed the add-cades-verify branch 2 times, most recently from 2584aa5 to f4cb69e Compare January 28, 2019 21:31
@FdaSilvaYY
Copy link
Contributor Author

Apart from my comment, can you have a look at Travis and figure out what's going on? Them are a few too many unresolved symbols for my comfort...

Fully fixed, I should not edit my code so late ;)
CI's are Green.

@maxcuttins
Copy link

any news about this?

@FdaSilvaYY FdaSilvaYY force-pushed the add-cades-verify branch 2 times, most recently from b20fafe to 53c49de Compare February 17, 2019 18:54
@FdaSilvaYY
Copy link
Contributor Author

FdaSilvaYY commented Feb 17, 2019

@maxcuttins : needs a bit of documents about the two added methods.
May be it is possible to get the signed attributes in a more fashion way .
Otherwise, the core changes are here.
I rebased this PR on top of #8117 to ease the merge.

@FdaSilvaYY FdaSilvaYY force-pushed the add-cades-verify branch 2 times, most recently from fb5c13b to 404e7f3 Compare February 19, 2019 19:49
@FdaSilvaYY FdaSilvaYY force-pushed the add-cades-verify branch 2 times, most recently from 288d872 to 40ad55c Compare April 4, 2019 20:13
@FdaSilvaYY FdaSilvaYY changed the title CAdes: implement CAdES-BES signed attributes validation CAdES: implement CAdES-BES signed attributes validation May 25, 2019
@FdaSilvaYY FdaSilvaYY force-pushed the add-cades-verify branch 3 times, most recently from 02258ec to 739f0d1 Compare May 25, 2019 18:59
@FdaSilvaYY
Copy link
Contributor Author

Ping @slontis : suggested tests added.

@slontis
Copy link
Member

slontis commented May 27, 2019

Is this PR dependant on PR #8117 or should #8117 just be closed?

@slontis
Copy link
Member

slontis commented May 27, 2019

Just a general comment about the generated files..
I have started keeping a seperate commit for the generated files (since they quite often need to be updated when other PR's are merged). That way you can then

  • rebase and then remove the generated files commit
  • make update and then add the generated files again and commit.

@FdaSilvaYY FdaSilvaYY force-pushed the add-cades-verify branch 2 times, most recently from 60589f2 to eea4f13 Compare May 10, 2020 19:26
@FdaSilvaYY
Copy link
Contributor Author

Fully rebased. CI are all green.
Just need to think a bit more about no-ts, no-cms interaction with these changes.

@opensignature
Copy link
Contributor

with make test TESTS=test_x509 V=1
there is this error:
crypto/pem/pvkfmt.c:42:18: runtime error: left shift of 137 by 24 places cannot be represented in type 'int'

@mspncp
Copy link
Contributor

mspncp commented May 17, 2020

with make test TESTS=test_x509 V=1
there is this error:
crypto/pem/pvkfmt.c:42:18: runtime error: left shift of 137 by 24 places cannot be represented in type 'int'

Thanks @opensignature. @FdaSilvaYY already reported this issue in #11853.

Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

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

Some minor things to resolve.

Copy link
Member

Choose a reason for hiding this comment

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

Nit: It is weird to "optimize" boolean value into unsigned char. The int type is usually used in place of boolean throughout the OpenSSL code. Also I would slightly prefer using (flags & CMS_CADES) != 0 instead of the ? operator.

Copy link
Member

Choose a reason for hiding this comment

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

Optional: at this point scount == sk_CMS_SignerInfo_num(sinfos) so you could use scount here to optimize.

Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to just return ASN1_INTEGER_cmp(is->serial, X509_get_serialNumber((X509 *)cert)); here?

Copy link
Member

Choose a reason for hiding this comment

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

This was now changed. You can also use X509v3_cache_extensions() directly.

Copy link
Member

Choose a reason for hiding this comment

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

This will require change to use fetch. Perhaps just mark with TODO 3.0.

Copy link
Member

Choose a reason for hiding this comment

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

This will have to be changed for 3.0 to use fetch. Please add TODO 3.0 comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed !

Copy link
Member

Choose a reason for hiding this comment

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

I think that X509_digest should do this automatically.

for signing certificate V2 and signing certificate extensions.

CAdES : lowercase name for now internal methods.
about the two new added methods and two new error codes.
[extended tests]
…ning certificate V2 and signing certificate extensions.
@FdaSilvaYY
Copy link
Contributor Author

Travis builds are Green, except usual s390 "no space left" ...

Copy link
Member

@t8m t8m left a comment

Choose a reason for hiding this comment

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

Good work!

@t8m
Copy link
Member

t8m commented May 25, 2020

@slontis Can you please re-approve?

Copy link
Member

@slontis slontis left a comment

Choose a reason for hiding this comment

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

Reapproved..

Thanks for your patience with this PR @FdaSilvaYY.

@slontis slontis added approval: done This pull request has the required number of approvals and removed approval: review pending This pull request needs review by a committer labels May 25, 2020
@mspncp mspncp added approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: done This pull request has the required number of approvals labels May 26, 2020
@mspncp
Copy link
Contributor

mspncp commented May 26, 2020

This pull request is ready to merge.

openssl-machine pushed a commit that referenced this pull request May 27, 2020
for signing certificate V2 and signing certificate extensions.

CAdES: lowercase name for now internal methods.

crypto/cms: generated file changes.

Add some CHANGES entries.

[extended tests]

Reviewed-by: Shane Lontis <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from #8098)
@t8m
Copy link
Member

t8m commented May 27, 2020

Squashed and merged as 9e3c510. Thank you very much for the PR and your patience when waiting for the reviews and merge.

@t8m t8m closed this May 27, 2020
@FdaSilvaYY FdaSilvaYY deleted the add-cades-verify branch May 27, 2020 15:42
@FdaSilvaYY
Copy link
Contributor Author

Thanks for all your reviews and remarks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: ready to merge The 24 hour grace period has passed, ready to merge branch: master Applies to master branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants