Merge pull request #5142 from SparkiDev/ssl_move_pk

ssl.c rework
This commit is contained in:
David Garske
2022-05-13 12:56:14 -07:00
committed by GitHub
6 changed files with 10000 additions and 9861 deletions

View File

@ -18,6 +18,7 @@ MAINTAINERCLEANFILES+= $(FIPS_FILES)
EXTRA_DIST += src/bio.c
EXTRA_DIST += src/conf.c
EXTRA_DIST += src/pk.c
EXTRA_DIST += src/x509.c
EXTRA_DIST += src/x509_str.c

9928
src/pk.c Normal file

File diff suppressed because it is too large Load Diff

9882
src/ssl.c

File diff suppressed because it is too large Load Diff

View File

@ -10373,7 +10373,7 @@ static int test_wc_Sha256GetHash (void)
if (flag == 0) {
flag = wc_Sha256GetHash(&sha256, hash1);
}
/*test bad arguements*/
/*test bad arguments*/
if (flag == 0) {
flag = wc_Sha256GetHash(NULL, NULL);
if (flag == BAD_FUNC_ARG) {
@ -10420,7 +10420,7 @@ static int test_wc_Sha256Copy (void)
if (flag == 0) {
flag = wc_Sha256Copy(&sha256, &temp);
}
/*test bad arguements*/
/*test bad arguments*/
if (flag == 0) {
flag = wc_Sha256Copy(NULL, NULL);
if (flag == BAD_FUNC_ARG) {
@ -10929,7 +10929,7 @@ static int test_Sha512_Family_GetHash(int type )
flag = ghashFp(&sha512, hash1);
}
/*test bad arguements*/
/*test bad arguments*/
if (!flag) {
if (ghashFp(NULL, NULL) != BAD_FUNC_ARG )
flag = WOLFSSL_FATAL_ERROR;
@ -10969,7 +10969,7 @@ static int test_wc_Sha512GetHash (void)
if (flag == 0) {
flag = wc_Sha512GetHash(&sha512, hash1);
}
/*test bad arguements*/
/*test bad arguments*/
if (flag == 0) {
flag = wc_Sha512GetHash(NULL, NULL);
if (flag == BAD_FUNC_ARG) {
@ -11017,7 +11017,7 @@ static int test_wc_Sha512Copy (void)
if (flag == 0) {
flag = wc_Sha512Copy(&sha512, &temp);
}
/*test bad arguements*/
/*test bad arguments*/
if (flag == 0) {
flag = wc_Sha512Copy(NULL, NULL);
if (flag == BAD_FUNC_ARG) {
@ -11289,7 +11289,7 @@ static int test_wc_Sha512_224Copy (void)
if (flag == 0) {
flag = wc_Sha512_224Copy(&sha512, &temp);
}
/*test bad arguements*/
/*test bad arguments*/
if (flag == 0) {
if (wc_Sha512_224Copy(NULL, NULL) != BAD_FUNC_ARG)
flag = WOLFSSL_FATAL_ERROR;
@ -11556,7 +11556,7 @@ static int test_wc_Sha512_256Copy (void)
if (flag == 0) {
flag = wc_Sha512_256Copy(&sha512, &temp);
}
/*test bad arguements*/
/*test bad arguments*/
if (flag == 0) {
if (wc_Sha512_256Copy(NULL, NULL) != BAD_FUNC_ARG)
flag = WOLFSSL_FATAL_ERROR;
@ -11937,7 +11937,7 @@ static int test_wc_Sha384GetHash (void)
if (flag == 0) {
flag = wc_Sha384GetHash(&sha384, hash1);
}
/*test bad arguements*/
/*test bad arguments*/
if (flag == 0) {
flag = wc_Sha384GetHash(NULL, NULL);
if (flag == BAD_FUNC_ARG) {
@ -11984,7 +11984,7 @@ static int test_wc_Sha384Copy (void)
if (flag == 0) {
flag = wc_Sha384Copy(&sha384, &temp);
}
/*test bad arguements*/
/*test bad arguments*/
if (flag == 0) {
flag = wc_Sha384Copy(NULL, NULL);
if (flag == BAD_FUNC_ARG) {
@ -12325,7 +12325,7 @@ static int test_wc_Sha224GetHash (void)
if (flag == 0) {
flag = wc_Sha224GetHash(&sha224, hash1);
}
/*test bad arguements*/
/*test bad arguments*/
if (flag == 0) {
flag = wc_Sha224GetHash(NULL, NULL);
if (flag == BAD_FUNC_ARG) {
@ -12374,7 +12374,7 @@ static int test_wc_Sha224Copy (void)
if (flag == 0) {
flag = wc_Sha224Copy(&sha224, &temp);
}
/*test bad arguements*/
/*test bad arguments*/
if (flag == 0) {
flag = wc_Sha224Copy(NULL, NULL);
if (flag == BAD_FUNC_ARG) {

View File

@ -1434,7 +1434,7 @@ int wolfSSL_EVP_PKEY_CTX_free(WOLFSSL_EVP_PKEY_CTX *ctx)
/* Creates a new WOLFSSL_EVP_PKEY_CTX structure.
*
* pkey key structure to use with new WOLFSSL_EVP_PEKY_CTX
* pkey key structure to use with new WOLFSSL_EVP_PKEY_CTX
* e engine to use. It should be NULL at this time.
*
* return the new structure on success and NULL if failed.

View File

@ -2915,7 +2915,8 @@ struct WOLFSSL_CTX {
void* protoMsgCtx; /* user set context with msg callback */
#endif
word32 timeout; /* session timeout */
#if defined(HAVE_ECC) || defined(HAVE_CURVE25519) || defined(HAVE_ED448)
#if defined(HAVE_ECC) || defined(HAVE_ED25519) || defined(HAVE_CURVE25519) || \
defined(HAVE_ED448)
word32 ecdhCurveOID; /* curve Ecc_Sum */
#endif
#ifdef HAVE_ECC
@ -4359,7 +4360,8 @@ struct WOLFSSL {
#if defined(HAVE_ECC) || defined(HAVE_ED25519) || defined(HAVE_ED448)
int eccVerifyRes;
#endif
#if defined(HAVE_ECC) || defined(HAVE_CURVE25519) || defined(HAVE_CURVE448)
#if defined(HAVE_ECC) || defined(HAVE_ED25519) || defined(HAVE_CURVE25519) || \
defined(HAVE_ED448) || defined(HAVE_CURVE448)
word32 ecdhCurveOID; /* curve Ecc_Sum */
ecc_key* eccTempKey; /* private ECDHE key */
byte eccTempKeyPresent; /* also holds type */
@ -4371,7 +4373,8 @@ struct WOLFSSL {
word16 eccTempKeySz; /* in octets 20 - 66 */
byte peerEccDsaKeyPresent;
#endif
#if defined(HAVE_ECC) || defined(HAVE_ED25519) || defined(HAVE_CURVE448)
#if defined(HAVE_ECC) || defined(HAVE_ED25519) || \
defined(HAVE_CURVE448) || defined(HAVE_ED448)
word32 pkCurveOID; /* curve Ecc_Sum */
#endif
#ifdef HAVE_ED25519
@ -5186,6 +5189,23 @@ WOLFSSL_LOCAL int wolfSSL_ASN1_STRING_canon(WOLFSSL_ASN1_STRING* asn_out,
WOLFSSL_LOCAL int wolfssl_get_ex_new_index(int class_index);
#endif
#if !defined(WC_NO_RNG) && (defined(OPENSSL_EXTRA) || \
(defined(OPENSSL_EXTRA_X509_SMALL) && !defined(NO_RSA)))
WOLFSSL_LOCAL WC_RNG* wolfssl_get_global_rng(void);
#endif
#if !defined(WOLFCRYPT_ONLY) && defined(OPENSSL_EXTRA)
#if defined(WOLFSSL_KEY_GEN) && defined(WOLFSSL_PEM_TO_DER)
WOLFSSL_LOCAL int EncryptDerKey(byte *der, int *derSz, const EVP_CIPHER* cipher,
unsigned char* passwd, int passwdSz, byte **cipherInfo, int maxDerSz);
#endif
#endif
#if defined(WOLFSSL_KEY_GEN) && !defined(NO_RSA) && !defined(HAVE_USER_RSA)
WOLFSSL_LOCAL int wolfSSL_RSA_To_Der(WOLFSSL_RSA* rsa, byte** outBuf,
int publicKey, void* heap);
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif