forked from wolfSSL/wolfssl
Linux KM compilability cont'd: conform to C89isms (declarations before statements); iffdef WOLFSSL_LINUXKM use do_div() for long long division rather than C operator (avoids unresolvable compile-time callouts to libgcc function); misc gating and relocations for includes.
This commit is contained in:
@@ -34,7 +34,9 @@
|
||||
#include <wolfssl/internal.h>
|
||||
#include <wolfssl/error-ssl.h>
|
||||
|
||||
#include <string.h>
|
||||
#ifndef WOLFSSL_LINUXKM
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CRL_MONITOR
|
||||
#if (defined(__MACH__) || defined(__FreeBSD__) || defined(__linux__))
|
||||
|
@@ -9357,10 +9357,13 @@ int CheckForAltNames(DecodedCert* dCert, const char* domain, int* checkCN)
|
||||
}
|
||||
|
||||
while (altName) {
|
||||
#if defined(OPENSSL_ALL) || defined(WOLFSSL_IP_ALT_NAME)
|
||||
char name[WOLFSSL_MAX_IPSTR] = {0};
|
||||
#endif
|
||||
|
||||
WOLFSSL_MSG("\tindividual AltName check");
|
||||
|
||||
#if defined(OPENSSL_ALL) || defined(WOLFSSL_IP_ALT_NAME)
|
||||
char name[WOLFSSL_MAX_IPSTR] = {0};
|
||||
/* check if alt name is stored as IP addr octet */
|
||||
if (altName->type == ASN_IP_TYPE) {
|
||||
char tmp[4];
|
||||
|
@@ -7921,9 +7921,10 @@ int wolfSSL_X509_get_ext_count(const WOLFSSL_X509* passedCert)
|
||||
/* Creates and returns pointer to a new X509_EXTENSION object in memory */
|
||||
WOLFSSL_X509_EXTENSION* wolfSSL_X509_EXTENSION_new(void)
|
||||
{
|
||||
WOLFSSL_X509_EXTENSION* newExt;
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_X509_EXTENSION_new");
|
||||
|
||||
WOLFSSL_X509_EXTENSION* newExt;
|
||||
newExt = (WOLFSSL_X509_EXTENSION*)XMALLOC(sizeof(WOLFSSL_X509_EXTENSION),
|
||||
NULL, DYNAMIC_TYPE_X509_EXT);
|
||||
if (newExt == NULL)
|
||||
|
@@ -9239,6 +9239,7 @@ static int wc_PKCS7_DecryptKari(PKCS7* pkcs7, byte* in, word32 inSz,
|
||||
switch (pkcs7->state) {
|
||||
case WC_PKCS7_DECRYPT_KARI: {
|
||||
WC_PKCS7_KARI* kari;
|
||||
|
||||
#ifndef NO_PKCS7_STREAM
|
||||
/* @TODO for now just get full buffer, needs divided up */
|
||||
if ((ret = wc_PKCS7_AddDataToStream(pkcs7, in, inSz,
|
||||
|
@@ -753,7 +753,11 @@ int fp_div(fp_int *a, fp_int *b, fp_int *c, fp_int *d)
|
||||
fp_word tmp;
|
||||
tmp = ((fp_word) x->dp[i]) << ((fp_word) DIGIT_BIT);
|
||||
tmp |= ((fp_word) x->dp[i - 1]);
|
||||
#ifdef WOLFSSL_LINUXKM
|
||||
do_div(tmp, (fp_word)y->dp[t]);
|
||||
#else
|
||||
tmp /= ((fp_word)y->dp[t]);
|
||||
#endif
|
||||
q->dp[i - t - 1] = (fp_digit) (tmp);
|
||||
}
|
||||
|
||||
@@ -4560,7 +4564,12 @@ static int fp_div_d(fp_int *a, fp_digit b, fp_int *c, fp_digit *d)
|
||||
w = (w << ((fp_word)DIGIT_BIT)) | ((fp_word)a->dp[ix]);
|
||||
|
||||
if (w >= b) {
|
||||
#ifdef WOLFSSL_LINUXKM
|
||||
t = (fp_digit)w;
|
||||
do_div(t, b);
|
||||
#else
|
||||
t = (fp_digit)(w / b);
|
||||
#endif
|
||||
w -= ((fp_word)t) * ((fp_word)b);
|
||||
} else {
|
||||
t = 0;
|
||||
|
@@ -2045,7 +2045,9 @@ struct tm* gmtime(const time_t* timer)
|
||||
}
|
||||
|
||||
ret->tm_mday = (int)++dayno;
|
||||
#ifndef WOLFSSL_LINUXKM
|
||||
ret->tm_isdst = 0;
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@@ -80,7 +80,9 @@ still to do: actual kernel module construction per https://www.kernel.org/doc/Do
|
||||
#undef HAVE_CONFIG_H
|
||||
#endif
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#define __KERNEL__
|
||||
#endif
|
||||
|
||||
_Pragma("GCC diagnostic push");
|
||||
/* Linux kernel header files generate profuse warnings unless these are masked out: */
|
||||
@@ -96,6 +98,8 @@ still to do: actual kernel module construction per https://www.kernel.org/doc/Do
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#ifndef SINGLE_THREADED
|
||||
#include <linux/kthread.h>
|
||||
#endif
|
||||
@@ -750,9 +754,9 @@ WOLFSSL_API int wolfCrypt_Cleanup(void);
|
||||
#else
|
||||
typedef __kernel_time64_t time_t;
|
||||
#endif
|
||||
struct tm* gmtime(const time_t* timer);
|
||||
extern time_t time(time_t * timer);
|
||||
#define XTIME time
|
||||
#define WOLFSSL_GMTIME
|
||||
#define XGMTIME(c, t) gmtime(c)
|
||||
#define NO_TIMEVAL 1
|
||||
|
||||
|
Reference in New Issue
Block a user