testing buffer size with const DH and remove redeclaration of WOLFSSL_CRL

This commit is contained in:
Jacob Barthelmeh
2017-03-30 10:30:55 -06:00
parent 14efd9735d
commit 5c2b5f86b9
3 changed files with 15 additions and 4 deletions

View File

@@ -179,7 +179,14 @@ static int GeneratePublic(DhKey* key, const byte* priv, word32 privSz,
int wc_DhGenerateKeyPair(DhKey* key, WC_RNG* rng, byte* priv, word32* privSz,
byte* pub, word32* pubSz)
{
int ret = GeneratePrivate(key, rng, priv, privSz);
int ret;
if (key == NULL || rng == NULL || priv == NULL || privSz == NULL ||
pub == NULL || pubSz == NULL) {
return BAD_FUNC_ARG;
}
ret = GeneratePrivate(key, rng, priv, privSz);
return (ret != 0) ? ret : GeneratePublic(key, priv, *privSz, pub, pubSz);
}

View File

@@ -7865,9 +7865,15 @@ static int dh_generate_test(WC_RNG *rng)
DhKey smallKey;
byte p[2] = { 0, 5 };
byte g[2] = { 0, 2 };
#ifdef WOLFSSL_DH_CONST
/* the table for constant DH lookup will round to the lowest byte size 21 */
byte priv[21];
byte pub[21];
#else
byte priv[2];
word32 privSz = sizeof(priv);
byte pub[2];
#endif
word32 privSz = sizeof(priv);
word32 pubSz = sizeof(pub);
wc_InitDhKey(&smallKey);

View File

@@ -34,8 +34,6 @@
extern "C" {
#endif
typedef struct WOLFSSL_CRL WOLFSSL_CRL;
WOLFSSL_LOCAL int InitCRL(WOLFSSL_CRL*, WOLFSSL_CERT_MANAGER*);
WOLFSSL_LOCAL void FreeCRL(WOLFSSL_CRL*, int dynamic);