integrity-checker: Fix checksum calculation after randomizing chunk_hash()
authorTobias Brunner <tobias@strongswan.org>
Thu, 27 Jun 2013 13:34:08 +0000 (15:34 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 27 Jun 2013 13:34:08 +0000 (15:34 +0200)
src/libstrongswan/utils/integrity_checker.c

index e962aba..be2faf2 100644 (file)
 typedef struct private_integrity_checker_t private_integrity_checker_t;
 
 /**
+ * Key used to calculate MACs (128-bit)
+ */
+static char key[] = "IntegrityChecker";
+
+/**
  * Private data of an integrity_checker_t object.
  */
 struct private_integrity_checker_t {
@@ -91,7 +96,7 @@ METHOD(integrity_checker_t, build_file, u_int32_t,
 
        *len = sb.st_size;
        contents = chunk_create(addr, sb.st_size);
-       checksum = chunk_hash(contents);
+       checksum = chunk_mac(contents, key);
 
        munmap(addr, sb.st_size);
        close(fd);
@@ -153,7 +158,7 @@ METHOD(integrity_checker_t, build_segment, u_int32_t,
 
        segment = chunk_create(dli.dli_fbase, dli.dli_saddr - dli.dli_fbase);
        *len = segment.len;
-       return chunk_hash(segment);
+       return chunk_mac(segment, key);
 }
 
 /**