[Teep] OTrP Proposal - Chunking Data to Conserve RAM

Anders Rundgren <anders.rundgren.net@gmail.com> Tue, 23 May 2017 15:11 UTC

Return-Path: <anders.rundgren.net@gmail.com>
X-Original-To: teep@ietfa.amsl.com
Delivered-To: teep@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 772EC129B95 for <teep@ietfa.amsl.com>; Tue, 23 May 2017 08:11:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0
X-Spam-Level:
X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[BAYES_50=0.8, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RqNXBYIjQcSK for <teep@ietfa.amsl.com>; Tue, 23 May 2017 08:11:45 -0700 (PDT)
Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2736412954E for <teep@ietf.org>; Tue, 23 May 2017 08:11:45 -0700 (PDT)
Received: by mail-wm0-x22d.google.com with SMTP id b84so28655814wmh.0 for <teep@ietf.org>; Tue, 23 May 2017 08:11:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:references:to:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=WNo4YmP73d3Ac2rICA1IK41/RyDo3PDUNl/8gnxkRFc=; b=Y2SwNtXnFL7oACVyFnXtJJ5fYwNSn2Ui+GDWwgniGLtG/onSlDHXb7B3gPAse35Lrt 8XuwnfQtbpdkHU8hxaGB3uIS+eGWbme7llgNz+RiabSjFuoiBf1TzHwqBXGjbEq6K7zT uizqA7jwyB6FyGuOep/FppG3Ynm4898CWEOZW/WbnZl71qPMRCGspoAZP70CBlDT0SPr CmN6UHXi2REdLI+//nckcWitQsm62iN8cBjUcJYAZbbGCSq1qXB7gnozSFv+BVlUN72c CEHPVxJ0BZg1vpgGUjvr6n1IVN85GTJI7wAP8F9L/hHzdcvwpliZ/kdnlzi24y2KD55U pZRA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:references:to:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=WNo4YmP73d3Ac2rICA1IK41/RyDo3PDUNl/8gnxkRFc=; b=OvWPpFuqvgpgF/zK1mZaB1YRtaVZbYI6C8yHaRBMYF0+JW7eivytuFb1G5TiUf9LYe RSmaJJCASJ8sHPwNBDx8r40pBgrCKuUeoPMcDFhte/ibFE0I3CrjciZqjdDsNE60qVAQ U6c9BIzwOXn6FYy3uFE0a3Hb1R+YGL2s6d0yhEntG2X7xzEMJ4oK6NlhrMj1H0lxm2il R92uh/IRu0uBt3a2DwjHCQJGbz+jQco4TzMS1wimRHZgh7MY+GKmPtqFXitK9GDtPeqs o8mY/57isMkhpf2bLj6eic60kZi+CCXhn22W0oul5GPx1wn6mS6KV1l5fjm16zQ+R3D1 n8sA==
X-Gm-Message-State: AODbwcAG7cxz0eE/vvdtSXWqDM7k5PACUQOz794y0HeGmdHUrY9cvAx9 dDax2VA/egfk6g==
X-Received: by 10.223.131.129 with SMTP id 1mr15686143wre.104.1495552303671; Tue, 23 May 2017 08:11:43 -0700 (PDT)
Received: from [192.168.1.79] (124.25.176.95.rev.sfr.net. [95.176.25.124]) by smtp.googlemail.com with ESMTPSA id v7sm1600894wrb.68.2017.05.23.08.11.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 May 2017 08:11:43 -0700 (PDT)
References: <681c5c6b-0c74-8ec0-0484-f38beaf2dd66@gmail.com>
To: teep@ietf.org
From: Anders Rundgren <anders.rundgren.net@gmail.com>
X-Forwarded-Message-Id: <681c5c6b-0c74-8ec0-0484-f38beaf2dd66@gmail.com>
Message-ID: <6a3da7e6-10e8-e1f3-0a5d-5126f8b62b9a@gmail.com>
Date: Tue, 23 May 2017 17:11:41 +0200
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <681c5c6b-0c74-8ec0-0484-f38beaf2dd66@gmail.com>
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/teep/qs-4aXf2Fx9mrBOz6Kj8f1Mk7G8>
Subject: [Teep] OTrP Proposal - Chunking Data to Conserve RAM
X-BeenThere: teep@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: A Protocol for Dynamic Trusted Execution Environment Enablement <teep.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/teep>, <mailto:teep-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/teep/>
List-Post: <mailto:teep@ietf.org>
List-Help: <mailto:teep-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/teep>, <mailto:teep-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 23 May 2017 15:11:48 -0000

Hi fellow TEEers,

As some of you know I have been working for a long time on a concept coined SKS/KeyGen2 which is about using a TA (or HW) as a universal keystore and then be able managing keys in an E2ES (End to End Security) fashion over the Web.

Since the data structures you can create with the management protocol (KeyGen2) are arbitrary complex, a naive approach would require an equally arbitrary amount of RAM.  Since RAM vs FLASH/ROM typically differ with a factor of 10 or more, I simply had to come up with a better solution.

The solution I found was to creating a _session_key_ and do things in _steps_.  This allows the system to use a non-encrypted (but MACed) API and only encrypt data which absolutely needs encryption. Another benefit is that the protocol can work on (what appears to be) a high level including aggregation of API calls.

https://cyberphone.github.io/doc/security/keygen2.html#Sample_Run

Are there downsides to this you may wonder?  Of course, _all_ solutions have such :-)
If a session is abruptly terminated you may end up with a bricked system.

Workaround:  The SKS (Secure Key Store) builds on a transaction concept so that nothing is "committed" (inside of it) until the last call has been _successfully_performed_.

There's another important benefit of the session key approach: Format independency on the protocol side since the API only needs to process low-level binary. That is, OTrP could be dressed in JSON and CBOR without _any_ protocol/API level adjustments.

This is not only a nice theory, a public PoC using a "soft" SKS is available for anybody having 5-10 minutes to spend:
https://test.webpki.org/webpay-merchant
https://play.google.com/store/apps/details?id=org.webpki.mobile.android

The next [anticipated] step on this project is transcending cryptographic keys to become first-class OS objects like Files, Processes, Users, etc. which I recently presented at Linaro Connect in Budapest.

Cheers,
Anders
https://priorart.ip.com/IPCOM/000215433