From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YNLKk-0007hN-59 for barebox@lists.infradead.org; Mon, 16 Feb 2015 13:03:31 +0000 Received: by mail-wi0-f171.google.com with SMTP id hi2so25861472wib.4 for ; Mon, 16 Feb 2015 05:03:07 -0800 (PST) From: h.feurstein@gmail.com Date: Mon, 16 Feb 2015 14:02:35 +0100 Message-Id: <1424091755-23273-1-git-send-email-h.feurstein@gmail.com> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH] commands/digest: add verify support To: barebox@lists.infradead.org RnJvbTogSHViZXJ0IEZldXJzdGVpbiA8aC5mZXVyc3RlaW5AZ21haWwuY29tPgoKU2lnbmVkLW9m Zi1ieTogSHViZXJ0IEZldXJzdGVpbiA8aC5mZXVyc3RlaW5AZ21haWwuY29tPgpbRUJdOiByZXdv cmtlZCBiYXNlZCBvbiBTYXNjaGEncyBjb21tZW50cyBhbmQgdGVzdGVkIHdpdGggbWQ1c3VtClNp Z25lZC1vZmYtYnk6IEVyaWMgQsOpbmFyZCA8ZXJpY0BldWtyZWEuY29tPgotLS0KIGNvbW1hbmRz L2RpZ2VzdC5jIHwgMTIwICsrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysr KysrKysrKystLS0tLQogMSBmaWxlIGNoYW5nZWQsIDExMCBpbnNlcnRpb25zKCspLCAxMCBkZWxl dGlvbnMoLSkKCmRpZmYgLS1naXQgYS9jb21tYW5kcy9kaWdlc3QuYyBiL2NvbW1hbmRzL2RpZ2Vz dC5jCmluZGV4IDA5MmZkYTIuLjJhOTgyZTUgMTAwNjQ0Ci0tL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