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

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