From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.6059.1623235404389547308 for ; Wed, 09 Jun 2021 03:43:24 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fXpx5GKm; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623235403; 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=lL3VorAGTOWmUJVxr6U68g7F9bXGvMw2W22uSaP6k+I=; b=fXpx5GKmtVmZjzC2C1DmXFfVuZ1os4CarCE6u3bsMzgJ1XvUi19Ue2x71wEbukLMwD2Mop Sljm4RLniFE+Si7ZRM1tiZsAX/ByiJjzFy97ckOGHjPSwK5EDjtCj+PSqURchEgP+Y9YKD JuElsdbh5hBsdFFXzAMG3WElW2GYAUI= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-462-qFov-EQ-NOS_Rkkm5fkqJg-1; Wed, 09 Jun 2021 06:43:22 -0400 X-MC-Unique: qFov-EQ-NOS_Rkkm5fkqJg-1 Received: by mail-wm1-f69.google.com with SMTP id o82-20020a1ca5550000b029019ae053d508so1785510wme.6 for ; Wed, 09 Jun 2021 03:43:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lL3VorAGTOWmUJVxr6U68g7F9bXGvMw2W22uSaP6k+I=; b=GCi5ha4prrixZHiPleDS1NOwRGXAzwMidpGPPutF8BPTc1MviXTFSq7qTSWlEHKFEl WiRAYCfXxzmdzH6WE134+IcLmqr3T8SLGYHdeFMju9R7AY1IYJtO8cvWPC0iUqi4vhoZ 2JMlD/xf65fGdDqmhj8+bphOqMUokgR0iCCIeEwDdA6Y64FhTG6/wkRoEW/8cB7KLTli uM5TIxjtYN+v/oiW2qTc2L6WqEoUW+eNSeom9gAfeeMmEdvQgLBIxuGBNFtCV2b0b9+3 58w/MVVX8hv/djtpt4KDSgFm0b8wbrctllH9A3IeYWKI8KuvEAnA1f4xyupVB3kP5Lqk DEQw== X-Gm-Message-State: AOAM532EtB86ABJB+Me5ePg+2h9cKABfkOnDesVN3jtAokQmZesdH27C FxpOmqGpFtvGkSkpcSWt6LqXVPLQh+bdAremeE9/hndQMB0nI8VScQMLyv+iGebs44dnYV9AzXe as7l0Od2Ohy0Ypg== X-Received: by 2002:adf:f7d1:: with SMTP id a17mr27480961wrq.84.1623235401024; Wed, 09 Jun 2021 03:43:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgQ/sKBsz+RBMbg2qOrtt9hDXwobWaQfwUKwCavQYypJfFG0o3J+3u1DKjgEvRorwp0+h4Vg== X-Received: by 2002:adf:f7d1:: with SMTP id a17mr27480933wrq.84.1623235400773; Wed, 09 Jun 2021 03:43:20 -0700 (PDT) Return-Path: Received: from [192.168.1.36] (235.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.235]) by smtp.gmail.com with ESMTPSA id o7sm2179316wro.76.2021.06.09.03.43.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Jun 2021 03:43:20 -0700 (PDT) Subject: Re: [PATCH 3/6] NetworkPkg/IScsiDxe: distinguish "maximum" and "selected" CHAP digest sizes To: Laszlo Ersek , edk2-devel-groups-io Cc: Jiaxin Wu , Maciej Rabeda , Siyuan Fu References: <20210608130652.2434-1-lersek@redhat.com> <20210608130652.2434-4-lersek@redhat.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: <299ff69a-7d20-c2bc-ca51-c07743a48075@redhat.com> Date: Wed, 9 Jun 2021 12:43:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210608130652.2434-4-lersek@redhat.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Hi Laszlo, On 6/8/21 3:06 PM, Laszlo Ersek wrote: > IScsiDxe uses the ISCSI_CHAP_RSP_LEN macro for expressing the size of the > digest (16) that it solely supports at this point (MD5). > ISCSI_CHAP_RSP_LEN is used for both (a) *allocating* digest-related > buffers (binary buffers and hex encodings alike), and (b) *processing* > binary digest buffers (comparing them, filling them, reading them). > > In preparation for adding other hash algorithms, split purpose (a) from > purpose (b). For purpose (a) -- buffer allocation --, introduce > ISCSI_CHAP_MAX_DIGEST_SIZE. For purpose (b) -- processing --, rely on > MD5_DIGEST_SIZE from . Matter of taste probably, I'd rather see this patch split in 2, as you identified. (b) first then (a). Regardless: Reviewed-by: Philippe Mathieu-Daude > Distinguishing these purposes is justified because purpose (b) -- > processing -- must depend on the hashing algorithm negotiated between > initiator and target, while for purpose (a) -- allocation --, using the > maximum supported digest size is suitable. For now, because only MD5 is > supported, introduce ISCSI_CHAP_MAX_DIGEST_SIZE *as* MD5_DIGEST_SIZE. > > Note that the argument for using the digest size as the size of the > outgoing challenge (in case mutual authentication is desired by the > initiator) remains in place. Because of this, the above two purposes are > distinguished for the "ISCSI_CHAP_AUTH_DATA.OutChallenge" field as well. > > This patch is functionally a no-op, just yet. > > Cc: Jiaxin Wu > Cc: Maciej Rabeda > Cc: Philippe Mathieu-Daudé > Cc: Siyuan Fu > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3355 > Signed-off-by: Laszlo Ersek > --- > NetworkPkg/IScsiDxe/IScsiCHAP.h | 17 +++++++++------ > NetworkPkg/IScsiDxe/IScsiCHAP.c | 22 ++++++++++---------- > 2 files changed, 22 insertions(+), 17 deletions(-)