A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nodejs/node/commit/9ffaf763e9 below:

use Maybe<void> in SecureContext · nodejs/node@9ffaf76 · GitHub

@@ -34,7 +34,7 @@ using v8::HandleScope;

34 34

using v8::Int32;

35 35

using v8::Integer;

36 36

using v8::Isolate;

37 -

using v8::Just;

37 +

using v8::JustVoid;

38 38

using v8::Local;

39 39

using v8::Maybe;

40 40

using v8::Nothing;

@@ -576,20 +576,20 @@ void SecureContext::SetKeylogCallback(KeylogCb cb) {

576 576

SSL_CTX_set_keylog_callback(ctx_.get(), cb);

577 577

}

578 578 579 -

Maybe<bool> SecureContext::UseKey(Environment* env,

579 +

Maybe<void> SecureContext::UseKey(Environment* env,

580 580

std::shared_ptr<KeyObjectData> key) {

581 581

if (key->GetKeyType() != KeyType::kKeyTypePrivate) {

582 582

THROW_ERR_CRYPTO_INVALID_KEYTYPE(env);

583 -

return Nothing<bool>();

583 +

return Nothing<void>();

584 584

}

585 585 586 586

ClearErrorOnReturn clear_error_on_return;

587 587

if (!SSL_CTX_use_PrivateKey(ctx_.get(), key->GetAsymmetricKey().get())) {

588 588

ThrowCryptoError(env, ERR_get_error(), "SSL_CTX_use_PrivateKey");

589 -

return Nothing<bool>();

589 +

return Nothing<void>();

590 590

}

591 591 592 -

return Just(true);

592 +

return JustVoid();

593 593

}

594 594 595 595

void SecureContext::SetKey(const FunctionCallbackInfo<Value>& args) {

@@ -689,9 +689,10 @@ void SecureContext::SetEngineKey(const FunctionCallbackInfo<Value>& args) {

689 689

}

690 690

#endif // !OPENSSL_NO_ENGINE

691 691 692 -

Maybe<bool> SecureContext::AddCert(Environment* env, BIOPointer&& bio) {

692 +

Maybe<void> SecureContext::AddCert(Environment* env, BIOPointer&& bio) {

693 693

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();

695 696

cert_.reset();

696 697

issuer_.reset();

697 698

@@ -701,9 +702,9 @@ Maybe<bool> SecureContext::AddCert(Environment* env, BIOPointer&& bio) {

701 702

if (SSL_CTX_use_certificate_chain(

702 703

ctx_.get(), std::move(bio), &cert_, &issuer_) == 0) {

703 704

ThrowCryptoError(env, ERR_get_error(), "SSL_CTX_use_certificate_chain");

704 -

return Nothing<bool>();

705 +

return Nothing<void>();

705 706

}

706 -

return Just(true);

707 +

return JustVoid();

707 708

}

708 709 709 710

void SecureContext::SetCert(const FunctionCallbackInfo<Value>& args) {

@@ -745,16 +746,17 @@ void SecureContext::AddCACert(const FunctionCallbackInfo<Value>& args) {

745 746

sc->SetCACert(bio);

746 747

}

747 748 748 -

Maybe<bool> SecureContext::SetCRL(Environment* env, const BIOPointer& bio) {

749 +

Maybe<void> SecureContext::SetCRL(Environment* env, const BIOPointer& bio) {

749 750

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();

751 753 752 754

DeleteFnPtr<X509_CRL, X509_CRL_free> crl(

753 755

PEM_read_bio_X509_CRL(bio.get(), nullptr, NoPasswordCallback, nullptr));

754 756 755 757

if (!crl) {

756 758

THROW_ERR_CRYPTO_OPERATION_FAILED(env, "Failed to parse CRL");

757 -

return Nothing<bool>();

759 +

return Nothing<void>();

758 760

}

759 761 760 762

X509_STORE* cert_store = SSL_CTX_get_cert_store(ctx_.get());

@@ -767,7 +769,7 @@ Maybe<bool> SecureContext::SetCRL(Environment* env, const BIOPointer& bio) {

767 769

CHECK_EQ(1,

768 770

X509_STORE_set_flags(

769 771

cert_store, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL));

770 -

return Just(true);

772 +

return JustVoid();

771 773

}

772 774 773 775

void SecureContext::AddCRL(const FunctionCallbackInfo<Value>& args) {


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4