Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ add_subdirectory(raspinfo)
add_subdirectory(vcgencmd)
add_subdirectory(vclog)
add_subdirectory(vcmailbox)
add_subdirectory(rpifwcrypto)
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@ A collection of scripts and simple applications
* [piolib](piolib/) - A library for accessing the Pi 5's PIO hardware.
* [raspinfo](raspinfo/) - A short script to dump information about the Pi. Intended for
the submission of bug reports.
* [rpifwcrypto](rpifwcrypto/) - A command line application and library for the
firmware cryptography services. Intended for use with Raspberry Pi Connect and
secure-boot provisioner.
* [vclog](vclog/) - A tool to get VideoCore 'assert' or 'msg' logs
with optional -f to wait for new logs to arrive.


**Build Instructions**

Install the prerequisites with "sudo apt install cmake device-tree-compiler libfdt-dev" - you need at least version 3.10 of cmake. Run the following commands to build and install everything, or see the README files in the subdirectories to just build utilities individually:
Install the prerequisites with "sudo apt install cmake device-tree-compiler libfdt-dev libgnutls28-dev" - you need at least version 3.10 of cmake. Run the following commands to build and install everything, or see the README files in the subdirectories to just build utilities individually:

- *cmake .*
N.B. Use *cmake -DBUILD_SHARED_LIBS=1 .* to build the libraries in the subprojects (libdtovl, gpiolib and piolib) as shared (as opposed to static) libraries.
N.B. Use *cmake -DBUILD_SHARED_LIBS=1 .* to build the libraries in the subprojects (libdtovl, gpiolib, librpifwcrypto and piolib) as shared (as opposed to static) libraries.
- *make*
- *sudo make install*
29 changes: 29 additions & 0 deletions rpifwcrypto/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 3.10...3.27)
include(GNUInstallDirs)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror")

# Set project name
project(rpifwcrypto)

# Find GnuTLS package
find_package(GnuTLS REQUIRED)

add_compile_definitions(LIBRARY_BUILD=1)
Copy link
Collaborator

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to LIBRARY_BUILD=1 ? librpifwcrypto.so should eventually be part of the APT package

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - LIBRARY_BUILD is a flag I created for pinctrl (and later piolib) to replace the linker magic for collecting constructors with an explicit function that calls them all; it has no effect otherwise.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line still seems to be present in the latest version. And this file is also missing a newline (aren't you a vim user)?


# Create the shared library
add_library(rpifwcrypto rpifwcrypto.c)
target_sources(rpifwcrypto PUBLIC rpifwcrypto.h)
set_target_properties(rpifwcrypto PROPERTIES PUBLIC_HEADER rpifwcrypto.h)
set_target_properties(rpifwcrypto PROPERTIES SOVERSION 0)

# Create the executable
add_executable(rpi-fw-crypto main.c)
target_link_libraries(rpi-fw-crypto rpifwcrypto ${GNUTLS_LIBRARIES})
target_include_directories(rpi-fw-crypto PRIVATE ${GNUTLS_INCLUDE_DIRS})

# Install rules
install(TARGETS rpi-fw-crypto RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS rpifwcrypto
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
Loading