[Cfrg] SHA256 based AEAD construction

Fihlman Emil <emil.fihlman@aalto.fi> Mon, 18 February 2019 23:17 UTC

Return-Path: <emil.fihlman@aalto.fi>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost []) by ietfa.amsl.com (Postfix) with ESMTP id 740F41271FF for <cfrg@ietfa.amsl.com>; Mon, 18 Feb 2019 15:17:16 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.3
X-Spam-Status: No, score=-4.3 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=aalto.fi
Received: from mail.ietf.org ([]) by localhost (ietfa.amsl.com []) (amavisd-new, port 10024) with ESMTP id kyJnhZqwy4EQ for <cfrg@ietfa.amsl.com>; Mon, 18 Feb 2019 15:17:13 -0800 (PST)
Received: from smtp-out-02.aalto.fi (smtp-out-02.aalto.fi []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5165D128B33 for <cfrg@irtf.org>; Mon, 18 Feb 2019 15:17:13 -0800 (PST)
Received: from smtp-out-02.aalto.fi (localhost.localdomain []) by localhost (Email Security Appliance) with SMTP id B49942713D1_C6B3BD9B for <cfrg@irtf.org>; Mon, 18 Feb 2019 23:12:25 +0000 (GMT)
Received: from exng4.org.aalto.fi (exng4.org.aalto.fi []) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (Client CN "exng4.org.aalto.fi", Issuer "org.aalto.fi RootCA" (not verified)) by smtp-out-02.aalto.fi (Sophos Email Appliance) with ESMTPS id 8FDE32713C3_C6B3BD9F for <cfrg@irtf.org>; Mon, 18 Feb 2019 23:12:25 +0000 (GMT)
Received: from exng8.org.aalto.fi ( by exng4.org.aalto.fi ( with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 19 Feb 2019 01:17:10 +0200
Received: from exng5.org.aalto.fi ( by exng8.org.aalto.fi ( with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 19 Feb 2019 01:17:09 +0200
Received: from exng5.org.aalto.fi ([fe80::c840:c193:838f:f99c]) by exng5.org.aalto.fi ([fe80::c840:c193:838f:f99c%17]) with mapi id 15.01.1591.008; Tue, 19 Feb 2019 01:17:09 +0200
From: Fihlman Emil <emil.fihlman@aalto.fi>
To: "cfrg@irtf.org" <cfrg@irtf.org>
Thread-Topic: SHA256 based AEAD construction
Thread-Index: AQHUx9pvOZNhhTnRDUWYeUMQ7Yvkyg==
Date: Mon, 18 Feb 2019 23:17:09 +0000
Message-ID: <fd27f95772f940889e6ab8e895f3efd9@aalto.fi>
Accept-Language: fi-FI, en-US
Content-Language: fi-FI
x-originating-ip: []
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aalto.fi; h=from:to:subject:date:message-id:content-type:content-transfer-encoding:mime-version; s=its18; bh=fdm0w5iZPTjf8cLM2nU41ERcydzDNqWq0hG8/NHZfi8=; b=NRdEL4szPmin2p0bC4Fk6j3KwM/T5bVYAjffFue/3HXuW81RmtsmIav/VJB3IDTeXi9rsc46BElakg5lg7olpaDITbGYu5Yn7Mf19fJxkkv3bm7SCIisbW8mZPfzBaTfqB9Hh44CVLrqWAiMvGJhCfRwS8W/YaCrohvt8RGHV93kwqx2mwhDbhELIjyxmpqbg47CKmsHAzc1Wuqr62GSTMpztkKZbbxn7g7uWlyDYNfYk+USj3OAg4YUYrQG9qmbweQdoAheoHlBfT9DA2tE9SS+wnfCKS6G9Rm31lsdlvKE+JSkqmSQAJkH3JbcHmhWTTj/YX9y27IwUYMepSCywQ==
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/LRhCd9zYT5EpmMCTBB0EtdRCNsY>
Subject: [Cfrg] SHA256 based AEAD construction
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg/>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Mon, 18 Feb 2019 23:17:17 -0000


Let me first apologise if this is not the correct forum (if so, any pointers towards a place of discussion are appreciated).

I recently implemented a SHA256 based AEAD crypto (base file https://emil.fi/d/sha256.c and a test program / simple utility https://emil.fi/d/sha256crypt.c).

In a nutshell:
We make an intermediate key kv by taking sha256(key|vector), which is then used to
a) generate a random keystream by taking sha256(kv|counter), with which input is xorred by and
b) take a hmac of the ciphertext for authentication.

This concept is nothing new nor special. Some positives provided by this scheme are a) the base key is in the system only for a brief moment, b) it's very, very simple and easy to audit and use.

My current idea is to release this as a foss library after refinements, mainly targeted for resource limited systems.
I greatly appreciate any criticism, guidance, ideas and suggestions (especially improvements on reducing ram and cpu requirements and hardening against any timing/side channel attacks are welcomed, I suspect there are quite a few low hanging fruits at the moment).

Emil Fihlman