Bug fix for verifying responses.
#include "opendefs.h"
#include "openserial.h"
#include "packetfunctions.h"
-#include "opencoap.h"
+#include "openoscoap.h"
#include "cborencoder.h"
#include "cryptoengine.h"
#include "sha.h"
@@ -312,10 +312,12 @@ owerror_t openoscoap_unprotect_message(
if (objectSecurity->length != 0) {
ciphertext = objectSecurity->pValue;
+ ciphertextLen = objectSecurity->length;
payloadInObjSec = TRUE;
}
else {
ciphertext = &msg->payload[0];
+ ciphertextLen = msg->length;
payloadInObjSec = FALSE;
}
@@ -365,7 +367,6 @@ owerror_t openoscoap_unprotect_message(
xor_arrays(nonce, partialIV, nonce, AES_CCM_16_64_128_IV_LEN);
}
- ciphertextLen = msg->length;
decStatus = cryptoengine_aes_ccms_dec(aad,
aadLen,
ciphertext,
