Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1818876pxb; Fri, 6 Nov 2020 23:04:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGN3ToSPC0X1BHx7JbPxp+nfmICJWrw1DMjbHknVeGArfrTI7fwdW5v0UM5S+xBzDofddk X-Received: by 2002:a17:906:65b:: with SMTP id t27mr5614587ejb.74.1604732648679; Fri, 06 Nov 2020 23:04:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604732648; cv=none; d=google.com; s=arc-20160816; b=YqXyXJbQSkFIcp7uEwzvGSiaISb5lX7GSlV5hGzGXgTksgdGZprWO2YhHcNHhhA18L DUhEYnTZP1Zfm7kd85mLRoSV1f8G1Gki8ycv+OgLghMC2pwuaRaKVlZEXXMmS+ucrkVX E9I9hJhAWpCId+KxD2Nr+THFRUv9dhUsPDJTqQ807AXybBgERQD5+vW9qlvB3CoNNJBK T0JiyyxBRG5uMZVP1cwhaQIUdJW5fDFR53rCkk9q7toQv6p8oGeeZu1PTCmb25Hy4mPk bN2TDgGLViQR5ybhMeDi//6LWcMl0HSSlz1/1CbLO9Dv2ZnytpK7Yik37PhGHjNz19Nt T/kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=j6wipFR8GeZTdvpF8TJMR6FeN7lIoplRclUV04wu6ys=; b=WE5ymGD8G/tmQ0rzS/StU7KMjcRaHJAufK9mitf7oGoGtoaSRA3Eiz7+vIFuRdT9Zs EPWKw1OxBX8entlD0YbC5uVSJ29VtatMIFWreG+qsNB1KmEPJqysw+U7THTUevx2eMGk 8gIvPyFeRb0jXVXtfyN0Pc3mrB1EiOv8lpljpZlJBJkJCSXMjuNOkI9sHOpk75MKzF0t J8c211TfC5LJsTvvsCWwb0V3u4GH7Vd0Wp4m3XOQyEbTYS4Xgl9bCZiptokKtHKoc1SS KRKrATU71Y47TiGxH3Z6/L+RfOUcdpPjd+LeTFX6gWEqcD36K6EdwSNR1iNdoena/8Wy svUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si2465011edj.549.2020.11.06.23.03.42; Fri, 06 Nov 2020 23:04:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725985AbgKGHDb (ORCPT + 99 others); Sat, 7 Nov 2020 02:03:31 -0500 Received: from mga17.intel.com ([192.55.52.151]:45622 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727822AbgKGHDb (ORCPT ); Sat, 7 Nov 2020 02:03:31 -0500 IronPort-SDR: kIKE7RUJKAsyIRuEbTf9T4qlp/QkuhNWOXSLXExa5K1cGUzSzhpQ9KVUMxAYGHP5qq9kQ6lZ6N 079zL5PWO1sw== X-IronPort-AV: E=McAfee;i="6000,8403,9797"; a="149485516" X-IronPort-AV: E=Sophos;i="5.77,458,1596524400"; d="scan'208";a="149485516" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2020 23:03:30 -0800 IronPort-SDR: eFNgLAtE7wsI5VVkv1xpDsW7m1WAkpfLLu8MaecQ1jUJC7cGJrDc+WNCchvs2PhqaljFxxqLzi 9O1xhHSMRkNQ== X-IronPort-AV: E=Sophos;i="5.77,458,1596524400"; d="scan'208";a="359032027" Received: from ralassax-mobl.amr.corp.intel.com (HELO ingas-nuc1.intel.com) ([10.209.101.141]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Nov 2020 23:03:30 -0800 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: luiz.von.dentz@intel.com, Inga Stotland Subject: [RFC PATCH BlueZ 06/10] tools/smp-tester: Convert to use ELL library Date: Fri, 6 Nov 2020 23:03:08 -0800 Message-Id: <20201107070312.8561-7-inga.stotland@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201107070312.8561-1-inga.stotland@intel.com> References: <20201107070312.8561-1-inga.stotland@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This reworks the source code to use ELL primitives and removes dependecies on GLib. --- Makefile.tools | 4 ++-- tools/smp-tester.c | 24 +++++++++--------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/Makefile.tools b/Makefile.tools index 7c29e115b..83c30252d 100644 --- a/Makefile.tools +++ b/Makefile.tools @@ -138,12 +138,12 @@ tools_bnep_tester_LDADD = lib/libbluetooth-internal.la \ src/libshared-glib.la $(GLIB_LIBS) tools_smp_tester_SOURCES = tools/smp-tester.c monitor/bt.h \ - emulator/hciemu.h emulator/hciemu.c \ + emulator/hciemu.h emulator/hciemu-ell.c \ emulator/btdev.h emulator/btdev.c \ emulator/bthost.h emulator/bthost.c \ emulator/smp.c tools_smp_tester_LDADD = lib/libbluetooth-internal.la \ - src/libshared-glib.la $(GLIB_LIBS) + src/libshared-ell.la $(ell_ldadd) tools_gap_tester_SOURCES = tools/gap-tester.c monitor/bt.h \ emulator/hciemu.h emulator/hciemu-ell.c \ diff --git a/tools/smp-tester.c b/tools/smp-tester.c index 7823b6b17..b7843c73d 100644 --- a/tools/smp-tester.c +++ b/tools/smp-tester.c @@ -18,7 +18,7 @@ #include #include -#include +#include #include "lib/bluetooth.h" #include "lib/hci.h" @@ -41,7 +41,6 @@ struct test_data { uint16_t mgmt_index; struct hciemu *hciemu; enum hciemu_type hciemu_type; - unsigned int io_id; uint8_t ia[6]; uint8_t ia_type; uint8_t ra[6]; @@ -223,11 +222,6 @@ static void test_post_teardown(const void *test_data) { struct test_data *data = tester_get_data(); - if (data->io_id > 0) { - g_source_remove(data->io_id); - data->io_id = 0; - } - if (data->crypto) { bt_crypto_unref(data->crypto); data->crypto = NULL; @@ -287,7 +281,7 @@ static const struct smp_req_rsp nval_req_1[] = { static const struct smp_data smp_server_nval_req_1_test = { .req = nval_req_1, - .req_count = G_N_ELEMENTS(nval_req_1), + .req_count = L_ARRAY_SIZE(nval_req_1), }; static const uint8_t smp_nval_req_2[7] = { 0x01 }; @@ -300,7 +294,7 @@ static const struct smp_req_rsp srv_nval_req_1[] = { static const struct smp_data smp_server_nval_req_2_test = { .req = srv_nval_req_1, - .req_count = G_N_ELEMENTS(srv_nval_req_1), + .req_count = L_ARRAY_SIZE(srv_nval_req_1), }; static const uint8_t smp_nval_req_3[] = { 0x01, 0xff }; @@ -313,7 +307,7 @@ static const struct smp_req_rsp srv_nval_req_2[] = { static const struct smp_data smp_server_nval_req_3_test = { .req = srv_nval_req_2, - .req_count = G_N_ELEMENTS(srv_nval_req_2), + .req_count = L_ARRAY_SIZE(srv_nval_req_2), }; static const uint8_t smp_basic_req_1[] = { 0x01, /* Pairing Request */ @@ -347,7 +341,7 @@ static const struct smp_req_rsp srv_basic_req_1[] = { static const struct smp_data smp_server_basic_req_1_test = { .req = srv_basic_req_1, - .req_count = G_N_ELEMENTS(srv_basic_req_1), + .req_count = L_ARRAY_SIZE(srv_basic_req_1), }; static const struct smp_req_rsp cli_basic_req_1[] = { @@ -361,7 +355,7 @@ static const struct smp_req_rsp cli_basic_req_1[] = { static const struct smp_data smp_client_basic_req_1_test = { .req = cli_basic_req_1, - .req_count = G_N_ELEMENTS(cli_basic_req_1), + .req_count = L_ARRAY_SIZE(cli_basic_req_1), }; static const uint8_t smp_basic_req_2[] = { 0x01, /* Pairing Request */ @@ -384,7 +378,7 @@ static const struct smp_req_rsp cli_basic_req_2[] = { static const struct smp_data smp_client_basic_req_2_test = { .req = cli_basic_req_2, - .req_count = G_N_ELEMENTS(cli_basic_req_1), + .req_count = L_ARRAY_SIZE(cli_basic_req_1), .mitm = true, }; @@ -423,7 +417,7 @@ static const struct smp_req_rsp cli_sc_req_1[] = { static const struct smp_data smp_client_sc_req_1_test = { .req = cli_sc_req_1, - .req_count = G_N_ELEMENTS(cli_sc_req_1), + .req_count = L_ARRAY_SIZE(cli_sc_req_1), .sc = true, }; @@ -449,7 +443,7 @@ static const struct smp_req_rsp cli_sc_req_2[] = { static const struct smp_data smp_client_sc_req_2_test = { .req = cli_sc_req_2, - .req_count = G_N_ELEMENTS(cli_sc_req_2), + .req_count = L_ARRAY_SIZE(cli_sc_req_2), .sc = true, }; -- 2.26.2