Revert "selftest: mitm-s4u2self: use zlib for CRC32_checksum calc"
authorIsaac Boukris <iboukris@gmail.com>
Thu, 7 May 2020 15:17:00 +0000 (17:17 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 15 May 2020 10:27:41 +0000 (10:27 +0000)
This reverts commit 151f8c0f31d3d17b9418db3793ec14ba7dbf2143.

This allows a clean revert (and so removal) of the test.

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/torture/krb5/kdc-canon-heimdal.c

index 8dc3e24a8d53b15a400d1da2b18dc1e00e75d655..dffebd7403807084ee9d2b95ff56cc845b6f2d57 100644 (file)
@@ -33,7 +33,6 @@
 #include "auth/auth_sam_reply.h"
 #include "auth/gensec/gensec.h"
 #include "param/param.h"
-#include "zlib.h"
 
 #define TEST_CANONICALIZE     0x0000001
 #define TEST_ENTERPRISE       0x0000002
@@ -215,17 +214,6 @@ static bool test_accept_ticket(struct torture_context *tctx,
        return true;
 }
 
-static void
-zCRC32_checksum(const void *data,
-               size_t len,
-               Checksum *C)
-{
-       uint32_t *crc = C->checksum.data;
-       *crc = ~(crc32(0xffffffff, data, len));
-       C->checksum.length = 4;
-       C->cksumtype = 1;
-}
-
 krb5_error_code
 _krb5_s4u2self_to_checksumdata(krb5_context context,
                               const PA_S4U2Self *self,
@@ -264,7 +252,11 @@ static bool change_for_user_principal(struct torture_krb5_context *test_context,
        torture_assert_int_equal(test_context->tctx,
                                 _krb5_s4u2self_to_checksumdata(k5_ctx, &mod_self, &cksum_data),
                                 0, "_krb5_s4u2self_to_checksumdata() failed");
-       zCRC32_checksum(cksum_data.data, cksum_data.length, &mod_self.cksum);
+       torture_assert_int_equal(test_context->tctx,
+                                krb5_create_checksum(k5_ctx, NULL, KRB5_KU_OTHER_CKSUM,
+                                                     CKSUMTYPE_CRC32, cksum_data.data,
+                                                     cksum_data.length, &mod_self.cksum),
+                                0, "krb5_create_checksum() failed");
 
        ASN1_MALLOC_ENCODE(PA_S4U2Self, for_user->padata_value.data, for_user->padata_value.length,
                           &mod_self, &used, ret);
@@ -278,6 +270,7 @@ static bool change_for_user_principal(struct torture_krb5_context *test_context,
 
        free_PA_S4U2Self(&self);
        krb5_data_free(&cksum_data);
+       free_Checksum(&mod_self.cksum);
 
        return true;
 }