@@ -34,7 +34,7 @@ using v8::HandleScope;
3434using v8::Int32;
3535using v8::Integer;
3636using v8::Isolate;
37- using v8::Just ;
37+ using v8::JustVoid ;
3838using v8::Local;
3939using v8::Maybe;
4040using v8::Nothing;
@@ -576,20 +576,20 @@ void SecureContext::SetKeylogCallback(KeylogCb cb) {
576576 SSL_CTX_set_keylog_callback (ctx_.get (), cb);
577577}
578578
579- Maybe<bool > SecureContext::UseKey (Environment* env,
579+ Maybe<void > SecureContext::UseKey (Environment* env,
580580 std::shared_ptr<KeyObjectData> key) {
581581 if (key->GetKeyType () != KeyType::kKeyTypePrivate ) {
582582 THROW_ERR_CRYPTO_INVALID_KEYTYPE (env);
583- return Nothing<bool >();
583+ return Nothing<void >();
584584 }
585585
586586 ClearErrorOnReturn clear_error_on_return;
587587 if (!SSL_CTX_use_PrivateKey (ctx_.get (), key->GetAsymmetricKey ().get ())) {
588588 ThrowCryptoError (env, ERR_get_error (), " SSL_CTX_use_PrivateKey" );
589- return Nothing<bool >();
589+ return Nothing<void >();
590590 }
591591
592- return Just ( true );
592+ return JustVoid ( );
593593}
594594
595595void SecureContext::SetKey (const FunctionCallbackInfo<Value>& args) {
@@ -689,9 +689,10 @@ void SecureContext::SetEngineKey(const FunctionCallbackInfo<Value>& args) {
689689}
690690#endif // !OPENSSL_NO_ENGINE
691691
692- Maybe<bool > SecureContext::AddCert (Environment* env, BIOPointer&& bio) {
692+ Maybe<void > SecureContext::AddCert (Environment* env, BIOPointer&& bio) {
693693 ClearErrorOnReturn clear_error_on_return;
694- if (!bio) return Just (false );
694+ // TODO(tniessen): this should be checked by the caller and not treated as ok
695+ if (!bio) return JustVoid ();
695696 cert_.reset ();
696697 issuer_.reset ();
697698
@@ -701,9 +702,9 @@ Maybe<bool> SecureContext::AddCert(Environment* env, BIOPointer&& bio) {
701702 if (SSL_CTX_use_certificate_chain (
702703 ctx_.get (), std::move (bio), &cert_, &issuer_) == 0 ) {
703704 ThrowCryptoError (env, ERR_get_error (), " SSL_CTX_use_certificate_chain" );
704- return Nothing<bool >();
705+ return Nothing<void >();
705706 }
706- return Just ( true );
707+ return JustVoid ( );
707708}
708709
709710void SecureContext::SetCert (const FunctionCallbackInfo<Value>& args) {
@@ -745,16 +746,17 @@ void SecureContext::AddCACert(const FunctionCallbackInfo<Value>& args) {
745746 sc->SetCACert (bio);
746747}
747748
748- Maybe<bool > SecureContext::SetCRL (Environment* env, const BIOPointer& bio) {
749+ Maybe<void > SecureContext::SetCRL (Environment* env, const BIOPointer& bio) {
749750 ClearErrorOnReturn clear_error_on_return;
750- if (!bio) return Just (false );
751+ // TODO(tniessen): this should be checked by the caller and not treated as ok
752+ if (!bio) return JustVoid ();
751753
752754 DeleteFnPtr<X509_CRL, X509_CRL_free> crl (
753755 PEM_read_bio_X509_CRL (bio.get (), nullptr , NoPasswordCallback, nullptr ));
754756
755757 if (!crl) {
756758 THROW_ERR_CRYPTO_OPERATION_FAILED (env, " Failed to parse CRL" );
757- return Nothing<bool >();
759+ return Nothing<void >();
758760 }
759761
760762 X509_STORE* cert_store = SSL_CTX_get_cert_store (ctx_.get ());
@@ -767,7 +769,7 @@ Maybe<bool> SecureContext::SetCRL(Environment* env, const BIOPointer& bio) {
767769 CHECK_EQ (1 ,
768770 X509_STORE_set_flags (
769771 cert_store, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL));
770- return Just ( true );
772+ return JustVoid ( );
771773}
772774
773775void SecureContext::AddCRL (const FunctionCallbackInfo<Value>& args) {
0 commit comments