Blame SOURCES/net-snmp-5.8-aes-config.patch

0e8785
From 0be093688013b90896f2db3204bb20e790d70149 Mon Sep 17 00:00:00 2001
0e8785
From: Bart Van Assche <bvanassche@acm.org>
0e8785
Date: Mon, 27 Apr 2020 08:23:16 -0700
0e8785
Subject: [PATCH] configure: Report supported authentication and encryption
0e8785
 modes correctly
0e8785
0e8785
Commit 9e49de2e03b1 ("NEWS: snmplib: AES-192/AES-256 compatibility with SNMP
0e8785
Research / CISCO") removed SHA-128 and SHA-192 support and added support for
0e8785
SHA-224, SHA-256, SHA-384 and SHA-512. Commit 329a9d3c9d63 ("revamp auth/priv
0e8785
protocol constants handling") added support for several AES encryption modes.
0e8785
Make the configure script report which modes are supported.
0e8785
---
0e8785
 configure                   | 15 ++++++++++++++-
0e8785
 configure.d/config_os_misc2 | 15 ++++++++++++++-
0e8785
 2 files changed, 28 insertions(+), 2 deletions(-)
0e8785
0e8785
diff --git a/configure b/configure
0e8785
index 46402589f..7481ebd07 100755
0e8785
--- a/configure
0e8785
+++ b/configure
0e8785
@@ -26453,7 +26453,13 @@ $as_echo "#define NETSNMP_USE_INTERNAL_CRYPTO 1" >>confdefs.h
0e8785
     { $as_echo "$as_me:${as_lineno-$LINENO}: result: Internal Crypto Support" >&5
0e8785
 $as_echo "Internal Crypto Support" >&6; }
0e8785
 elif test "x$useopenssl" != "xno" ; then
0e8785
-    authmodes="MD5 SHA1 SHA512 SHA384 SHA256 SHA192"
0e8785
+    authmodes="MD5 SHA1"
0e8785
+    if test "x$ac_cv_func_EVP_sha224" = xyes; then
0e8785
+        authmodes="$authmodes SHA224 SHA256"
0e8785
+    fi
0e8785
+    if test "x$ac_cv_func_EVP_sha384" = xyes; then
0e8785
+        authmodes="$authmodes SHA384 SHA512"
0e8785
+    fi
0e8785
     if test "x$enable_privacy" != "xno" ; then
0e8785
         if test "x$ac_cv_header_openssl_aes_h" = "xyes" ; then
0e8785
             encrmodes="DES AES"
0e8785
@@ -26492,6 +26498,13 @@ fi
0e8785
 if test "x$enable_md5" = "xno"; then
0e8785
     authmodes=`echo $authmodes | $SED 's/MD5 *//;'`
0e8785
 fi
0e8785
+if test "x$ac_cv_func_AES_cfb128_encrypt" = xyes ||
0e8785
+   test "x$CRYPTO" = xinternal; then
0e8785
+    encrmodes="$encrmodes AES128"
0e8785
+    if test "x$aes_capable" = "xyes"; then
0e8785
+        encrmodes="$encrmodes AES192 AES192C AES256 AES256C"
0e8785
+    fi
0e8785
+fi
0e8785
 
0e8785
 
0e8785
 
0e8785
diff --git a/configure.d/config_os_misc2 b/configure.d/config_os_misc2
0e8785
index 1df9bf0a2..be0bccec0 100644
0e8785
--- a/configure.d/config_os_misc2
0e8785
+++ b/configure.d/config_os_misc2
0e8785
@@ -53,7 +53,13 @@ if test "x$CRYPTO" = "xinternal" ; then
0e8785
     AC_DEFINE(NETSNMP_USE_INTERNAL_CRYPTO, 1, "Define if internal cryptography code should be used")
0e8785
     AC_MSG_RESULT(Internal Crypto Support)
0e8785
 elif test "x$useopenssl" != "xno" ; then
0e8785
-    authmodes="MD5 SHA1 SHA512 SHA384 SHA256 SHA192"
0e8785
+    authmodes="MD5 SHA1"
0e8785
+    if test "x$ac_cv_func_EVP_sha224" = xyes; then
0e8785
+        authmodes="$authmodes SHA224 SHA256"
0e8785
+    fi
0e8785
+    if test "x$ac_cv_func_EVP_sha384" = xyes; then
0e8785
+        authmodes="$authmodes SHA384 SHA512"
0e8785
+    fi
0e8785
     if test "x$enable_privacy" != "xno" ; then
0e8785
         if test "x$ac_cv_header_openssl_aes_h" = "xyes" ; then
0e8785
             encrmodes="DES AES"
0e8785
@@ -86,6 +92,13 @@ fi
0e8785
 if test "x$enable_md5" = "xno"; then
0e8785
     authmodes=`echo $authmodes | $SED 's/MD5 *//;'`
0e8785
 fi
0e8785
+if test "x$ac_cv_func_AES_cfb128_encrypt" = xyes ||
0e8785
+   test "x$CRYPTO" = xinternal; then
0e8785
+    encrmodes="$encrmodes AES128"
0e8785
+    if test "x$aes_capable" = "xyes"; then
0e8785
+        encrmodes="$encrmodes AES192 AES192C AES256 AES256C"
0e8785
+    fi
0e8785
+fi
0e8785
 AC_SUBST(LNETSNMPLIBS)
0e8785
 AC_SUBST(LAGENTLIBS)
0e8785
 
0e8785
0e8785
diff -urNp a/net-snmp-create-v3-user.in b/net-snmp-create-v3-user.in
0e8785
--- a/net-snmp-create-v3-user.in	2020-06-15 12:59:05.117432700 +0200
0e8785
+++ b/net-snmp-create-v3-user.in	2020-06-15 13:01:36.151905241 +0200
0e8785
@@ -58,11 +58,11 @@ case $1 in
0e8785
 	    exit 1
0e8785
 	fi
0e8785
         case $1 in
0e8785
-            DES|AES|AES128)
0e8785
+            DES|AES|AES128|AES192|AES256)
0e8785
 	    Xalgorithm=$1
0e8785
 	    shift
0e8785
 	    ;;
0e8785
-            des|aes|aes128)
0e8785
+            des|aes|aes128|aes192|aes256)
0e8785
 	    Xalgorithm=`echo $1 | tr a-z A-Z`
0e8785
 	    shift
0e8785
 	    ;;