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

[rt.openssl.org #4685] [PATCH] Add missing prototype for FIPS callback #2533

Closed
richsalz opened this Issue Feb 2, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@richsalz
Copy link
Contributor

richsalz commented Feb 2, 2017

Migrated from rt.openssl.org#4685 (status was 'new')

Requestors:

From matthias.st.pierre@ncp-e.com on 2016-09-26 13:41:45:

The call to FIPS_crypto_set_id_callback() was added in revision a43cfd7bb1fc681d563e,
but there is no prototype for it in <openssl/fips.h>.
---

This leads to warnings on some platforms (e.g. x86_64-ncp-linux-gnu-gcc):
o_init.c:77:5: warning: implicit declaration of function 'FIPS_crypto_set_id_callback' [-Wimplicit-function-declaration]

and to an error on iOS (clang -arch arm64):
o_init.c:77:5: error: implicit declaration of function 'FIPS_crypto_set_id_callback' is invalid in C99 [-Werror,-Wimplicit-function-declaration]


 crypto/o_init.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/crypto/o_init.c b/crypto/o_init.c
index 185841e..a399318 100644
--- a/crypto/o_init.c
+++ b/crypto/o_init.c
@@ -74,6 +74,8 @@ void OPENSSL_init(void)
 #ifdef OPENSSL_FIPS
     FIPS_set_locking_callbacks(CRYPTO_lock, CRYPTO_add_lock);
 # ifndef OPENSSL_NO_DEPRECATED
+    /* the prototype is missing in <openssl/fips.h> */
+    void FIPS_crypto_set_id_callback(unsigned long (*func)(void));
     FIPS_crypto_set_id_callback(CRYPTO_thread_id);
 # endif
     FIPS_set_error_callbacks(ERR_put_error, ERR_add_error_vdata);
-- 
2.7.3

From matthias.st.pierre@ncp-e.com on 2016-09-26 16:23:45:

The call to FIPS_crypto_set_id_callback() was added in revision a43cfd7bb1fc681d563e,
but there is no prototype for it in <openssl/fips.h>.
---

Moved the function prototype upwards, because declarations can only be placed
at the top of a function in C.


 crypto/o_init.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/crypto/o_init.c b/crypto/o_init.c
index 185841e..18bb858 100644
--- a/crypto/o_init.c
+++ b/crypto/o_init.c
@@ -58,6 +58,11 @@
 #ifdef OPENSSL_FIPS
 # include <openssl/fips.h>
 # include <openssl/rand.h>
+
+# ifndef OPENSSL_NO_DEPRECATED
+/* the prototype is missing in <openssl/fips.h> */
+void FIPS_crypto_set_id_callback(unsigned long (*func)(void));
+# endif
 #endif
 
 /*
-- 
2.7.3

@richsalz

This comment has been minimized.

Copy link
Contributor Author

richsalz commented Feb 7, 2017

ping @snhenson -- can we fix this without re-validating?

@mspncp

This comment has been minimized.

Copy link
Contributor

mspncp commented Dec 7, 2017

This change does not affect the fips object module, only the fips-enabled libcrypto. So no problem with FIPS ;-)

@mattcaswell

This comment has been minimized.

Copy link
Member

mattcaswell commented Dec 7, 2017

@mspncp Could you recreate this patch as a github PR?

@mspncp

This comment has been minimized.

Copy link
Contributor

mspncp commented Dec 7, 2017

Already in progress ;-)

mspncp added a commit to mspncp/openssl that referenced this issue Dec 7, 2017

Add missing prototype for FIPS callback
Fixes openssl#2533

The call to FIPS_crypto_set_id_callback() was added in revision a43cfd7,
but there is no prototype for it in <openssl/fips.h>.

Signed-off-by: Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
@mspncp

This comment has been minimized.

Copy link
Contributor

mspncp commented Dec 7, 2017

See #4870

@Jan-E

This comment has been minimized.

Copy link

Jan-E commented Dec 7, 2017

FWIW: #4870 solved my issue in #4864

mspncp added a commit to mspncp/openssl that referenced this issue Dec 7, 2017

Add missing prototype for FIPS callback
Fixes openssl#2533

The call to FIPS_crypto_set_id_callback() was added in revision a43cfd7,
but there is no prototype for it in <openssl/fips.h>.

Signed-off-by: Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
@mspncp

This comment has been minimized.

Copy link
Contributor

mspncp commented Dec 8, 2017

@richsalz this issue can be closed now. Fixed by #4870.

levitte pushed a commit that referenced this issue Dec 8, 2017

Add missing prototype for FIPS callback
Fixes #2533

The call to FIPS_crypto_set_id_callback() was added in revision a43cfd7,
but there is no prototype for it in <openssl/fips.h>.

Signed-off-by: Dr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #4870)

@richsalz richsalz closed this Dec 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.