Introducing an application-level library for the CLI and OpenSSL-based applications#4992
Introducing an application-level library for the CLI and OpenSSL-based applications#4992DDvO wants to merge 11 commits intoopenssl:masterfrom
Conversation
|
This pull request is related to suggestions I made in May 2016 and Sep 2017: |
|
This pull request contains in its first five commits various small corrections for shortcomings in the build machinery of OpenSSL I came across while building the addition of the new library, namely:
|
| } | ||
| foreach (@{$ordinals{$dest}}) { | ||
| my %known_ordinals = | ||
| my %known_ordinals = # TODO this should be configurable in build.info using ORDINALS |
There was a problem hiding this comment.
Actually, everything about ORDINALS can be removed, both here and anywhere in Configurations.
There was a problem hiding this comment.
Do you mean that also util/lib*.num are not needed anymore, not even for building Windows DLLs?
The better if so, because these often cause(d) extra work.
Hope that someone who is very familiar with this topic takes care of removing the unncessary pieces.
There was a problem hiding this comment.
Ah, no, not quite so unnecessary, sorry. What's not needed any more is the build.info keyword ORDINALS. It serves no purpose any more, as we've made the generation of corresponding .map / .def / .opt file explicit.
I will, however, clean out the stuff around ORDINAL, thanks.
|
|
||
| foreach my $filename (@openssl_source) { | ||
| open F, $filename or die "Couldn't open $_: $!\n"; | ||
| open F, $filename or die "Couldn't open $filename: $!\n"; |
| LIBS=libcrypto libssl libsecapp | ||
| ORDINALS[libcrypto]=crypto | ||
| ORDINALS[libssl]=ssl | ||
| ORDINALS[libsecapp]=secapp |
There was a problem hiding this comment.
The three ORDINALS lines aren't necessary at all
|
Ok... so here's a few thoughts:
It's true that people do copy that code (hey, I've done the same in previous work), but it's entirely at their own risk. So in the end, while this might seem like a good idea, this places a maintenance burden on @openssl that I'm unsure we're willing to take. I'm sorry to deliver such a message, 'cause you have obviously put time and effort into this. |
|
@levitte thanks for your swift comments. I already anticipated the points you made about internal and unstable API components - that's why I wrote above: "Of course, when this PR is accepted, some further cleanup would make sense." My main points of this PR are that an application-level library would be of great benefit for several reasons and that it is not too hard to implement. Of course, the actual contents of the library are debatable - putting essentially all of apps.c and app_rand.c is just an example. Yet at least functions like Sure I'll put the various commits with small general improvements in a separate PR. |
|
How if I reduce the initial (API) contents of the new library to: Hope this addresses (all) the concerns mentioned above. |
|
I am sceptical about the need for a new library (for this purpose). If we think there is code in the apps that is generally useful, I'm not sure why we wouldn't push that code down into libcrypto or libssl as appropriate. If we were to introduce a new library then I think it should be part of a broader review of the structure of all our codebase. There are other things that have been proposed for splitting out into separate libraries, e.g. we could make all algorithms dynamically loadable at runtime. There is also code in libcrypto which isn't really crypto related at all and probably doesn't belong there at all. Such a wholesale review probably shouldn't happen until 1.2.0 |
…on using write(); fix '#' indentation
|
What about libtls from LibreSSL? |
|
So @DDvO, I just wanted to let you know that, which I'm sceptical about making a public library, I've recently come to think that a private apps library (that's made out of all the apps modules that aren't directly CLI stuff) wouldn't be such a bad thing, for practical purposes. So I want to thank you for the inspiration. |
|
@mattcaswell and @levitte, very pleased that you confirmed that having such a lib would have practical advantages. and that you put this as a 1.2.0 milestone. OpenSSL itself will benefit from this even without the need to sanitize and document the interface of such a library. Yet if this extra effort on the API is spent, also external users of OpenSSL would benefit. This would bring a considerable usability boost because OpenSSL-based developments would not need to deal with various awkward and error-prone details, for instance, on file handling, key management, certificate checking using CRLs and OCSP, and management of TLS connections. |
|
This PR needs a rebase. |
This PR is very unlikely to be merged as is, so a rebase would be pointless. |
|
Indeed, no need to rebase since this was essentially a proof-of-concept. |
|
I suggest it get closed, even. |
|
If it gets closed I suspect that the milestone tag for 1.2.0 will get neglected. |
|
Shall we convert this into an issue? |
|
Closing this in favor of the new issue #13440, |
So far, the OpenSSL code has essentially a three-level structure with a stack of two libraries and a command-line application at the top:
apps/openssllibssllibcryptoThe
apps/directory contains various generally useful code like handling crypto-related files and messages, general TLS client/server and CA functionality, support for higher-level protocols like S/MIME, CRL fetching, OCSP, and certainly more to come.While this code serves as a model for using the crypto and ssl libraries and can be used in a limited way by invoking the
opensslapplication binary (CLI), it cannot be re-used directly. Other applications that need similar functionality need to copy or re-implement portions of that code and then maintain it.On the other hand, the two libraries contain some code that is actually too high-level for them, for instance the minimal HTTP client as part of the crypto library (
crypto/ocsp/ocsp_ht.c). It would be very helpful to introduce a further level in the hierarchy containing a more application-oriented library:apps/openssland external OpenSSL-based applicationslibsecapp<-- new (with tentative name)libssllibcryptoThen all more high-level and application support functionality can go there. This would make much of the generally useful code that so far resides in the
apps/folder directly accessible to other applications at the programming level, i.e., in the form of a library/API, with all the re-usability advantages that this brings. It would also relievelibcryptofrom more high-level topics like HTTP.This library would also form an ideal condensation point for further higher-level uses of crypto and TLS that may in the future get integrated with OpenSSL.
This pull request contains a fully functional proof-of-concept implementation for the above proposal. It introduces a library with the preliminary name 'secapp'.
For now, the library consists of essentially the code that so far as been in
apps/apps.candapps/app_rand.c, moved to thesecapp/directory. (I had to move and partly rename some functions between these two source files andapps/opt.cbecause the cut between these sources was not entirely clean. Of course, when this PR is accepted, some further cleanup would make sense.) I moved most ofapps/apps.htoinclude/openssl/apps.h, while the strictly internal declarations in it went in a new fileapps/apps_locl.hand the ones related to the command-line option functionality went in a new fileapps/opt.h.The high-level
build.infomechanism proved very useful for adding the new library, stating its dependencies etc. Yet it turned out that its implementation inConfigureandutil/mkdef.plis not complete - I added respective TODOs there.I made sure that all this (including tests) builds and runs both in a Linux-like environment (Cygwin) and native Windows (Visual C).
Checklist