Remove redundant strlen()'s on sha1 digest verification
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 28 Apr 2011 07:31:23 +0000 (10:31 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 28 Apr 2011 12:24:09 +0000 (15:24 +0300)
- string comparison notices different length anyway, avoid going
  through the same data twice

lib/signature.c

index ca12be8..e0b4893 100644 (file)
@@ -445,7 +445,7 @@ verifySHA1Digest(rpmtd sigtd, DIGEST_CTX sha1ctx, char **msg)
 
     (void) rpmDigestFinal(ctx, (void **)&SHA1, NULL, 1);
 
-    if (SHA1 == NULL || strlen(SHA1) != strlen(sig) || !rstreq(SHA1, sig)) {
+    if (SHA1 == NULL || !rstreq(SHA1, sig)) {
        rasprintf(msg, "%s %s Expected(%s) != (%s)\n", title,
                  rpmSigString(res), sig, SHA1 ? SHA1 : "(nil)");
     } else {