Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #7517

Merged
merged 3 commits into from
May 13, 2024
Merged
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
15 changes: 6 additions & 9 deletions src/pk.c
Original file line number Diff line number Diff line change
Expand Up @@ -15745,8 +15745,7 @@ int wolfSSL_PEM_read_bio(WOLFSSL_BIO* bio, char **name, char **header,
* @param [in] header Encryption header.
* @param [in] data DER data.
* @param [in] len Length of DER data.
* @return 0 on success.
* @return MEMORY_E when dynamic memory allocation fails.
* @return 0 on failure.
*/
int wolfSSL_PEM_write_bio(WOLFSSL_BIO* bio, const char *name,
const char *header, const unsigned char *data, long len)
Expand All @@ -15757,23 +15756,21 @@ int wolfSSL_PEM_write_bio(WOLFSSL_BIO* bio, const char *name,

/* Validate parameters. */
if ((bio == NULL) || (name == NULL) || (header == NULL) || (data == NULL)) {
err = 1;
err = BAD_FUNC_ARG;
}

/* Encode into a buffer. */
if ((!err) && (pem_write_data(name, header, data, len, &pem, &pemLen) !=
0)) {
pemLen = 0;
err = 1;
if (!err) {
err = pem_write_data(name, header, data, len, &pem, &pemLen);
}

/* Write PEM into BIO. */
if ((!err) && (wolfSSL_BIO_write(bio, pem, pemLen) != (int)pemLen)) {
pemLen = 0;
err = IO_FAILED_E;
}

XFREE(pem, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return pemLen;
return (!err) ? pemLen : 0;
}
#endif /* !NO_BIO */

Expand Down
2 changes: 1 addition & 1 deletion wolfcrypt/src/cmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ int wc_CmacUpdate(Cmac* cmac, const byte* in, word32 inSz)
/* Clear CRYPTOCB_UNAVAILABLE return code */
ret = 0;

while (inSz != 0) {
while ((ret == 0) && (inSz != 0)) {
word32 add = min(inSz, AES_BLOCK_SIZE - cmac->bufferSz);
XMEMCPY(&cmac->buffer[cmac->bufferSz], in, add);

Expand Down