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

Fix conversion on various files #8135

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

gasbytes
Copy link
Contributor

@gasbytes gasbytes commented Oct 31, 2024

These ones were linux specific (x86_64 on Void Linux).
Most of them were automated using a shell script that I wrote locally, that uses a vim interactive shell.
Working on the next block of files.

Testing: "gcc (GCC) 13.2.0"

$ ./configure --enable-all CC=gcc 'CFLAGS=-Werror -Wno-pragmas -Wall -Wextra -Wunknown-pragmas --param=ssp-buffer-size=1 -Waddress -Warray-bounds -Wbad-function-cast -Wchar-subscripts -Wcomment -Wfloat-equal -Wformat-security -Wformat=2 -Wmaybe-uninitialized -Wmissing-field-initializers -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wnormalized=id -Woverride-init -Wpointer-arith -Wpointer-sign -Wshadow -Wsign-compare -Wstrict-overflow=1 -Wstrict-prototypes -Wswitch-enum -Wundef -Wunused -Wunused-result -Wunused-variable -Wwrite-strings -fwrapv -Wsign-conversion -fmax-errors=1'
$ make

douzzer
douzzer previously requested changes Nov 9, 2024
Copy link
Contributor

@douzzer douzzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebase+reconciliation needed.

CONFLICT (content): Merge conflict in src/tls.c

looks good otherwise.

@douzzer douzzer assigned gasbytes and unassigned wolfSSL-Bot Nov 9, 2024
@gasbytes
Copy link
Contributor Author

retest this please

@gasbytes gasbytes assigned wolfSSL-Bot and unassigned gasbytes Nov 13, 2024
@dgarske
Copy link
Contributor

dgarske commented Nov 15, 2024

@gasbytes please share how you produced these conversion warnings. Which complier and what build steps. Thank you

@dgarske
Copy link
Contributor

dgarske commented Nov 15, 2024

@gasbytes please squash.

@gasbytes
Copy link
Contributor Author

gasbytes commented Nov 15, 2024

@gasbytes please share how you produced these conversion warnings. Which complier and what build steps. Thank you

@dgarske
Of course, version of gcc:

$ gcc --version
$ gcc (GCC) 13.2.0

And this is the configuration, followed just by a make:

$ ./config.status --config
$ --enable-all CC=gcc 'CFLAGS=-Werror -Wno-pragmas -Wall -Wextra -Wunknown-pragmas --param=ssp-buffer-size=1 -Waddress -Warray-bounds -Wbad-function-cast -Wchar-subscripts -Wcomment -Wfloat-equal -Wformat-security -Wformat=2 -Wmaybe-uninitialized -Wmissing-field-initializers -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wnormalized=id -Woverride-init -Wpointer-arith -Wpointer-sign -Wshadow -Wsign-compare -Wstrict-overflow=1 -Wstrict-prototypes -Wswitch-enum -Wundef -Wunused -Wunused-result -Wunused-variable -Wwrite-strings -fwrapv -Wsign-conversion -fmax-errors=1'

configure.ac: activate opensslextra for --enable-curl even if ENABLED_OPENSSLCOEXIST; tests/api.c: in test_wolfSSL_SESSION(), use WOLFSSL_SUCCESS, not SSL_SUCCESS, in HAVE_SESSION_TICKET span reachable in non-OPENSSL_EXTRA builds.

codespell fixes.

more fixes

no need to cast to unsigned long int, went back to normal int

various trailing spaces and hard tabs fixes

addressing bugprone-misplaced-widening-cast (loss of precision)

configure.ac: activate opensslextra for --enable-curl even if ENABLED_OPENSSLCOEXIST; tests/api.c: in test_wolfSSL_SESSION(), use WOLFSSL_SUCCESS, not SSL_SUCCESS, in HAVE_SESSION_TICKET span reachable in non-OPENSSL_EXTRA builds.

codespell fixes.

Ability to bypass './configure' as some tests/scripts run it anyway

Fix false positive error on gcc 9.4.0

"error: ‘nameSz’ may be used uninitialized in this function", but it's not actually going to be used uninitialized.

Add support for Raspberry Pi Pico

This adds improved support for the Raspberry Pi Pico range of
microcontrollers.

Benchmark now compiles, and added support for the RNG functions of the
Pico SDK. This gives a ~2x RNG performance improvement on the RP2040 and
over 3x improvement on the RP2350.

The accelerated SHA256 in the RP2350 unfortunately cannot be used with
wolfSSL.

spelling: tiny cleanup.

Testing fixes

Fix header inclusion: settings.h after options.h.
pkcs8_encode(): dh is not available if NO_DH is defined.

wolfCLU added support for PKCS7

assorted cleanups and refactors for C89 conformance, codespell and check-source-text, and consistent heap shim usage.

.github/workflows/codespell.yml: remove */README_jp.txt from "skip" list.

IDE/Renesas/cs+/Projects/t4_demo/README_jp.txt: convert from SHIFT_JIS to UTF-8.

cmake/options.h.in: use "#cmakedefine HAVE_PTHREAD 1" to avoid conflict with config.h.

configure.ac: add --enable-c89, and remove !ENABLED_OPENSSLEXTRA dependency from AM_CONDITIONAL([BUILD_CRYPTONLY],...).

wolfcrypt/src/asn.c: refactor SetOthername() for efficiency, and add PRAGMA_GCC to suppress false positive -Wstringop-overflow associated with -fstack-protector.

wolfssl/wolfcrypt/rsa.h: add WC_ prefixes to RSA_PKCS1_PADDING_SIZE and RSA_PKCS1_OAEP_PADDING_SIZE, and define unprefixed compat aliases only if !OPENSSL_COEXIST.

wolfssl/wolfcrypt/types.h:

  #ifdef WOLF_C89, #define WC_BITFIELD unsigned;
  enhance WOLF_ENUM_DUMMY_LAST_ELEMENT() to include the line number, to construct unique labels given a per-filename argument, to accommodate anonymous enums.

examples/asn1/asn1.c:
examples/client/client.c:
examples/pem/pem.c:
examples/server/server.c:
wolfcrypt/src/sp_dsp32.c:
wolfcrypt/src/wc_port.c:
wolfssl/test.h:

  use XMALLOC/XREALLOC/XFREE consistently, not malloc/realloc/free.

wolfcrypt/benchmark/benchmark.c:
wolfcrypt/src/memory.c:
wolfcrypt/test/test.c:
wolfssl/wolfcrypt/mem_track.h:
wolfssl/wolfcrypt/settings.h:
wolfssl/wolfcrypt/types.h:

  annotate intentional native heap access with "/* native heap */".

wolfcrypt/src/asn.c:
wolfssl/callbacks.h:
wolfssl/openssl/ec.h:
wolfssl/openssl/ssl.h:
wolfssl/wolfcrypt/hpke.h:
wolfssl/wolfcrypt/types.h:

  fix enum trailing commas.

wolfssl/openssl/ec.h:
wolfssl/openssl/evp.h:
wolfssl/openssl/rsa.h:
wolfssl/openssl/ssl.h:

  use WC_BITFIELD in bitfield elements, not byte or word16, to allow for pedantic C89 conformant builds.

wolfssl/openssl/ec.h:
wolfssl/openssl/evp.h:
wolfssl/openssl/pem.h:
wolfssl/openssl/ssl.h:
wolfssl/wolfcrypt/logging.h:
avoid variadic macros wherever possible, and where unavoidable, #ifdef WOLF_NO_VARIADIC_MACROS, define them with empty arg lists, rather than ..., to support Watcom compiler.

wolfssl/wolfcrypt/settings.h: if defined(__WATCOMC__), define WOLF_NO_VARIADIC_MACROS.

wolfssl/test.h: revert heap shim refactor -- api.c relies on these being native heap allocations.

Fix for building sources (wildcard *.c). Add macro guard on new files.

Kyber/ML-KEM: make both available

Make Kyber and ML-KEM individually available as well as at the same
time.
Modified TLS layer to support both Kyber and ML-KEM.
Added new identifiers in TLS layer for ML-KEM.

display heap pointer with debug enabled

Use only one or the other

merge mix-up

dot instead of pointer

wrapping lines < 80 characters

No new line at the end of the file codespell.yml
@dgarske dgarske requested a review from douzzer November 15, 2024 14:43
@dgarske
Copy link
Contributor

dgarske commented Nov 15, 2024

Retest this please:

[make check (macos-latest, --enable-harden-tls)](https://github.com/wolfSSL/wolfssl/pull/8135#logs)

Test complete
wolfSSL error: tcp connect failed: Connection refused

Running simple test
SSL version is TLSv1.2
SSL cipher suite is TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
SSL curve name is SECP256R1
SSL version is TLSv1.2
SSL cipher suite is TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
SSL curve name is SECP256R1
Client message: hello wolfssl!
I hear you fa shizzle!

Running TLS test
FAIL testsuite/testsuite.test (exit status: 1)
./configure --enable-aesgcm=table --enable-all --enable-intelasm --enable-sp-math-all 
FAIL scripts/ocsp-stapling_tls13multi.test (exit status: 1)

dgarske
dgarske previously approved these changes Nov 15, 2024
@dgarske dgarske assigned douzzer and unassigned douzzer and gasbytes Nov 15, 2024
@douzzer
Copy link
Contributor

douzzer commented Nov 16, 2024

has a slew of conflicts relative to current master:

CONFLICT (content): Merge conflict in configure.ac
CONFLICT (content): Merge conflict in src/ssl.c
CONFLICT (content): Merge conflict in src/tls.c
CONFLICT (content): Merge conflict in tests/quic.c

it's a mystery to me why github thinks "Merging can be performed automatically"...

@douzzer douzzer assigned gasbytes and unassigned wolfSSL-Bot Nov 16, 2024
@gasbytes
Copy link
Contributor Author

@douzzer

I think this might be because I resolved those conflicts using GitHub's web editor, but I'm not entirely sure why GitHub now says the merge can be performed automatically. As far as I can tell, those files don’t seem to have any breaking changes compared to master, so that might also be a reason.

DYNAMIC_TYPE_HASHES);
(*destination)->messages = (byte*)XMALLOC((size_t)source->length,
ssl->heap,
(size_t)DYNAMIC_TYPE_HASHES);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the third argument to our malloc's are an int type. This should either be cast to an int type or not cast.

src/ssl.c Outdated
@@ -16437,8 +16442,8 @@ long wolfSSL_clear_options(WOLFSSL* ssl, long opt)
WOLFSSL_ENTER("wolfSSL_clear_options");
if(ssl == NULL)
return WOLFSSL_FAILURE;
ssl->options.mask &= ~opt;
return ssl->options.mask;
ssl->options.mask &= (long unsigned int)~opt;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In wolfssl/internal.h I see options.mask being an unsigned long type, not long unsigned int.

tests/quic.c Outdated
@@ -21,6 +21,10 @@

#ifdef HAVE_CONFIG_H
#include <config.h>
#else
#ifndef WOLFSSL_USER_SETTINGS
#include <wolfssl/options.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a duplicate include? Right below this there is also a conditional include of wolfssl/options.h

@@ -6293,14 +6293,16 @@ void wolfSSL_EVP_init(void)
case WC_AES_256_OFB_TYPE:
#endif
wc_AesFree(&ctx->cipher.aes);
ctx->flags &= ~WOLFSSL_EVP_CIPH_LOW_LEVEL_INITED;
ctx->flags &=
(long unsigned int)~WOLFSSL_EVP_CIPH_LOW_LEVEL_INITED;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets match the type used in the struct for this and the next cast. Using unsigned long

@@ -1420,7 +1420,7 @@ unsigned long wc_PeekErrorNodeLineData(const char **file, int *line,
}
}

unsigned long wc_GetErrorNodeErr(void)
int wc_GetErrorNodeErr(void)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If changing this to a return type of int go through the function and check all return cases. I see a cast to unsigned long on one of them.

@gasbytes
Copy link
Contributor Author

Retest this please (#8182)

@gasbytes gasbytes assigned wolfSSL-Bot and gasbytes and unassigned gasbytes and wolfSSL-Bot Nov 21, 2024
@gasbytes
Copy link
Contributor Author

Working on a couple more Renesas specific.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants