Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checksum.c: Use the EVP API to compute the MD5 checksum #4244

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions libglusterfs/src/checksum.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
cases as published by the Free Software Foundation.
*/

#include <openssl/md5.h>
#include <openssl/evp.h>
#include <openssl/sha.h>
#include <zlib.h>
#include <stdint.h>
Expand Down Expand Up @@ -40,5 +40,13 @@ gf_rsync_strong_checksum(unsigned char *data, size_t len,
void
gf_rsync_md5_checksum(unsigned char *data, size_t len, unsigned char *md5)
{
MD5(data, len, md5);
EVP_MD_CTX *mdctx;
// Use the MD5 digest algorithm
const EVP_MD *md = EVP_md5();

mdctx = EVP_MD_CTX_new();
EVP_DigestInit_ex(mdctx, md, NULL);
EVP_DigestUpdate(mdctx, data, len);
EVP_DigestFinal_ex(mdctx, md5, NULL);
EVP_MD_CTX_free(mdctx);
}
2 changes: 1 addition & 1 deletion libglusterfs/src/client_t.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ gf_client_dump_fdtables(xlator_t *this)
clienttable->cliententries[count].next_free)
continue;
client = clienttable->cliententries[count].client;
if (client->client_uid) {
if (client) {
gf_proc_dump_build_key(key, "conn", "%d.id", count);
gf_proc_dump_write(key, "%s", client->client_uid);
}
Expand Down