Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1753834pxp; Thu, 10 Mar 2022 11:26:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxXbnZFK47fkolfcaQXHTGBo5EHnQoIkPGSVmSxbFyXPSRB6OYffeQwt+MV4wsEfziGaeGU X-Received: by 2002:a63:91c1:0:b0:37f:eeee:6692 with SMTP id l184-20020a6391c1000000b0037feeee6692mr5292490pge.603.1646940409595; Thu, 10 Mar 2022 11:26:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646940409; cv=none; d=google.com; s=arc-20160816; b=xoiSHdWgOvcJivFZVI+k+rIlGfjb/uf4CSr0huFoSL5zGkUN9fKcJKfG6s4LC7gpbt EImLU70NrmPrT5toovxkl6LgPhJfQgnGKHcAY0vy3aLDMUpEm8nADjpkoaBs3pG5Np9l Pc4YmG5cfD2fgufeqhhT311izhzdNW0lUkl4Ya45AwXQZLdP/2kJ9eSXOSpNtNxNd1xy MN+wLd8a3hxUM5CnFdhtKAB0dm+MkmAlVwZYh5dJkZu0Npbmt4zod+4Z2sUeVoYplHJJ 1IC7unwcjvUtMDEh+jOIwISeovOa8VyZLl3WpReQokDuuuzgUv32pERJ+YBSUJtQUPOj pfmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=y6eO8XbobmJwk07KyUQcG8ew/bFwEAqu4InZOavV7ZM=; b=eiytGi48ndUWWx+zg4AsCcJRhjdzincaIioG4eSo//o6XO66+4xccY8J8BmlVNZbFk QhIKzM8XXWO2jy5/js92XSHF0expVQlG+9u8N9293Th4GWh8ek2cgA9HWa0cORWl0bIf nAftH6YYwSvaV7ic18a1lDXxLjpB3bVh4ZaBQ715gOdH2TU7aa6Cjk+L6e9txjoSZSHf g09XGHkqhnqupUWTxuEfIEVAxw9dS1/xe4E+v4JGTNgBOFPWVaHS0P8KXWsFjvZRBZh+ hj7g9n8M7izeuRqRiepyjhJMRltFPHgWUfaz6Wi1p9git1jFZh6ekaKOB4r2U4mb8pR5 iYNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YTkLBhAD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020a170902e94d00b001500c602582si5674800pll.621.2022.03.10.11.26.32; Thu, 10 Mar 2022 11:26:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=YTkLBhAD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244072AbiCJQxI (ORCPT + 99 others); Thu, 10 Mar 2022 11:53:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244327AbiCJQxB (ORCPT ); Thu, 10 Mar 2022 11:53:01 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8033198D30 for ; Thu, 10 Mar 2022 08:51:57 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id 9so5385229pll.6 for ; Thu, 10 Mar 2022 08:51:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=y6eO8XbobmJwk07KyUQcG8ew/bFwEAqu4InZOavV7ZM=; b=YTkLBhADqm9amv8PHrviGDK7uKbDAZgW7pTRiKrarMaKDkgVtNpIIN+9hNVp4Ef3qI 3w8N8HgC43l507NznwsW5B3iVpzhTE+71LKzCdVPMk0OUcTgdrWfYg31w9PWfxTgc3Vv QDGxj6g6cf9/tGJQbvLczxTLlCPUEuuKI8PxM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=y6eO8XbobmJwk07KyUQcG8ew/bFwEAqu4InZOavV7ZM=; b=v0YnPQwxGYEfSwP2rviIxQwOMXLujHXGu3B1zIvQfxPygbRJxMPFMAFBX+XWeCnTN4 nsc5qpGa9RH8y4m0z2T8H4EceK96Zel3CYzJJKpMsfYIOh+5JdVZ+BCyGzqXbb7lf4oD VXKD/yrQ0+wR38pkssZOmKmcM0ZfFSxqU7zTNdjbOYP91Eoyvkc2HA8a2Qmoq9VB3DVF fkWewSBk2Ola6oQAYzxPyl8a9BEkqPlGLaN+Uzn6MgjZawQCn18sHtiS2vhBd+zrl0wJ y5KXGIhY77Qhz9r6qvI1Zo+dCN87RRCpAk1uWDUISoUU3VE5YeKQRbph38dxXFm/KkGw CCFw== X-Gm-Message-State: AOAM530JVFQcMM4hzpaV+dUKzocw8GMyoq7RZRLa2IHWCR/8B7DiSrXT KbcEApUsawoWLLdg4ejT9IprSg== X-Received: by 2002:a17:902:7e4d:b0:14f:e295:5a41 with SMTP id a13-20020a1709027e4d00b0014fe2955a41mr5872399pln.27.1646931117342; Thu, 10 Mar 2022 08:51:57 -0800 (PST) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id lb4-20020a17090b4a4400b001b9b20eabc4sm7078816pjb.5.2022.03.10.08.51.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Mar 2022 08:51:56 -0800 (PST) Date: Thu, 10 Mar 2022 08:51:56 -0800 From: Kees Cook To: Lee Jones Cc: David Howells , David Woodhouse , keyrings@vger.kernel.org, Adam Langley , linux-kernel@vger.kernel.org, Eric Biggers Subject: Re: [PATCH v2 1/1] sign-file: Do not attempt to use the ENGINE_* API if it's not available Message-ID: <202203100851.C00D9AB73@keescook> References: <20211005161833.1522737-1-lee.jones@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 08, 2022 at 10:31:11AM +0000, Lee Jones wrote: > OpenSSL's ENGINE API is deprecated in OpenSSL v3.0. > > Use OPENSSL_NO_ENGINE to ensure the ENGINE API is only used if it is > present. This will safeguard against compile errors when using SSL > implementations which lack support for this deprecated API. On Fedora rawhide, I'm still seeing a bunch of warnings: scripts/sign-file.c: In function 'display_openssl_errors': scripts/sign-file.c:89:9: warning: 'ERR_get_error_line' is deprecated: Since OpenSSL 3.0 [-Wdeprecat ed-declarations] 89 | while ((e = ERR_get_error_line(&file, &line))) { | ^~~~~ In file included from scripts/sign-file.c:29: /usr/include/openssl/err.h:411:15: note: declared here 411 | unsigned long ERR_get_error_line(const char **file, int *line); | ^~~~~~~~~~~~~~~~~~ scripts/sign-file.c: In function 'drain_openssl_errors': scripts/sign-file.c:102:9: warning: 'ERR_get_error_line' is deprecated: Since OpenSSL 3.0 [-Wdepreca ted-declarations] 102 | while (ERR_get_error_line(&file, &line)) {} | ^~~~~ /usr/include/openssl/err.h:411:15: note: declared here 411 | unsigned long ERR_get_error_line(const char **file, int *line); | ^~~~~~~~~~~~~~~~~~ ... > > Cc: David Howells > Cc: David Woodhouse > Cc: Eric Biggers > Cc: Kees Cook > Cc: keyrings@vger.kernel.org > Co-developed-by: Adam Langley > Signed-off-by: Lee Jones > --- > v2: Clear up subject and patch description to avoid confusion > > scripts/sign-file.c | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > > diff --git a/scripts/sign-file.c b/scripts/sign-file.c > index fbd34b8e8f578..fa3fa59db6669 100644 > --- a/scripts/sign-file.c > +++ b/scripts/sign-file.c > @@ -135,7 +135,9 @@ static int pem_pw_cb(char *buf, int len, int w, void *v) > static EVP_PKEY *read_private_key(const char *private_key_name) > { > EVP_PKEY *private_key; > + BIO *b; > > +#ifndef OPENSSL_NO_ENGINE > if (!strncmp(private_key_name, "pkcs11:", 7)) { > ENGINE *e; > > @@ -153,17 +155,16 @@ static EVP_PKEY *read_private_key(const char *private_key_name) > private_key = ENGINE_load_private_key(e, private_key_name, > NULL, NULL); > ERR(!private_key, "%s", private_key_name); > - } else { > - BIO *b; > - > - b = BIO_new_file(private_key_name, "rb"); > - ERR(!b, "%s", private_key_name); > - private_key = PEM_read_bio_PrivateKey(b, NULL, pem_pw_cb, > - NULL); > - ERR(!private_key, "%s", private_key_name); > - BIO_free(b); > + return private_key; > } > +#endif > > + b = BIO_new_file(private_key_name, "rb"); > + ERR(!b, "%s", private_key_name); > + private_key = PEM_read_bio_PrivateKey(b, NULL, pem_pw_cb, > + NULL); > + ERR(!private_key, "%s", private_key_name); > + BIO_free(b); > return private_key; > } -- Kees Cook