oscore: Handle encrypt error return

Check return from cose_encrypt0_encrypt() and correct spelling error.
This commit is contained in:
Jon Shallow authored and Jon Shallow committed 2023-02-03 12:48:53 +00:00
1 parent 583c52c567
commit c7cda63092
4 files changed
+12 -6

No files matched your search

+6
View File
@@ -591,6 +591,12 @@ coap_oscore_new_pdu_encrypted(coap_session_t *session,
ciphertext_len = cose_encrypt0_encrypt(cose,
ciphertext_buffer,
plain_pdu->used_size + AES_CCM_TAG);
if ((int)ciphertext_len <= 0) {
coap_log_warn(
"OSCORE: Encryption Failure, result code: %d \n",
(int)ciphertext_len);
goto error;
}
assert(ciphertext_len < OSCORE_CRYPTO_BUFFER_SIZE);
/* Add in OSCORE option (previously computed) */