Skip to content

Commit 6b241ca

Browse files
committed
Move some cdef declarations for RSA to separate section
The definitions for the following functions are not always available when wolfSSL is configured to only contain a minimum of functionality: - wc_GetPkcs8TraditionalOffset (only with ASN, which is required for RSA) - wc_PemToDer (only when KEYGEN is enabled) - wc_DerToPemEx (only when KEYGEN is enabled) This change allows for building the Python wrapper when ASN and RSA are both disabled.
1 parent e9ebda0 commit 6b241ca

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

scripts/build_ffi.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,6 @@ def build_ffi(local_wolfssl, features):
546546
int wc_RNG_GenerateBlock(WC_RNG*, byte*, word32);
547547
int wc_RNG_GenerateByte(WC_RNG*, byte*);
548548
int wc_FreeRng(WC_RNG*);
549-
550-
int wc_GetPkcs8TraditionalOffset(byte* input, word32* inOutIdx, word32 sz);
551549
"""
552550

553551
if not features["FIPS"] or features["FIPS_VERSION"] > 2:
@@ -743,6 +741,8 @@ def build_ffi(local_wolfssl, features):
743741
int wc_InitRsaKey(RsaKey* key, void*);
744742
int wc_FreeRsaKey(RsaKey* key);
745743
744+
int wc_GetPkcs8TraditionalOffset(byte* input, word32* inOutIdx, word32 sz);
745+
746746
int wc_RsaPrivateKeyDecode(const byte*, word32*, RsaKey*, word32);
747747
int wc_RsaPublicKeyDecode(const byte*, word32*, RsaKey*, word32);
748748
int wc_RsaEncryptSize(RsaKey*);
@@ -957,13 +957,17 @@ def build_ffi(local_wolfssl, features):
957957
} DerBuffer;
958958
typedef struct { ...; } EncryptedInfo;
959959
960+
word32 wc_EncodeSignature(byte* out, const byte* digest, word32 digSz,
961+
int hashOID);
962+
"""
963+
964+
if features["KEYGEN"]:
965+
cdef += """
960966
int wc_PemToDer(const unsigned char* buff, long longSz, int type,
961967
DerBuffer** pDer, void* heap, EncryptedInfo* info,
962968
int* keyFormat);
963969
int wc_DerToPemEx(const byte* der, word32 derSz, byte* output, word32 outSz,
964970
byte *cipher_info, int type);
965-
word32 wc_EncodeSignature(byte* out, const byte* digest, word32 digSz,
966-
int hashOID);
967971
"""
968972

969973
if features["WC_RNG_SEED_CB"]:

0 commit comments

Comments
 (0)