mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
Merge pull request #6509 from douzzer/20230613-wc_test_ret_t
20230613-wc_test_ret_t
This commit is contained in:
@ -355,9 +355,9 @@ static WC_INLINE int wc_XChaCha20Poly1305_crypt_oneshot(
|
|||||||
int isEncrypt)
|
int isEncrypt)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
ssize_t dst_len = isEncrypt ?
|
long int dst_len = isEncrypt ?
|
||||||
(ssize_t)src_len + POLY1305_DIGEST_SIZE :
|
(long int)src_len + POLY1305_DIGEST_SIZE :
|
||||||
(ssize_t)src_len - POLY1305_DIGEST_SIZE;
|
(long int)src_len - POLY1305_DIGEST_SIZE;
|
||||||
const byte *src_i;
|
const byte *src_i;
|
||||||
byte *dst_i;
|
byte *dst_i;
|
||||||
size_t src_len_rem;
|
size_t src_len_rem;
|
||||||
@ -375,7 +375,7 @@ static WC_INLINE int wc_XChaCha20Poly1305_crypt_oneshot(
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ssize_t)dst_space < dst_len) {
|
if ((long int)dst_space < dst_len) {
|
||||||
ret = BUFFER_E;
|
ret = BUFFER_E;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -23,19 +23,26 @@
|
|||||||
#ifndef WOLFCRYPT_TEST_H
|
#ifndef WOLFCRYPT_TEST_H
|
||||||
#define WOLFCRYPT_TEST_H
|
#define WOLFCRYPT_TEST_H
|
||||||
|
|
||||||
|
#include <wolfssl/wolfcrypt/types.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WC_TEST_RET_CUSTOM_TYPE
|
||||||
|
typedef WC_TEST_RET_CUSTOM_TYPE wc_test_ret_t;
|
||||||
|
#else
|
||||||
|
typedef sword32 wc_test_ret_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STACK_SIZE
|
#ifdef HAVE_STACK_SIZE
|
||||||
THREAD_RETURN WOLFSSL_THREAD wolfcrypt_test(void* args);
|
THREAD_RETURN WOLFSSL_THREAD wolfcrypt_test(void* args);
|
||||||
#else
|
#else
|
||||||
int wolfcrypt_test(void* args);
|
wc_test_ret_t wolfcrypt_test(void* args);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NO_MAIN_DRIVER
|
#ifndef NO_MAIN_DRIVER
|
||||||
int wolfcrypt_test_main(int argc, char** argv);
|
wc_test_ret_t wolfcrypt_test_main(int argc, char** argv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WOLFSSL_ESPIDF) || defined(_WIN32_WCE)
|
#if defined(WOLFSSL_ESPIDF) || defined(_WIN32_WCE)
|
||||||
@ -44,13 +51,13 @@ int wolf_test_task(void);
|
|||||||
|
|
||||||
#ifndef WC_TEST_RET_HAVE_CUSTOM_MACROS
|
#ifndef WC_TEST_RET_HAVE_CUSTOM_MACROS
|
||||||
|
|
||||||
#define WC_TEST_RET_TAG_NC 0
|
#define WC_TEST_RET_TAG_NC 0L
|
||||||
#define WC_TEST_RET_TAG_EC 1
|
#define WC_TEST_RET_TAG_EC 1L
|
||||||
#define WC_TEST_RET_TAG_ERRNO 2
|
#define WC_TEST_RET_TAG_ERRNO 2L
|
||||||
#define WC_TEST_RET_TAG_I 3
|
#define WC_TEST_RET_TAG_I 3L
|
||||||
|
|
||||||
#define WC_TEST_RET_ENC(line, i, tag) \
|
#define WC_TEST_RET_ENC(line, i, tag) \
|
||||||
(-((line) + ((int)((unsigned)(i) & 0x7ff) * 100000) + ((tag) << 29)))
|
(-((wc_test_ret_t)(line) + ((wc_test_ret_t)((word32)(i) & 0x7ffL) * 100000L) + ((wc_test_ret_t)(tag) << 29L)))
|
||||||
|
|
||||||
#ifndef WC_TEST_RET_LN
|
#ifndef WC_TEST_RET_LN
|
||||||
#define WC_TEST_RET_LN __LINE__
|
#define WC_TEST_RET_LN __LINE__
|
||||||
@ -74,16 +81,16 @@ int wolf_test_task(void);
|
|||||||
#define WC_TEST_RET_ENC_ERRNO WC_TEST_RET_ENC_NC
|
#define WC_TEST_RET_ENC_ERRNO WC_TEST_RET_ENC_NC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define WC_TEST_RET_DEC_TAG(x) ((-(x)) >> 29)
|
#define WC_TEST_RET_DEC_TAG(x) ((-(x)) >> 29L)
|
||||||
|
|
||||||
/* decode line number */
|
/* decode line number */
|
||||||
#define WC_TEST_RET_DEC_LN(x) (((-(x)) & ~(3 << 29)) % 100000)
|
#define WC_TEST_RET_DEC_LN(x) ((int)(((-(x)) & ~(3L << 29L)) % 100000L))
|
||||||
|
|
||||||
/* decode integer or errno */
|
/* decode integer or errno */
|
||||||
#define WC_TEST_RET_DEC_I(x) (((-(x)) & ~(3 << 29)) / 100000)
|
#define WC_TEST_RET_DEC_I(x) ((int)((((-(x)) & ~(3L << 29L)) / 100000L)))
|
||||||
|
|
||||||
/* decode error code */
|
/* decode error code */
|
||||||
#define WC_TEST_RET_DEC_EC(x) (-WC_TEST_RET_DEC_I(x))
|
#define WC_TEST_RET_DEC_EC(x) ((int)(-WC_TEST_RET_DEC_I(x)))
|
||||||
|
|
||||||
#endif /* !WC_TEST_RET_HAVE_CUSTOM_MACROS */
|
#endif /* !WC_TEST_RET_HAVE_CUSTOM_MACROS */
|
||||||
|
|
||||||
|
@ -1880,11 +1880,13 @@ extern void uITRON4_free(void *p) ;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#if defined(NO_WC_SSIZE_TYPE) || defined(ssize_t)
|
||||||
#ifndef HAVE_SSIZE_T
|
/* ssize_t comes from system headers or user_settings.h */
|
||||||
#include <BaseTsd.h>
|
#elif defined(WC_SSIZE_TYPE)
|
||||||
typedef SSIZE_T ssize_t;
|
typedef WC_SSIZE_TYPE ssize_t;
|
||||||
#endif
|
#elif defined(_MSC_VER)
|
||||||
|
#include <BaseTsd.h>
|
||||||
|
typedef SSIZE_T ssize_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* If DCP is used without SINGLE_THREADED, enforce WOLFSSL_CRYPT_HW_MUTEX */
|
/* If DCP is used without SINGLE_THREADED, enforce WOLFSSL_CRYPT_HW_MUTEX */
|
||||||
|
Reference in New Issue
Block a user