Revert previous change, as I fixed MD5(9).
This commit is contained in:
parent
e23555c1ae
commit
f0667561aa
@ -159,7 +159,6 @@ static __inline void
|
||||
eli_metadata_encode(struct g_eli_metadata *md, u_char *data)
|
||||
{
|
||||
MD5_CTX ctx;
|
||||
uint32_t hash[4]; /* Need proper aligment here. */
|
||||
u_char *p;
|
||||
|
||||
p = data;
|
||||
@ -176,15 +175,13 @@ eli_metadata_encode(struct g_eli_metadata *md, u_char *data)
|
||||
bcopy(md->md_mkeys, p, sizeof(md->md_mkeys)); p += sizeof(md->md_mkeys);
|
||||
MD5Init(&ctx);
|
||||
MD5Update(&ctx, data, p - data);
|
||||
MD5Final((u_char *)hash, &ctx);
|
||||
bcopy(hash, md->md_hash, sizeof(md->md_hash));
|
||||
MD5Final(md->md_hash, &ctx);
|
||||
bcopy(md->md_hash, p, sizeof(md->md_hash));
|
||||
}
|
||||
static __inline int
|
||||
eli_metadata_decode_v0(const u_char *data, struct g_eli_metadata *md)
|
||||
{
|
||||
MD5_CTX ctx;
|
||||
uint32_t hash[4]; /* Need proper aligment here. */
|
||||
const u_char *p;
|
||||
|
||||
p = data + sizeof(md->md_magic) + sizeof(md->md_version);
|
||||
@ -199,8 +196,7 @@ eli_metadata_decode_v0(const u_char *data, struct g_eli_metadata *md)
|
||||
bcopy(p, md->md_mkeys, sizeof(md->md_mkeys)); p += sizeof(md->md_mkeys);
|
||||
MD5Init(&ctx);
|
||||
MD5Update(&ctx, data, p - data);
|
||||
MD5Final((u_char *)hash, &ctx);
|
||||
bcopy(hash, md->md_hash, sizeof(md->md_hash));
|
||||
MD5Final(md->md_hash, &ctx);
|
||||
if (bcmp(md->md_hash, p, 16) != 0)
|
||||
return (EINVAL);
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user