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

Commit e9834e3d authored by Miguel Aranda's avatar Miguel Aranda
Browse files

Extend list of ciphers in conscrypt perftests

Also adds null check for sendingFutures in ClientSocketPerfTest.

Test: atest testname
Bug: 238882102
Change-Id: I2ce58eada58d184443517f6b83180ef75050d926
parent 228ccb46
Loading
Loading
Loading
Loading
+14 −30
Original line number Diff line number Diff line
@@ -112,39 +112,23 @@ public final class ClientSocketPerfTest {
        for (EndpointFactory endpointFactory : EndpointFactory.values()) {
            for (ChannelType channelType : ChannelType.values()) {
                for (PerfTestProtocol protocol : PerfTestProtocol.values()) {
                    for (int messageSize : ConscryptParams.messageSizes) {
                        for (String cipher : ConscryptParams.ciphers) {
                            params.add(
                                    new Object[] {
                                            new Config(
                                                    endpointFactory,
                                                    endpointFactory,
                                        64,
                                        "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
                                        channelType,
                                        protocol)
                            });
                    params.add(
                            new Object[] {
                                new Config(
                                        endpointFactory,
                                        endpointFactory,
                                        512,
                                        "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
                                        channelType,
                                        protocol)
                            });
                    params.add(
                            new Object[] {
                                new Config(
                                        endpointFactory,
                                        endpointFactory,
                                        4096,
                                        "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
                                                    messageSize,
                                                    cipher,
                                                    channelType,
                                                    protocol)
                                    });
                        }
                    }
                }
            }
        }
        return params;
    }

+35 −0
Original line number Diff line number Diff line
/*
 * Copyright 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.conscrypt;

import java.util.List;

public class ConscryptParams {
    public static final List<String> ciphers = List.of(
        "TLS_RSA_WITH_AES_128_GCM_SHA256",
        "TLS_RSA_WITH_AES_256_GCM_SHA384",
        "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256",
        "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
        "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256"
    );

    public static final List<Integer> messageSizes = List.of(
        64,
        512,
        4096
    );
}
 No newline at end of file
+4 −2
Original line number Diff line number Diff line
@@ -87,11 +87,13 @@ public final class EngineHandshakePerfTest {
        }
    }


    public Collection getParams() {
        final List<Object[]> params = new ArrayList<>();
        for (BufferType bufferType : BufferType.values()) {
            params.add(new Object[] {new Config(bufferType,
                "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", 100)});
            for (String cipher : ConscryptParams.ciphers) {
                params.add(new Object[] {new Config(bufferType, cipher, 100)});
            }
        }
        return params;
    }
+6 −7
Original line number Diff line number Diff line
@@ -37,10 +37,10 @@ import static org.conscrypt.TestUtils.newTextMessage;
import static org.junit.Assert.assertEquals;

import java.nio.ByteBuffer;
import java.util.Locale;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLException;
@@ -94,12 +94,11 @@ public final class EngineWrapPerfTest {
    public Collection getParams() {
        final List<Object[]> params = new ArrayList<>();
        for (BufferType bufferType : BufferType.values()) {
            params.add(new Object[] {new Config(bufferType, 64,
                                    "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")});
            params.add(new Object[] {new Config(bufferType, 512,
                                    "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")});
            params.add(new Object[] {new Config(bufferType, 4096,
                                    "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256")});
            for (int messageSize : ConscryptParams.messageSizes) {
                for (String cipher : ConscryptParams.ciphers) {
                    params.add(new Object[] {new Config(bufferType, messageSize, cipher)});
                }
            }
        }
        return params;
    }
+6 −9
Original line number Diff line number Diff line
@@ -102,15 +102,12 @@ public final class ServerSocketPerfTest {
        final List<Object[]> params = new ArrayList<>();
        for (EndpointFactory endpointFactory : EndpointFactory.values()) {
            for (ChannelType channelType : ChannelType.values()) {
                for (int messageSize : ConscryptParams.messageSizes) {
                    for (String cipher : ConscryptParams.ciphers) {
                        params.add(new Object[] {new Config(endpointFactory,
                    endpointFactory, 64,
                    "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", channelType)});
                params.add(new Object[] {new Config(endpointFactory,
                    endpointFactory, 512,
                    "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", channelType)});
                params.add(new Object[] {new Config(endpointFactory,
                    endpointFactory, 4096,
                    "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", channelType)});
                            endpointFactory, messageSize, cipher, channelType)});
                    }
                }
            }
        }
        return params;