Skip to content

Commit

Permalink
fixup! src: deduplicate X509 getter implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
tniessen committed Jun 26, 2023
1 parent 95806b5 commit 2dbacb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions src/crypto/crypto_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ MaybeLocal<Value> GetModulusString(
}
} // namespace

MaybeLocal<Object> GetRawDERCertificate(Environment* env, X509* cert) {
MaybeLocal<Value> GetRawDERCertificate(Environment* env, X509* cert) {
int size = i2d_X509(cert, nullptr);

std::unique_ptr<BackingStore> bs;
Expand Down Expand Up @@ -1386,18 +1386,14 @@ MaybeLocal<Object> X509ToObject(
info,
env->fingerprint512_string(),
GetFingerprintDigest(env, EVP_sha512(), cert)) ||
!Set<Value>(context,
info,
env->ext_key_usage_string(),
GetKeyUsage(env, cert)) ||
!Set<Value>(
context, info, env->ext_key_usage_string(), GetKeyUsage(env, cert)) ||
!Set<Value>(context,
info,
env->serial_number_string(),
GetSerialNumber(env, cert)) ||
!Set<Object>(context,
info,
env->raw_string(),
GetRawDERCertificate(env, cert))) {
!Set<Value>(
context, info, env->raw_string(), GetRawDERCertificate(env, cert))) {
return MaybeLocal<Object>();
}

Expand Down
2 changes: 1 addition & 1 deletion src/crypto/crypto_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ v8::MaybeLocal<v8::Value> GetCurrentCipherVersion(Environment* env,

v8::MaybeLocal<v8::Value> GetSerialNumber(Environment* env, X509* cert);

v8::MaybeLocal<v8::Object> GetRawDERCertificate(Environment* env, X509* cert);
v8::MaybeLocal<v8::Value> GetRawDERCertificate(Environment* env, X509* cert);

v8::Local<v8::Value> ToV8Value(Environment* env, const BIOPointer& bio);
bool SafeX509SubjectAltNamePrint(const BIOPointer& out, X509_EXTENSION* ext);
Expand Down

0 comments on commit 2dbacb7

Please sign in to comment.