Conversation
without this change pd will hang if it receives too many bytes. it might also hang if the LEN_LSB or LEN_MSB is corrupted. Signed-off-by: Johan Carlsson <johan.carlsson@teenage.engineering>
PD: always check the timeout on receiving packets
This solves the crash i've been seeing. What seems to happen is that PyArg_Parse writes to a 64-bit type and we input a 32-bit, so the buf pointer have its lowest 4 bytes corrupted. Signed-off-by: Johan Carlsson <johan.carlsson@teenage.engineering>
python: change len from int to the correct type of Py_ssize_t.
Make security conscious assumptions (see below) where possible. Fail where these assumptions don't hold. - Don't allow use of SCBK-D. - Assume that a KEYSET was successful at an earlier time. Fixes: osdp-dev#21 Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
CONFIG_OSDP_SC_ENABLED was added to maintain consistency with zephyr port. But on hindsight, it add too much clutter to code. Retiring this in favor of facing patch-time difficulties. Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Some places the PD is referred to with `pd_info_t *` array offsets. In others (when pd replies) pd address is sent as pd identifier. For an application, the PD must always be identifiable with one integer to avoid confusion. Fix this issue by using `pd_info_t *` array offset as the single point of reference for a PD in CP mode. In PD mode, since there is only one PD, no indication will be passed. Fixes: osdp-dev#17 Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Fixes: osdp-dev#25 Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Data is in bits if format is OSDP_CARD_FMT_RAW_* or bytes when format is OSDP_CARD_FMT_ASCII. Update the comment to indicate this. pyosdp was not expecting length field as it didn't expect bits in data. Add support for this when format is set to OSDP_CARD_FMT_RAW_* Fixes: osdp-dev#26 Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Some PD/CP don't send the initial mark byte (0xFF) as defined in OSDP specification. This patch adds a compile time switch to disable sending/expecting the mark byte so LibOSDP can work with such devices. Fixes: osdp-dev#27 Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
When the PD response with unexpected response for a PD_ID/PD_CAP request, the PD was set to offline but a missing break caused the state machine to go ahead with the rest of the commands. Fix two instance of this bug. Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
This patch adds support for multiple PDs connected to a CP over a single channel. A new channel->id is introduced to uniquely identify a channel across connected PDs and each PD holds that channel until it's finished with it. Fixes: osdp-dev#28 Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Mixed testing done so far did not cover all supported commands and replies as it tests only those that are used during the CP/PD setup phase. This patch adds a unit test wrapper that calls build_command then the tries to decode the command immediately. This way we can test future command/replies without too much efforts. Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
…tive Use NAK error code OSDP_PD_NAK_SC_COND(6) instead of OSDP_PD_NAK_RECORD(9) when rejecting a command type that is not allowed when SC is inactive and ENFORCE_SECURE is enabled.
Another patch in the direction of having a statically allocated PD when there is only one PD. Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
pd: Use better NAK error code when rejecting a command due to SC inactive
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Related-to: osdp-dev#53 Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
This commit adds file transfer support as a plug-in to LibOSDP. To complile, enable cmake option CONFIG_OSDP_FILE (--file in configure). Related-to: osdp-dev#24 Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
The latest OSDP Specification v2.2 discourages Master Key based key derivation and recommends the APP to pre-share the SCBK to the PDs in a secure manner and use that. This patch adds support for passing SCBK for each PD by passing it though the existing osdp_pd_info_t struct. Due to this, the method signature for osdp_pd_setup() has changed. Related-to: osdp-dev#53, osdp-dev#52 Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Signed-off-by: Siddharth Chandrasekaran <siddharth@embedjournal.com>
Change the check related to the master key so that the memcpy and warning message depend only on whether or not the master key is defined.
I've been using @embedjournal.com email address for a looong time time now; but it is time to sunset it. This decision is to suppress the increasing number of queries/doubts on the maintainership of libosdp (by me personaly or by my employer). Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
Fix the master key check in osdp_cp_setup()
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
It has been around for a while now and I really like the simplicity of being able to build libosdp with just bash and make. So create a dedicated Makefile (instead of generating it at configure time). Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
The logic around master_key/scbk/enforce_secure had gotten very messy. Re-arrange code to make it look slightly better. Related-to: osdp-dev#56 Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
Merge code commit from base repository
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.