libosdp 3.1.0__tar.gz → 3.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. {libosdp-3.1.0 → libosdp-3.1.2}/PKG-INFO +1 -1
  2. {libosdp-3.1.0 → libosdp-3.1.2}/libosdp.egg-info/PKG-INFO +1 -1
  3. {libosdp-3.1.0 → libosdp-3.1.2}/setup.py +1 -1
  4. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/include/osdp_export.h +10 -0
  5. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/osdp_common.h +0 -1
  6. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/osdp_config.h +4 -4
  7. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/osdp_cp.c +8 -25
  8. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/osdp_phy.c +17 -30
  9. {libosdp-3.1.0 → libosdp-3.1.2}/MANIFEST.in +0 -0
  10. {libosdp-3.1.0 → libosdp-3.1.2}/README.md +0 -0
  11. {libosdp-3.1.0 → libosdp-3.1.2}/libosdp.egg-info/SOURCES.txt +0 -0
  12. {libosdp-3.1.0 → libosdp-3.1.2}/libosdp.egg-info/dependency_links.txt +0 -0
  13. {libosdp-3.1.0 → libosdp-3.1.2}/libosdp.egg-info/top_level.txt +0 -0
  14. {libosdp-3.1.0 → libosdp-3.1.2}/osdp/__init__.py +0 -0
  15. {libosdp-3.1.0 → libosdp-3.1.2}/osdp/channel.py +0 -0
  16. {libosdp-3.1.0 → libosdp-3.1.2}/osdp/constants.py +0 -0
  17. {libosdp-3.1.0 → libosdp-3.1.2}/osdp/control_panel.py +0 -0
  18. {libosdp-3.1.0 → libosdp-3.1.2}/osdp/helpers.py +0 -0
  19. {libosdp-3.1.0 → libosdp-3.1.2}/osdp/key_store.py +0 -0
  20. {libosdp-3.1.0 → libosdp-3.1.2}/osdp/peripheral_device.py +0 -0
  21. {libosdp-3.1.0 → libosdp-3.1.2}/pyproject.toml +0 -0
  22. {libosdp-3.1.0 → libosdp-3.1.2}/setup.cfg +0 -0
  23. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/include/osdp.h +0 -0
  24. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/python/osdp_sys/base.c +0 -0
  25. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/python/osdp_sys/cp.c +0 -0
  26. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/python/osdp_sys/data.c +0 -0
  27. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/python/osdp_sys/module.c +0 -0
  28. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/python/osdp_sys/module.h +0 -0
  29. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/python/osdp_sys/pd.c +0 -0
  30. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/python/osdp_sys/utils.c +0 -0
  31. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/crypto/tinyaes.c +0 -0
  32. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/crypto/tinyaes_src.c +0 -0
  33. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/crypto/tinyaes_src.h +0 -0
  34. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/osdp_common.c +0 -0
  35. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/osdp_diag.c +0 -0
  36. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/osdp_diag.h +0 -0
  37. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/osdp_file.c +0 -0
  38. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/osdp_file.h +0 -0
  39. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/osdp_pd.c +0 -0
  40. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/src/osdp_sc.c +0 -0
  41. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/include/utils/assert.h +0 -0
  42. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/include/utils/crc16.h +0 -0
  43. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/include/utils/disjoint_set.h +0 -0
  44. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/include/utils/list.h +0 -0
  45. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/include/utils/logger.h +0 -0
  46. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/include/utils/pcap_gen.h +0 -0
  47. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/include/utils/queue.h +0 -0
  48. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/include/utils/slab.h +0 -0
  49. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/include/utils/utils.h +0 -0
  50. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/src/crc16.c +0 -0
  51. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/src/disjoint_set.c +0 -0
  52. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/src/list.c +0 -0
  53. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/src/logger.c +0 -0
  54. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/src/pcap_gen.c +0 -0
  55. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/src/queue.c +0 -0
  56. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/src/slab.c +0 -0
  57. {libosdp-3.1.0 → libosdp-3.1.2}/vendor/utils/src/utils.c +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libosdp
3
- Version: 3.1.0
3
+ Version: 3.1.2
4
4
  Summary: Library implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol)
5
5
  Home-page: https://github.com/goToMain/libosdp
6
6
  Author: Siddharth Chandrasekaran
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: libosdp
3
- Version: 3.1.0
3
+ Version: 3.1.2
4
4
  Summary: Library implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol)
5
5
  Home-page: https://github.com/goToMain/libosdp
6
6
  Author: Siddharth Chandrasekaran
@@ -11,7 +11,7 @@ import shutil
11
11
  import subprocess
12
12
 
13
13
  project_name = "libosdp"
14
- project_version = "3.1.0"
14
+ project_version = "3.1.2"
15
15
  current_dir = os.path.dirname(os.path.realpath(__file__))
16
16
  repo_root = os.path.realpath(os.path.join(current_dir, ".."))
17
17
 
@@ -48,6 +48,16 @@
48
48
 
49
49
  /* ---------- Deprecation (with message) ---------- */
50
50
 
51
+ /*
52
+ * Undefine API_DEPRECATED before redefining it. On macOS the SDK header
53
+ * <os/availability.h> defines API_DEPRECATED with a different signature
54
+ * (platform/version specifiers, not a plain string), which causes macro
55
+ * expansion errors when osdp.h uses OSDP_DEPRECATED_EXPORT("msg").
56
+ */
57
+ #ifdef API_DEPRECATED
58
+ #undef API_DEPRECATED
59
+ #endif
60
+
51
61
  /* Prefer C++ [[deprecated("msg")]] if available, otherwise compiler specifics. */
52
62
  #if defined(__cplusplus) && API_HAS_CPP_ATTR(deprecated)
53
63
  /* [[deprecated("msg")]] supported */
@@ -273,7 +273,6 @@ union osdp_ephemeral_data {
273
273
  #define PD_FLAG_HAS_SCBK BIT(12) /* PD has a dedicated SCBK */
274
274
  #define PD_FLAG_SC_DISABLED BIT(13) /* master_key=NULL && scbk=NULL */
275
275
  #define PD_FLAG_PKT_BROADCAST BIT(14) /* this packet was addressed to 0x7F */
276
- #define PD_FLAG_CP_USE_CRC BIT(15) /* CP uses CRC-16 instead of checksum */
277
276
 
278
277
  /* CP event requests; used with make_request() and check_request() */
279
278
  #define CP_REQ_RESTART_SC 0x00000001
@@ -11,11 +11,11 @@
11
11
  * @brief The following macros are defined defined from the variable in cmake
12
12
  * files. All @XXX@ are replaced by the value of XXX as resolved by cmake.
13
13
  */
14
- #define PROJECT_VERSION "3.1.0"
14
+ #define PROJECT_VERSION "3.1.2"
15
15
  #define PROJECT_NAME "libosdp"
16
- #define GIT_BRANCH "master"
17
- #define GIT_REV "c92c896"
18
- #define GIT_TAG ""
16
+ #define GIT_BRANCH "HEAD"
17
+ #define GIT_REV "24d5ec7"
18
+ #define GIT_TAG "v3.1.2"
19
19
  #define GIT_DIFF ""
20
20
  #define REPO_ROOT "/home/runner/work/libosdp/libosdp"
21
21
 
@@ -53,6 +53,7 @@ enum osdp_cp_error_e {
53
53
  OSDP_CP_ERR_INPROG = -5,
54
54
  OSDP_CP_ERR_UNKNOWN = -6,
55
55
  OSDP_CP_ERR_SEQ_NUM = -7,
56
+ OSDP_CP_ERR_APP = -8, /* Application layer error */
56
57
  };
57
58
 
58
59
  struct cp_cmd_node {
@@ -416,13 +417,6 @@ static int cp_decode_response(struct osdp_pd *pd, uint8_t *buf, int len)
416
417
  if (len != REPLY_NAK_DATA_LEN) {
417
418
  break;
418
419
  }
419
- if (buf[pos] == OSDP_PD_NAK_MSG_CHK &&
420
- ISSET_FLAG(pd, PD_FLAG_CP_USE_CRC)) {
421
- LOG_INF("PD NAK'd CRC-16, falling back to checksum");
422
- CLEAR_FLAG(pd, PD_FLAG_CP_USE_CRC);
423
- ret = OSDP_CP_ERR_RETRY_CMD;
424
- break;
425
- }
426
420
  LOG_WRN("PD replied with NAK(%d) for CMD: %s(%02x)",
427
421
  buf[pos], osdp_cmd_name(pd->cmd_id), pd->cmd_id);
428
422
  ret = OSDP_CP_ERR_NONE;
@@ -481,16 +475,6 @@ static int cp_decode_response(struct osdp_pd *pd, uint8_t *buf, int len)
481
475
  } else {
482
476
  CLEAR_FLAG(pd, PD_FLAG_SC_CAPABLE);
483
477
  }
484
-
485
- /* Check checksum/CRC support capability */
486
- t1 = OSDP_PD_CAP_CHECK_CHARACTER_SUPPORT;
487
- if (pd->cap[t1].function_code == t1) {
488
- if (pd->cap[t1].compliance_level & 0x01) {
489
- SET_FLAG(pd, PD_FLAG_CP_USE_CRC);
490
- } else {
491
- CLEAR_FLAG(pd, PD_FLAG_CP_USE_CRC);
492
- }
493
- }
494
478
  ret = OSDP_CP_ERR_NONE;
495
479
  break;
496
480
  case REPLY_OSTATR: {
@@ -657,7 +641,7 @@ static int cp_decode_response(struct osdp_pd *pd, uint8_t *buf, int len)
657
641
  osdp_compute_session_keys(pd);
658
642
  if (osdp_verify_pd_cryptogram(pd) != 0) {
659
643
  LOG_ERR("Failed to verify PD cryptogram");
660
- return OSDP_CP_ERR_GENERIC;
644
+ return OSDP_CP_ERR_APP;
661
645
  }
662
646
  ret = OSDP_CP_ERR_NONE;
663
647
  break;
@@ -895,19 +879,20 @@ static int cp_phy_state_update(struct osdp_pd *pd)
895
879
  break;
896
880
  case OSDP_CP_PHY_STATE_REPLY_WAIT:
897
881
  rc = cp_process_reply(pd);
898
- if (rc == OSDP_CP_ERR_NONE) {
882
+ if (rc == OSDP_CP_ERR_NONE || rc == OSDP_CP_ERR_APP) {
899
883
  pd->tstamp = osdp_millis_now();
900
884
  osdp_phy_progress_sequence(pd);
901
- cp_phy_state_done(pd);
902
- return OSDP_CP_ERR_NONE;
903
885
  }
904
- if (rc == OSDP_CP_ERR_SEQ_NUM ||
886
+ if (rc == OSDP_CP_ERR_NONE ||
887
+ rc == OSDP_CP_ERR_SEQ_NUM ||
905
888
  (rc == OSDP_CP_ERR_UNKNOWN && pd->cmd_id == CMD_POLL &&
906
889
  ISSET_FLAG(pd, OSDP_FLAG_IGN_UNSOLICITED))) {
907
890
  cp_phy_state_done(pd);
908
891
  return OSDP_CP_ERR_NONE;
909
892
  }
910
- if (rc == OSDP_CP_ERR_GENERIC || rc == OSDP_CP_ERR_UNKNOWN) {
893
+ if (rc == OSDP_CP_ERR_GENERIC ||
894
+ rc == OSDP_CP_ERR_UNKNOWN ||
895
+ rc == OSDP_CP_ERR_APP) {
911
896
  goto error;
912
897
  }
913
898
  if (rc == OSDP_CP_ERR_RETRY_CMD) {
@@ -1528,8 +1513,6 @@ static int cp_add_pd(struct osdp *ctx, int num_pd, const osdp_pd_info_t *info_li
1528
1513
  pd->flags = info->flags;
1529
1514
  pd->seq_number = -1;
1530
1515
  SET_FLAG(pd, PD_FLAG_SC_DISABLED);
1531
- /* Default to CRC-16 until we know PD capabilities */
1532
- SET_FLAG(pd, PD_FLAG_CP_USE_CRC);
1533
1516
  memcpy(&pd->channel, &info->channel, sizeof(struct osdp_channel));
1534
1517
  if (info->scbk != NULL) {
1535
1518
  memcpy(pd->sc.scbk, info->scbk, 16);
@@ -79,7 +79,7 @@ static int osdp_channel_receive(struct osdp_pd *pd)
79
79
  return total_recv;
80
80
  }
81
81
 
82
- static uint8_t osdp_compute_checksum(uint8_t *msg, int length)
82
+ uint8_t osdp_compute_checksum(uint8_t *msg, int length)
83
83
  {
84
84
  uint8_t checksum = 0;
85
85
  int i, whole_checksum;
@@ -187,10 +187,7 @@ int osdp_phy_packet_init(struct osdp_pd *pd, uint8_t *buf, int max_len)
187
187
  id = pd->cmd_id;
188
188
  }
189
189
  pkt->control = phy_get_next_seq_number(pd);
190
- if (is_pd_mode(pd) ||
191
- (is_cp_mode(pd) && ISSET_FLAG(pd, PD_FLAG_CP_USE_CRC))) {
192
- pkt->control |= PKT_CONTROL_CRC;
193
- }
190
+ pkt->control |= PKT_CONTROL_CRC;
194
191
 
195
192
  if (sc_is_active(pd)) {
196
193
  pkt->control |= PKT_CONTROL_SCB;
@@ -212,7 +209,7 @@ static int phy_packet_finalize(struct osdp_pd *pd, uint8_t *buf,
212
209
  uint16_t crc16;
213
210
  struct osdp_packet_header *pkt;
214
211
  uint8_t *data;
215
- int data_len, checksum_len;
212
+ int data_len;
216
213
 
217
214
  /* Do a sanity check only; we expect header to be pre-filled */
218
215
  if ((unsigned long)len <= sizeof(struct osdp_packet_header)) {
@@ -238,10 +235,9 @@ static int phy_packet_finalize(struct osdp_pd *pd, uint8_t *buf,
238
235
  return OSDP_ERR_PKT_FMT;
239
236
  }
240
237
 
241
- /* len: with CRC (2 bytes) or checksum (1 byte) */
242
- checksum_len = (pkt->control & PKT_CONTROL_CRC) ? 2 : 1;
243
- pkt->len_lsb = BYTE_0(len + checksum_len);
244
- pkt->len_msb = BYTE_1(len + checksum_len);
238
+ /* len: with 2 byte CRC */
239
+ pkt->len_lsb = BYTE_0(len + 2);
240
+ pkt->len_msb = BYTE_1(len + 2);
245
241
 
246
242
  if (is_data_trace_enabled(pd)) {
247
243
  uint8_t control;
@@ -287,15 +283,14 @@ static int phy_packet_finalize(struct osdp_pd *pd, uint8_t *buf,
287
283
  }
288
284
  len += osdp_encrypt_data(pd, is_cp_mode(pd), data, data_len);
289
285
  }
290
- /* len: with 4bytes MAC; with CRC (2 bytes) or checksum (1 byte); without 1 byte mark */
286
+ /* len: with 4bytes MAC; with 2 byte CRC; without 1 byte mark */
291
287
  if (len + 4 > max_len) {
292
288
  goto out_of_space_error;
293
289
  }
294
290
 
295
- /* len: with CRC/checksum; with 4 byte MAC */
296
- checksum_len = (pkt->control & PKT_CONTROL_CRC) ? 2 : 1;
297
- pkt->len_lsb = BYTE_0(len + checksum_len + 4);
298
- pkt->len_msb = BYTE_1(len + checksum_len + 4);
291
+ /* len: with 2 byte CRC; with 4 byte MAC */
292
+ pkt->len_lsb = BYTE_0(len + 2 + 4);
293
+ pkt->len_msb = BYTE_1(len + 2 + 4);
299
294
 
300
295
  /* compute and extend the buf with 4 MAC bytes */
301
296
  osdp_compute_mac(pd, is_cp_mode(pd), buf, len);
@@ -304,22 +299,14 @@ static int phy_packet_finalize(struct osdp_pd *pd, uint8_t *buf,
304
299
  len += 4;
305
300
  }
306
301
 
307
- /* fill crc16 or checksum */
308
- if (pkt->control & PKT_CONTROL_CRC) {
309
- if (len + 2 > max_len) {
310
- goto out_of_space_error;
311
- }
312
- crc16 = osdp_compute_crc16(buf, len);
313
- buf[len + 0] = BYTE_0(crc16);
314
- buf[len + 1] = BYTE_1(crc16);
315
- len += 2;
316
- } else {
317
- if (len + 1 > max_len) {
318
- goto out_of_space_error;
319
- }
320
- buf[len] = osdp_compute_checksum(buf, len);
321
- len += 1;
302
+ /* fill crc16 */
303
+ if (len + 2 > max_len) {
304
+ goto out_of_space_error;
322
305
  }
306
+ crc16 = osdp_compute_crc16(buf, len);
307
+ buf[len + 0] = BYTE_0(crc16);
308
+ buf[len + 1] = BYTE_1(crc16);
309
+ len += 2;
323
310
 
324
311
  return len + packet_has_mark(pd);
325
312
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes