Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable parsing of the initial log entry & use of log entry types. #466

Closed
wants to merge 2 commits into from

Conversation

flihp
Copy link

@flihp flihp commented Jul 13, 2023

The current implementation will return an empty LogEntries structure if get_log_entries returns a LogEntries that contains an initial LogEntry. AFAIK this is caused by a failure to parse / deserialize the cmd field of the LogEntry when it's set to 255 as this doesn't currently map to a command::Code. The initial log entry is described in https://developers.yubico.com/YubiHSM2/Commands/Get_Log_Entries.html

This PR does 2 things:

  • Move the LogEntries and LogEntry structure out of the audit::commands module (pub(crate) visibility) to the audit module where they're given pub visibility to allow use of these types by external code.
  • Update from_u8 and to_u8 in response::Code to map the value for the initial log entry value from the LogEntry::cmd field.

This requires moving these types to out of the 'audit::commands' module
as it is limited to `pub (crate)` scope.
https://developers.yubico.com/YubiHSM2/Commands/Get_Log_Entries.html
describes the initial audit log entry as:

> When the device initializes after a reset, a log entry with all fields
> set to 0xff is logged.

This commit updates the serialization logic to map the initial audit log
`cmd` field with value `0xff` to a `command::Code` through the
`response::Code` type. We implement this as a special case in the
`response::Code` to / from  u8 functions.
@flihp
Copy link
Author

flihp commented Jul 13, 2023

This same issue was addressed in #463.

@flihp flihp closed this Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant