Skip to content

Comments

New load_csr() in apps.c simplifiying req, x509, and ca apps and allowing DER input to ca#4940

Closed
DDvO wants to merge 4 commits intoopenssl:masterfrom
siemens:load_csr-format
Closed

New load_csr() in apps.c simplifiying req, x509, and ca apps and allowing DER input to ca#4940
DDvO wants to merge 4 commits intoopenssl:masterfrom
siemens:load_csr-format

Conversation

@DDvO
Copy link
Contributor

@DDvO DDvO commented Dec 15, 2017

New helper function X509_REQ *load_csr(const char *file, int format, const char *desc)
in apps/apps.c simplifying and generalizing CSR loading in req.c, x509.c, and ca.c.
Moreover, new -inform and -certform CLI options to ca app now allowing DER input.
Tested with DER (rather than PEM) CSR input format in 80-test_ca.t.

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

@DDvO
Copy link
Contributor Author

DDvO commented Dec 22, 2017

@bernd-edlinger, thanks for your review and comments.

Indeed the output in case of unsupported format could be more helpful. I've now done this not only for load_csr() but also for other file loading functions, introducing helper functions format2str() and print_format_error().

Doing so, I found that the use of the desc / descrip string parameter was a bit inconsistent, with some functions having it and similar other functions not; so I added it where missing.
Moreover, when using this parameter, no checks had been done whether it is NULL, so I added such guards. This leads to the nice extra feature that error printing on file loading can be suppressed, which can be very handy for instance when trying to load files using differenct formats until (hopefully) this succeeds.

@richsalz
Copy link
Contributor

Nice work, @DDvO

@DDvO
Copy link
Contributor Author

DDvO commented Dec 27, 2017

Hmm, it looks like the Travis CI build https://travis-ci.org/openssl/openssl/jobs/321919199 failed due to some Debian package (update) issue?

tpank pushed a commit to mpeylo/cmpossl that referenced this pull request Jan 15, 2018
@mattcaswell mattcaswell added this to the 1.1.1 milestone Jan 24, 2018
@levitte
Copy link
Member

levitte commented Mar 29, 2018

At this point, I think we need to post-pone this PR to be post-1.1.1, as it's very much an added features thing.

Also, I'm thinking that this kind of change should really make use of the OSSL_STORE API.

@DDvO
Copy link
Contributor Author

DDvO commented Apr 22, 2020

I've meanwhile rebased also this PR such that we can hopefully integrate it with #11470 soon.
Travis CI went fine (while the AppVeyor runs are still queued, but I don't expect problems there).
Anything concrete that I can quickly improve?

@t8m
Copy link
Member

t8m commented Apr 22, 2020

Hopefully nobody depends on exact wording (and case) for the error messages in scripts.

Could you please amend the commit message of the last commit so the subject is shorter and you add description of the changes in message body.

@DDvO DDvO force-pushed the load_csr-format branch from ecf54e5 to 2016efc Compare April 22, 2020 13:46
@DDvO
Copy link
Contributor Author

DDvO commented Apr 22, 2020

Hopefully nobody depends on exact wording (and case) for the error messages in scripts.

It would be pretty unwise to do so.
This is not the first time error messages are adapted.

Could you please amend the commit message of the last commit so the subject is shorter and you add description of the changes in message body.

Sure - done.
I anyway plan to partly squash and reword the commit messages once the changes are stable.

@t8m
Copy link
Member

t8m commented Apr 22, 2020

I think if CI passes this could be approved unless you plan further changes.

@DDvO
Copy link
Contributor Author

DDvO commented Apr 22, 2020

Pleased to hear. I don't plan to do further changes unless request by a review.
Then let's just wait for the CI checks and in the meantime I'll prepare the cleanup for the commit structure and comments...

DDvO added 4 commits April 22, 2020 19:54
Make use of new load_csr() in 'ca', 'req', and 'x509' app
Add '-inform' and '-certform' option to 'ca' app
Add 'desc' parameter to load_crl() function defined in apps/lib/apps.c
Allow 'desc' parameter to be NULL (gives option to suppress error output)
Also make sure that all error messages in apps.c consistently begin upper-case.
Changed files: apps/lib/apps.c and apps/{req.c,s_client.c,s_server.c,x509.c}
@DDvO DDvO force-pushed the load_csr-format branch from 2016efc to 163b1ae Compare April 22, 2020 18:11
@DDvO
Copy link
Contributor Author

DDvO commented Apr 22, 2020

Since Travis CI went fine I've already updated the PR to the final commit structure I propose.

@t8m t8m added approval: done This pull request has the required number of approvals branch: master Applies to master branch labels Apr 23, 2020
@openssl-machine
Copy link
Collaborator

24 hours has passed since 'approval: done' was set, but this PR has failing CI tests. Once the tests pass it will get moved to 'approval: ready to merge' automatically, alternatively please review and set the label manually.

@DDvO DDvO added the approval: ready to merge The 24 hour grace period has passed, ready to merge label Apr 24, 2020
@DDvO
Copy link
Contributor Author

DDvO commented Apr 24, 2020

For some reason AppVeyor is still queued on this PR (and others as well) since about two days,
and as far as I recall it already went fine earlier on this PR.
So I've just manually marked this "ready to merge" and will do the merge now...

openssl-machine pushed a commit that referenced this pull request Apr 24, 2020
Make use of new load_csr() in 'ca', 'req', and 'x509' app
Add '-inform' and '-certform' option to 'ca' app
Add 'desc' parameter to load_crl() function defined in apps/lib/apps.c
Allow 'desc' parameter to be NULL (gives option to suppress error output)

Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: David von Oheimb <[email protected]>
(Merged from #4940)
openssl-machine pushed a commit that referenced this pull request Apr 24, 2020
…s/lib/opt.c

Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: David von Oheimb <[email protected]>
(Merged from #4940)
openssl-machine pushed a commit that referenced this pull request Apr 24, 2020
Reviewed-by: Tomas Mraz <[email protected]>
Reviewed-by: David von Oheimb <[email protected]>
(Merged from #4940)
openssl-machine pushed a commit that referenced this pull request Apr 24, 2020
Also make sure that all error messages in apps.c consistently begin upper-case.
Changed files: apps/lib/apps.c and apps/{req.c,s_client.c,s_server.c,x509.c}

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

DDvO commented Apr 24, 2020

Merged - thanks @t8m for your swift review!

@DDvO DDvO closed this Apr 24, 2020
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 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.

9 participants