Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2350045pxb; Thu, 4 Nov 2021 19:09:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqR9u0G9xXZm3Ctk9teTQT+WOkVk0a4uMp7SoOqcGI2ReyOH6/azHYCWyQ85c4WqOteJ0M X-Received: by 2002:a5d:8792:: with SMTP id f18mr38421178ion.52.1636078141029; Thu, 04 Nov 2021 19:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1636078141; cv=none; d=google.com; s=arc-20160816; b=0ITTWZWViqEvuS1lFQr+ESTccshrz9LWJFF3yqQgOSXLyKxFgp3NdiRN1V5EsX8yYM /vm/rdmDr0581/6K4Ucj+tShKcvd8LwN3XwS8rgLpcqUBvomolqGdQWAF9BWfJ7u49Zh J3arGUZHZL0uHDcrT9BDS6INKyUHVypbtifZqaus7s+Kuf+wA+nXkTZUoV8LSsEaLhq9 CZ0xt9HR+oIb8CWBmxqj/YDXz7krIAhtPDiDwZ2cqzAyoEvazsSmjUqeFs9slZSUrmu5 KxgsA8t0vwjrvclOPsrDaN5dtPbKCMsy1+GpYTWoPN6AXkZbiOdPnOr1FiLJsNcXqc7X /x2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=G7p3eOuyEP7P+5SWAUtBhjcxOrwbMlR3hzNOptyZbA0=; b=0a5Ky8TpkWyKFxmYTsF28Whe3JJiWlZ5Ez7q2dLoiYXXfnlmCwH7bFxthVYFPWj1v1 39TNI1n61vBw9tDeH49rHsxGWh/6s6bnbEprJZmKNaZrdLVOGhFmzyyeDKq/Oq2mTVAk q+XExxMIRHb+rE5Br4IFc0F68NsmLPCwT32oYhNvWmqbmjVmC5yeR4PrUTeaCKfACU3b 5puax+5Bp2j8u/HiRcnPh4Z/UpUb1oBSL+tBuw/7OCBJSMY0czQ7Rg2+irA+z/xvEJxJ Vn5UuQBYaA2XdGyI8W//uCQgfE5RQY7QO9Q+dIb2Xc7hed5mlBNGlvmykPCgwv/eu49E glow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IhRaPGPT; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b23si6959751ioc.72.2021.11.04.19.08.45; Thu, 04 Nov 2021 19:09:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IhRaPGPT; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230172AbhKECLW (ORCPT + 99 others); Thu, 4 Nov 2021 22:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230168AbhKECLV (ORCPT ); Thu, 4 Nov 2021 22:11:21 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1971EC061714; Thu, 4 Nov 2021 19:08:43 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id u1so11382930wru.13; Thu, 04 Nov 2021 19:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=G7p3eOuyEP7P+5SWAUtBhjcxOrwbMlR3hzNOptyZbA0=; b=IhRaPGPTa0Jq3iIOcXz9/JXOprUzK8DqDoOx5denLiUjptwj8/xLn0hta0XM0v0huY /QxlgAOlv1ZjWed0HDnlQoh2ESmisDJRm/0U2D9ml9Fw3GLkDvJowHiGw6aVh/x9QrYD C7I9Q+/Jpg/Kuw1QKheqT1ENR6jue0hnbE7JFxs9ybiohII2nS/dLTr4IECH5gUDNmWo 0JShhxbc1kniPMH5ldiPE7ntLeUop/CkFJoXgHawHt6tz5oNQ/k01qZL00AWZXo6yIt3 O/aeVM9LaQJ6mXHtks6yk9/POvvwv4lTeHRBu2VGA5R67KW58kNU0gY76G4R+aFa54mX jbpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=G7p3eOuyEP7P+5SWAUtBhjcxOrwbMlR3hzNOptyZbA0=; b=w1Ap5emnC3gFKGp6aecKlLhGdTo4LIF5Kp39D1gd9gBJoY6K1t2WKawHOJStKK5ANk vaNvzcSsSXEErWaThxEQe2NBSJv9cfXZqGfHRq7Zp5PPGNkZCBBYSbIj1alQK8PJzcPn R38oyQV5gNI7DmcEXWEGzg/tN5SD6ZkzX+nKxrc47+tTajIRtC/h9vhgmAHFk7B7fX6J yF9+4w3Ex8+7JJj8dHhj9Tc52K5GxoDesV9a45Haw/BxV8OHDl2sRIbsBVmxXmz0z4c6 iTCVZyCYbtRnjv2igL+js6g7nVQ25bjRxUq0wTfzdojQ8ajTPBc/8LoJNuRTuihsLU/A 0QKw== X-Gm-Message-State: AOAM531KpGRUp8oK8AKCKEYrhkCC6Cpc4LU8rCN1tSpi1OrQA6IQlNir utDwNb1uoDvxMgamHODBiP4= X-Received: by 2002:adf:df0b:: with SMTP id y11mr45201713wrl.181.1636078121738; Thu, 04 Nov 2021 19:08:41 -0700 (PDT) Received: from ?IPV6:2a02:8084:e84:2480:228:f8ff:fe6f:83a8? ([2a02:8084:e84:2480:228:f8ff:fe6f:83a8]) by smtp.gmail.com with ESMTPSA id c79sm6826731wme.43.2021.11.04.19.08.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Nov 2021 19:08:41 -0700 (PDT) Message-ID: <7a32f18e-aa92-8fd8-4f53-72b4ef8b0ffc@gmail.com> Date: Fri, 5 Nov 2021 02:08:40 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v2 06/25] tcp: authopt: Compute packet signatures Content-Language: en-US To: Leonard Crestez Cc: "David S. Miller" , Herbert Xu , Kuniyuki Iwashima , Hideaki YOSHIFUJI , Jakub Kicinski , Yuchung Cheng , Francesco Ruggeri , Mat Martineau , Christoph Paasch , Ivan Delalande , Priyaranjan Jha , netdev@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan , Eric Dumazet , David Ahern References: <5245f35901015acc6a41d1da92deb96f3e593b7c.1635784253.git.cdleonard@gmail.com> From: Dmitry Safonov <0x7f454c46@gmail.com> In-Reply-To: <5245f35901015acc6a41d1da92deb96f3e593b7c.1635784253.git.cdleonard@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 11/1/21 16:34, Leonard Crestez wrote: [..] > +/* Find TCP_AUTHOPT in header. > + * > + * Returns pointer to TCP_AUTHOPT or NULL if not found. > + */ > +static u8 *tcp_authopt_find_option(struct tcphdr *th) > +{ > + int length = (th->doff << 2) - sizeof(*th); > + u8 *ptr = (u8 *)(th + 1); > + > + while (length >= 2) { > + int opcode = *ptr++; > + int opsize; > + > + switch (opcode) { > + case TCPOPT_EOL: > + return NULL; > + case TCPOPT_NOP: > + length--; > + continue; > + default: > + if (length < 2) > + return NULL; ^ never true, as checked by the loop condition > + opsize = *ptr++; > + if (opsize < 2) > + return NULL; > + if (opsize > length) > + return NULL; > + if (opcode == TCPOPT_AUTHOPT) > + return ptr - 2; > + } > + ptr += opsize - 2; > + length -= opsize; > + } > + return NULL; > +} Why copy'n'pasting tcp_parse_md5sig_option(), rather than adding a new argument to the function? Thanks, Dmitry