Skip to content
Snippets Groups Projects
Commit 280f6066 authored by clohr's avatar clohr
Browse files

Relache les contraintes sur le format des timestamps


git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/C/branches/version-0.7@2278 b32b6428-25c9-4566-ad07-03861ab6144f
parent 18ef82cb
No related branches found
No related tags found
No related merge requests found
cache.o: cache.c xaal.h
metadatadb.o: metadatadb.c xaal.h
automalua.o: automalua.c xaal.h
updateKV.o: updateKV.c xaal.h
metadatadb.o: metadatadb.c xaal.h
metadatadbTester.o: metadatadbTester.c xaal.h
......@@ -339,24 +339,14 @@ bool xAAL_read_bus(const xAAL_businfo_t *bus,
csec = cbor_array_get(cmsg, 1);
cusec = cbor_array_get(cmsg, 2);
// JKX => Quick & Dirty fix the INT32 in csec
// I'm living Christophe the pleasure to rewrite this test :)
/*
if ( !cbor_isa_uint(csec) || (cbor_int_get_width(csec) != CBOR_INT_64)
|| !cbor_isa_uint(cusec) || (cbor_int_get_width(cusec) != CBOR_INT_32) ) {
if ( !cbor_isa_uint(csec) || !cbor_isa_uint(cusec) ) {
if (xAAL_error_log) fprintf(xAAL_error_log, "Invalid 'timestamp' values in xAAL message\n");
cbor_decref(&cmsg);
return false;
}
*/
// due to the way int are encoded the current timestamp can be 2bytes or 3.
if (cbor_int_get_width(csec) == CBOR_INT_64)
timestamp.tv_sec = cbor_get_uint64(csec);
if (cbor_int_get_width(csec) == CBOR_INT_32)
timestamp.tv_sec = cbor_get_uint32(csec);
timestamp.tv_usec = cbor_get_uint32(cusec);
timestamp.tv_sec = cbor_get_int(csec);
timestamp.tv_usec = cbor_get_int(cusec);
npub.sec = htobe64(timestamp.tv_sec); // build nonce for chacha20
npub.usec = htobe32(timestamp.tv_usec);
......@@ -470,8 +460,7 @@ bool xAAL_read_bus(const xAAL_businfo_t *bus,
/* msgType */
cmsgType = cbor_array_get(cpayload, 2);
if ( !cmsgType || !cbor_isa_uint(cmsgType) || (cbor_int_get_width(cmsgType)!=CBOR_INT_8)
|| cbor_get_uint8(cmsgType) > xAAL_MSGTYPE_LAST ) {
if ( !cmsgType || !cbor_isa_uint(cmsgType) || cbor_get_int(cmsgType) > xAAL_MSGTYPE_LAST ) {
if (xAAL_error_log) fprintf(xAAL_error_log, "Invalid 'msgType' field in xAAL header\n");
cbor_decref(&cmsg);
cbor_decref(ctargets);
......@@ -480,7 +469,7 @@ bool xAAL_read_bus(const xAAL_businfo_t *bus,
free(*devType);
return false;
}
*msgType = cbor_get_uint8(cmsgType);
*msgType = cbor_get_int(cmsgType);
caction = cbor_array_get(cpayload, 3);
if ( !caction || !cbor_isa_string(caction) || cbor_string_is_indefinite(caction)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment