From patchwork Mon Jun 10 12:08:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 166314 Delivered-To: patches@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp949490ilk; Mon, 10 Jun 2019 05:09:06 -0700 (PDT) X-Received: by 2002:a17:90a:30cf:: with SMTP id h73mr21357515pjb.42.1560168546636; Mon, 10 Jun 2019 05:09:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560168546; cv=none; d=google.com; s=arc-20160816; b=PYY7NFqqwzYdObeInkju4tjwqCOc8+oOzBoONx8WyH3weTMsCYiB6PYbtF9yM9KqKf MSas2WCE4b9lzVT/92aXgCdgLs2oVYvBhnSBisOw4TT8eQnzvNlAegLQD8d5pmkJ91wS DiZzO2QFZ7KsJsQmDfRCqAcETnrpx9dbwD00tgVGZ63EgOFcmW1D0Cno8h79djSJ8Trv laMJY4t4uwBopZkKeRE5DR55+P/oWF/6oF/pjrXuYr+XkVd3Rtk4exzI7WGQ9mf8KFy5 K5+20yMv2YZ5KkXqnzzPPXnhb+4e8ohET0P4ah6kjKtll4+SDPsDo0PTkST/tfkfpck9 nExw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R+jHcisbx1tt/pu2xGZj1ycF1n/RmYgv7srHZQSAev4=; b=ljN5SpwRuccNMxpTZp4w7AAWPT2UIz/vcUbAt1cyhwiuez9b5zQLTwtDuuIbeqZb5N skB3RO/edcTUo5p6Y1yjOTwsYIK3StU5/mH8ERNr3BltWe+VUlc8bDpuNcmkOuRC3gl7 4LSE44w05qX8CPqf0nTMn4hF8+c7W12qcMWqE7N9vuw5EuOhGB+t6CTGjh4UZvXBDYQa Cz9WGOH3GVcsswUdbCW4DROLEu8wyfdfbSxnm4qQsnidpygZtv7Ay6HBqvfLBRk2SC7l NRJO1PVt/FPvqVnLDzI8VTNvDG7vubxvc6EyAYnM39EzbuNFXLQ/EqouzuVBAkaAfN70 7Pew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oCYS+NY5; spf=pass (google.com: domain of sumit.garg@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=sumit.garg@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id h1sor8694045pgc.77.2019.06.10.05.09.06 for (Google Transport Security); Mon, 10 Jun 2019 05:09:06 -0700 (PDT) Received-SPF: pass (google.com: domain of sumit.garg@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oCYS+NY5; spf=pass (google.com: domain of sumit.garg@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=sumit.garg@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=R+jHcisbx1tt/pu2xGZj1ycF1n/RmYgv7srHZQSAev4=; b=oCYS+NY5YL6PkPCcVZ715Bf8TIF/qpxha86lVwwHKZ9zKM2ZYuM/xuww7vpivroQvl 4VS3Uo67bxhpyQOWtmzv2CBwWKyvGPzV/RcJLa0MFsT6JWiebwZ3dBsVOIuJ5kMgacBD mK7OgmPcPPePr6WqncyLGsARitGh/2XxowezstNiSu2RSoQqoXXSCMo7VssbFhJprl+o Ldkp9w7DuAOtuG3rhkOAdbjVe7BE2T3WugkG8H/gG4NPpeofw8GU+hY/MoRXyDvP/DMY ceHiv8iooib4Bq9lihoZPirlL5o5MN6yr1CIjpae/9trccHvgu19CqVjfOaM9HxABEQM VfFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=R+jHcisbx1tt/pu2xGZj1ycF1n/RmYgv7srHZQSAev4=; b=kPqwS09jljqx5XpeWnm7NMRU46oM2z4upTjkAQFRhPkxjBOraBC6PBEZwOmAqI0qV7 GUTeE4PA3qfqvbLXABBmX/aydOhTQGlG66iJI5mk+KlOmMabOLpKmW0Hgl3vNQ5dg+Wf HaJoMOhBRJFeYh+ZBIlX9lcw17wQYkbccBzk8rvb9x6tKsAigUFH2a39QRpwBQr9WX7A pDBWMKExX/dAsiIAc0uXqJyLyWvGg+wc0xAGa/K44d2DP9siLmcQSw2K5xJ6cgO3caoB q/t9aetFEWqVB28gRlZWMa4nkGndYeYEBgR6smbqKOac5olH7RKnjAV9cAha9pnc5wR8 yaLA== X-Gm-Message-State: APjAAAXlhnb8D+WUKrKQksT29DxWGQC4m56jlX0lFbcv5ba/zH9M6LmU x12ahFMco75vAExRhL8ASpmZCb2E X-Google-Smtp-Source: APXvYqxyArCN4nqS+GTwNqPkLkg+rCxs/r6Zpq+foFvMrMbOR7PEjUz3wq3/cMoK4eUcHUndP586Yg== X-Received: by 2002:a63:1d53:: with SMTP id d19mr15548095pgm.152.1560168546320; Mon, 10 Jun 2019 05:09:06 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([117.196.234.139]) by smtp.gmail.com with ESMTPSA id f7sm2452961pfd.43.2019.06.10.05.09.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Jun 2019 05:09:05 -0700 (PDT) From: Sumit Garg To: daniel.thompson@linaro.org Cc: patches@linaro.org, Sumit Garg Subject: [PATCH 5/7] KEYS: encrypted: Allow TEE based trusted master keys Date: Mon, 10 Jun 2019 17:38:33 +0530 Message-Id: <1560168515-32714-6-git-send-email-sumit.garg@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1560168515-32714-1-git-send-email-sumit.garg@linaro.org> References: <1560168515-32714-1-git-send-email-sumit.garg@linaro.org> Allow search for TEE based trusted keys to act as master keys in case TPM device is not present. Signed-off-by: Sumit Garg --- security/keys/encrypted-keys/masterkey_trusted.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/security/keys/encrypted-keys/masterkey_trusted.c b/security/keys/encrypted-keys/masterkey_trusted.c index dc3d18c..cb99832 100644 --- a/security/keys/encrypted-keys/masterkey_trusted.c +++ b/security/keys/encrypted-keys/masterkey_trusted.c @@ -26,6 +26,9 @@ * Trusted keys are sealed to PCRs and other metadata. Although userspace * manages both trusted/encrypted key-types, like the encrypted key type * data, trusted key type data is not visible decrypted from userspace. + * + * Also, check for alternate trusted keys provided via TEE in case there + * is no TPM available. */ struct key *request_trusted_key(const char *trusted_desc, const u8 **master_key, size_t *master_keylen) @@ -34,8 +37,11 @@ struct key *request_trusted_key(const char *trusted_desc, struct key *tkey; tkey = request_key(&key_type_trusted, trusted_desc, NULL); - if (IS_ERR(tkey)) - goto error; + if (IS_ERR(tkey)) { + tkey = request_key(&key_type_tee_trusted, trusted_desc, NULL); + if (IS_ERR(tkey)) + goto error; + } down_read(&tkey->sem); tpayload = tkey->payload.data[0];