Skip to content
Closed
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
26 changes: 11 additions & 15 deletions src/node_crypto_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -386,31 +386,27 @@ Local<Value> ToV8Value(Environment* env, const BIOPointer& bio) {
return ret.FromMaybe(Local<Value>());
}

MaybeLocal<Value> GetCipherName(
Environment* env,
const SSL_CIPHER* cipher) {
MaybeLocal<Value> GetCipherValue(Environment* env,
const SSL_CIPHER* cipher,
const char* (*getstr)(const SSL_CIPHER* cipher)) {
if (cipher == nullptr)
return Undefined(env->isolate());

return OneByteString(env->isolate(), SSL_CIPHER_get_name(cipher));
return OneByteString(env->isolate(), getstr(cipher));
}

MaybeLocal<Value> GetCipherStandardName(
Environment* env,
const SSL_CIPHER* cipher) {
if (cipher == nullptr)
return Undefined(env->isolate());

return OneByteString(env->isolate(), SSL_CIPHER_standard_name(cipher));
MaybeLocal<Value> GetCipherName(Environment* env, const SSL_CIPHER* cipher) {
return GetCipherValue(env, cipher, SSL_CIPHER_get_name);
}

MaybeLocal<Value> GetCipherVersion(
MaybeLocal<Value> GetCipherStandardName(
Environment* env,
const SSL_CIPHER* cipher) {
if (cipher == nullptr)
return Undefined(env->isolate());
return GetCipherValue(env, cipher, SSL_CIPHER_standard_name);
}

return OneByteString(env->isolate(), SSL_CIPHER_get_version(cipher));
MaybeLocal<Value> GetCipherVersion(Environment* env, const SSL_CIPHER* cipher) {
return GetCipherValue(env, cipher, SSL_CIPHER_get_version);
}

StackOfX509 CloneSSLCerts(X509Pointer&& cert,
Expand Down