dcerpc-netlogon: fix compilation with older gcrypt versions.
authorDario Lombardo <lomato@gmail.com>
Tue, 7 Jan 2020 14:37:12 +0000 (15:37 +0100)
committerDario Lombardo <lomato@gmail.com>
Tue, 7 Jan 2020 16:52:24 +0000 (16:52 +0000)
GCRY_CIPHER_MODE_CFB8 has been introduced in gcrypt 1.8.0:
https://abi-laboratory.pro/?view=changelog&l=libgcrypt&v=1.8.0

Add conditional compilation code for older versions.

Change-Id: I756cc118fce261a6e1a580f4a6a244c8ff0b381f
Reviewed-on: https://code.wireshark.org/review/35678
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
epan/dissectors/packet-dcerpc-netlogon.c

index 7c60217a30d6d6e64e178e812052dbb22eaf336d..1b05041d1c8728d1f3d4c36b0b09ffcccd58adbd 100644 (file)
@@ -6652,7 +6652,7 @@ netlogon_dissect_netrserverauthenticate23_reply(tvbuff_t *tvb, int offset,
 #endif
             if( flags & NETLOGON_FLAG_AES )
             {
-#ifdef HAVE_KERBEROS
+#if defined(HAVE_KERBEROS) && GCRYPT_VERSION_NUMBER >= 0x010800 /* 1.8.0 */
                 guint8 salt_buf[16] = { 0 };
                 guint8 sha256[HASH_SHA2_256_LENGTH];
                 guint64 calculated_cred;
@@ -7705,6 +7705,7 @@ static int get_seal_key(const guint8 *session_key,int key_len,guint8* seal_key)
 
 }
 
+#if GCRYPT_VERSION_NUMBER >= 0x010800 /* 1.8.0 */
 static guint64 uncrypt_sequence_aes(guint8* session_key,guint64 checksum,guint64 enc_seq,unsigned char is_server _U_)
 {
     gcry_error_t err;
@@ -7747,6 +7748,7 @@ static guint64 uncrypt_sequence_aes(guint8* session_key,guint64 checksum,guint64
     gcry_cipher_close(cipher_hd);
     return enc_seq;
 }
+#endif
 
 static guint64 uncrypt_sequence_strong(guint8* session_key,guint64 checksum,guint64 enc_seq,unsigned char is_server _U_)
 {
@@ -7784,9 +7786,11 @@ static guint64 uncrypt_sequence_strong(guint8* session_key,guint64 checksum,guin
 
 static guint64 uncrypt_sequence(guint32 flags, guint8* session_key,guint64 checksum,guint64 enc_seq,unsigned char is_server _U_)
 {
+#if GCRYPT_VERSION_NUMBER >= 0x010800 /* 1.8.0 */
     if (flags & NETLOGON_FLAG_AES) {
         return uncrypt_sequence_aes(session_key, checksum, enc_seq, is_server);
     }
+#endif
 
     if (flags & NETLOGON_FLAG_STRONGKEY) {
         return uncrypt_sequence_strong(session_key, checksum, enc_seq, is_server);
@@ -7795,6 +7799,7 @@ static guint64 uncrypt_sequence(guint32 flags, guint8* session_key,guint64 check
     return 0;
 }
 
+#if GCRYPT_VERSION_NUMBER >= 0x010800 /* 1.8.0 */
 static gcry_error_t prepare_decryption_cipher_aes(netlogon_auth_vars *vars,
                                                   gcry_cipher_hd_t *_cipher_hd)
 {
@@ -7833,6 +7838,7 @@ static gcry_error_t prepare_decryption_cipher_aes(netlogon_auth_vars *vars,
     *_cipher_hd = cipher_hd;
     return 0;
 }
+#endif
 
 static gcry_error_t prepare_decryption_cipher_strong(netlogon_auth_vars *vars,
                                                      gcry_cipher_hd_t *_cipher_hd)
@@ -7879,9 +7885,11 @@ static gcry_error_t prepare_decryption_cipher(netlogon_auth_vars *vars,
 {
     *_cipher_hd = NULL;
 
+#if GCRYPT_VERSION_NUMBER >= 0x010800 /* 1.8.0 */
     if (vars->flags & NETLOGON_FLAG_AES) {
         return prepare_decryption_cipher_aes(vars, _cipher_hd);
     }
+#endif
 
     if (vars->flags & NETLOGON_FLAG_STRONGKEY) {
         return prepare_decryption_cipher_strong(vars, _cipher_hd);