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

src: simplify arg type of AddFingerprintDigest #42101

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/crypto/crypto_common.cc
Expand Up @@ -435,20 +435,20 @@ MaybeLocal<Object> GetLastIssuedCert(
void AddFingerprintDigest(
const unsigned char* md,
unsigned int md_size,
char (*fingerprint)[3 * EVP_MAX_MD_SIZE + 1]) {
char fingerprint[3 * EVP_MAX_MD_SIZE + 1]) {
unsigned int i;
const char hex[] = "0123456789ABCDEF";

for (i = 0; i < md_size; i++) {
(*fingerprint)[3*i] = hex[(md[i] & 0xf0) >> 4];
(*fingerprint)[(3*i)+1] = hex[(md[i] & 0x0f)];
(*fingerprint)[(3*i)+2] = ':';
fingerprint[3*i] = hex[(md[i] & 0xf0) >> 4];
fingerprint[(3*i)+1] = hex[(md[i] & 0x0f)];
fingerprint[(3*i)+2] = ':';
}

if (md_size > 0) {
(*fingerprint)[(3*(md_size-1))+2] = '\0';
fingerprint[(3*(md_size-1))+2] = '\0';
} else {
(*fingerprint)[0] = '\0';
fingerprint[0] = '\0';
}
}

Expand Down Expand Up @@ -603,7 +603,7 @@ MaybeLocal<Value> GetFingerprintDigest(
char fingerprint[EVP_MAX_MD_SIZE * 3 + 1];

if (X509_digest(cert, method, md, &md_size)) {
AddFingerprintDigest(md, md_size, &fingerprint);
AddFingerprintDigest(md, md_size, fingerprint);
return OneByteString(env->isolate(), fingerprint);
}
return Undefined(env->isolate());
Expand Down