Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/sctp/sctp-client-dtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int main(int argc, char **argv)
wolfSSL_CIPHER_get_name(wolfSSL_get_current_cipher(ssl)));

wolfSSL_write(ssl, response, (int)strlen(response));
int got = wolfSSL_read(ssl, buffer, sizeof(buffer));
int got = wolfSSL_read(ssl, buffer, sizeof(buffer) - 1);
if (got > 0) {
buffer[got] = 0;
printf("server said: %s\n", buffer);
Expand Down
2 changes: 1 addition & 1 deletion examples/sctp/sctp-server-dtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int main(int argc, char **argv)
printf("Cipher Suite is %s\n",
wolfSSL_CIPHER_get_name(wolfSSL_get_current_cipher(ssl)));

int got = wolfSSL_read(ssl, buffer, sizeof(buffer));
int got = wolfSSL_read(ssl, buffer, sizeof(buffer) - 1);
if (got > 0) {
buffer[got] = 0;
printf("client said: %s\n", buffer);
Expand Down
8 changes: 8 additions & 0 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -24468,6 +24468,7 @@ static int SSL_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz,
/* in buffer */
ret |= wc_Md5Update(&md5, in, sz);
if (ret != 0) {
wc_Md5Free(&md5);
WOLFSSL_ERROR_VERBOSE(VERIFY_MAC_ERROR);
return VERIFY_MAC_ERROR;
}
Expand All @@ -24479,6 +24480,7 @@ static int SSL_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz,
}
#endif
if (ret != 0) {
wc_Md5Free(&md5);
WOLFSSL_ERROR_VERBOSE(VERIFY_MAC_ERROR);
return VERIFY_MAC_ERROR;
}
Expand All @@ -24488,6 +24490,7 @@ static int SSL_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz,
ret |= wc_Md5Update(&md5, PAD2, padSz);
ret |= wc_Md5Update(&md5, result, digestSz);
if (ret != 0) {
wc_Md5Free(&md5);
WOLFSSL_ERROR_VERBOSE(VERIFY_MAC_ERROR);
return VERIFY_MAC_ERROR;
}
Expand All @@ -24499,6 +24502,7 @@ static int SSL_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz,
}
#endif
if (ret != 0) {
wc_Md5Free(&md5);
WOLFSSL_ERROR_VERBOSE(VERIFY_MAC_ERROR);
return VERIFY_MAC_ERROR;
}
Expand All @@ -24518,6 +24522,7 @@ static int SSL_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz,
/* in buffer */
ret |= wc_ShaUpdate(&sha, in, sz);
if (ret != 0) {
wc_ShaFree(&sha);
WOLFSSL_ERROR_VERBOSE(VERIFY_MAC_ERROR);
return VERIFY_MAC_ERROR;
}
Expand All @@ -24529,6 +24534,7 @@ static int SSL_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz,
}
#endif
if (ret != 0) {
wc_ShaFree(&sha);
WOLFSSL_ERROR_VERBOSE(VERIFY_MAC_ERROR);
return VERIFY_MAC_ERROR;
}
Expand All @@ -24538,6 +24544,7 @@ static int SSL_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz,
ret |= wc_ShaUpdate(&sha, PAD2, padSz);
ret |= wc_ShaUpdate(&sha, result, digestSz);
if (ret != 0) {
wc_ShaFree(&sha);
WOLFSSL_ERROR_VERBOSE(VERIFY_MAC_ERROR);
return VERIFY_MAC_ERROR;
}
Expand All @@ -24549,6 +24556,7 @@ static int SSL_hmac(WOLFSSL* ssl, byte* digest, const byte* in, word32 sz,
}
#endif
if (ret != 0) {
wc_ShaFree(&sha);
WOLFSSL_ERROR_VERBOSE(VERIFY_MAC_ERROR);
return VERIFY_MAC_ERROR;
}
Expand Down
11 changes: 7 additions & 4 deletions wolfcrypt/src/ecc.c
Original file line number Diff line number Diff line change
Expand Up @@ -9664,9 +9664,10 @@ int wc_ecc_import_point_der_ex(const byte* in, word32 inLen,
alt_fp_init(point->z);
#else
err = mp_init_multi(point->x, point->y, point->z, NULL, NULL, NULL);
#endif

if (err != MP_OKAY)
return MEMORY_E;
#endif

/* check for point type (4, 2, or 3) */
pointType = in[0];
Expand Down Expand Up @@ -10935,9 +10936,10 @@ static int _ecc_import_x963_ex2(const byte* in, word32 inLen, ecc_key* key,
key->kb, key->ku
#endif
);

if (err != MP_OKAY)
return MEMORY_E;
#endif
if (err != MP_OKAY)
return MEMORY_E;
#ifdef WOLFSSL_ECC_BLIND_K
mp_forcezero(key->kb);
#endif
Expand Down Expand Up @@ -11999,9 +12001,10 @@ static int _ecc_import_raw_private(ecc_key* key, const char* qx,
key->kb, key->ku
#endif
);
#endif

if (err != MP_OKAY)
return MEMORY_E;
#endif
#ifdef WOLFSSL_ECC_BLIND_K
mp_forcezero(key->kb);
#endif
Expand Down
Loading