clean up wolfcrypt code base for -std=c89 -pedantic: add WC_BITFIELD macro to avoid -Wpedantics for "type of bit-field ... is a GCC extension", with overrideable default definition "byte", and replace parent types of all bitfields with WC_BITFIELD;

fix numerous trailing commas in enums, mostly by removing them, but one (in asn.h, enum Extensions_Sum) using WOLF_ENUM_DUMMY_LAST_ELEMENT();

rearrange bitfields in struct ed25519_key for contiguity;

always define WOLFSSL_SP_NO_DYN_STACK when defined(WOLF_C89).
This commit is contained in:
Daniel Pouzzner
2024-10-15 18:24:03 -05:00
parent 4fd33b6b5d
commit ffc07215a4
19 changed files with 129 additions and 124 deletions

View File

@@ -20858,7 +20858,7 @@ static const ASNItem subjDirAttrASN[] = {
enum {
SUBJDIRATTRASN_IDX_SEQ = 0,
SUBJDIRATTRASN_IDX_OID,
SUBJDIRATTRASN_IDX_SET,
SUBJDIRATTRASN_IDX_SET
};
/* Number of items in ASN.1 template for BasicConstraints. */
@@ -23526,9 +23526,9 @@ typedef struct DecodeInstr {
/* Tag expected. */
byte tag;
/* Operation to perform: step in or go over */
byte op:1;
WC_BITFIELD op:1;
/* ASN.1 item is optional. */
byte optional:1;
WC_BITFIELD optional:1;
} DecodeInstr;
/* Step into ASN.1 item. */
@@ -40761,7 +40761,7 @@ enum {
HOLDER_IDX_ISSUERSERIAL_SEQ,
HOLDER_IDX_GN_SEQ,
HOLDER_IDX_SERIAL_INT,
HOLDER_IDX_GN_SEQ_OPT1,
HOLDER_IDX_GN_SEQ_OPT1
};
/* Number of items in ASN template for an X509 Acert. */
@@ -40885,7 +40885,7 @@ static const ASNItem AttCertIssuerASN[] =
};
enum {
ATTCERTISSUER_IDX_GN_SEQ,
ATTCERTISSUER_IDX_GN_SEQ
};
/* Number of items in ASN template for an X509 Acert. */

View File

@@ -118,12 +118,12 @@ struct PKCS7State {
word32 peakUsed; /* most bytes used for struct at any one time */
word32 peakRead; /* most bytes used by read buffer */
#endif
byte multi:1; /* flag for if content is in multiple parts */
byte flagOne:1;
byte detached:1; /* flag to indicate detached signature is present */
byte noContent:1;/* indicates content isn't included in bundle */
byte degenerate:1;
byte indefLen:1; /* flag to indicate indef-length encoding used */
WC_BITFIELD multi:1; /* flag for if content is in multiple parts */
WC_BITFIELD flagOne:1;
WC_BITFIELD detached:1; /* flag to indicate detached signature is present */
WC_BITFIELD noContent:1;/* indicates content isn't included in bundle */
WC_BITFIELD degenerate:1;
WC_BITFIELD indefLen:1; /* flag to indicate indef-length encoding used */
};
@@ -1523,7 +1523,7 @@ typedef struct ESD {
wc_HashAlg hash;
enum wc_HashType hashType;
byte contentDigest[WC_MAX_DIGEST_SIZE + 2]; /* content only + ASN.1 heading */
byte contentDigestSet:1;
WC_BITFIELD contentDigestSet:1;
byte contentAttribsDigest[WC_MAX_DIGEST_SIZE];
byte encContentDigest[MAX_ENCRYPTED_KEY_SZ];
@@ -6829,9 +6829,9 @@ typedef struct WC_PKCS7_KARI {
word32 sharedInfoSz; /* size of ECC-CMS-SharedInfo encoded */
byte ukmOwner; /* do we own ukm buffer? 1:yes, 0:no */
byte direction; /* WC_PKCS7_ENCODE | WC_PKCS7_DECODE */
byte decodedInit : 1; /* indicates decoded was initialized */
byte recipKeyInit : 1; /* indicates recipKey was initialized */
byte senderKeyInit : 1; /* indicates senderKey was initialized */
WC_BITFIELD decodedInit:1; /* indicates decoded was initialized */
WC_BITFIELD recipKeyInit:1; /* indicates recipKey was initialized */
WC_BITFIELD senderKeyInit:1; /* indicates senderKey was initialized */
} WC_PKCS7_KARI;