From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031120Ab2CVVw2 (ORCPT ); Thu, 22 Mar 2012 17:52:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60625 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965161Ab2CVVwY (ORCPT ); Thu, 22 Mar 2012 17:52:24 -0400 Date: Thu, 22 Mar 2012 17:52:11 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file.rdu.redhat.com To: Mandeep Singh Baines cc: device-mapper development , Steffen Klassert , Will Drewry , linux-kernel@vger.kernel.org, Elly Jones , Olof Johansson , Andrew Morton , Alasdair G Kergon , Milan Broz Subject: Re: [dm-devel] [PATCH] dm: remake of the verity target In-Reply-To: <20120322174101.GM27051@google.com> Message-ID: References: <20120306215947.GB27051@google.com> <20120320154159.GD27051@google.com> <20120322174101.GM27051@google.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 22 Mar 2012, Mandeep Singh Baines wrote: > Mikulas Patocka (mpatocka@redhat.com) wrote: > > > > This is improved patch that supports both the old format and the new > > format. I checked that it is interoperable with with the old Google > > userspace tool and with the original Google kernel driver. > > > > Thanks much for doing this:) > > This looks good but would a prepend/append flag be better? It does more than changing prepend/append salt. I changed alignment in the new format so that it doesn't have to use a multiply instruction. In the old format, if digest size is not a power of two, all digests are placed first and the rest of the block is padded with zeros. In the new format, each digest is padded with zeros to a power of two. For example, when using sha1, the old format padding looks like this: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbb bbbbbbbbbbbbbbbbccccccccccccccccccccccccccccccccccccccccdddddddd dddddddddddddddddddddddddddddddd00000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 ... and the new format padding looks like this: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa000000000000000000000000 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb000000000000000000000000 cccccccccccccccccccccccccccccccccccccccc000000000000000000000000 dddddddddddddddddddddddddddddddddddddddd000000000000000000000000 The version "0" (first argument in the target line) actually means the old style padding and the salt is hashed after the data. The version "1" means new style padding and the salt is hashed before the data. If someone comes with another format, we can use version "2" for it, etc. Mikulas