mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
account for different peer certificate in test case, g++ build fix, static memory size increase
This commit is contained in:
committed by
Eric Blankenhorn
parent
a9accb6c39
commit
51d55ed1c8
32
src/bio.c
32
src/bio.c
@ -161,14 +161,17 @@ static int wolfSSL_BIO_MD_read(WOLFSSL_BIO* bio, void* buf, int sz)
|
||||
{
|
||||
int ret = sz;
|
||||
|
||||
if (wolfSSL_EVP_MD_CTX_type(bio->ptr) == (NID_hmac & 0xFF)) {
|
||||
if (wolfSSL_EVP_DigestSignUpdate(bio->ptr, buf, sz) != WOLFSSL_SUCCESS)
|
||||
if (wolfSSL_EVP_MD_CTX_type((WOLFSSL_EVP_MD_CTX*)bio->ptr) ==
|
||||
(NID_hmac & 0xFF)) {
|
||||
if (wolfSSL_EVP_DigestSignUpdate((WOLFSSL_EVP_MD_CTX*)bio->ptr, buf,
|
||||
sz) != WOLFSSL_SUCCESS)
|
||||
{
|
||||
ret = WOLFSSL_FATAL_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (wolfSSL_EVP_DigestUpdate(bio->ptr, buf, ret) != WOLFSSL_SUCCESS) {
|
||||
if (wolfSSL_EVP_DigestUpdate((WOLFSSL_EVP_MD_CTX*)bio->ptr, buf, ret)
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
ret = WOLFSSL_FATAL_ERROR;
|
||||
}
|
||||
}
|
||||
@ -467,14 +470,16 @@ static int wolfSSL_BIO_MD_write(WOLFSSL_BIO* bio, const void* data, int len)
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
if (wolfSSL_EVP_MD_CTX_type(bio->ptr) == (NID_hmac & 0xFF)) {
|
||||
if (wolfSSL_EVP_DigestSignUpdate(bio->ptr, data, len) !=
|
||||
WOLFSSL_SUCCESS) {
|
||||
if (wolfSSL_EVP_MD_CTX_type((WOLFSSL_EVP_MD_CTX*)bio->ptr) ==
|
||||
(NID_hmac & 0xFF)) {
|
||||
if (wolfSSL_EVP_DigestSignUpdate((WOLFSSL_EVP_MD_CTX*)bio->ptr, data,
|
||||
len) != WOLFSSL_SUCCESS) {
|
||||
ret = WOLFSSL_BIO_ERROR;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (wolfSSL_EVP_DigestUpdate(bio->ptr, data, len) != WOLFSSL_SUCCESS) {
|
||||
if (wolfSSL_EVP_DigestUpdate((WOLFSSL_EVP_MD_CTX*)bio->ptr, data, len)
|
||||
!= WOLFSSL_SUCCESS) {
|
||||
ret = WOLFSSL_BIO_ERROR;
|
||||
}
|
||||
}
|
||||
@ -809,14 +814,14 @@ int wolfSSL_BIO_gets(WOLFSSL_BIO* bio, char* buf, int sz)
|
||||
#ifndef WOLFCRYPT_ONLY
|
||||
/* call final on hash */
|
||||
case WOLFSSL_BIO_MD:
|
||||
if (wolfSSL_EVP_MD_CTX_size(bio->ptr) > sz) {
|
||||
if (wolfSSL_EVP_MD_CTX_size((WOLFSSL_EVP_MD_CTX*)bio->ptr) > sz) {
|
||||
WOLFSSL_MSG("Output buffer was too small for digest");
|
||||
ret = WOLFSSL_FAILURE;
|
||||
}
|
||||
else {
|
||||
unsigned int szOut = 0;
|
||||
ret = wolfSSL_EVP_DigestFinal(bio->ptr, (unsigned char*)buf,
|
||||
&szOut);
|
||||
ret = wolfSSL_EVP_DigestFinal((WOLFSSL_EVP_MD_CTX*)bio->ptr,
|
||||
(unsigned char*)buf, &szOut);
|
||||
if (ret == WOLFSSL_SUCCESS) {
|
||||
ret = szOut;
|
||||
}
|
||||
@ -1302,9 +1307,10 @@ int wolfSSL_BIO_reset(WOLFSSL_BIO *bio)
|
||||
#ifndef WOLFCRYPT_ONLY
|
||||
case WOLFSSL_BIO_MD:
|
||||
if (bio->ptr != NULL) {
|
||||
const WOLFSSL_EVP_MD* md = wolfSSL_EVP_MD_CTX_md(bio->ptr);
|
||||
wolfSSL_EVP_MD_CTX_init(bio->ptr);
|
||||
wolfSSL_EVP_DigestInit(bio->ptr, md);
|
||||
const WOLFSSL_EVP_MD* md =
|
||||
wolfSSL_EVP_MD_CTX_md((WOLFSSL_EVP_MD_CTX*)bio->ptr);
|
||||
wolfSSL_EVP_MD_CTX_init((WOLFSSL_EVP_MD_CTX*)bio->ptr);
|
||||
wolfSSL_EVP_DigestInit((WOLFSSL_EVP_MD_CTX*)bio->ptr, md);
|
||||
}
|
||||
return 0;
|
||||
#endif /* WOLFCRYPT_ONLY */
|
||||
|
@ -15190,7 +15190,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
||||
int ret = WOLFSSL_FAILURE;
|
||||
|
||||
if ((bio != NULL) && (mdcp != NULL)) {
|
||||
*mdcp = bio->ptr;
|
||||
*mdcp = (WOLFSSL_EVP_MD_CTX*)bio->ptr;
|
||||
ret = WOLFSSL_SUCCESS;
|
||||
}
|
||||
|
||||
@ -15472,7 +15472,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
||||
}
|
||||
|
||||
if (bio->type == WOLFSSL_BIO_MD) {
|
||||
wolfSSL_EVP_MD_CTX_free(bio->ptr);
|
||||
wolfSSL_EVP_MD_CTX_free((WOLFSSL_EVP_MD_CTX*)bio->ptr);
|
||||
}
|
||||
|
||||
XFREE(bio, 0, DYNAMIC_TYPE_OPENSSL);
|
||||
|
10
tests/api.c
10
tests/api.c
@ -24317,11 +24317,17 @@ static void test_wolfSSL_SESSION(void)
|
||||
int bufSz;
|
||||
|
||||
AssertNotNull(x509 = SSL_SESSION_get0_peer(sess));
|
||||
AssertIntEQ((bufSz = X509_NAME_get_text_by_NID(
|
||||
AssertIntGT((bufSz = X509_NAME_get_text_by_NID(
|
||||
X509_get_subject_name(x509), NID_organizationalUnitName,
|
||||
buf, sizeof(buf))), 7);
|
||||
buf, sizeof(buf))), 0);
|
||||
AssertIntNE((bufSz == 7 || bufSz == 16), 0); /* should be one of these*/
|
||||
if (bufSz == 7) {
|
||||
AssertIntEQ(XMEMCMP(buf, "Support", bufSz), 0);
|
||||
}
|
||||
if (bufSz == 16) {
|
||||
AssertIntEQ(XMEMCMP(buf, "Programming-2048", bufSz), 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
AssertNotNull(sess_copy = wolfSSL_SESSION_dup(sess));
|
||||
|
@ -110,7 +110,7 @@ WOLFSSL_API int wolfSSL_GetAllocators(wolfSSL_Malloc_cb*,
|
||||
#elif defined (OPENSSL_EXTRA)
|
||||
/* extra storage in structs for multiple attributes and order */
|
||||
#ifndef LARGEST_MEM_BUCKET
|
||||
#define LARGEST_MEM_BUCKET 25536
|
||||
#define LARGEST_MEM_BUCKET 25600
|
||||
#endif
|
||||
#define WOLFMEM_BUCKETS 64,128,256,512,1024,2432,3360,4480,\
|
||||
LARGEST_MEM_BUCKET
|
||||
|
Reference in New Issue
Block a user