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

sys/vfs_util: add vfs_file_<hash>() functions and md5sum, sha1sum and sha256sum shell commands #18040

Merged
merged 6 commits into from
May 19, 2022

Conversation

benpicco
Copy link
Contributor

Contribution description

This adds helper functions to compute the hash of a file as well as accompanying shell functions md5sum, sha1sum and sha256sum.

Testing procedure

Just add the module with the name of the shell function, e.g

USEMODULE += md5sum
USEMODULE += sha1sum
USEMODULE += sha256sum
2022-04-30 18:22:26,944 # > md5sum /nvm0/image.bin /nvm0/old_image.bin
2022-04-30 18:22:27,025 # 927c31ba0e221b6b0ed916d0f6bb794f  /nvm0/image.bin
2022-04-30 18:22:27,098 # 0e4c7aaf386573e4a4a872d28afd066a  /nvm0/old_image.bin

2022-04-30 18:22:34,224 # > sha1sum /nvm0/image.bin /nvm0/old_image.bin
2022-04-30 18:22:34,334 # 6c1207ba448d380133ada360f42633d2bdfd83e4  /nvm0/image.bin
2022-04-30 18:22:34,433 # a3b4b6aafef50f0efcff0b0fc52fc98ef1c80217  /nvm0/old_image.bin

2022-04-30 18:22:48,370 # > sha256sum /nvm0/image.bin /nvm0/old_image.bin
2022-04-30 18:22:48,461 # 00848c421e9661a33b54e0905abdd3be9a1084f890fe0cef78dbbfbb5bf3e54a  /nvm0/image.bin
2022-04-30 18:22:48,544 # ceea881479bc0dd542393531e01a59a4397f06fab47550ecc818fc0059b6008b  /nvm0/old_image.bin

Issues/PRs references

@github-actions github-actions bot added Area: build system Area: Build system Area: sys Area: System labels Apr 30, 2022
@benpicco benpicco requested review from chrysn and fjmolinas May 1, 2022 21:52
@fjmolinas
Copy link
Contributor

Can you rebase and trigger the ci?

@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label May 17, 2022
@benpicco benpicco requested review from kfessel and maribu May 18, 2022 21:45
Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

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

ACK. Code looks good and I trust your testing results

@benpicco benpicco merged commit 82fd89f into RIOT-OS:master May 19, 2022
@benpicco benpicco deleted the vfs_util-hash branch May 19, 2022 07:08
@chrysn
Copy link
Member

chrysn commented May 19, 2022

Nice. I've wanted something like a light version of Linux's fs-verity, but a VFS helper for checksumming is a good thing to have until then. (If some future file systems store checksums and verify them at read time, they could later short-cut the reading and provide the check sum directly).

@chrysn chrysn added this to the Release 2022.07 milestone Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: build system Area: Build system Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants