From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 534991F461 for ; Sat, 24 Aug 2019 14:15:11 +0000 (UTC) Received: from localhost ([::1]:38018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i1Wov-0000ny-VB for normalperson@yhbt.net; Sat, 24 Aug 2019 10:15:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50155) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i1Wor-0000nq-10 for bug-gnulib@gnu.org; Sat, 24 Aug 2019 10:15:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i1Wop-0007n9-RW for bug-gnulib@gnu.org; Sat, 24 Aug 2019 10:15:04 -0400 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::7]:12790) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i1Wop-0007jP-62 for bug-gnulib@gnu.org; Sat, 24 Aug 2019 10:15:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1566656099; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:X-RZG-CLASS-ID:X-RZG-AUTH:From: Subject:Sender; bh=qqJ5OCFM7o4d6RtMsiledrR/fywCvuSCgLwAKWS/vys=; b=UBdWp1Cd2kKlMOtmghZmqYnp7O1XCr4BlpkVAui8/0qzAySvSBLYQlE1Gh6oEsy5F0 rzYM9bV9LHLuxWGuvTN1FYpE1BXtnVdvApzv8aKU+ZyRhWPV6iTolwZs0z61eQ1PlFNn CRzw5XY/pQ7Zy1+2r/4ogUi4OrBFlcuqZRxVmc95fmoOh1eIiCp0hWVl9oclygRTGkP3 TjRiC7pYY7IU53kMk0xvtEMqXmxPDAZvxWb/kiNnnwGgNkZcWIIgu31LO6jPXzjYPYNH 3lto6dpxyFqtMYBQFyV4HuoNWDcVtyWLVDxaKJYa6elaihiJr3dYXN74c6ZC8YL+KNfi 7k5A== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOGaf0zJZW" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 44.26.1 DYNA|AUTH) with ESMTPSA id 507e7dv7OEExKS3 (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Sat, 24 Aug 2019 16:14:59 +0200 (CEST) From: Bruno Haible To: bug-gnulib@gnu.org Subject: crypto/gc-md2: optimize and clarify code Date: Sat, 24 Aug 2019 16:14:58 +0200 Message-ID: <3371168.FpREjUSgGq@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-157-generic; KDE/5.18.0; x86_64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5300::7 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" Make lib/gc-gnulib.c and lib/gc-libgcrypt.c more consistent with each other. 2019-08-24 Bruno Haible crypto/gc-md2: Optimize and clarify code. * lib/gc-gnulib.c (gc_hash_open): Comment out md2_init_ctx invocation. * lib/gc-libgcrypt.c (gc_hash_open): Clarify why md2_init_ctx invocation is not needed. diff --git a/lib/gc-gnulib.c b/lib/gc-gnulib.c index 62aa50a..6fcb4a1 100644 --- a/lib/gc-gnulib.c +++ b/lib/gc-gnulib.c @@ -646,7 +646,8 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle) { #if GNULIB_GC_MD2 case GC_MD2: - md2_init_ctx (&ctx->md2Context); + /* Not needed, because ctx is already zero-initialized. */ + /*md2_init_ctx (&ctx->md2Context);*/ break; #endif diff --git a/lib/gc-libgcrypt.c b/lib/gc-libgcrypt.c index 6c95712..fbfd0a1 100644 --- a/lib/gc-libgcrypt.c +++ b/lib/gc-libgcrypt.c @@ -270,9 +270,13 @@ gc_hash_open (Gc_hash hash, Gc_hash_mode mode, gc_hash_handle * outhandle) switch (hash) { +#if GNULIB_GC_MD2 case GC_MD2: + /* Not needed, because ctx is already zero-initialized. */ + /*md2_init_ctx (&ctx->md2Context);*/ gcryalg = GCRY_MD_NONE; break; +#endif case GC_MD4: gcryalg = GCRY_MD_MD4;