mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-07 14:30:49 +02:00
Rename OFFSETOF macro to WolfSSL specific WC_OFFSETOF name
There are the following reasons for this - it conflicts with the OFFSETOF macro in the OS/2 header (Open Watcom) - it is compiler-specific and should use the C standard offsetof definition in the header file stddef.h - it is more transparent unique name
This commit is contained in:
@@ -898,7 +898,7 @@ static RevokedCert *DupRevokedCertList(RevokedCert* in, void* heap)
|
||||
static CRL_Entry* DupCRL_Entry(const CRL_Entry* ent, void* heap)
|
||||
{
|
||||
CRL_Entry *dupl;
|
||||
const size_t copyOffset = OFFSETOF(CRL_Entry, verifyMutex) +
|
||||
const size_t copyOffset = WC_OFFSETOF(CRL_Entry, verifyMutex) +
|
||||
sizeof(ent->verifyMutex);
|
||||
#ifdef CRL_STATIC_REVOKED_LIST
|
||||
if (ent->totalCerts > CRL_MAX_REVOKED_CERTS) {
|
||||
|
||||
+1
-1
@@ -9471,7 +9471,7 @@ static void DtlsMsgAssembleCompleteMessage(DtlsMsg* msg)
|
||||
* alignment of char.
|
||||
*/
|
||||
dtls = (DtlsHandShakeHeader*)(void *)((char *)msg->fragBucketList
|
||||
+ OFFSETOF(DtlsFragBucket,buf)
|
||||
+ WC_OFFSETOF(DtlsFragBucket,buf)
|
||||
- DTLS_HANDSHAKE_HEADER_SZ);
|
||||
|
||||
msg->fragBucketList = NULL;
|
||||
|
||||
+1
-1
@@ -3757,7 +3757,7 @@ static int wolfSSL_DupSessionEx(const WOLFSSL_SESSION* input,
|
||||
word16 ticLenAlloc = 0;
|
||||
byte *ticBuff = NULL;
|
||||
#endif
|
||||
const size_t copyOffset = OFFSETOF(WOLFSSL_SESSION, heap) +
|
||||
const size_t copyOffset = WC_OFFSETOF(WOLFSSL_SESSION, heap) +
|
||||
sizeof(input->heap);
|
||||
int ret = WOLFSSL_SUCCESS;
|
||||
|
||||
|
||||
+80
-80
@@ -6594,16 +6594,16 @@ static int DecodeRsaPssParams(const byte* params, word32 sz,
|
||||
defined(WOLFSSL_KCAPI_RSA) || defined(WOLFSSL_SE050)))
|
||||
/* Byte offset of numbers in RSA key. */
|
||||
size_t rsaIntOffset[] = {
|
||||
OFFSETOF(RsaKey, n),
|
||||
OFFSETOF(RsaKey, e),
|
||||
WC_OFFSETOF(RsaKey, n),
|
||||
WC_OFFSETOF(RsaKey, e),
|
||||
#ifndef WOLFSSL_RSA_PUBLIC_ONLY
|
||||
OFFSETOF(RsaKey, d),
|
||||
OFFSETOF(RsaKey, p),
|
||||
OFFSETOF(RsaKey, q),
|
||||
WC_OFFSETOF(RsaKey, d),
|
||||
WC_OFFSETOF(RsaKey, p),
|
||||
WC_OFFSETOF(RsaKey, q),
|
||||
#if defined(WOLFSSL_KEY_GEN) || defined(OPENSSL_EXTRA) || !defined(RSA_LOW_MEM)
|
||||
OFFSETOF(RsaKey, dP),
|
||||
OFFSETOF(RsaKey, dQ),
|
||||
OFFSETOF(RsaKey, u)
|
||||
WC_OFFSETOF(RsaKey, dP),
|
||||
WC_OFFSETOF(RsaKey, dQ),
|
||||
WC_OFFSETOF(RsaKey, u)
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
@@ -13097,13 +13097,13 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/CN=", 4,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectCN),
|
||||
OFFSETOF(DecodedCert, subjectCNLen),
|
||||
OFFSETOF(DecodedCert, subjectCNEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectCN),
|
||||
WC_OFFSETOF(DecodedCert, subjectCNLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectCNEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
OFFSETOF(DecodedCert, issuerCN),
|
||||
OFFSETOF(DecodedCert, issuerCNLen),
|
||||
OFFSETOF(DecodedCert, issuerCNEnc),
|
||||
WC_OFFSETOF(DecodedCert, issuerCN),
|
||||
WC_OFFSETOF(DecodedCert, issuerCNLen),
|
||||
WC_OFFSETOF(DecodedCert, issuerCNEnc),
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_X509_NAME_AVAILABLE
|
||||
@@ -13114,13 +13114,13 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/SN=", 4,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectSN),
|
||||
OFFSETOF(DecodedCert, subjectSNLen),
|
||||
OFFSETOF(DecodedCert, subjectSNEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectSN),
|
||||
WC_OFFSETOF(DecodedCert, subjectSNLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectSNEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
OFFSETOF(DecodedCert, issuerSN),
|
||||
OFFSETOF(DecodedCert, issuerSNLen),
|
||||
OFFSETOF(DecodedCert, issuerSNEnc),
|
||||
WC_OFFSETOF(DecodedCert, issuerSN),
|
||||
WC_OFFSETOF(DecodedCert, issuerSNLen),
|
||||
WC_OFFSETOF(DecodedCert, issuerSNEnc),
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_X509_NAME_AVAILABLE
|
||||
@@ -13131,13 +13131,13 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/serialNumber=", 14,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectSND),
|
||||
OFFSETOF(DecodedCert, subjectSNDLen),
|
||||
OFFSETOF(DecodedCert, subjectSNDEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectSND),
|
||||
WC_OFFSETOF(DecodedCert, subjectSNDLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectSNDEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
OFFSETOF(DecodedCert, issuerSND),
|
||||
OFFSETOF(DecodedCert, issuerSNDLen),
|
||||
OFFSETOF(DecodedCert, issuerSNDEnc),
|
||||
WC_OFFSETOF(DecodedCert, issuerSND),
|
||||
WC_OFFSETOF(DecodedCert, issuerSNDLen),
|
||||
WC_OFFSETOF(DecodedCert, issuerSNDEnc),
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_X509_NAME_AVAILABLE
|
||||
@@ -13148,13 +13148,13 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/C=", 3,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectC),
|
||||
OFFSETOF(DecodedCert, subjectCLen),
|
||||
OFFSETOF(DecodedCert, subjectCEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectC),
|
||||
WC_OFFSETOF(DecodedCert, subjectCLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectCEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
OFFSETOF(DecodedCert, issuerC),
|
||||
OFFSETOF(DecodedCert, issuerCLen),
|
||||
OFFSETOF(DecodedCert, issuerCEnc),
|
||||
WC_OFFSETOF(DecodedCert, issuerC),
|
||||
WC_OFFSETOF(DecodedCert, issuerCLen),
|
||||
WC_OFFSETOF(DecodedCert, issuerCEnc),
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_X509_NAME_AVAILABLE
|
||||
@@ -13165,13 +13165,13 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/L=", 3,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectL),
|
||||
OFFSETOF(DecodedCert, subjectLLen),
|
||||
OFFSETOF(DecodedCert, subjectLEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectL),
|
||||
WC_OFFSETOF(DecodedCert, subjectLLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectLEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
OFFSETOF(DecodedCert, issuerL),
|
||||
OFFSETOF(DecodedCert, issuerLLen),
|
||||
OFFSETOF(DecodedCert, issuerLEnc),
|
||||
WC_OFFSETOF(DecodedCert, issuerL),
|
||||
WC_OFFSETOF(DecodedCert, issuerLLen),
|
||||
WC_OFFSETOF(DecodedCert, issuerLEnc),
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_X509_NAME_AVAILABLE
|
||||
@@ -13182,13 +13182,13 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/ST=", 4,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectST),
|
||||
OFFSETOF(DecodedCert, subjectSTLen),
|
||||
OFFSETOF(DecodedCert, subjectSTEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectST),
|
||||
WC_OFFSETOF(DecodedCert, subjectSTLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectSTEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
OFFSETOF(DecodedCert, issuerST),
|
||||
OFFSETOF(DecodedCert, issuerSTLen),
|
||||
OFFSETOF(DecodedCert, issuerSTEnc),
|
||||
WC_OFFSETOF(DecodedCert, issuerST),
|
||||
WC_OFFSETOF(DecodedCert, issuerSTLen),
|
||||
WC_OFFSETOF(DecodedCert, issuerSTEnc),
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_X509_NAME_AVAILABLE
|
||||
@@ -13199,9 +13199,9 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/street=", 8,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectStreet),
|
||||
OFFSETOF(DecodedCert, subjectStreetLen),
|
||||
OFFSETOF(DecodedCert, subjectStreetEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectStreet),
|
||||
WC_OFFSETOF(DecodedCert, subjectStreetLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectStreetEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
0,
|
||||
0,
|
||||
@@ -13216,13 +13216,13 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/O=", 3,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectO),
|
||||
OFFSETOF(DecodedCert, subjectOLen),
|
||||
OFFSETOF(DecodedCert, subjectOEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectO),
|
||||
WC_OFFSETOF(DecodedCert, subjectOLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectOEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
OFFSETOF(DecodedCert, issuerO),
|
||||
OFFSETOF(DecodedCert, issuerOLen),
|
||||
OFFSETOF(DecodedCert, issuerOEnc),
|
||||
WC_OFFSETOF(DecodedCert, issuerO),
|
||||
WC_OFFSETOF(DecodedCert, issuerOLen),
|
||||
WC_OFFSETOF(DecodedCert, issuerOEnc),
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_X509_NAME_AVAILABLE
|
||||
@@ -13233,13 +13233,13 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/OU=", 4,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectOU),
|
||||
OFFSETOF(DecodedCert, subjectOULen),
|
||||
OFFSETOF(DecodedCert, subjectOUEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectOU),
|
||||
WC_OFFSETOF(DecodedCert, subjectOULen),
|
||||
WC_OFFSETOF(DecodedCert, subjectOUEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
OFFSETOF(DecodedCert, issuerOU),
|
||||
OFFSETOF(DecodedCert, issuerOULen),
|
||||
OFFSETOF(DecodedCert, issuerOUEnc),
|
||||
WC_OFFSETOF(DecodedCert, issuerOU),
|
||||
WC_OFFSETOF(DecodedCert, issuerOULen),
|
||||
WC_OFFSETOF(DecodedCert, issuerOUEnc),
|
||||
#endif
|
||||
#endif
|
||||
#ifdef WOLFSSL_X509_NAME_AVAILABLE
|
||||
@@ -13301,9 +13301,9 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/businessCategory=", 18,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectBC),
|
||||
OFFSETOF(DecodedCert, subjectBCLen),
|
||||
OFFSETOF(DecodedCert, subjectBCEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectBC),
|
||||
WC_OFFSETOF(DecodedCert, subjectBCLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectBCEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
0,
|
||||
0,
|
||||
@@ -13335,9 +13335,9 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/postalCode=", 12,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectPC),
|
||||
OFFSETOF(DecodedCert, subjectPCLen),
|
||||
OFFSETOF(DecodedCert, subjectPCEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectPC),
|
||||
WC_OFFSETOF(DecodedCert, subjectPCLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectPCEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
0,
|
||||
0,
|
||||
@@ -13352,9 +13352,9 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/userid=", 8,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectUID),
|
||||
OFFSETOF(DecodedCert, subjectUIDLen),
|
||||
OFFSETOF(DecodedCert, subjectUIDEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectUID),
|
||||
WC_OFFSETOF(DecodedCert, subjectUIDLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectUIDEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
0,
|
||||
0,
|
||||
@@ -13370,9 +13370,9 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/N=", 3,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectN),
|
||||
OFFSETOF(DecodedCert, subjectNLen),
|
||||
OFFSETOF(DecodedCert, subjectNEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectN),
|
||||
WC_OFFSETOF(DecodedCert, subjectNLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectNEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
0,
|
||||
0,
|
||||
@@ -13387,9 +13387,9 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/GN=", 4,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectGN),
|
||||
OFFSETOF(DecodedCert, subjectGNLen),
|
||||
OFFSETOF(DecodedCert, subjectGNEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectGN),
|
||||
WC_OFFSETOF(DecodedCert, subjectGNLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectGNEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
0,
|
||||
0,
|
||||
@@ -13404,9 +13404,9 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/initials=", 10,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectI),
|
||||
OFFSETOF(DecodedCert, subjectILen),
|
||||
OFFSETOF(DecodedCert, subjectIEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectI),
|
||||
WC_OFFSETOF(DecodedCert, subjectILen),
|
||||
WC_OFFSETOF(DecodedCert, subjectIEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
0,
|
||||
0,
|
||||
@@ -13421,9 +13421,9 @@ static const CertNameData certNameSubject[] = {
|
||||
{
|
||||
"/dnQualifier=", 13,
|
||||
#if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_CERT_EXT)
|
||||
OFFSETOF(DecodedCert, subjectDNQ),
|
||||
OFFSETOF(DecodedCert, subjectDNQLen),
|
||||
OFFSETOF(DecodedCert, subjectDNQEnc),
|
||||
WC_OFFSETOF(DecodedCert, subjectDNQ),
|
||||
WC_OFFSETOF(DecodedCert, subjectDNQLen),
|
||||
WC_OFFSETOF(DecodedCert, subjectDNQEnc),
|
||||
#ifdef WOLFSSL_HAVE_ISSUER_NAMES
|
||||
0,
|
||||
0,
|
||||
|
||||
@@ -219,11 +219,11 @@ typedef struct WOLFSSL_ASN1_ITEM WOLFSSL_ASN1_ITEM;
|
||||
mtype##_member_data, \
|
||||
sizeof(mtype##_member_data) / sizeof(WOLFSSL_ASN1_TEMPLATE), \
|
||||
sizeof(mtype) ,\
|
||||
OFFSETOF(mtype, type) \
|
||||
WC_OFFSETOF(mtype, type) \
|
||||
};
|
||||
|
||||
#define ASN1_TYPE(type, member, tag, first_byte, exp, seq) \
|
||||
OFFSETOF(type, member), tag, first_byte, exp, seq
|
||||
WC_OFFSETOF(type, member), tag, first_byte, exp, seq
|
||||
|
||||
/* Function callbacks need to be defined immediately otherwise we will
|
||||
* incorrectly expand the type. Ex: ASN1_INTEGER -> WOLFSSL_ASN1_INTEGER */
|
||||
|
||||
@@ -996,15 +996,14 @@ typedef struct w64wrapper {
|
||||
#define XTOLOWER(c) tolower((c))
|
||||
#endif
|
||||
|
||||
#ifdef __WATCOMC__
|
||||
/* avoid OFFSETOF conflict in os2def.h */
|
||||
#undef OFFSETOF
|
||||
#endif
|
||||
#ifndef OFFSETOF
|
||||
#ifndef WC_OFFSETOF
|
||||
#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 4))
|
||||
#define OFFSETOF(type, field) __builtin_offsetof(type, field)
|
||||
#define WC_OFFSETOF(type, field) __builtin_offsetof(type, field)
|
||||
#elif defined(__WATCOMC__)
|
||||
#include <stddef.h>
|
||||
#define WC_OFFSETOF offsetof
|
||||
#else
|
||||
#define OFFSETOF(type, field) ((size_t)&(((type *)0)->field))
|
||||
#define WC_OFFSETOF(type, field) ((size_t)&(((type *)0)->field))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user