Merge pull request #822 from JacobBarthelmeh/Testing

testing buffer size with const DH and remove redeclaration of WOLFSSL…
This commit is contained in:
toddouska
2017-03-31 08:53:49 -07:00
committed by GitHub
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, int wc_DhGenerateKeyPair(DhKey* key, WC_RNG* rng, byte* priv, word32* privSz,
byte* pub, word32* pubSz) 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); 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; DhKey smallKey;
byte p[2] = { 0, 5 }; byte p[2] = { 0, 5 };
byte g[2] = { 0, 2 }; 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]; byte priv[2];
word32 privSz = sizeof(priv);
byte pub[2]; byte pub[2];
#endif
word32 privSz = sizeof(priv);
word32 pubSz = sizeof(pub); word32 pubSz = sizeof(pub);
wc_InitDhKey(&smallKey); wc_InitDhKey(&smallKey);

View File

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