summaryrefslogtreecommitdiffstats
path: root/include/digest.h
Commit message (Collapse)AuthorAgeFilesLines
* fs: ubifs: Add authentication supportSascha Hauer2019-04-241-0/+5
| | | | | | | | | | | | This adds UBIFS authentication support. For now, we do not do any authentication even on authenticated UBIFS images. Since this behaviour is not what the user normally expects when mounting authenticated images we only do this when the user explicitly allows it in "global.ubifs.allow_authenticated_unauthenticated". If the flag is false then we refuse mounting such an image and return -EPERM instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: digest: Change the signature of digest_file_window()Andrey Smirnov2019-01-161-1/+1
| | | | | | | | | On 32-bit systems "ulong" will limit digest_file_window()'s maximum size to 4 GiB. Convert "start" and "size" to "loff_t" in order to be able to handle maximum file size supported by the rest of the system. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* digest.h: Sync hash_algo values with kernelSascha Hauer2018-10-081-1/+7
| | | | | | | | enum hash_algo is exported from the Kernel, so sync it with the numbers that are exported. Since we have barebox specific extensions to the hash_algo list add a big comment and put the extenstions at the end. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: add CRC32 digestYegor Yefremov2016-05-251-0/+1
| | | | | | | CRC32 digest can be used to check CRC32 hashes in FIT images etc. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: add digest_alloc_by_algo()Sascha Hauer2016-01-261-0/+23
| | | | | | | | | | | In barebox the function digest_alloc() allocates a digest based on a string. When a subsystem already uses an integer value to identify a digest it makes no sense to create a string and pass it to digest_alloc(), where it is parsed again. This patch adds the possibility to get a digest by an enum. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: digest: provide static inline no-ops if digest is disabledMarc Kleine-Budde2015-06-171-0/+11
| | | | | | Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: digest: mark signature argument as constMarc Kleine-Budde2015-05-261-5/+5
| | | | | Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: sha1: switch to linux implementationJean-Christophe PLAGNIOL-VILLARD2015-03-271-0/+5
| | | | | | | | | | | | | | | | | current implementation $ ls -al build/versatilpb/arch/arm/pbl/zbarebox.bin -rw-r--r-- 1 root root 211095 Mar 24 13:21 build/versatilpb/arch/arm/pbl/zbarebox.bin linux generic implementation $ ls -al build/versatilpb/arch/arm/pbl/zbarebox.bin -rw-r--r-- 1 root root 210829 Mar 24 13:21 build/versatilpb/arch/arm/pbl/zbarebox.bin on a compressed lzo barebox we will 266 bytes Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: prepare to allow multiple digest driverJean-Christophe PLAGNIOL-VILLARD2015-03-271-3/+9
| | | | | | | | | | This will allow to have hw driver or asm optimised driver. Use a priority level to determine which one to use at runtime. The generic one will be 0. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* digest: allow algo to specify their length at runtimeJean-Christophe PLAGNIOL-VILLARD2015-03-271-1/+2
| | | | | | | | such as RSA as we load a DER key we will detect the key size at runtime and so the algo length. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: digest: speficied when a digest need a key to be usedJean-Christophe PLAGNIOL-VILLARD2015-03-201-0/+12
| | | | | | | | | | | such as for hmac(xxx) you must provide a key This will allow to enforce the correct parameter at digest command <digest>sum is not impacted Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* command: add generic digest commandJean-Christophe PLAGNIOL-VILLARD2015-03-201-2/+6
| | | | | | | That can be used for digest calculation and verify Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* digest: add digest callbackJean-Christophe PLAGNIOL-VILLARD2015-03-191-0/+8
| | | | | | | | | | | Combination of @init and @update and @final. This function effectively behaves as the entire chain of operations, @init, @update and @final issued in sequence. This is added for hardware which cannot do even the @finup, but can only do the whole transformation in one run. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* digest: add verify callbackJean-Christophe PLAGNIOL-VILLARD2015-03-191-0/+6
| | | | | | | | | | | | this will allow to compare a md with the original one When calling this do not call final For RSA_SIGN verification final does not exist only verify as final will be for signing Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: digest: digest_file_window/digest_file/digest_file_by_name drop key ↵Jean-Christophe PLAGNIOL-VILLARD2015-03-191-3/+0
| | | | | | | | | params expect the key to be set before calling Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: digest: Make string arguments constSascha Hauer2015-03-131-9/+10
| | | | | | | Most string arguments for keys and filenames can be const. Change that. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* command: add hmac sum supportfor md5, sha1, sha224, sha256, sha384, sha512Jean-Christophe PLAGNIOL-VILLARD2015-03-131-0/+3
| | | | | | | | | | | | | | | pass the key via -h param barebox@barebox sandbox:/ sha256sum -h test /dev/fd0 c297473e9bb221c5dc51d47ad75c76095f1bdc4ca9dff1d5931c2e22bf11a0de /dev/fd0 0x00000000 ... 0xffffffffffffffff use the same idea as openssl command $ openssl dgst -sha256 -hmac "test" TODO HMAC-SHA256(TODO)= c297473e9bb221c5dc51d47ad75c76095f1bdc4ca9dff1d5931c2e22bf11a0de Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* digest: add HMAC support for md5, sha1, sha224, sha256, sha384, sha512Jean-Christophe PLAGNIOL-VILLARD2015-03-131-0/+8
| | | | | | | the hmac algo will be registered as hmac(%s) such as hmac(sha256) Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* digest: make it multi-instanceJean-Christophe PLAGNIOL-VILLARD2015-03-121-9/+19
| | | | | | | | | | Now you need to call digest_alloc and when you finish to use it digest_free. We need this for upcomming aes encryption support and secure boot as we will need multiple instance of the same digest. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* digest: introduce digest_{init/update/final/length}Jean-Christophe PLAGNIOL-VILLARD2015-03-121-0/+21
| | | | | | | | This will allow to move from a one at a time digest to a multi-instance with too much impact on the code using it Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* digest: factorise file digest to common/digest.cJean-Christophe PLAGNIOL-VILLARD2011-10-121-0/+8
| | | | | | | | | | rename it to digest_file_window introduce digest_file to digest a file and digest_file_by_name where we specify the algo by name Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add digest frameworkJean-Christophe PLAGNIOL-VILLARD2010-09-201-0/+49
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>