Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932282AbcLNNo2 (ORCPT ); Wed, 14 Dec 2016 08:44:28 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:49890 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753463AbcLNNoZ (ORCPT ); Wed, 14 Dec 2016 08:44:25 -0500 MIME-Version: 1.0 In-Reply-To: <1e502c6b-cda3-c46d-2535-fcfb58f443a9@stressinduktion.org> References: <20161214035927.30004-1-Jason@zx2c4.com> <20161214035927.30004-3-Jason@zx2c4.com> <1e502c6b-cda3-c46d-2535-fcfb58f443a9@stressinduktion.org> From: "Jason A. Donenfeld" Date: Wed, 14 Dec 2016 14:44:12 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 3/4] secure_seq: use siphash24 instead of md5_transform To: Hannes Frederic Sowa Cc: David Laight , Netdev , kernel-hardening@lists.openwall.com, Andi Kleen , LKML , Linux Crypto Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 965 Lines: 21 Hi Hannes, Thanks for the feedback. > __packed not only removes all padding of the struct but also changes the > alignment assumptions for the whole struct itself. The rule, the struct > is aligned by its maximum alignment of a member is no longer true. That > said, the code accessing this struct will change (not on archs that can > deal efficiently with unaligned access, but on others). That's interesting. There currently aren't any alignment requirements in siphash because we use the unaligned helper functions, but as David pointed out in another thread, maybe that too should change. In that case, we'd have an aligned-only version of the function that requires 8-byte aligned input. Perhaps the best way to go about that would be to just mark the struct as __packed __aligned(8). Or, I guess, since 64-bit accesses gets split into two on 32-bit, that'd be best descried as __packed __aligned(sizeof(long)). Would that be an acceptable solution? Jason