From patchwork Tue Nov 16 11:25:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandy Harris X-Patchwork-Id: 12622073 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BB9CC433F5 for ; Tue, 16 Nov 2021 11:26:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6651B619E8 for ; Tue, 16 Nov 2021 11:26:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235004AbhKPL3t (ORCPT ); Tue, 16 Nov 2021 06:29:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234874AbhKPL3b (ORCPT ); Tue, 16 Nov 2021 06:29:31 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64B19C061766; Tue, 16 Nov 2021 03:25:35 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id b184-20020a1c1bc1000000b0033140bf8dd5so2095684wmb.5; Tue, 16 Nov 2021 03:25:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=KIxL8pBMd//z5YINEw+kh9VMjDTIKYH5lzSpZAefCDI=; b=WjtCOMMLpaA8sOhPA/0pKpG5Pjx22ssT5Zy9+XY45U6LQ7ZVk/7eaNAi4nZPfhoT09 7R4XhIrksJQ1CdNDDFWh1WJBhfGmzbwc+bGMwxKAC6ttM4G5LOS5AySeONbhcI1xHve/ X5wuPCrQR5rAfnh+sG1Yb7QziO5QrrIOxmSBH//cO0iUYtPws1fjK9ZiCNmVVEUU576H haZKIcCgIglMWTisNVK3Vd9dI8GqPpvTeqoEs7+71qxDhH5oTBmrWEgUEAwUF705qJ3z 4uzlGH6g5wHgOjurP7ylVKCafttBGNEZBHeYJEs+g3xAJo4Rj4avxR+UE9Fy+8Z65bSl 5fiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=KIxL8pBMd//z5YINEw+kh9VMjDTIKYH5lzSpZAefCDI=; b=yiEfgKW3d3TAxoGksgOH1hscOjdHkHpsxyUHCNtdy1qFZ52yosuH6wPwn7yFySqzb/ SD8IeZDHp+TTAev54D3qIWcjwDyq8zLCL3hxw1T1CEJj82/3ZrOUOxYSiiK/bM3CA/ii DjGkNJk9tz74XBxm4nmOp3JH9x+OU4tHiQmCW6zWkhC+6W7CE1iIgwi19smIgpkvdBpb WyrCiIeCv6bmE+NWkJrN1KitmjMiEifBNxnLlY+yF0Y7CZ8psSDo7+SgcjK6LWznr5IW oeSVQwGJ7/uUYsLEd0hWOPiI7l5M+js1KyxwoEOSf/XAFO0Iady/SIxiyuyFbcM1NA26 uqxg== X-Gm-Message-State: AOAM533FNYTD0hF+iM6DoiyQMVY/Z7IWmrQMncau++DbnQq4zKlfbMCb sD4aXmIBMCDbSRo1+XRtsvDHTl2EMVd6vg623yq7ajo4rM0= X-Google-Smtp-Source: ABdhPJxnbFQv1dTzlXUN67+XMFz/lUUZpvt7OlTc0tdxapNHsE53zcaflGNH6ScTj3O2csAYZxRXAeBNNWGHy7A7oNk= X-Received: by 2002:a7b:cf10:: with SMTP id l16mr69365510wmg.17.1637061933897; Tue, 16 Nov 2021 03:25:33 -0800 (PST) MIME-Version: 1.0 From: Sandy Harris Date: Tue, 16 Nov 2021 19:25:22 +0800 Message-ID: Subject: [PATCH 1/8] Replace memset() with memzero_explicit() To: LKML , Linux Crypto Mailing List , "David S. Miller" , Herbert Xu , Greg Kroah-Hartman Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Replace memset(address,0,bytes) which may be optimised away with memzero_explicit(address,bytes) which resists such optimisation --- crypto/des_generic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- diff --git a/crypto/des_generic.c b/crypto/des_generic.c index c85354a5e94c..105a32e7afea 100644 --- a/crypto/des_generic.c +++ b/crypto/des_generic.c @@ -30,7 +30,7 @@ static int des_setkey(struct crypto_tfm *tfm, const u8 *key, err = 0; } if (err) - memset(dctx, 0, sizeof(*dctx)); + memzero_explicit(dctx, sizeof(*dctx)); return err; } @@ -62,7 +62,7 @@ static int des3_ede_setkey(struct crypto_tfm *tfm, const u8 *key, err = 0; } if (err) - memset(dctx, 0, sizeof(*dctx)); + memzero_explicit(dctx, sizeof(*dctx)); return err; } From patchwork Tue Nov 16 11:27:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandy Harris X-Patchwork-Id: 12622079 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E6C4C433FE for ; Tue, 16 Nov 2021 11:28:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6618E61360 for ; Tue, 16 Nov 2021 11:28:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234967AbhKPLby (ORCPT ); Tue, 16 Nov 2021 06:31:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235030AbhKPLbc (ORCPT ); Tue, 16 Nov 2021 06:31:32 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5701C061202; Tue, 16 Nov 2021 03:27:54 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id d72-20020a1c1d4b000000b00331140f3dc8so2118116wmd.1; Tue, 16 Nov 2021 03:27:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=vWgOKohvQ1jgRBXJgzAciLoS0Yy7GFRwvJIzGnozW3I=; b=i1BgAeNO/tOsTb8KAd2vhXRtX4E303K14B3V/34rANciSCktefSUex0sMNQAm1f4To VPvE2xSPiOIG67HlR7UE6BkUKkUvWlGa48Ti4Wl1syF48lsOr8skMdR+sKtjmKa0TOBE VcQnADecEsinktocIlx+qrPmNVC3N6nCZfkx/i1IIPdNqBwmIjTwsRXfF0vq1/u8NGz5 jSTirGYqEUEVr0U+eZJBBDqndltIcnXBNyr6SFxS95JaecNLDO8YFGKZBSBqTQ0MOwF+ /8n1WkDRCknE9uuoHqQwPtMQZ1XbH/YkDb1AAEOMR9bCedB3vpfW2flwdGjH0ONM1ixt gVAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=vWgOKohvQ1jgRBXJgzAciLoS0Yy7GFRwvJIzGnozW3I=; b=G2548SxBGI0gMETp0nNj6MxPn2hR4D0UpiGZ5rVtZiUM2FAKJ5WXQFe1zuV25d5WQz HEfQzKYMKv8qL7mwQko9qrOZUTKVw2jbu5OBBloAoNL/GIe/RvpzuSn2b1Mbd4fTeZj1 l+W9o4/s46+Sjqj2z/3UhoqXK/5eep7+joAWi3WOOoNhKqQXoHFGuiSzQcDvzcskbVfY SrTms7kvF8FBb5QGoSbN6n3LZsuDyHt92fRjb40R10LL++AFlMedDvYsTcfrV8dwNLUd A6dZuP7h/VrLntZpsXIUOV8JzL23qIMomXddHd7VlsXjpwx3mlfeL7Br8ZLsVc/hZlRA K1Qw== X-Gm-Message-State: AOAM532mtrh4RH4nesIyh7HtAilQ8rrQR/MUENw63nwtJkE4aC24n1Z3 pgz93RfckWwhR5DLrGoiAMWE7hykzcQpL5+nbNtX+mlPWoM= X-Google-Smtp-Source: ABdhPJyBWvBh4Y082LIMiso5r6ENmFOkrKKeIhWG2FaAVAUFGOMJlcUc34PbNoiCJ2YYaifii8INeV82KxFVp67pB1Q= X-Received: by 2002:a05:600c:2246:: with SMTP id a6mr67603571wmm.5.1637062073422; Tue, 16 Nov 2021 03:27:53 -0800 (PST) MIME-Version: 1.0 From: Sandy Harris Date: Tue, 16 Nov 2021 19:27:41 +0800 Message-ID: Subject: [PATCH 2/8] Replace memset() with memzero_explicit() To: LKML , Linux Crypto Mailing List , "David S. Miller" , Herbert Xu , Greg Kroah-Hartman Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Replace memset(address,0,bytes) which may be optimised away with memzero_explicit(address,bytes) which resists such optimisation --- crypto/drbg.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) @@ -852,7 +852,7 @@ static int drbg_hash_df(struct drbg_state *drbg, } out: - memset(tmp, 0, drbg_blocklen(drbg)); + memzero_explicit(tmp, drbg_blocklen(drbg)); return ret; } @@ -895,7 +895,7 @@ static int drbg_hash_update(struct drbg_state *drbg, struct list_head *seed, ret = drbg_hash_df(drbg, drbg->C, drbg_statelen(drbg), &datalist2); out: - memset(drbg->scratchpad, 0, drbg_statelen(drbg)); + memzero_explicit(drbg->scratchpad, drbg_statelen(drbg)); return ret; } @@ -927,7 +927,7 @@ static int drbg_hash_process_addtl(struct drbg_state *drbg, drbg->scratchpad, drbg_blocklen(drbg)); out: - memset(drbg->scratchpad, 0, drbg_blocklen(drbg)); + memzero_explicit(drbg->scratchpad, drbg_blocklen(drbg)); return ret; } @@ -967,8 +967,7 @@ static int drbg_hash_hashgen(struct drbg_state *drbg, } out: - memset(drbg->scratchpad, 0, - (drbg_statelen(drbg) + drbg_blocklen(drbg))); + memzero_explicit(drbg->scratchpad, (drbg_statelen(drbg) + drbg_blocklen(drbg))); return len; } @@ -1015,7 +1014,7 @@ static int drbg_hash_generate(struct drbg_state *drbg, drbg_add_buf(drbg->V, drbg_statelen(drbg), u.req, 8); out: - memset(drbg->scratchpad, 0, drbg_blocklen(drbg)); + memzero_explicit(drbg->scratchpad, drbg_blocklen(drbg)); return len; } @@ -1202,8 +1201,8 @@ static int drbg_seed(struct drbg_state *drbg, struct drbg_string *pers, } if (!reseed) { - memset(drbg->V, 0, drbg_statelen(drbg)); - memset(drbg->C, 0, drbg_statelen(drbg)); + memzero_explicit(drbg->V, drbg_statelen(drbg)); + memzero_explicit(drbg->C, drbg_statelen(drbg)); } ret = __drbg_seed(drbg, &seedlist, reseed); diff --git a/crypto/drbg.c b/crypto/drbg.c index f72f340a1321..08c4586a4cc9 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -507,9 +507,9 @@ static int drbg_ctr_df(struct drbg_state *drbg, ret = 0; out: - memset(iv, 0, drbg_blocklen(drbg)); - memset(temp, 0, drbg_statelen(drbg) + drbg_blocklen(drbg)); - memset(pad, 0, drbg_blocklen(drbg)); + memzero_explicit(iv, drbg_blocklen(drbg)); + memzero_explicit(temp, drbg_statelen(drbg) + drbg_blocklen(drbg)); + memzero_explicit(pad, drbg_blocklen(drbg)); return ret; } @@ -580,9 +580,9 @@ static int drbg_ctr_update(struct drbg_state *drbg, struct list_head *seed, ret = 0; out: - memset(temp, 0, drbg_statelen(drbg) + drbg_blocklen(drbg)); + memzero_explicit(temp, drbg_statelen(drbg) + drbg_blocklen(drbg)); if (2 != reseed) - memset(df_data, 0, drbg_statelen(drbg)); + memzero_explicit(df_data, drbg_statelen(drbg)); return ret; } From patchwork Tue Nov 16 11:30:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandy Harris X-Patchwork-Id: 12622081 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF9EEC433F5 for ; Tue, 16 Nov 2021 11:33:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93B6C61360 for ; Tue, 16 Nov 2021 11:33:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235719AbhKPLfv (ORCPT ); Tue, 16 Nov 2021 06:35:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235554AbhKPLdt (ORCPT ); Tue, 16 Nov 2021 06:33:49 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DBC4C061766; Tue, 16 Nov 2021 03:30:52 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id d5so36908926wrc.1; Tue, 16 Nov 2021 03:30:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=3vMY7wpgxEOPnmcVhZUPHgtnZuCn2Fi54kwyxPuSgk8=; b=kzFtBPZjmp0qawjCbfxG0hnHk7KOrRP6WQUQX5LTYV2SFnL6XudBi5VXQpJjg+H3cR VMDzyBvvzhcucCY5qTArAiyUOaVmww1jULjbJWYqhmgIuofuniWBVQrzDPa/nhbfmaHb uNhsjT3Jh090Pe7+ISUlSpA8Kwsj5/+egeesATH6wHGnqCBSWME+Hn8AyRSTnBsdaizJ XbmIEoLvOkDjDcTp/EhIzMXUIuLR7o78amgM7h+/6Oq6ZjkPTnTqL0fGzFC4iUS79453 jLM6Lok1davECP+gqPQd0oZObZPLZMz2lXmrZaUmkCytScvgk5d3d+ovz+KXTN0Py1vc Z8sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=3vMY7wpgxEOPnmcVhZUPHgtnZuCn2Fi54kwyxPuSgk8=; b=sh2tJsScShaqrOJzLMig94XqVK5Y6ZgdJUGRwWww0d3Dq7fZz59bDJqgckU+0hfiNJ odulci9s5eNHIgJkch51idhDKVtz+hO0xlEEb6LRU1VwLGdQM/cSE4O4POioV9vxr7VJ B4vEibUeO2H53uB1w3i86PQGO/T8EVem7Q1lx+Dl343cG4tRRCAPujrobO7tqespBG7R nUdvJZfenUrqTRngx6fATAPbOApt3pYhElmmiYmtY70RrQvItO4Ur7oxwkGdIiyN/UkD cSElOcyhy+kDwshDtDgSHeIl5HxVmIieZiGhgpj8yF73CEyZT3O1TIayFwYk4d/BRqyN Be/A== X-Gm-Message-State: AOAM530AJfXypxL5j/2zaje/AAyuxo6MAbEybp+agS6lj+MVeYaDJK54 kx3YpbrIgAzdOhKFUXXcJt+zeMYGPxyx6hUEkw+igxb5LhU= X-Google-Smtp-Source: ABdhPJzzFCih2BQmHE18MCNDHQ736Sv16LAswewqmtT6w64I5zRTmsiO6WN0ZLPpnX5P8nlDxIj6cB0AOBnu6Oq3hs4= X-Received: by 2002:a05:6000:52:: with SMTP id k18mr8225993wrx.192.1637062250915; Tue, 16 Nov 2021 03:30:50 -0800 (PST) MIME-Version: 1.0 From: Sandy Harris Date: Tue, 16 Nov 2021 19:30:39 +0800 Message-ID: Subject: [PATCH 3/8] Replace memset() with memzero_explicit() To: LKML , Linux Crypto Mailing List , "David S. Miller" , Herbert Xu , Greg Kroah-Hartman Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Replace memset(address,0,bytes) which may be optimised away with memzero_explicit(address,bytes) which resists such optimisation --- crypto/dh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/dh.c b/crypto/dh.c index cd4f32092e5c..ff7dc65b3b41 100644 --- a/crypto/dh.c +++ b/crypto/dh.c @@ -25,7 +25,7 @@ static void dh_clear_ctx(struct dh_ctx *ctx) mpi_free(ctx->q); mpi_free(ctx->g); mpi_free(ctx->xa); - memset(ctx, 0, sizeof(*ctx)); + memzero_explicit(ctx, sizeof(*ctx)); } /* From patchwork Tue Nov 16 11:32:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandy Harris X-Patchwork-Id: 12622131 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05491C433EF for ; Tue, 16 Nov 2021 11:36:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3C3761AA3 for ; Tue, 16 Nov 2021 11:36:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235144AbhKPLjI (ORCPT ); Tue, 16 Nov 2021 06:39:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235475AbhKPLiG (ORCPT ); Tue, 16 Nov 2021 06:38:06 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C4ECC061764; Tue, 16 Nov 2021 03:32:59 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id a9so10695411wrr.8; Tue, 16 Nov 2021 03:32:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=MwLBy7MN9rjOVXhuT6sJXkWqGYnANC26XLE5d8TIP2Q=; b=D00XmI5yrQrfUGaeKyMzsfY8RNjjMt8lkKZ+ONpTApw9XlyRxU9RYC744+12rvK8Ks 6JxSFOiWlDSVI3eAFxm8K8caAqtBXetSwMPf3OTWgNNTcGceTAsNkYHcbShp0xv9H6NC gk0W+dWgc5BHF3Qb9XdTNaBjIZx45C2SHpbtmZeEa7HxC0NeoZGHwfY898jNio8jRi4S NuTyLVkhtj9HtFxKAwUbwZD1PhYhS9jv06Rwqx27sIW1k2EvSBbuiWKSU/hHo6vp+6TP 0L8zxyx07NO5i6lisAJa56j4yI4kkfMCV2IAiy+ya8DiBvv8gtnMMwRkahQJTbSf+yX/ R9kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=MwLBy7MN9rjOVXhuT6sJXkWqGYnANC26XLE5d8TIP2Q=; b=RTLkZr6ppz6DO84YoteKaazpujfaBG2HYU0tgBZpr166R27R5R/AzngYtREthGVos2 E0si9qDRKxVHTY/OYoAjd1PJdYXqyehY4TEDnuP+cX7CT9wtdsYscBtXDxkGzrrVCIee FWxvSqgVBhebgm/Op/T8VaPGjikz71F6VK0DQPKZZyogmnis9SODRGIBe2oyv/iA097i +dtGMiblr+3QMsjHTsed3M9Eo+xEiozX/fp8HvjVD2BMIYwDS6ftzpqFuzXgomkz5sMQ 6qr0qVYpzWor7+ee5cDYfRuWIgx4O5cwyIOyq8NNUuwwPEq29k5NCI6dv82ODGwmAXWo CnAA== X-Gm-Message-State: AOAM532gvKuIeiGtSOkpi7+DXPEOKicxCnMJgQGsw74eQo7vX2S4coKa qdUv436aOqu8lLa39PU4356DAZj2YIov2dteUhn720VHEdw= X-Google-Smtp-Source: ABdhPJwCX3Ef/IG/ZRI/s+QbwYsKKUuA0ClGBt/EsUwqNcFVFeMBhoF37aWTvxiJRh58gue/QXMXnQ+Ho0FldLcxgGU= X-Received: by 2002:a05:6000:18ac:: with SMTP id b12mr7799584wri.355.1637062377685; Tue, 16 Nov 2021 03:32:57 -0800 (PST) MIME-Version: 1.0 From: Sandy Harris Date: Tue, 16 Nov 2021 19:32:46 +0800 Message-ID: Subject: [PATCH 4/8] Replace memset() with memzero_explicit() To: LKML , Linux Crypto Mailing List , "David S. Miller" , Herbert Xu , Greg Kroah-Hartman Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Replace memset(address,0,bytes) which may be optimised away with memzero_explicit(address,bytes) which resists such optimisation --- crypto/echainiv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- diff --git a/crypto/echainiv.c b/crypto/echainiv.c index 69686668625e..6a7321da2fc1 100644 --- a/crypto/echainiv.c +++ b/crypto/echainiv.c @@ -64,7 +64,7 @@ static int echainiv_encrypt(struct aead_request *req) memcpy(&nseqno, info + ivsize - 8, 8); seqno = be64_to_cpu(nseqno); - memset(info, 0, ivsize); + memzero_explicit(info, ivsize); scatterwalk_map_and_copy(info, req->dst, req->assoclen, ivsize, 1); From patchwork Tue Nov 16 11:34:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandy Harris X-Patchwork-Id: 12622133 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E93EC433EF for ; Tue, 16 Nov 2021 11:37:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DFF2663265 for ; Tue, 16 Nov 2021 11:37:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235401AbhKPLkq (ORCPT ); Tue, 16 Nov 2021 06:40:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235256AbhKPLj6 (ORCPT ); Tue, 16 Nov 2021 06:39:58 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C6C4C06121D; Tue, 16 Nov 2021 03:34:56 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id z1-20020a05600c220100b00337f97d2464so1598399wml.1; Tue, 16 Nov 2021 03:34:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=OKm72OBf2FpxYQCv0sB/f+DkBwoP27JOzZaWrwqWFj4=; b=O/F/kABNBuHmPwDVg3PSUcnyGVW0cz2m5CMF7/O0fU5kVCBz/Pc2vsnPc7st1wIkvi qm/BIGSYiHqg/a8h3TApXiQJtKqyRnhGAMz2NqqGMa1RNSSG7AlABr6JCbWvhn+24feX QB2cYDY8uS0FhJ9TMap+c22Atd5FC0rWlZiyvExu1o5SsCggyA2OXWUxFwIzxIVgK91H CWD5fs5EQP8Y8V4JtbZ/6JJ1fiAtsr5EQvuRaKmqHdlDcq0k5uYyPmYTy+ePGJCtInUl /EuI+FB2d0eVEl9y/zfmiaZ/ECbTUFeu8yv5Z6/SGri/mA0YHNyCLK3l/xyWjWsnNgrt q1ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=OKm72OBf2FpxYQCv0sB/f+DkBwoP27JOzZaWrwqWFj4=; b=njE1iCsLGh3aUr9zU1rizsK56D/3o+lf5sFTq+/FqBHhwvtHsDQKBsVPCnDHdbuLWr mpfFIBx1/Sz5csezA9haGLlJ8yV5Hnyr+146fE1b/zcpU+D28Ca+6VBbTws7vQVH+p3L ywrufyAyjdMtLwTSxcO8mIVxO4gNkGnJtp55Nq6TXCQHFKbzt+0dtJ3ADDpaRJlNG0Eb A0RD8njp7JFcDEreH1OgWXkFB/mM4S+cJO6DhzzeFZMYLkKnRWDtvItDqQGuqYqKadA9 fsp3+t7oFtwdgizYP6fZ4iXA1fNKQR0LX63pDjqkPGjW3OGN0yCAwK4PbvmuTBLIvIqN zNZA== X-Gm-Message-State: AOAM533ja6o6lF79N5Mk0TM65lxu5jmRRVSqOV3MRXax/TCMGmclPXek o6zYrkbVvCTY0RQnzGza25ZIAK1RgQ/jRhGQmKxNg23qJ7E= X-Google-Smtp-Source: ABdhPJzgNg+P77+DN3iCvFUOuqEzCWsgayJFWiSc9f/BHCLia5o5ZFhffvy7YyrzIg41Li3heJK4wrVEoqSiRFGHjBw= X-Received: by 2002:a7b:cf10:: with SMTP id l16mr69435166wmg.17.1637062494781; Tue, 16 Nov 2021 03:34:54 -0800 (PST) MIME-Version: 1.0 From: Sandy Harris Date: Tue, 16 Nov 2021 19:34:43 +0800 Message-ID: Subject: [PATCH 5/8] Replace memset() with memzero_explicit() To: LKML , Linux Crypto Mailing List , "David S. Miller" , Herbert Xu , Greg Kroah-Hartman Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Replace memset(address,0,bytes) which may be optimised away with memzero_explicit(address,bytes) which resists such optimisation --- crypto/shash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) shash->update(desc, data + unaligned_len, len - unaligned_len); @@ -156,7 +156,7 @@ static int shash_final_unaligned(struct shash_desc *desc, u8 *out) memcpy(out, buf, ds); out: - memset(buf, 0, ds); + memzero_explicit(buf, ds); return err; } diff --git a/crypto/shash.c b/crypto/shash.c index 0a0a50cb694f..f07d06f5da71 100644 --- a/crypto/shash.c +++ b/crypto/shash.c @@ -112,7 +112,7 @@ static int shash_update_unaligned(struct shash_desc *desc, const u8 *data, memcpy(buf, data, unaligned_len); err = shash->update(desc, buf, unaligned_len); - memset(buf, 0, unaligned_len); + memzero_explicit(buf, unaligned_len); return err ?: From patchwork Tue Nov 16 11:36:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandy Harris X-Patchwork-Id: 12622135 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D5E9C433F5 for ; Tue, 16 Nov 2021 11:38:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3CCC860F9B for ; Tue, 16 Nov 2021 11:38:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235288AbhKPLli (ORCPT ); Tue, 16 Nov 2021 06:41:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235412AbhKPLkr (ORCPT ); Tue, 16 Nov 2021 06:40:47 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 980E2C061229; Tue, 16 Nov 2021 03:36:40 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id c71-20020a1c9a4a000000b0032cdcc8cbafso2127069wme.3; Tue, 16 Nov 2021 03:36:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=LTEOIY/eUybXZeS3eIxrCfmEcoic7/sGgtFEUDGaJhE=; b=TX706o8lUSRxnx83yKZ6yV71gIapSpXePBuPaeHWnam0Id4igbdcZPmccfGZfhpZ0C CccmK8bLuDsGAxlXHkRNFn12LSwgEBR4ei9IB42HhhNl6Etrm0gm/EcaEiZrU4oREu5F Fi7WVt8/7c64zE2QwZKIKrWjTH098pWekxFwWEI2G1LJPFOT/oADK11W/XWFAEAXBewH lLplvb0H0c12nWMR2V5xGSmP+6yGY4CegPi4OU9tJdAnFWb1Gcn9xEkAo5QUnKm0fatw OXOyKCzOUuLkyoZVCfdqWzvGVsfqAHOkryQVcWJEIv0yUeDMeIfCZ+Tt3VLz9jhV5Rma FJ9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=LTEOIY/eUybXZeS3eIxrCfmEcoic7/sGgtFEUDGaJhE=; b=fevG8kj0mwFoofG1LkEW17aDJg9mWL9E1kpl26rjUF7pIyXXDMHo1d8Y/DSsKI3dxj fJlK5ujRVOGSFlujlNqf4I8sb+4D+sZrHxvHb60NFnqrce4DpWvYpOwLvqME9VelDnfW sgIJDuin+Odad46Qtk0GxKfYlOZzSlyRLO21I56mVKxY3CvjaGbPU2/QZBNICI/XuVf+ 691Ec7Xejlln6hPqLbe1Ueky+3kDG8SJxkzb+b1AExBL+MtRVK5Fzd/t5g4mKnfpyf9N 9xdB2t+3P54Pl58Zy9H1qFVDlNpE+obdn1L4vNOtsh8OU6s1XVi0qyCiq03x/mTXrivP y2ew== X-Gm-Message-State: AOAM531gkEhn5IwbZtfwsezaClfSq8WH88ZjQQ+oRyLbo+fUHiQ1wapH Wl1z63zT+JMVS0M/REQwABIPzWuqTO6Sj3NOiGxFSueLz48= X-Google-Smtp-Source: ABdhPJzWaXUihz1qRzdj5NZSXo8+WJKVajZuoybvlc540cny3ejqfzkPDvfcpA1jdVeu2+/PHrIjDB+HgptCkgqd//4= X-Received: by 2002:a05:600c:2246:: with SMTP id a6mr67667259wmm.5.1637062599013; Tue, 16 Nov 2021 03:36:39 -0800 (PST) MIME-Version: 1.0 From: Sandy Harris Date: Tue, 16 Nov 2021 19:36:27 +0800 Message-ID: Subject: [PATCH 6/8] Replace memset() with memzero_explicit() To: LKML , Linux Crypto Mailing List , "David S. Miller" , Herbert Xu , Greg Kroah-Hartman Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Replace memset(address,0,bytes) which may be optimised away with memzero_explicit(address,bytes) which resists such optimisation --- crypto/sha3_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/sha3_generic.c b/crypto/sha3_generic.c index 3e4069935b53..cfc10dd62e02 100644 --- a/crypto/sha3_generic.c +++ b/crypto/sha3_generic.c @@ -232,7 +232,7 @@ int crypto_sha3_final(struct shash_desc *desc, u8 *out) if (digest_size & 4) put_unaligned_le32(sctx->st[i], (__le32 *)digest); - memset(sctx, 0, sizeof(*sctx)); + memzero_explicit(sctx, sizeof(*sctx)); return 0; } EXPORT_SYMBOL(crypto_sha3_final); From patchwork Tue Nov 16 11:38:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandy Harris X-Patchwork-Id: 12622137 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0BABC433F5 for ; Tue, 16 Nov 2021 11:40:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD9326334A for ; Tue, 16 Nov 2021 11:40:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232424AbhKPLnt (ORCPT ); Tue, 16 Nov 2021 06:43:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234944AbhKPLmg (ORCPT ); Tue, 16 Nov 2021 06:42:36 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB8CDC061767; Tue, 16 Nov 2021 03:38:19 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id p3-20020a05600c1d8300b003334fab53afso1679397wms.3; Tue, 16 Nov 2021 03:38:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=eHO+LnzYTLvi1ibWQBQ4VJT9l42Re/gLaBNAO09hBu0=; b=pu130IqB8Qy4jcg4TDLmnmcKdgryY8vLFCykVkkPJfcnk+FX8jnNgtK88l1bDHL5+W lhhes8rAN46j/p3Ok/L8YwIUH/K78PiaU9P5ABv+gQAfN9pr5rSoh84kTj6SYzbrycdL vKffhO1bYf30ZbIaqxezRU5MqfGyCC7XDMRqgf0G7elhzzoeNZm23WJpPJmyR2r9OIsV 2QQL3OnET3qK27plJHFGEyMVRfwxvWeOpPUAfMga6eRvT9+Dls8y92ry6RhzHMsvl+vz 1Zh/UrSN0tvDDaT7DzWilExeBYmWK0o+4BwLntgVF+SqWq0xvITEyVkv75qikIV+OJfU LGLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=eHO+LnzYTLvi1ibWQBQ4VJT9l42Re/gLaBNAO09hBu0=; b=c1jr6Tz51KM/PAg+yntP2Dc8MaP7LwwCPHtB+0VVr7vasxaR8/J5tNmGaRb0QTXvJh EN4RLmSZSaZXnGKPWWzno0HbLDN3iT8mumlRQk3mtUxsSSvCRawixewbz84f+MQfAKHH E+UbP7Ng5qQhHuZzWuxje2YP+f54orSfoNkycmEw001sUKYdHlkx0RJk1lnLC7Ff6QK6 DBUh/Wa9uRoc0SmRSmY3cTv6sz9PvR1n0iZ8ZUwcaWpb5EhUog1r+9q7sKAG+43Kwy4s VLLLSz1nXOMXpFBJiXrxG0us2MXZQQchNMDKjd7UfcGEKsnVyWKqnkuGGKdF2dWmPJEu NOaw== X-Gm-Message-State: AOAM5305BlISJ/yVE2hAPzPzpOA0ovpfhIcbypajp3bPZ9FA7+D147Cu BACO3vhaMpNfVDE7JPPMhMZMcviPJCP/4h2qHV35ByAY/u0= X-Google-Smtp-Source: ABdhPJyeOJR96UJvqBee6IUrqwD26c0Xsj7Rz0iifGm1qj625vOJ1lY28aMdqEdExTkhtHnu3XsR5Oexjj5iVJnHvwI= X-Received: by 2002:a05:600c:1f13:: with SMTP id bd19mr52327080wmb.9.1637062698315; Tue, 16 Nov 2021 03:38:18 -0800 (PST) MIME-Version: 1.0 From: Sandy Harris Date: Tue, 16 Nov 2021 19:38:06 +0800 Message-ID: Subject: [PATCH 7/8] Replace memset() with memzero_explicit() To: LKML , Linux Crypto Mailing List , "David S. Miller" , Herbert Xu , Greg Kroah-Hartman Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Replace memset(address,0,bytes) which may be optimised away with memzero_explicit(address,bytes) which resists such optimisation --- crypto/sm2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- diff --git a/crypto/sm2.c b/crypto/sm2.c index db8a4a265669..58641d964671 100644 --- a/crypto/sm2.c +++ b/crypto/sm2.c @@ -124,7 +124,7 @@ static void sm2_ec_ctx_deinit(struct mpi_ec_ctx *ec) { mpi_ec_deinit(ec); - memset(ec, 0, sizeof(*ec)); + memzero_explicit(ec, sizeof(*ec)); } /* RESULT must have been initialized and is set on success to the From patchwork Tue Nov 16 11:39:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandy Harris X-Patchwork-Id: 12622139 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEC1DC433EF for ; Tue, 16 Nov 2021 11:40:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE0966336D for ; Tue, 16 Nov 2021 11:40:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235261AbhKPLnu (ORCPT ); Tue, 16 Nov 2021 06:43:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235638AbhKPLn2 (ORCPT ); Tue, 16 Nov 2021 06:43:28 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C51FFC06120E; Tue, 16 Nov 2021 03:39:57 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id a9so10733331wrr.8; Tue, 16 Nov 2021 03:39:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=0lnIW5bIuasV3MVGJulBjO6erZ6NZCFpVTL6XPkUY7g=; b=UTENRlvJv4CKfNdhgLfetOkofGUZ4Zvf1hW/NurNT5vUDxHNNIb/33acvpw1+D77OS RvrwY+3Da+G0yn/wpX2PwmfBo2Fw11YM+9pTZpZB2NuProGgpT6TKugrcGdEc5KqCvZM vwZGV7OG+wZjz4KAAFS/IJEIQE8bnRXLsjgD12Rjg/T/Tv4+5tQ+iq3zPs9/o4E+e8q/ 5nYBR5MlANoH56B+5qlZj/z0S69ytkHHKgHOiE26ae3ghN4rQFiT77yWuG761QL5piO1 eMsLFG2qCR+MHRs1nd5AaLNE2C3n98hbtjeATSRPY+BCdMQI49O9ghgOKjy7lkBTyI4V Y+xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=0lnIW5bIuasV3MVGJulBjO6erZ6NZCFpVTL6XPkUY7g=; b=eF8AGFFV9D2JJ3F+kZg3buGiSs0YF0sUY6dwqFlp6aAbsmg4Bj0FaoG5+HZkPnkRNx 6gyPJD7nuUBO5JE2wdiIQzR9fwXlO1ZgmLnUMIf21EYtSb7MYw79e8GlVMWOBJZ0yh+T dsVg7pdlsmo9V9LrSy2CcNDdpftC5eeMdPKplTOjQ4TJPdfnxNBW6zqLJW8dk6Ms7Xa2 znr3XI7xpKx8LEYpvuxjeYDWPknmFNUvgJ5gKNoT5ergwGNe5vSVWRBCs2RnJi+lv2NJ +LaVRVzFwnflocIlaxBzb401H+4gNh04orqkxXFmUVl+nUax6i/pXxjvcrQxadkEM4pf m1xQ== X-Gm-Message-State: AOAM530XkfLr33q6W5ZCfUsLVW5VrUHCOPvESOiW43Hoj2qIDZ0nBRW+ fn5OM3e6k32A9MXQLKESdGN1zxPzVIi1+pnpZD0y6NaFQ4o= X-Google-Smtp-Source: ABdhPJxdqnHy+l4gg9zlNJwBz43z7HVYBhCmcU6R3AaNMLjruGuDQXNbnm08ViAsE3fyjpx103quBwNYR6jNnV3NPwE= X-Received: by 2002:a05:6000:52:: with SMTP id k18mr8294124wrx.192.1637062796271; Tue, 16 Nov 2021 03:39:56 -0800 (PST) MIME-Version: 1.0 From: Sandy Harris Date: Tue, 16 Nov 2021 19:39:44 +0800 Message-ID: Subject: [PATCH 8/8] Replace memset() with memzero_explicit() To: LKML , Linux Crypto Mailing List , "David S. Miller" , Herbert Xu , Greg Kroah-Hartman Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Replace memset(address,0,bytes) which may be optimised away with memzero_explicit(address,bytes) which resists such optimisation --- crypto/rmd160.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- diff --git a/crypto/rmd160.c b/crypto/rmd160.c index c5fe4034b153..a80f783d5a4f 100644 --- a/crypto/rmd160.c +++ b/crypto/rmd160.c @@ -329,7 +329,7 @@ static int rmd160_final(struct shash_desc *desc, u8 *out) dst[i] = cpu_to_le32p(&rctx->state[i]); /* Wipe context */ - memset(rctx, 0, sizeof(*rctx)); + memzero_explicit(rctx, sizeof(*rctx)); return 0; }