commit - a08fda08dfda5473c47e3d6d0d01fc62d08dd5ec
commit + eed4085c0f4916f79731c3fc1a8adeb149b59a69
blob - d91f248fe08f8bda24931834c38c29dfd8d08fd2
blob + 5911bacfda535885152cd7e9f16c9481094c581c
--- lib/hash.c
+++ lib/hash.c
SHA1Init(&hash->sha1_ctx);
else if (algo == GOT_HASH_SHA256)
SHA256Init(&hash->sha256_ctx);
+ else
+ abort();
}
void
SHA1Update(&hash->sha1_ctx, data, len);
else if (hash->algo == GOT_HASH_SHA256)
SHA256Update(&hash->sha256_ctx, data, len);
+ else
+ abort();
}
void
SHA1Final(out, &hash->sha1_ctx);
else if (hash->algo == GOT_HASH_SHA256)
SHA256Final(out, &hash->sha256_ctx);
+ else
+ abort();
}
void
id->algo = hash->algo;
if (hash->algo == GOT_HASH_SHA1)
SHA1Final(id->hash, &hash->sha1_ctx);
- else
+ else if (hash->algo == GOT_HASH_SHA256)
SHA256Final(id->hash, &hash->sha256_ctx);
+ else
+ abort();
}
int
return memcmp(b1, b2, SHA1_DIGEST_LENGTH);
else if (algo == GOT_HASH_SHA256)
return memcmp(b1, b2, SHA256_DIGEST_LENGTH);
+ else
+ abort();
return -1;
}