Ungate constants and gate tests

pull/36/head
Andrew Hutchings 2022-02-09 14:18:23 +00:00
parent 3327d9ae39
commit e58d81533c
2 changed files with 41 additions and 40 deletions

View File

@ -432,6 +432,7 @@ if _lib.RSA_ENABLED:
assert 1024 / 8 == len(signature) == rsa_private.output_size assert 1024 / 8 == len(signature) == rsa_private.output_size
assert plaintext == rsa_private.verify(signature) assert plaintext == rsa_private.verify(signature)
if _lib.RSA_PSS_ENABLED:
def test_rsa_pss_sign_verify(rsa_private, rsa_public): def test_rsa_pss_sign_verify(rsa_private, rsa_public):
plaintext = t2b("Everyone gets Friday off yippee.") plaintext = t2b("Everyone gets Friday off yippee.")

View File

@ -371,28 +371,6 @@ if HMAC_ENABLED:
""" """
if RSA_ENABLED: if RSA_ENABLED:
_cdef += """
typedef struct {...; } RsaKey;
int wc_InitRsaKey(RsaKey* key, void*);
int wc_FreeRsaKey(RsaKey* key);
int wc_RsaPrivateKeyDecode(const byte*, word32*, RsaKey*, word32);
int wc_RsaPublicKeyDecode(const byte*, word32*, RsaKey*, word32);
int wc_RsaEncryptSize(RsaKey*);
int wc_RsaPrivateDecrypt(const byte*, word32, byte*, word32,
RsaKey* key);
int wc_RsaPublicEncrypt(const byte*, word32, byte*, word32,
RsaKey*, WC_RNG*);
int wc_RsaPublicEncrypt_ex(const byte* in, word32 inLen, byte* out,
word32 outLen, RsaKey* key, WC_RNG* rng, int type,
enum wc_HashType hash, int mgf, byte* label, word32 labelSz);
int wc_RsaPrivateDecrypt_ex(const byte* in, word32 inLen,
byte* out, word32 outLen, RsaKey* key, int type,
enum wc_HashType hash, int mgf, byte* label, word32 labelSz);
"""
if RSA_PSS_ENABLED:
_cdef += """ _cdef += """
static const int WC_RSA_PKCSV15_PAD; static const int WC_RSA_PKCSV15_PAD;
static const int WC_RSA_OAEP_PAD; static const int WC_RSA_OAEP_PAD;
@ -422,7 +400,29 @@ if RSA_ENABLED:
static const int WC_HASH_TYPE_SHA3_512; static const int WC_HASH_TYPE_SHA3_512;
static const int WC_HASH_TYPE_BLAKE2B; static const int WC_HASH_TYPE_BLAKE2B;
static const int WC_HASH_TYPE_BLAKE2S; static const int WC_HASH_TYPE_BLAKE2S;
typedef struct {...; } RsaKey;
int wc_InitRsaKey(RsaKey* key, void*);
int wc_FreeRsaKey(RsaKey* key);
int wc_RsaPrivateKeyDecode(const byte*, word32*, RsaKey*, word32);
int wc_RsaPublicKeyDecode(const byte*, word32*, RsaKey*, word32);
int wc_RsaEncryptSize(RsaKey*);
int wc_RsaPrivateDecrypt(const byte*, word32, byte*, word32,
RsaKey* key);
int wc_RsaPublicEncrypt(const byte*, word32, byte*, word32,
RsaKey*, WC_RNG*);
int wc_RsaPublicEncrypt_ex(const byte* in, word32 inLen, byte* out,
word32 outLen, RsaKey* key, WC_RNG* rng, int type,
enum wc_HashType hash, int mgf, byte* label, word32 labelSz);
int wc_RsaPrivateDecrypt_ex(const byte* in, word32 inLen,
byte* out, word32 outLen, RsaKey* key, int type,
enum wc_HashType hash, int mgf, byte* label, word32 labelSz);
"""
if RSA_PSS_ENABLED:
_cdef += """
int wc_RsaPSS_Sign(const byte* in, word32 inLen, byte* out, word32 outLen, int wc_RsaPSS_Sign(const byte* in, word32 inLen, byte* out, word32 outLen,
enum wc_HashType hash, int mgf, RsaKey* key, WC_RNG* rng); enum wc_HashType hash, int mgf, RsaKey* key, WC_RNG* rng);
int wc_RsaPSS_Verify(byte* in, word32 inLen, byte* out, word32 outLen, int wc_RsaPSS_Verify(byte* in, word32 inLen, byte* out, word32 outLen,