Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant declarations of ERR_load_*_strings() #5150

Closed
wants to merge 4 commits into from

Conversation

Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
@nmathewson
Copy link
Contributor

@nmathewson nmathewson commented Jan 23, 2018

In commit 52df25c, the
ERR_load_FOO_strings() functions were moved from their original
location in foo.h into new headers called fooerr.h. But they were
never removed from their original locations. This duplication
causes redundant-declaration warnings on programs that use OpenSSL's
headers with such warnings enabled.

This patch removes redundant declarations only, and adds no new code.

@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Jan 23, 2018

(I am hoping I can skip the CLA on this one, since it only removes code.)

@richsalz
Copy link
Contributor

@richsalz richsalz commented Jan 23, 2018

Looks like we did some of them, but not all. If you think this is not copyrightable, please amend your commit message to put "CLA: trivial" in the text. I kind of think there's no originality here, the compiler will warn you and tell you what to do, so I am okay with this being trivial.

@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Jan 23, 2018

Amended the commit message per request; no other changes.

@@ -12,7 +12,6 @@ extern "C" {
#endif

#ifndef HEADER_PEM_H
int ERR_load_PEM_strings(void);
#endif
Copy link
Member

@levitte levitte Jan 23, 2018

Please remove the guard as well

Copy link
Contributor Author

@nmathewson nmathewson Jan 23, 2018

Hm. Additionally, should this file begin including pemerr.h?

Copy link
Contributor Author

@nmathewson nmathewson Jan 23, 2018

(done)

Copy link
Member

@levitte levitte Jan 23, 2018

Nope. On second thought, this file should be removed entirely, and additionally, crypto/err/err_all.c should be changed to include the <openssl/*err.h> headers instead of the main ones...

Copy link
Member

@levitte levitte Jan 23, 2018

... and you can remove the inclusion of <openssl/pem2.h> in include/openssl/pem.h...

Copy link
Member

@levitte levitte Jan 23, 2018

...

come to think of it, you're right, we have to have this file include <openssl/pemerr.h> for the sake of the occasional poor guy who does include this one directly (should never happen, but it is a public header file, so...).

What I said about crypto/err/err_all.c and include/openssl/pem.h stands, though...

Copy link
Contributor Author

@nmathewson nmathewson Jan 23, 2018

I've tried to take this into account with two new commits just pushed.

@@ -207,7 +207,6 @@ int OSSL_STORE_do_all_loaders(void (*do_function) (const OSSL_STORE_LOADER
/*
* Error strings
*/
Copy link
Member

@levitte levitte Jan 23, 2018

Please remove this comment too

Copy link
Contributor Author

@nmathewson nmathewson Jan 23, 2018

done

@richsalz
Copy link
Contributor

@richsalz richsalz commented Jan 23, 2018

Sad to say that I do not believe (because of the err_all change) that this is still trivial.

@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Jan 23, 2018

Do you suppose you could merge the other parts in that case? I hadn't intended to refactor any code beyond the headers originally. If not, I'll try to negotiate the CLA process.

For what it's worth, the err_all change was mechanically generated: I replaced ".h>" with "err.h>", and then reverted the changes that the compiler cared about.

@richsalz
Copy link
Contributor

@richsalz richsalz commented Jan 23, 2018

Others may be inclined to view this as no-cla-needed. You can either wait for them to approve, or pull out the all_err changes, or deal with the CLA. So many fine choices to choose from :)

Copy link
Member

@levitte levitte left a comment

Apart from this little thing, this looks good to me

#ifndef HEADER_PEM_H
int ERR_load_PEM_strings(void);
#endif

#ifdef __cplusplus
}
#endif
Copy link
Member

@levitte levitte Jan 23, 2018

We don't need the C++ wrapper any more, please remove it

@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Jan 23, 2018

I've sent some questions to legal@; I'll revisit this PR once I have a CLA in place.

@levitte
Copy link
Member

@levitte levitte commented Jan 23, 2018

Ah, now I notice the discussion... yeah, I'd say we've now walked into CLA land.

Copy link
Member

@levitte levitte left a comment

Travis told me...

#include <openssl/pemerr.h>
#include <openssl/x509err.h>
#include <openssl/x509v3err.h>
#include <openssl/conferr.h>
Copy link
Member

@levitte levitte Jan 23, 2018

You need to add #include <openssl/pkcs7err.h> here. It was previously included via <openssl/x509.h>, but since that got changed to <openssl/x509err.h>, ...

@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Jan 23, 2018

Thanks for the fast answers. I've sent in a CLA and made the requested changes.

@richsalz
Copy link
Contributor

@richsalz richsalz commented Jan 23, 2018

One last hurdle. Either change the commit email to be your MIT address, or we need a corporate CLA from Torproject. Or remove the err_all changes. Sorry for all the hassle.

@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Jan 23, 2018

Ok. Technically, I'm an officer of the corporation, but I ought to ask the director first. I'll get back to you when I hear more

@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Jan 23, 2018

The corporate CLA has been sent.

@levitte
Copy link
Member

@levitte levitte commented Jan 23, 2018

Hmmm, Travis is still unhappy, but that's because util/mkerr.pl needs a change, which I think is for another PR.

Either way, you need to do a make update and include the resulting changes in this PR

@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Jan 23, 2018

Done. Any better now?

@levitte
Copy link
Member

@levitte levitte commented Jan 23, 2018

Travis is probably happier... I'm not entirely, but that's not your fault, and I'll fix in a separate PR

@levitte
Copy link
Member

@levitte levitte commented Jan 23, 2018

... or well, the following patch will make the result somewhat better. Feel free to apply it and do another make update.

diff --git a/util/mkdef.pl b/util/mkdef.pl
index 98cdae537..d62b5fc08 100755
--- a/util/mkdef.pl
+++ b/util/mkdef.pl
@@ -302,7 +302,7 @@ $crypto.=" include/internal/err.h";
 $crypto.=" include/internal/rand.h";
 foreach my $f ( glob(catfile($config{sourcedir},'include/openssl/*.h')) ) {
     my $fn = "include/openssl/" . lc(basename($f));
-    $crypto .= " $fn" if !defined $skipthese{$fn} && $f !~ m@/[a-z]+err\.h$@;
+    $crypto .= " $fn" if !defined $skipthese{$fn};
 }
 
 my $symhacks="include/openssl/symhacks.h";

@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Jan 23, 2018

I've tried doing what you said.

@richsalz
Copy link
Contributor

@richsalz richsalz commented Feb 7, 2018

it couldn't hurt if you rebase against a fresh master and push.

@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Feb 7, 2018

Done! The patch from @levitte is now redundant, so I removed it during the rebase, and I did a fresh "make update" run. I should have a CLA on file; I'm not sure why the bot is saying I don't.

@mattcaswell
Copy link
Member

@mattcaswell mattcaswell commented Feb 7, 2018

Close/Reopen to kick the bot

@mattcaswell
Copy link
Member

@mattcaswell mattcaswell commented Feb 7, 2018

There was an error in our CLA records. Fixed now.

@levitte
Copy link
Member

@levitte levitte commented Feb 7, 2018

Argh... the removal of those module specific key words at the end of lines in util/libcrypto.num worry me. I'll have another PR up to fix that. Please hold on...

@levitte
Copy link
Member

@levitte levitte commented Feb 7, 2018

#5275 corrects the issues I'm seeing.

@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Feb 9, 2018

I see #5275 is merged. Should I rebase again?

@levitte
Copy link
Member

@levitte levitte commented Feb 9, 2018

Yes, please, and a new make update

nmathewson added 4 commits Feb 9, 2018
In commit 52df25c, the
ERR_load_FOO_strings() functions were moved from their original
location in foo.h into new headers called fooerr.h.  But they were
never removed from their original locations.  This duplication
causes redundant-declaration warnings on programs that use OpenSSL's
headers with such warnings enabled.
  - pem2.h is empty, so pem.h doesn't need to include it.
  - pem2.h once declared ERR_load_PEM_strings(), so it should now
    include pemerr.h
@nmathewson nmathewson force-pushed the redundant_err_load branch from b246148 to 22fbfd5 Feb 9, 2018
@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Feb 9, 2018

Done, as requested.

levitte
levitte approved these changes Feb 9, 2018
Copy link
Member

@levitte levitte left a comment

Looks good to me.

Thanks for your patience!

@levitte
Copy link
Member

@levitte levitte commented Feb 9, 2018

@richsalz, your approval still valid, I take it?

@richsalz
Copy link
Contributor

@richsalz richsalz commented Feb 9, 2018

yes, still valid.

@nmathewson
Copy link
Contributor Author

@nmathewson nmathewson commented Feb 9, 2018

Thanks for your patience!

No worries. The first time I tried to get a nontrivial patch into OpenSSL, I had to revise it something like 18-25 times. :)

@levitte
Copy link
Member

@levitte levitte commented Feb 9, 2018

Merged. a5d0d6b to 83739b3

@levitte levitte closed this Feb 9, 2018
levitte added a commit that referenced this issue Feb 9, 2018
In commit 52df25c, the
ERR_load_FOO_strings() functions were moved from their original
location in foo.h into new headers called fooerr.h.  But they were
never removed from their original locations.  This duplication
causes redundant-declaration warnings on programs that use OpenSSL's
headers with such warnings enabled.

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #5150)
levitte added a commit that referenced this issue Feb 9, 2018
  - pem2.h is empty, so pem.h doesn't need to include it.
  - pem2.h once declared ERR_load_PEM_strings(), so it should now
    include pemerr.h

Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #5150)
levitte added a commit that referenced this issue Feb 9, 2018
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #5150)
levitte added a commit that referenced this issue Feb 9, 2018
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from #5150)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment