Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9809add5 authored by Yifan Hong's avatar Yifan Hong
Browse files

binder: Move no-verify test objects to libbinder_tls_test_utils

... so that it can be used in fuzzer.

Test: pass
Bug: 195598155
Change-Id: If71af5f70b2477b93d692878d59d98cfe3aaec14
parent e0e53288
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ using android::ProcessState;
using android::RpcAuthPreSigned;
using android::RpcCertificateFormat;
using android::RpcCertificateVerifier;
using android::RpcCertificateVerifierNoOp;
using android::RpcServer;
using android::RpcSession;
using android::RpcTransportCtxFactory;
@@ -89,13 +90,6 @@ static const std::initializer_list<int64_t> kTransportList = {
        Transport::RPC_TLS,
};

// Certificate validation happens during handshake and does not affect the result of benchmarks.
// Skip certificate validation to simplify the setup process.
class RpcCertificateVerifierNoOp : public RpcCertificateVerifier {
public:
    status_t verify(const SSL*, uint8_t*) override { return OK; }
};

std::unique_ptr<RpcTransportCtxFactory> makeFactoryTls() {
    auto pkey = android::makeKeyPairForSelfSignedCert();
    CHECK_NE(pkey.get(), nullptr);
@@ -108,6 +102,8 @@ std::unique_ptr<RpcTransportCtxFactory> makeFactoryTls() {
}

static sp<RpcSession> gSession = RpcSession::make();
// Certificate validation happens during handshake and does not affect the result of benchmarks.
// Skip certificate validation to simplify the setup process.
static sp<RpcSession> gSessionTls = RpcSession::make(makeFactoryTls());
#ifdef __BIONIC__
static const String16 kKernelBinderInstance = String16(u"binderRpcBenchmark-control");
+8 −0
Original line number Diff line number Diff line
@@ -16,11 +16,13 @@

#pragma once

#include <memory>
#include <mutex>

#include <binder/RpcAuth.h>
#include <binder/RpcCertificateFormat.h>
#include <binder/RpcCertificateVerifier.h>
#include <binder/RpcTransport.h>
#include <openssl/ssl.h>
#include <utils/Errors.h>

@@ -75,4 +77,10 @@ private:
    std::vector<bssl::UniquePtr<X509>> mTrustedPeerCertificates;
};

// A RpcCertificateVerifier that does not verify anything.
class RpcCertificateVerifierNoOp : public RpcCertificateVerifier {
public:
    status_t verify(const SSL*, uint8_t*) override { return OK; }
};

} // namespace android