Re: [PATCH 4/7] digest: add verify callback

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Mar 13, 2015, at 1:41 AM, Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote:
> 
> On Thu, Mar 12, 2015 at 03:22:23PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
>> 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@xxxxxxxxxxxx>
>> ---
>> crypto/digest.c   | 23 ++++++++++++++++++++++-
>> crypto/hmac.c     |  1 +
>> crypto/internal.h |  2 ++
>> crypto/md5.c      |  1 +
>> crypto/sha1.c     |  1 +
>> crypto/sha2.c     |  2 ++
>> crypto/sha4.c     |  2 ++
>> include/digest.h  |  6 ++++++
>> 8 files changed, 37 insertions(+), 1 deletion(-)
>> 
>> diff --git a/crypto/digest.c b/crypto/digest.c
>> index c06089d..98c3607 100644
>> --- a/crypto/digest.c
>> +++ b/crypto/digest.c
>> @@ -26,6 +26,8 @@
>> #include <module.h>
>> #include <linux/err.h>
>> 
>> +#include "internal.h"
>> +
>> static LIST_HEAD(digests);
>> 
>> static struct digest_algo *digest_algo_get_by_name(const char *name);
>> @@ -37,9 +39,28 @@ static int dummy_init(struct digest *d)
>> 
>> static void dummy_free(struct digest *d) {}
>> 
>> +int digest_generic_verity(struct digest *d, const unsigned char *md)
> 
> s/verity/verify/
> 

I already fix this wired that the pull is different from my local version
>> +{
>> +	int ret;
>> +	int len = digest_length(d);
>> +	unsigned char *tmp;
>> +
>> +	tmp = xmalloc(sizeof(len));
> 
> sizeof(len) is not what you want.
> 
ditto
>> +
>> +	ret = digest_final(d, tmp);
>> +	if (ret)
>> +		goto end;
>> +
>> +	ret = memcmp(md, tmp, len);
> 
> ret = ret ? -EINVAL : 0;
> 
> To consistently return an error code.
yeap

Best Regards,
J.
> 
> Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux