From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Seungki Kim Newsgroups: gmane.emacs.bugs Subject: bug#65826: [PATCH] Add nonce support for gnutls-hash-mac Date: Sat, 9 Sep 2023 01:33:30 +0900 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000146f1e0604db8ad8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35376"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65826@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 08 18:34:33 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qeeRF-000918-3h for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 08 Sep 2023 18:34:33 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qeeQj-0000sQ-8O; Fri, 08 Sep 2023 12:34:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qeeQh-0000jv-Q6 for bug-gnu-emacs@gnu.org; Fri, 08 Sep 2023 12:33:59 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qeeQh-0001l2-Gi for bug-gnu-emacs@gnu.org; Fri, 08 Sep 2023 12:33:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qeeQj-0001W5-QQ for bug-gnu-emacs@gnu.org; Fri, 08 Sep 2023 12:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Seungki Kim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 Sep 2023 16:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65826 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65826-submit@debbugs.gnu.org id=B65826.16941908315812 (code B ref 65826); Fri, 08 Sep 2023 16:34:01 +0000 Original-Received: (at 65826) by debbugs.gnu.org; 8 Sep 2023 16:33:51 +0000 Original-Received: from localhost ([127.0.0.1]:45347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qeeQY-0001Vg-Uc for submit@debbugs.gnu.org; Fri, 08 Sep 2023 12:33:51 -0400 Original-Received: from mail-vs1-xe2d.google.com ([2607:f8b0:4864:20::e2d]:51586) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qeeQX-0001VT-BS for 65826@debbugs.gnu.org; Fri, 08 Sep 2023 12:33:49 -0400 Original-Received: by mail-vs1-xe2d.google.com with SMTP id ada2fe7eead31-45088c95591so996702137.3 for <65826@debbugs.gnu.org>; Fri, 08 Sep 2023 09:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694190821; x=1694795621; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=3iDYGQCgGKuN72+t7m0LizZHbYThsFVjapWplAWNVwE=; b=evrPk6CNnG1SOc0bDsTHRni8Q0o2DPSQCgxSsht6Fh6sQJWEOcm4P3y21+4g/LvrRN ReoewyT/U8dCzwsR3ofL8UOm9iAh/oCFaCpTgpcocPMcFx5k02r7k4D77ZUvsLFQxMW7 j/7DQ2N9LaC+2041yJWl+b7AAt4AjBFvZc55+OjYFtSTRCW91i5j8vaEKRUoa8qkc3M7 V1gfEy7egS302GqP2OuYv9tn/XeA+GISVvYHaprLNShIJ+ZpmhRm9/EPn/kiohyVIaV7 dA/dFLCJqdwfqU4Bln32MJLzABhp8FHczPy5N4wrzVZy1N9IeS0jtNQkZsKB/NFXoBwp Popg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694190821; x=1694795621; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3iDYGQCgGKuN72+t7m0LizZHbYThsFVjapWplAWNVwE=; b=X/3rA+H6HIaD6K9N8G3FroSqpB30KxCRp1AVrm1OHvba8K9ah9bI1cdLKPmNEmp96m LsKO703jCQ/jSlT272Wp+AO5Cp/eojztFqEv/fhkcD1fObUd+m29z/8/vI6A1re4AIrq SDWh8kLsN/Zmv58lN13ke31b5D/rVjfeXLTY5QFX4gw03mAopIGTziMEoc9hqYWQOzFO SQDIuldzvX5UpfLIwWlK8U+/fUnVWMBzT5ZnNad7CzDlNPmidGj+mRFK+zlNL9vvbYW+ 9Xwox4raZniyxy4pAswMijGImRM/wDXx54XQJbcwk9mmOw9/yGXBNmzAIbZ13q+oGPqF A9/A== X-Gm-Message-State: AOJu0Yy/Z/QZLzchH4Xa1zpf+Yd/c3GIWgdJP2KcjOHj5zWIfK8KSfJz atpyVrta3j0ZT3Nz+cwY1I4WQKWM7Oj67l1tN6tDWFsZIII= X-Google-Smtp-Source: AGHT+IGyfRjZrGpqVsomKojRPTHKNvX3yMMmpWZbqjtV8me9r2d5oHUYFMuIMthxvXgsgZ/SXojqftI3/5brVPIWFp4= X-Received: by 2002:a67:f601:0:b0:44d:3d24:c1a1 with SMTP id k1-20020a67f601000000b0044d3d24c1a1mr2995175vso.9.1694190821205; Fri, 08 Sep 2023 09:33:41 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:269792 Archived-At: --000000000000146f1e0604db8ad8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thank you for your good suggestion. It seems like test/lisp/net/gnutls-tests.el would be the right place to add unit tests for my patch.(Please let me know if it is not) I will update the patch adding unit tests on this thread as soon as it is ready. Thanks. 2023=EB=85=84 9=EC=9B=94 9=EC=9D=BC (=ED=86=A0) =EC=98=A4=EC=A0=84 1:18, St= efan Kangas =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > SK Kim writes: > > > As far as I understood, currently `gnutls-hash-mac' does not support > nonce > > input, so there is no way to properly hash with some MAC algorithms whi= ch > > require nonce. (e.g AES-GMAC-128) > > So I suggest adding an optional argument NONCE to `gnutls-hash-mac' to > > support MAC algorithms with nonce. > > > > What I have tested after applying the attached patch are as below. > > 1. AES-GMC-128/192/256 works correctly. > > 2. NONCE does not affect SHA256/SHA512 hash results, even if presented. > > > > Since NONCE is added as an optional argument, I believe it will not eve= n > > affect existing code using the 'gnutls-hash-mac' function. > > Sounds useful. Could you add unit tests for this, though? In > particular, it would be good to test your number 1 and 2 above. > --000000000000146f1e0604db8ad8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you for your good suggestion.

It= seems like test/lisp/net/gnutls-tests.el would be the right place to add u= nit tests for my patch.(Please let me know if it is not)
I will update t= he patch adding unit tests on this thread as soon as it is ready.

Than= ks.

2023=EB=85=84 9=EC=9B=94 9=EC=9D=BC (=ED=86=A0) =EC=98=A4=EC=A0=84= 1:18, Stefan Kangas <stefanka= ngas@gmail.com>=EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1:
SK Kim <tttuuu888@gmail.com> writes:
> As far as I understood, currently `gnutls-hash-mac' does not suppo= rt nonce
> input, so there is no way to properly hash with some MAC algorithms wh= ich
> require nonce. (e.g AES-GMAC-128)
> So I suggest adding an optional argument NONCE to `gnutls-hash-mac'= ; to
> support MAC algorithms with nonce.
>
> What I have tested after applying the attached patch are as below.
> 1. AES-GMC-128/192/256 works correctly.
> 2. NONCE does not affect SHA256/SHA512 hash results, even if presented= .
>
> Since NONCE is added as an optional argument, I believe it will not ev= en
> affect existing code using the 'gnutls-hash-mac' function.

Sounds useful.=C2=A0 Could you add unit tests for this, though?=C2=A0 In particular, it would be good to test your number 1 and 2 above.
--000000000000146f1e0604db8ad8--