-
Notifications
You must be signed in to change notification settings - Fork 72
rpifwcrypto: Initial revision #139
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
base: master
Are you sure you want to change the base?
Conversation
@roliver-rpi Adding early draft PR here so that we can start integrating this in parallel with firmware dependencies. |
Firmware changes are now merged (but not released) |
Client side library and application for the Raspberry Pi firmware cryptography service. The firmware mailbox based crypto service provides limited support for cryptographic operations using a ECDSA P-256 stored in OTP (using rpi-otp-private-key). The current operations are * Get number of OTP keys * Get status for key * Set status for a key (runtime lock) * ECDSA SHA256 signature * HMAC SHA256 (max message size 2KB) e.g. LUKS passphrase = HMAC(device-unique-ley, serial64 + EMMC CID) rpifwcrypto is a command line application designed to allow the crypto operations to be easily used in shell scripts. rpifwcrypto.h provides a library interface so that this can be embedded in other applications. Direct usage of mailbox API (vcmailbox) is not recommended because this is a new feature and the mailbox API is not frozen.
# Find GnuTLS package | ||
find_package(GnuTLS REQUIRED) | ||
|
||
add_compile_definitions(LIBRARY_BUILD=1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is a hangover from the original - pinctrl or piolib, I imagine - and appears not to be used here.
install(TARGETS rpi-fw-crypto RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
install(TARGETS rpifwcrypto | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a newline.
mbox_close(mb); | ||
|
||
return (rc < 0) ? rc : RPI_FW_CRYPTO_SUCCESS; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline.
} | ||
#endif | ||
|
||
#endif /* RPI_FW_CRYPTO_H */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing newline.
@@ -74,7 +74,6 @@ static void mbox_close(int file_desc) { | |||
close(file_desc); | |||
} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? If so, there's another double-blank on lines 57-58.
return rc; | ||
|
||
if (msg.resp.length > sig_max_len) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This brace usage doesn't match the rest of this code, but there are other examples.
Client side library and application for the Raspberry Pi firmware cryptography service. The firmware mailbox based crypto service provides limited support for cryptographic operations using a ECDSA p256 private core stored in OTP (using rpi-otp-private-key).
The current operations are
rpifwcrypto is a command line application designed to allow the
crypto operations to be easily used in shell scripts.
rpifwcrypto.h provides a library interface so that this can be
embedded in other applications.
Direct usage of mailbox API (vcmailbox) is not recommended
because this is a new feature and the mailbox API is not frozen.