constify *_dup() and *i2d_*() and related fns, add DECLARE_ASN1_DUP_FUNCTION#8029
constify *_dup() and *i2d_*() and related fns, add DECLARE_ASN1_DUP_FUNCTION#8029DDvO wants to merge 28 commits intoopenssl:masterfrom
Conversation
|
I've just eliminated further type casts from evp.h as far as possible, |
|
Nice clean-up!
|
There was a problem hiding this comment.
I'm going to assume that you scripted an automatic replacement of every _dup declaration with the corresponding DECLARE_ASN1_DUP_FUNCTION line. That script obviously went rogue, as it affected non-ASN.1 types. Or, if it was intentional, I'm just gonna say "no", because this is just deeply confusing (I'll go as far as saying that this is an abuse of that macro)
UPDATE: turns out I was only half right. For some of the items I complained about, "no" still stands. For others, not.
Pleased to hear! It caused quite a lot of work for me, in particular since constifying some functions required constifying many further declarations. In some cases it was pretty hard to find out that although a cast to |
|
@DDvO, sorry for all the unnecessary noise |
|
FYI, Travis currently reports this: |
Thanks for pointing this out; when reverting to the old format I forgot to add the 'const'. Fixed. |
|
Meanwhile I've also been able to constify Then I realized that all the Moreover, I've folded various 'manual' declarations of |
|
I've just updated |
|
I've also constified most of the |
|
Yesterday I noticed that - for whatever reason - Travis CI had not been run again after my last updates of Jan 25th, such that some outdated build errors still showed :-( The most elegant workaround for this issue I found meanwhile is to rebase and force-push :-) |
|
Travis refuses to run jobs on PRs that it thinks has merge problems with the branch the PR started off from. |
This would indeed be a good reason, but AFAICS the (only) conflicting commit that has been pushed onto the master in the meantime (e85d19c) was pushed on Jan 27, which was several days after Travis took a break on this PR. |
This time Travis simply got stuck on two builds :-/ saying
|
|
Ive restarted those two jobs, let's hope that changes things |
It did - thanks :) |
|
The last comments on the contents of this PR have been answered a week ago. |
mattcaswell
left a comment
There was a problem hiding this comment.
Not a full review. I just noticed a few things.
mattcaswell
left a comment
There was a problem hiding this comment.
A few minor things. But, assuming those are fixed, I think this is ok. Still needs a second review.
|
Thanks @mattcaswell for your review and first approval. @levitte, since you also requested changes and gave many comments on this PR that lead to various major improvements, I think it would be very beneficial if you could do the second review. |
FdaSilvaYY
left a comment
There was a problem hiding this comment.
Nice and impressive work 👍
Just a few nits more.
mattcaswell
left a comment
There was a problem hiding this comment.
Reconfirmed after styling nit update. Ping @levitte
|
@levitte, when do you think you can do the final review/approval? |
|
Looking now. Sorry, was distracted by Other Stuff™ |
|
Thanks @levitte - |
|
I squashed the commits and pushed this. Thanks @DDvO for this significant contribution! |
…e, introducing DECLARE_ASN1_DUP_FUNCTION Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from #8029)
…e, introducing DECLARE_ASN1_DUP_FUNCTION Reviewed-by: Richard Levitte <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from openssl#8029) (cherry picked from commit 9fdcc21) Conflicts: crypto/ess/ess_asn1.c (not in 1.1.1) crypto/evp/mac_lib.c (not in 1.1.1) crypto/evp/pkey_mac.c (not in 1.1.1) include/openssl/ess.h (not in 1.1.1) include/openssl/evp.h (EVP_MAC, EVP_MAC_CTX removed) util/perl/OpenSSL/ParseC.pm (not in 1.1.1)
|
@DDvO it's a pity that this constification was not backported to 1.1.1! Im currently porting my company's code from 1.0.2 to 1.1.1 and I stumbled over constness problems which you already fixed on master. I tried a cherry-pick, all conflicts were trivially resolvable (new files which did not exist yet in 1.1.1, as well as the new EVP_MAC and EVP_MAC_CTX prototypes in evp.h). Unfortunately, the cm_pmeth.c file was alredy deleted in master when your patch got merged, so this file was not constified by you. crypto/cmac/cm_pmeth.c:134:5: error: initialization of \
'int (*)(EVP_PKEY_CTX *, const EVP_PKEY_CTX *)' {aka 'int (*)(struct evp_pkey_ctx_st *, const struct evp_pkey_ctx_st *)'}
from incompatible pointer type 'int (*)(EVP_PKEY_CTX *, EVP_PKEY_CTX *)'
{aka 'int (*)(struct evp_pkey_ctx_st *, struct evp_pkey_ctx_st *)'} [-Werror=incompatible-pointer-types]
pkey_cmac_copy,
^~~~~~~~~~~~~~Would it be a great effort for you to fix the constification for me and create a pull request for 1.1.1? Your help would be highly appreciated! Ideally, you would call the pull request and refer to #8029 in the description. To give you a start, I pushed the cherry-picked commit to mspncp@6e36edb on my repository clone. (It's on the branch pr-8029-constify-dup-111). To obtain a local copy of the branch, you can do the following |
|
I'll give it a try.. |
On the next morning, with more sleep, the problem turned out to be easy to fix. I'll open a pull request soon. Thanks again for volunteering and sorry for interrupting you. |
… possible, introducing DECLARE_ASN1_DUP_FUNCTION Fix compiler errors for modules which were already removed when pull request openssl#8029 was merged to master.
|
See #9347. Feedback welcome. |
This adds
constto parameters of*_dup()and*i2d_*()and related functions as far as (likely) possible, introducing also DECLARE_ASN1_DUP_FUNCTION.I'm just not fully sure if there are cases of deep (vs. shallow) copying, which would require extra care.
This PR has been extracted from #7646 as advised by @FdaSilvaYY and @mspncp.
Fixes #3742
partly.