Fixes from PR review: styling and formatting, remove duplicate code
This commit is contained in:
parent
5711d12364
commit
28cf563c76
@ -64,7 +64,7 @@ EXTRA_DIST += \
|
||||
certs/dh2048.der \
|
||||
certs/dh3072.der \
|
||||
certs/rsa2048.der \
|
||||
certs/rsa-pub-2048.pem \
|
||||
certs/rsa-pub-2048.pem \
|
||||
certs/rsa3072.der \
|
||||
certs/dsa2048.der \
|
||||
certs/dsa3072.der \
|
||||
|
11
configure.ac
11
configure.ac
@ -2218,8 +2218,6 @@ else
|
||||
ENABLED_ARC4=no
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL([BUILD_IDEA], [test "x$ENABLED_IDEA" = "xyes"])
|
||||
|
||||
|
||||
# MD5
|
||||
AC_ARG_ENABLE([md5],
|
||||
@ -3399,15 +3397,6 @@ then
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_EXT_CACHE -DHAVE_EX_DATA"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# ARC4
|
||||
AC_ARG_ENABLE([arc4],
|
||||
[AS_HELP_STRING([--enable-arc4],[Enable ARC4 (default: disabled)])],
|
||||
[ ENABLED_ARC4=$enableval ],
|
||||
[ ENABLED_ARC4=no ]
|
||||
)
|
||||
|
||||
if test "$ENABLED_OPENSSH" = "yes" || test "$ENABLED_WPAS" = "yes" || test "$ENABLED_QT" = "yes"
|
||||
then
|
||||
ENABLED_ARC4="yes"
|
||||
|
@ -18104,7 +18104,7 @@ int wolfSSL_sk_CIPHER_description(WOLFSSL_CIPHER* cipher)
|
||||
*/
|
||||
strLen = (int)XSTRLEN(name);
|
||||
|
||||
for(i=0,j=0,k=0; i < strLen; i++) {
|
||||
for (i = 0, j = 0, k = 0; i < strLen; i++) {
|
||||
if(name[i] != '-' && k < MAX_SEGMENTS && j < MAX_SEGMENT_SZ) {
|
||||
n[k][j] = name[i]; /* Fill kth segment string until '-' */
|
||||
j++;
|
||||
|
15
src/ssl.c
15
src/ssl.c
@ -19748,12 +19748,12 @@ int wolfSSL_DH_check(const WOLFSSL_DH *dh, int *codes)
|
||||
WOLFSSL_DH *wolfSSL_d2i_DHparams(WOLFSSL_DH **dh, const unsigned char **pp,
|
||||
long length)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_d2i_DHparams");
|
||||
|
||||
WOLFSSL_DH *newDH = NULL;
|
||||
int ret;
|
||||
word32 idx = 0;
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_d2i_DHparams");
|
||||
|
||||
if (pp == NULL || length <= 0) {
|
||||
WOLFSSL_MSG("bad argument");
|
||||
return NULL;
|
||||
@ -19794,10 +19794,11 @@ WOLFSSL_DH *wolfSSL_d2i_DHparams(WOLFSSL_DH **dh, const unsigned char **pp,
|
||||
*/
|
||||
int wolfSSL_i2d_DHparams(const WOLFSSL_DH *dh, unsigned char **out)
|
||||
{
|
||||
WOLFSSL_ENTER("Enter wolfSSL_i2d_DHparams");
|
||||
word32 len;
|
||||
int ret = 0;
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_i2d_DHparams");
|
||||
|
||||
if (dh == NULL) {
|
||||
WOLFSSL_MSG("Bad parameters");
|
||||
return WOLFSSL_FAILURE;
|
||||
@ -20634,7 +20635,7 @@ WOLFSSL_STACK* wolfSSL_sk_new_cipher(void)
|
||||
int wolfSSL_sk_CIPHER_push(WOLF_STACK_OF(WOLFSSL_CIPHER)* sk,
|
||||
WOLFSSL_CIPHER* cipher)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_sk_CIPHER_push");
|
||||
WOLFSSL_STUB("wolfSSL_sk_CIPHER_push");
|
||||
(void)sk;
|
||||
(void)cipher;
|
||||
return 0;
|
||||
@ -20643,7 +20644,7 @@ int wolfSSL_sk_CIPHER_push(WOLF_STACK_OF(WOLFSSL_CIPHER)* sk,
|
||||
|
||||
WOLFSSL_CIPHER* wolfSSL_sk_CIPHER_pop(WOLF_STACK_OF(WOLFSSL_CIPHER)* sk)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_sk_CIPHER_pop");
|
||||
WOLFSSL_STUB("wolfSSL_sk_CIPHER_pop");
|
||||
(void)sk;
|
||||
return NULL;
|
||||
}
|
||||
@ -21053,7 +21054,7 @@ WOLFSSL_EVP_PKEY* wolfSSL_X509_get_pubkey(WOLFSSL_X509* x509)
|
||||
key->ownDsa = 1;
|
||||
key->dsa = wolfSSL_DSA_new();
|
||||
if (key->dsa == NULL) {
|
||||
XFREE(key, x509->heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
||||
wolfSSL_EVP_PKEY_free(key);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -21062,7 +21063,7 @@ WOLFSSL_EVP_PKEY* wolfSSL_X509_get_pubkey(WOLFSSL_X509* x509)
|
||||
WOLFSSL_DSA_LOAD_PUBLIC) != SSL_SUCCESS) {
|
||||
wolfSSL_DSA_free(key->dsa);
|
||||
key->dsa = NULL;
|
||||
XFREE(key, x509->heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
||||
wolfSSL_EVP_PKEY_free(key);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -960,11 +960,7 @@ static int CheckBitString(const byte* input, word32* inOutIdx, int* len,
|
||||
* output Buffer to write into.
|
||||
* returns the number of bytes added to the buffer.
|
||||
*/
|
||||
#if defined(WOLFSSL_QT) || defined(OPENSSL_ALL)
|
||||
WOLFSSL_LOCAL word32 SetBitString(word32 len, byte unusedBits, byte* output)
|
||||
#else
|
||||
static word32 SetBitString(word32 len, byte unusedBits, byte* output)
|
||||
#endif
|
||||
{
|
||||
word32 idx = 0;
|
||||
|
||||
@ -4662,7 +4658,7 @@ static WC_INLINE void FreeTmpDsas(byte** tmps, void* heap)
|
||||
|
||||
#if !defined(HAVE_SELFTEST) && defined(WOLFSSL_KEY_GEN)
|
||||
/* Write a public DSA key to output */
|
||||
int SetDsaPublicKey(byte* output, DsaKey* key,
|
||||
int wc_SetDsaPublicKey(byte* output, DsaKey* key,
|
||||
int outLen, int with_header)
|
||||
{
|
||||
/* p, g, q = DSA params, y = public exponent */
|
||||
@ -4682,7 +4678,7 @@ int SetDsaPublicKey(byte* output, DsaKey* key,
|
||||
byte bitString[1 + MAX_LENGTH_SZ + 1];
|
||||
int idx, pSz, gSz, qSz, ySz, innerSeqSz, outerSeqSz, bitStringSz = 0;
|
||||
|
||||
WOLFSSL_ENTER("SetDsaPublicKey");
|
||||
WOLFSSL_ENTER("wc_SetDsaPublicKey");
|
||||
|
||||
if (output == NULL || key == NULL || outLen < MAX_SEQ_SZ) {
|
||||
return BAD_FUNC_ARG;
|
||||
@ -4711,6 +4707,7 @@ int SetDsaPublicKey(byte* output, DsaKey* key,
|
||||
if ((qSz = SetASNIntMP(&key->q, MAX_DSA_INT_SZ, q)) < 0) {
|
||||
WOLFSSL_MSG("SetASNIntMP Error with q");
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(p, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(q, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return qSz;
|
||||
@ -4725,6 +4722,8 @@ int SetDsaPublicKey(byte* output, DsaKey* key,
|
||||
if ((gSz = SetASNIntMP(&key->g, MAX_DSA_INT_SZ, g)) < 0) {
|
||||
WOLFSSL_MSG("SetASNIntMP Error with g");
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(p, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(q, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(g, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return gSz;
|
||||
@ -4739,6 +4738,9 @@ int SetDsaPublicKey(byte* output, DsaKey* key,
|
||||
if ((ySz = SetASNIntMP(&key->y, MAX_DSA_INT_SZ, y)) < 0) {
|
||||
WOLFSSL_MSG("SetASNIntMP Error with y");
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(p, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(q, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(g, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(y, key->heap, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return ySz;
|
||||
@ -4839,9 +4841,9 @@ int SetDsaPublicKey(byte* output, DsaKey* key,
|
||||
|
||||
/* Convert DSA Public key to DER format, write to output (inLen), return bytes
|
||||
written */
|
||||
int DsaKeyToPublicDer(DsaKey* key, byte* output, word32 inLen)
|
||||
int wc_DsaKeyToPublicDer(DsaKey* key, byte* output, word32 inLen)
|
||||
{
|
||||
return SetDsaPublicKey(output, key, inLen, 1);
|
||||
return wc_SetDsaPublicKey(output, key, inLen, 1);
|
||||
}
|
||||
#endif /* !HAVE_SELFTEST && WOLFSSL_KEY_GEN */
|
||||
|
||||
|
@ -1139,8 +1139,8 @@ WOLFSSL_LOCAL word32 SetOctetString(word32 len, byte* output);
|
||||
WOLFSSL_LOCAL int wc_DhParamsToDer(DhKey* key, byte* out, word32* outSz);
|
||||
WOLFSSL_LOCAL int wc_DhPubKeyToDer(DhKey* key, byte* out, word32* outSz);
|
||||
WOLFSSL_LOCAL int wc_DhPrivKeyToDer(DhKey* key, byte* out, word32* outSz);
|
||||
WOLFSSL_LOCAL word32 SetBitString(word32 len, byte unusedBits, byte* output);
|
||||
#endif
|
||||
WOLFSSL_LOCAL word32 SetBitString(word32 len, byte unusedBits, byte* output);
|
||||
WOLFSSL_LOCAL word32 SetImplicit(byte tag,byte number,word32 len,byte* output);
|
||||
WOLFSSL_LOCAL word32 SetExplicit(byte number, word32 len, byte* output);
|
||||
WOLFSSL_LOCAL word32 SetSet(word32 len, byte* output);
|
||||
|
@ -41,8 +41,6 @@
|
||||
#define DsaPublicKeyDecode wc_DsaPublicKeyDecode
|
||||
#define DsaPrivateKeyDecode wc_DsaPrivateKeyDecode
|
||||
#define DsaKeyToDer wc_DsaKeyToDer
|
||||
#define SetDsaPublicKey wc_SetDsaPublicKey
|
||||
#define DsaKeyToPublicDer wc_DsaKeyToPublicDer
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
Loading…
Reference in New Issue
Block a user