Skip to content

Chunk 9 of CMP contribution to OpenSSL: CMP client and related tests#11300

Closed
DDvO wants to merge 3 commits intoopenssl:masterfrom
mpeylo:cmpossl_incremental9
Closed

Chunk 9 of CMP contribution to OpenSSL: CMP client and related tests#11300
DDvO wants to merge 3 commits intoopenssl:masterfrom
mpeylo:cmpossl_incremental9

Conversation

@DDvO
Copy link
Contributor

@DDvO DDvO commented Mar 10, 2020

Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSL
Also includes CRMF (RFC 4211) and HTTP transfer (RFC 6712).
Adds the CMP and CRMF API to libcrypto and the "cmp" app to the CLI.
Adds extensive documentation and tests.

9th chunk: CMP client library code and related tests

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

@DDvO
Copy link
Contributor Author

DDvO commented Mar 11, 2020

I just realized that the case

#if !defined(OPENSSL_NO_OCSP)

is not needed any more for the CMP client :)

@DDvO DDvO force-pushed the cmpossl_incremental9 branch from 23b7715 to c7fbf0e Compare March 12, 2020 13:02
@DDvO
Copy link
Contributor Author

DDvO commented Mar 12, 2020

Thanks @mattcaswell for your swift and helpful review comments!
I've solved all issues - except for the deeper structural one: what to do while waiting for certificate responses - and rebased the PR.

@DDvO
Copy link
Contributor Author

DDvO commented Mar 12, 2020

In the meantime: are there any other open issues with this PR?

Copy link
Member

@mattcaswell mattcaswell left a comment

Choose a reason for hiding this comment

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

I've taken another scan through this PR and noted a couple of minor issues below.

As noted above I continue to have some concerns about the transfer_cb API and how errors are handled. Other than that and the outstanding issue about what to do while waiting for certificate responses, I'm ok with this PR.

@DDvO
Copy link
Contributor Author

DDvO commented Mar 13, 2020

I've taken another scan through this PR and noted a couple of minor issues below.

Thanks - I've just fixed these, along with various minor naming inconsistencies I realizied.
Moreover I've extended the documentation of the new CMP client functions.

As noted above I continue to have some concerns about the transfer_cb API and how errors are handled.

I've addressed these as well.

Other than that and the outstanding issue about what to do while waiting for certificate responses, I'm ok with this PR.

Very pleased to hear!
I was planning to re-structure the code to address the waiting issue today,
but was held up by other things and will do by Monday...

@mattcaswell
Copy link
Member

Note - the AppVeyor failure looks relevant:

..\crypto\cmp\cmp_client.c(301): error C2220: warning treated as error - no 'object' file generated
..\crypto\cmp\cmp_client.c(301): warning C4244: 'function': conversion from 'int64_t' to 'unsigned long', possible loss of data
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual 

@DDvO
Copy link
Contributor Author

DDvO commented Mar 16, 2020

Note - the AppVeyor failure looks relevant:

Thx for the hint; this will be solved with my next update..

@DDvO DDvO force-pushed the cmpossl_incremental9 branch from bfce635 to 72e99e6 Compare March 17, 2020 10:23
@DDvO
Copy link
Contributor Author

DDvO commented Mar 18, 2020

Thanks @Akretsch for your two review comments, which I've handled. Did this finish your pass?

@DDvO
Copy link
Contributor Author

DDvO commented Mar 18, 2020

@mattcaswell, are you fine with the implementation (including tests and documentation) of the new OSSL_CMP_try_certreq() function?

@DDvO
Copy link
Contributor Author

DDvO commented Mar 20, 2020

@mattcaswell, yesterday there was the usual false positive of Travis CI due to timeout; everything else went fine.
I've just done two cosmetic improvements according to @Akretsch's review and pushed the result, which gives the CI a new chance to report all-green.

Anything else to do on this chunk from your perspective?

@DDvO DDvO force-pushed the cmpossl_incremental9 branch from e084c95 to ab321a0 Compare March 20, 2020 14:32
@DDvO
Copy link
Contributor Author

DDvO commented Mar 20, 2020

Travis CI went fine this morning.
I've just rebased the PR and added two minor fixup commits that came up during rebasing #10587.

@DDvO DDvO force-pushed the cmpossl_incremental9 branch 2 times, most recently from 5a7f31f to 9491ccd Compare March 23, 2020 08:09
@DDvO
Copy link
Contributor Author

DDvO commented Mar 23, 2020

Rebased again, on the just merged #10504.

Copy link
Member

@mattcaswell mattcaswell left a comment

Choose a reason for hiding this comment

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

LGTM

@mattcaswell mattcaswell added the approval: done This pull request has the required number of approvals label Mar 24, 2020
@DDvO DDvO force-pushed the cmpossl_incremental9 branch from 9491ccd to ce9d9de Compare March 24, 2020 12:50
@DDvO
Copy link
Contributor Author

DDvO commented Mar 24, 2020

Great, thanks @mattcaswell

In preparation of merging this chunk tomorrow I've squashed it as much as I believe makes sense.

@openssl-machine
Copy link
Collaborator

24 hours has passed since 'approval: done' was set, but as this PR has been updated in that time the label 'approval: ready to merge' is not being automatically set. Please review the updates and set the label manually.

DDvO added 3 commits March 25, 2020 14:10
Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSL
Also includes CRMF (RFC 4211) and HTTP transfer (RFC 6712).
Adds the CMP and CRMF API to libcrypto and the "cmp" app to the CLI.
Adds extensive documentation and tests.
@DDvO DDvO force-pushed the cmpossl_incremental9 branch from ce9d9de to 4522634 Compare March 25, 2020 13:12
openssl-machine pushed a commit that referenced this pull request Mar 25, 2020
…rning

Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: David von Oheimb <[email protected]>
(Merged from #11300)
openssl-machine pushed a commit that referenced this pull request Mar 25, 2020
Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: David von Oheimb <[email protected]>
(Merged from #11300)
openssl-machine pushed a commit that referenced this pull request Mar 25, 2020
Certificate Management Protocol (CMP, RFC 4210) extension to OpenSSL
Also includes CRMF (RFC 4211) and HTTP transfer (RFC 6712).
Adds the CMP and CRMF API to libcrypto and the "cmp" app to the CLI.
Adds extensive documentation and tests.

Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: David von Oheimb <[email protected]>
(Merged from #11300)
@DDvO
Copy link
Contributor Author

DDvO commented Mar 25, 2020

Merged, closing :)

@DDvO DDvO closed this Mar 25, 2020
@bernd-edlinger
Copy link
Member

Sorry, can we please revert this one, it shot down my #11393
which addresses the same issue but in a slightly better way.

@mattcaswell
Copy link
Member

Given the size of this PR compared to #11393, it makes more sense to adjust #11393.

@bernd-edlinger
Copy link
Member

Okay, I have not looked at the whole picture.

@DDvO
Copy link
Contributor Author

DDvO commented Mar 26, 2020

I deliberately kept my change to strncpy in a separate commit: b4ba2b7, so it could be reverted easily.
Yet I do not see that replacing the function by memcpy would be better.

@bernd-edlinger
Copy link
Member

But in general I do not understand why every PR addresses so many different
topics at the same time. What is this good for?

@DDvO
Copy link
Contributor Author

DDvO commented Mar 26, 2020

It was a fixup of a CMP-related change.

@bernd-edlinger
Copy link
Member

strcpy implies zero-termination. memcpy does not,
that is the reason why there was this warning in the first place.
also the strcpy below is funny, because it implies
okay. then I close my PR. I can impossibly keep up with your speed.

@DDvO
Copy link
Contributor Author

DDvO commented Mar 26, 2020

AFAICS using memcpy with the same length is wrong.
In order to copy over the NUL termination one needs to copy sep_len + 1 bytes/chars.
This is what my solution does.

@DDvO
Copy link
Contributor Author

DDvO commented Mar 26, 2020

Semantically neither of the fixes is/was needed.
Just some compilers brought a (in this case misleading) warning.
BTW, also clang did so, which motivated my change.

@DDvO
Copy link
Contributor Author

DDvO commented Mar 26, 2020

also the strcpy below is funny, because it implies

Indeed. Yet interestingly at least clang did not warn on

strncpy(p, (const char *)ASN1_STRING_get0_data(current), length);

For this line I agree that using memcpy would at least look better because apparently it is not guaranteed that that ASN1_STRING_get0_data() is NUL-terminated.
Yet, also here it is semantically not relevant due to the final assignment *p = '\0'.

@bernd-edlinger
Copy link
Member

The warning is not semantically misleading, but as I said, go with your change,
my life does not depend on the memcpy

@DDvO
Copy link
Contributor Author

DDvO commented Mar 26, 2020

BTW, can you give me a hint how to use gcc-10 on the latest Debian edition (10.3 "buster")?
It currently includes gcc (Debian 8.3.0-6) 8.3.0.

@bernd-edlinger
Copy link
Member

build it from source. that is not yet released.

@DDvO
Copy link
Contributor Author

DDvO commented Mar 27, 2020

After getting around some build issues I meanwhile have a working gcc (GCC) 10.0.1 20200326,
and my SSD has some 9.5 GB less space.

OpenSSL builds (with --strict-warnings etc.) based on PR#11404 (which includes the merged commits of this PR#11300) with gcc-10.0.1 went fine without warnings.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants