From patchwork Tue Feb 7 18:06:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Eremin-Solenikov X-Patchwork-Id: 93579 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp2319340qgi; Tue, 7 Feb 2017 10:07:25 -0800 (PST) X-Received: by 10.233.235.66 with SMTP id b63mr16768301qkg.144.1486490845707; Tue, 07 Feb 2017 10:07:25 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id d68si3528464qkg.155.2017.02.07.10.07.25; Tue, 07 Feb 2017 10:07:25 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 34FD862F82; Tue, 7 Feb 2017 18:07:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 8BB9F62FA2; Tue, 7 Feb 2017 18:06:34 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id E11E362F82; Tue, 7 Feb 2017 18:06:27 +0000 (UTC) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com [209.85.215.46]) by lists.linaro.org (Postfix) with ESMTPS id DC73F60EAB for ; Tue, 7 Feb 2017 18:06:25 +0000 (UTC) Received: by mail-lf0-f46.google.com with SMTP id x1so67774273lff.0 for ; Tue, 07 Feb 2017 10:06:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=EEBl9nEOd1QbCzHSigujBqqUuq6WeoFtFARutyk81zs=; b=o9r/YQXRhc/oITYyaCGoWwFCX0uhKw10bOeyHfFSLl3eLHgyUnGmzdW0DMcl03yHsM 8x00qjUy+UZeR9WO0JTeVAwnhy3bQiNSxPlO4PetbeDxIEJCmhE+oFuyOMWBPKK8FeEZ AXURs7Rlz19AzSFatZ1/zcVnX43tdR1Yh4JdbhxAFt/RCW766fOxra/nFMsTObwZgo2S qm8EKAiZJfjZNpvI6d7Uqhf0edTkxuwtTHC5pF7C/COv8qtad1H1CbmP0qgjVVc6fOBB eYlJn5H58DBGnLkdbpL1s5GQar71HjxH5HB+ajR7JlQXGb3CndhmuKyJMQssQkO4LfRM etHA== X-Gm-Message-State: AMke39lpKPrq5yqk65tO5quS0cAXYn5wtGciSAmH4jqo/lde6PfbFMjGOa/juecI4zZBYOH1Si4= X-Received: by 10.25.15.68 with SMTP id e65mr6302598lfi.117.1486490784591; Tue, 07 Feb 2017 10:06:24 -0800 (PST) Received: from forlindon.lumag.auriga.ru ([93.185.26.131]) by smtp.gmail.com with ESMTPSA id s20sm1548331lfe.41.2017.02.07.10.06.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Feb 2017 10:06:23 -0800 (PST) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Tue, 7 Feb 2017 21:06:17 +0300 Message-Id: <20170207180617.5169-3-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170207180617.5169-1-dmitry.ereminsolenikov@linaro.org> References: <20170207180617.5169-1-dmitry.ereminsolenikov@linaro.org> Subject: [lng-odp] [PATCH v2 3/3] linux-generic: crypto: support OpenSSL 1.1.0 X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" OpenSSL 1.1.0 uses new threading API. It is no longer necessary to set locking callbacks to use OpenSSL in a multi-threaded environment. The old threading API should no longer be used. So don't allocate/set locking callbacks with new OpenSSL. Signed-off-by: Dmitry Eremin-Solenikov --- platform/linux-generic/odp_crypto.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) -- 2.11.0 diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index d83b8e09..d1d32497 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -26,6 +26,7 @@ #include #include #include +#include #define MAX_SESSIONS 32 @@ -948,16 +949,18 @@ odp_crypto_operation(odp_crypto_op_param_t *param, return 0; } -static unsigned long openssl_thread_id(void) +static +unsigned long ODP_UNUSED openssl_thread_id(void) { return (unsigned long)odp_thread_id(); } odp_ticketlock_t *openssl_locks; -static void openssl_lock(int mode, int n, - const char *file ODP_UNUSED, - int line ODP_UNUSED) +static +void ODP_UNUSED openssl_lock(int mode, int n, + const char *file ODP_UNUSED, + int line ODP_UNUSED) { if (mode & CRYPTO_LOCK) odp_ticketlock_lock(&openssl_locks[n]); @@ -972,6 +975,10 @@ static void openssl_init_locks(void) odp_shm_t shm; int idx; + /* OpenSSL does not need locks after 1.1.0 */ + if (OPENSSL_VERSION_NUMBER >= 0x10100000L) + return; + nlocks = CRYPTO_num_locks(); if (nlocks <= 0) return; @@ -996,6 +1003,10 @@ static void openssl_init_locks(void) static int openssl_term_locks(void) { + /* OpenSSL does not need locks after 1.1.0 */ + if (OPENSSL_VERSION_NUMBER >= 0x10100000L) + return 0; + CRYPTO_set_locking_callback(NULL); CRYPTO_set_id_callback(NULL);