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 C2E0143BCF; Fri, 1 Mar 2024 18:59:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 82B46433EF; Fri, 1 Mar 2024 18:59:00 +0100 (CET) Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) by mails.dpdk.org (Postfix) with ESMTP id BA56C4336E for ; Fri, 1 Mar 2024 18:58:56 +0100 (CET) Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3c19bc08f96so1969369b6e.2 for ; Fri, 01 Mar 2024 09:58:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709315936; x=1709920736; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lAKHHOeyOrADvZoZlagpBMrnt1cOInFGnnxvfeaQEQ8=; b=xJrLvunXporpcnLXV+NXYPbl+8AVaAlCpCIVo7WyYu6PSJNY0QJxcImNkM/DjNt22v EhDPxZ0mkgq4QF2M4N6GydXWWb3/V3cxVBlWtQ1ELulqg1FY56oaHIJ9Hoyvr3CFn3V5 ksZDX0S3UpzzKUTRby6l9rjU1v8AxIJd8h0mdCGWgNhk1/mgLvj1TvFj5EWF+1PiLz81 PekPABf6tcYc2WFrkPNzIRpY+1CZB3n8gKEy9/E//2IYr7bx85dUhhE4JLQHo4JHw3Kz CCvv8WB18I4oRV8jrGa2HizW3NRT4mID4Fav5lv0yuyhkMHcntnQgFesN1/NiYg6p6CB 68uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709315936; x=1709920736; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lAKHHOeyOrADvZoZlagpBMrnt1cOInFGnnxvfeaQEQ8=; b=gGqajXTi/zvvvCzovrtvRa2dQmCVyUKeFTqrPgXZZ5eutCxZXMktA2IMohhFVRMeCQ xRo4p+z/TjK50542oZwdIPrrV0du3gpXFyqrjs00LAVCRcUaNl4f92BT4yXpLez7/DiQ eh4b68sCXexLhpul/qgmnUW64FgcaRQ420enosb9RxiCMlYa389fwvQafuwuDerHkH8j 6rVS/wO5wf8t63ts0gFniZ8sF2haVrna/mTrduHUt0a/r5EybESZIW92TTy0QW5UR5g8 OvASHNm2AUF/xIxX9irZ0Ra05rcedhCQH0RC32levxqvpH3Su4HAV6840AJBwJhsySMU R7dA== X-Gm-Message-State: AOJu0Yy0qhhJEIIF73nh/CKEwamaSyb0XlOS6QVJ+sj+3zwuhSpgZ4ph EV+81HEbmHn5sE4TIEGf944hXX6EZ5bq90zgtR+3TbplIHtE2cKbB+WHnk/3b0PND9Qhclc04vN 8mm7wUg== X-Google-Smtp-Source: AGHT+IHPn9KP0rQzAALHQPlMEkl3YkyF5NusNoK+qwDldg6pQN8dE9YmRibsSsLLZLPQpsUJ+aMArg== X-Received: by 2002:a05:6808:1492:b0:3c1:7c55:3730 with SMTP id e18-20020a056808149200b003c17c553730mr2569537oiw.42.1709315936034; Fri, 01 Mar 2024 09:58:56 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id bw7-20020a056a02048700b005e438ea2a5asm2938828pgb.53.2024.03.01.09.58.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 09:58:55 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Devendra Singh Rawat , Alok Prasad Subject: [PATCH 4/6] net/qede: replace use of rand() Date: Fri, 1 Mar 2024 09:57:09 -0800 Message-ID: <20240301175842.159967-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240301175842.159967-1-stephen@networkplumber.org> References: <20240301175842.159967-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The function of rand() is a weak random number generator. Use the DPDK rte_rand() instead. Note: this doesn't matter for real security, since most drivers use a fixed RSS default key. Signed-off-by: Stephen Hemminger --- drivers/net/qede/qede_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 254548d40638..bee9fa4f60a1 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -7,6 +7,7 @@ #include "qede_ethdev.h" #include #include +#include #include static const struct qed_eth_ops *qed_ops; @@ -1040,9 +1041,8 @@ static void qede_prandom_bytes(uint32_t *buff) { uint8_t i; - srand((unsigned int)time(NULL)); for (i = 0; i < ECORE_RSS_KEY_SIZE; i++) - buff[i] = rand(); + buff[i] = rte_rand(); } int qede_config_rss(struct rte_eth_dev *eth_dev) -- 2.43.0