{"id":10396,"url":"https://patchwork.libcamera.org/api/1.1/patches/10396/?format=json","web_url":"https://patchwork.libcamera.org/patch/10396/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20201109105159.981412-1-kieran.bingham@ideasonboard.com>","date":"2020-11-09T10:51:59","name":"[libcamera-devel] libcamera: pub_key: Support GNUTLS < v3","commit_ref":null,"pull_url":null,"state":"rejected","archived":false,"hash":"4cb2f4c0ae11da4cdc7f5316d1749d35cf05f6bc","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":{"id":11,"url":"https://patchwork.libcamera.org/api/1.1/users/11/?format=json","username":"kbingham","first_name":"Kieran","last_name":"Bingham","email":"kieran.bingham@ideasonboard.com"},"mbox":"https://patchwork.libcamera.org/patch/10396/mbox/","series":[{"id":1452,"url":"https://patchwork.libcamera.org/api/1.1/series/1452/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1452","date":"2020-11-09T10:51:59","name":"[libcamera-devel] libcamera: pub_key: Support GNUTLS < v3","version":1,"mbox":"https://patchwork.libcamera.org/series/1452/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10396/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10396/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 95B17BE082\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  9 Nov 2020 10:52:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 207026306B;\n\tMon,  9 Nov 2020 11:52:11 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2BB8B62D19\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Nov 2020 11:52:09 +0100 (CET)","from localhost.localdomain\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 95BADB2B;\n\tMon,  9 Nov 2020 11:52:08 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Myzs/HdZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1604919128;\n\tbh=pnAxxw7xsBNCNe7USE4hPMCB6X365rj9W44dAxW+TlE=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=Myzs/HdZrC7HK/dHDtdxvXrWXjJEatGeQkTi0xjOfcSV10NmkL21f9MhGcghX83nA\n\th0Dpa8rem11XFR8lYJf9KGuyI+IupVLWYmmxFJcv5PgtG2d7fYI5dpXpFhj0Fdc0HS\n\txIKCOd+hgoHsRAiq7bG6TK7w+rvUcWmqrlJ+tWwo=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Mon,  9 Nov 2020 10:51:59 +0000","Message-Id":"<20201109105159.981412-1-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.25.1","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH] libcamera: pub_key: Support GNUTLS < v3","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"Matti Lehtimaki <matti.lehtimaki@gmail.com>,\n\tSimon Schmeisser <mail_to_wrt@gmx.de>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"It has been reported that SailfishOS is packaged with an older GnuTLS\nlibrary. Supporting GnuTLS < 3 appears to be trivial, but comes at the\ncost of using a #define to switch.\n\nUse a #define block to support older GnuTLS installations.\n\nReported-by: Simon Schmeisser <mail_to_wrt@gmx.de>\nSuggested-by: Matti Lehtimaki <matti.lehtimaki@gmail.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/libcamera/pub_key.cpp | 7 +++++++\n 1 file changed, 7 insertions(+)\n\nThis was reported at [0], with a fix proposed at [1]\n\n[0] https://github.com/sailfish-on-dontbeevil/droid-config-pinephone/issues/55\n[1] https://git.sailfishos.org/mal/libcamera/blob/master/rpm/gnutls2.patch\n\nAlternatively we could just /require/ GnuTLS >= 3... but this seems\nfairly cheap.\n\nThis patch is a simplified version of [1] (No need to check if we're\n__cplusplus, in a cpp file, but I haven't seen that this is needed\neither).\n\nI'd like to see Tested-by: tags on this before integration, as I have no\nway to verify it.\n\n--\nKieran","diff":"diff --git a/src/libcamera/pub_key.cpp b/src/libcamera/pub_key.cpp\nindex 9bb08fda34af..857c395373ea 100644\n--- a/src/libcamera/pub_key.cpp\n+++ b/src/libcamera/pub_key.cpp\n@@ -8,7 +8,9 @@\n #include \"libcamera/internal/pub_key.h\"\n \n #if HAVE_GNUTLS\n+extern \"C\" {\n #include <gnutls/abstract.h>\n+}\n #endif\n \n /**\n@@ -87,8 +89,13 @@ bool PubKey::verify([[maybe_unused]] Span<const uint8_t> data,\n \t\tstatic_cast<unsigned int>(sig.size())\n \t};\n \n+#if GNUTLS_VERSION_MAJOR >= 3\n \tint ret = gnutls_pubkey_verify_data2(pubkey_, GNUTLS_SIGN_RSA_SHA256, 0,\n \t\t\t\t\t     &gnuTlsData, &gnuTlsSig);\n+#else\n+\tint ret = gnutls_pubkey_verify_data(pubkey_, 0, &gnuTlsData, &gnuTlsSig);\n+#endif\n+\n \treturn ret >= 0;\n #else\n \treturn false;\n","prefixes":["libcamera-devel"]}