Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 2083876 - -Wimplicit-function-declaration when compiling FIPS_mode() function with clang
Summary: -Wimplicit-function-declaration when compiling FIPS_mode() function with clang
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: openssl
Version: 36
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Dmitry Belyavskiy
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PortingToModernCHelpNeeded 2083879
TreeView+ depends on / blocked
 
Reported: 2022-05-10 21:29 UTC by Tom Stellard
Modified: 2023-01-05 11:05 UTC (History)
8 users (show)

Fixed In Version: openssl-3.0.7-2.fc38
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2083879 (view as bug list)
Environment:
Last Closed: 2023-01-05 11:05:21 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FC-442 0 None None None 2022-05-10 21:42:42 UTC

Internal Links: 2152504

Description Tom Stellard 2022-05-10 21:29:43 UTC
Description of problem:
The new FIPS_mode() macros expands to EVP_default_properties_is_fips_enabled() which has a declaration in a different header file.  This causes clang to emit the -Wimplicit-function-declaration warning when compiling applications that use the macro.

Version-Release number of selected component (if applicable):
openssl-3.0.2-5.fc36

How reproducible:
Always

Steps to Reproduce:

$ dnf install clang openssl-devel
$ cat fips-clang.c
#include <stdio.h>
#include <openssl/fips.h>

int main(int argc, char **argv) {
  if (FIPS_mode())
    printf("FIPS mode enabled\n");
  return 0;
}

$ clang -Werror clang-fips.c 
clang-fips.c:5:7: error: implicit declaration of function 'EVP_default_properties_is_fips_enabled' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  if (FIPS_mode())
      ^
/usr/include/openssl/fips.h:20:22: note: expanded from macro 'FIPS_mode'
# define FIPS_mode() EVP_default_properties_is_fips_enabled(NULL)
                     ^
1 error generated.


Expected results:
Program compiles successfully.

Comment 1 Dmitry Belyavskiy 2022-10-11 12:32:10 UTC
-Werror is not default compilation option, clang is not default compiler, and workaround exists. So closing.

Comment 2 Florian Weimer 2022-12-12 10:15:48 UTC
Sorry, this hasn't been valid C for over 20 years and needs to be fixed.

Comment 3 Dmitry Belyavskiy 2022-12-12 10:25:37 UTC
NP as I fixed a similar bug for RHEL

Comment 4 Fedora Update System 2023-01-05 11:04:46 UTC
FEDORA-2023-68886f4451 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-68886f4451

Comment 5 Fedora Update System 2023-01-05 11:05:21 UTC
FEDORA-2023-68886f4451 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.