commit - 0674467428bb864d0bbda6fd3275e0dcc86aad85
commit + 89a8666a0364791b8c6b40f914b1dc919592d1ee
blob - d40e105145c22f33fe7cec5f0c4ec30ce0c7f502
blob + 40936929f879cc3b104cfb23f50f50ae7366d1b2
--- 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;
}