Re: AES192 and SHA256 support

Bill Fenner <[email protected]> Tue, 4 Jun 2024 23:13:48 -0400
Newsgroups gmane.network.net-snmp.devel
Message-ID <CAF4Soga3HRCSUDgX3=gu5XGLfWvkgg1BDBuTmESjV19Q3EiC0g@mail.gmail.com>
--===============3481096443551303144==
Content-Type: multipart/alternative; boundary="0000000000001f795e061a1bf57b"

--0000000000001f795e061a1bf57b
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Sukeerthi,

You're looking at the code that is used when NETSNMP_USE_PKCS11 is
defined.  The SHA2 hashes such as SHA256 are only available with OpenSSL,
in which case we use sc_get_openssl_hashfn() to pick the hash function that
corresponds with the configured hash algorithm.

  Bill


On Fri, May 17, 2024 at 7:44=E2=80=AFAM sukeerthi bj <[email protected]=
> wrote:

> Hi,
>
> I see AES192 and SHA256 support in SNMP, but wanted to understand if belo=
w
> code is doing right? Here for pcks_generate_ku only CKM_SHA_1 is passed.
> For SHA256 should not CKM_SHA256 be passed here instead?
> Can anyone have a look into this and explain?
>
> #ifndef NETSNMP_DISABLE_MD5
> if (NETSNMP_USMAUTH_HMACMD5 =3D=3D auth_type)
> return pkcs_generate_Ku(CKM_MD5, P, pplen, Ku, kulen);
> else
> #endif
> if (NETSNMP_USMAUTH_HMACSHA1 =3D=3D auth_type)
> return pkcs_generate_Ku(CKM_SHA_1, P, pplen, Ku, kulen);
> else {
> return (SNMPERR_GENERR);
> _______________________________________________
> Net-snmp-coders mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
>

--0000000000001f795e061a1bf57b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Sukeerthi,<div><br></div><div>You&#39;re looking at the=
 code that is used when=C2=A0NETSNMP_USE_PKCS11 is defined.=C2=A0 The SHA2 =
hashes such as SHA256 are only available with OpenSSL, in which case we use=
=C2=A0sc_get_openssl_hashfn() to pick the hash function that corresponds wi=
th the configured hash algorithm.</div><div><br></div><div>=C2=A0 Bill</div=
><div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">On Fri, May 17, 2024 at 7:44=E2=80=AFAM sukeerthi bj &lt;<a=
 href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:=
<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr=
">Hi,<div><br></div><div>I see AES192 and SHA256 support in SNMP, but wante=
d to understand if below code is doing right? Here for pcks_generate_ku onl=
y CKM_SHA_1 is passed.=C2=A0</div><div>For SHA256 should not=C2=A0CKM_SHA25=
6 be passed here instead?</div><div>Can anyone have a look into=C2=A0this a=
nd explain?</div><div><br></div><div><div style=3D"color:rgb(212,212,212);b=
ackground-color:rgb(30,30,30);font-family:Menlo,Monaco,&quot;Courier New&qu=
ot;,monospace;font-size:12px;line-height:18px;white-space:pre-wrap"><div><s=
pan style=3D"color:rgb(197,134,192)">#ifndef</span><span style=3D"color:rgb=
(86,156,214)"> NETSNMP_DISABLE_MD5</span></div><div>    <span style=3D"colo=
r:rgb(197,134,192)">if</span> (NETSNMP_USMAUTH_HMACMD5 =3D=3D auth_type)</d=
iv><div>        <span style=3D"color:rgb(197,134,192)">return</span> <span =
style=3D"color:rgb(220,220,170)">pkcs_generate_Ku</span>(CKM_MD5, P, pplen,=
 Ku, kulen);</div><div>    <span style=3D"color:rgb(197,134,192)">else</spa=
n></div><div><span style=3D"color:rgb(197,134,192)">#endif</span></div><div=
>        <span style=3D"color:rgb(197,134,192)">if</span> (NETSNMP_USMAUTH_=
HMACSHA1 =3D=3D auth_type)</div><div>        <span style=3D"color:rgb(197,1=
34,192)">return</span> <span style=3D"color:rgb(220,220,170)">pkcs_generate=
_Ku</span>(CKM_SHA_1, P, pplen, Ku, kulen);</div><div>    <span style=3D"co=
lor:rgb(197,134,192)">else</span> {</div><div>        <span style=3D"color:=
rgb(197,134,192)">return</span> (SNMPERR_GENERR);</div></div></div></div>
_______________________________________________<br>
Net-snmp-coders mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">=
[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/net-snmp-coders" re=
l=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/list=
info/net-snmp-coders</a><br>
</blockquote></div>

--0000000000001f795e061a1bf57b--


--===============3481096443551303144==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============3481096443551303144==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

--===============3481096443551303144==--