Re: [PATCH v5 ima-evm-utils 1/2] set default hash algorithm in configuration time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 09, 2021 at 05:03:41PM -0400, Mimi Zohar wrote:
> On Thu, 2021-09-02 at 16:24 -0300, Bruno Meneguele wrote:
> > +       AC_ARG_WITH([default_hash],
> > +               AS_HELP_STRING([--with-default-hash=ALGORITHM], [specifies the default hash algorithm to be used]),
> > +               [HASH_ALGO=$withval],
> > +               [HASH_ALGO=sha1])
> > +
> > +       AC_CHECK_HEADER([$HASH_INFO_HEADER],
> > +               [HAVE_HASH_INFO_HEADER=yes],
> > +               [AC_MSG_WARN([$HASH_INFO_HEADER not found.])])
> > +
> > +       if test "x$HAVE_HASH_INFO_HEADER" = "x"; then
> > +               AC_MSG_RESULT([using $HASH_ALGO algorithm as default hash algorith])
> > +               AC_DEFINE_UNQUOTED(DEFAULT_HASH_ALGO, "$HASH_ALGO", [Define default hash algorithm])
> > +       else
> > +               AC_PROG_SED()
> > +               AC_PROG_GREP()
> > +               $SED -n 's/HASH_ALGO_\(.*\),/\L\1\E/p' $HASH_INFO_HEADER | $GREP -w -i $HASH_ALGO > /dev/null
> 
> This does an a case insensitive test for the hash algorithm, but the
> code itself doesn't support upper case hash algorithms (e.g. SHA1,
> SHA256).
> 

This case-insensitive is actually redundant here, since in the 'sed' I'm
already lowering the case with '\L\1\E'. Will remove it.

> thanks,
> 
> Mimi
> 
> 
> > +               have_hash=$?
> > +
> > +               if test $have_hash -ne 0; then
> > +                       AC_MSG_ERROR([$HASH_ALGO algorithm specified, but not provided by the kernel], 1)
> > +               else
> > +                       AC_MSG_NOTICE([using $HASH_ALGO as default hash algorithm])
> > +                       AC_DEFINE_UNQUOTED(DEFAULT_HASH_ALGO, "$HASH_ALGO", [Define default hash algorithm])
> > +               fi
> 
> 

-- 
bmeneg 
PGP Key: http://bmeneg.com/pubkey.txt

Attachment: signature.asc
Description: PGP signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux