From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 85CEB45BC0; Thu, 24 Oct 2024 14:06:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 47B1D4345B; Thu, 24 Oct 2024 14:06:12 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 7F50043456 for ; Thu, 24 Oct 2024 14:06:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729771570; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8klH1HN8a3h8/kXSxSde1p/bNiepeEwyMK8anF5hDtE=; b=Vd6JRCeJxQAc1N3MESlkA/kNpKYOLViNcf2vZpRZPUXGoVTdwIuij8i04t4tXaZMxhW2F0 pv/cOhX7WxHAylOKrzozWWCdlGSZPDiC9D95vr1cxlDvox9AnD6NMrobYGdgbTlQZCWrns ojQi0LDqgpqZ4m+yAvng+WnV3c8SgII= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-681-joSxlb86OKyO9hBCwAMOSQ-1; Thu, 24 Oct 2024 08:06:05 -0400 X-MC-Unique: joSxlb86OKyO9hBCwAMOSQ-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EEB451955D44; Thu, 24 Oct 2024 12:06:03 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.57]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D34F419560B2; Thu, 24 Oct 2024 12:05:59 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@amd.com, stephen@networkplumber.org, mattias.ronnblom@ericsson.com, stable@dpdk.org, Kai Ji , Slawomir Mrozowicz , Tomasz Kulasek , Daniel Mrzyglod , Pablo de Lara , Michal Kobylinski Subject: [PATCH 4/6] crypto/openssl: fix 3DES-CTR with big endian CPUs Date: Thu, 24 Oct 2024 14:05:33 +0200 Message-ID: <20241024120535.2722316-5-david.marchand@redhat.com> In-Reply-To: <20241024120535.2722316-1-david.marchand@redhat.com> References: <20241024120535.2722316-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Caught by code review. Don't byte swap unconditionally (assuming that CPU is little endian is wrong). Instead, convert from big endian to cpu and vice versa. Fixes: d61f70b4c918 ("crypto/libcrypto: add driver for OpenSSL library") Cc: stable@dpdk.org Signed-off-by: David Marchand --- drivers/crypto/openssl/rte_openssl_pmd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 9657b70c7a..9f5f3cda7d 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -2,6 +2,7 @@ * Copyright(c) 2016-2017 Intel Corporation */ +#include #include #include #include @@ -110,9 +111,9 @@ ctr_inc(uint8_t *ctr) { uint64_t *ctr64 = (uint64_t *)ctr; - *ctr64 = __builtin_bswap64(*ctr64); + *ctr64 = rte_be_to_cpu_64(*ctr64); (*ctr64)++; - *ctr64 = __builtin_bswap64(*ctr64); + *ctr64 = rte_cpu_to_be_64(*ctr64); } /* -- 2.46.2