Skip to content

Commit 5255c88

Browse files
Make clang-format stricter and run it for all conscrypt (#1480)
* Make clang-format stricter and run it for all conscrypt * Make clang-format stricter and run it for all conscrypt
1 parent 7cbb302 commit 5255c88

File tree

369 files changed

+12728
-12022
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

369 files changed

+12728
-12022
lines changed

.clang-format

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
---
22
Language: Cpp
3-
BasedOnStyle: Google
3+
BasedOnStyle: Google
44
AccessModifierOffset: -4
55
AllowShortFunctionsOnASingleLine: Empty
66
ColumnLimit: 100
77
IndentWidth: 4
88
ContinuationIndentWidth: 8
99
TypenameMacros: ['STACK_OF']
10+
AlignEscapedNewlines: Left
11+
AlignAfterOpenBracket: Align
1012
---
1113
Language: Java
1214
BasedOnStyle: Google
1315
ColumnLimit: 100
1416
IndentWidth: 4
1517
ContinuationIndentWidth: 8
18+
AlignAfterOpenBracket: Align
1619
JavaImportGroups:
1720
- android
1821
- androidx

android-stub/src/main/java/android/crypto/hpke/HpkeSpi.java

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
package android.crypto.hpke;
1818

19+
import libcore.util.NonNull;
20+
import libcore.util.Nullable;
21+
1922
import java.security.GeneralSecurityException;
2023
import java.security.InvalidKeyException;
2124
import java.security.PrivateKey;
2225
import java.security.PublicKey;
23-
import libcore.util.NonNull;
24-
import libcore.util.Nullable;
25-
2626

2727
/**
2828
* Service Provider Interface for HPKE client API classes to communicate with implementations
@@ -64,13 +64,9 @@ public interface HpkeSpi {
6464
* @throws UnsupportedOperationException if the mode is not supported by this implementation
6565
* @throws IllegalStateException if this SPI has already been initialised
6666
*/
67-
void engineInitSender(
68-
@NonNull PublicKey recipientKey,
69-
@Nullable byte[] info,
70-
@Nullable PrivateKey senderKey,
71-
@Nullable byte[] psk,
72-
@Nullable byte[] psk_id)
73-
throws InvalidKeyException;
67+
void engineInitSender(@NonNull PublicKey recipientKey, @Nullable byte[] info,
68+
@Nullable PrivateKey senderKey, @Nullable byte[] psk,
69+
@Nullable byte[] psk_id) throws InvalidKeyException;
7470

7571
/**
7672
* Initialises an HPKE SPI in one of the sender modes described in RFC 9180 with
@@ -109,13 +105,9 @@ void engineInitSender(
109105
* @throws UnsupportedOperationException if the mode is not supported by this implementation
110106
* @throws IllegalStateException if this SPI has already been initialised
111107
*/
112-
void engineInitSenderWithSeed(
113-
@NonNull PublicKey recipientKey,
114-
@Nullable byte[] info,
115-
@Nullable PrivateKey senderKey,
116-
@Nullable byte[] psk,
117-
@Nullable byte[] psk_id,
118-
@NonNull byte[] sKe)
108+
void engineInitSenderWithSeed(@NonNull PublicKey recipientKey, @Nullable byte[] info,
109+
@Nullable PrivateKey senderKey, @Nullable byte[] psk,
110+
@Nullable byte[] psk_id, @NonNull byte[] sKe)
119111
throws InvalidKeyException;
120112

121113
/**
@@ -149,13 +141,9 @@ void engineInitSenderWithSeed(
149141
* @throws UnsupportedOperationException if the mode is not supported by this implementation
150142
* @throws IllegalStateException if this SPI has already been initialised
151143
*/
152-
void engineInitRecipient(
153-
@NonNull byte[] encapsulated,
154-
@NonNull PrivateKey recipientKey,
155-
@Nullable byte[] info,
156-
@Nullable PublicKey senderKey,
157-
@Nullable byte[] psk,
158-
@Nullable byte[] psk_id)
144+
void engineInitRecipient(@NonNull byte[] encapsulated, @NonNull PrivateKey recipientKey,
145+
@Nullable byte[] info, @Nullable PublicKey senderKey,
146+
@Nullable byte[] psk, @Nullable byte[] psk_id)
159147
throws InvalidKeyException;
160148

161149
/**
@@ -180,7 +168,8 @@ void engineInitRecipient(
180168
* as a sender
181169
* @throws GeneralSecurityException on decryption failures
182170
*/
183-
@NonNull byte[] engineOpen(@NonNull byte[] ciphertext, @Nullable byte[] aad)
171+
@NonNull
172+
byte[] engineOpen(@NonNull byte[] ciphertext, @Nullable byte[] aad)
184173
throws GeneralSecurityException;
185174

186175
/**

android-stub/src/main/java/android/pake/PakeServerKeyManagerParameters.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public final class PakeServerKeyManagerParameters implements ManagerFactoryParam
7272
* @param serverId The server identifier for the link.
7373
* @return An unmodifiable list of PAKE options for the given link.
7474
*/
75-
public @NonNull List<PakeOption> getOptions(
76-
@Nullable byte[] clientId, @Nullable byte[] serverId) {
75+
public @NonNull List<PakeOption> getOptions(@Nullable byte[] clientId,
76+
@Nullable byte[] serverId) {
7777
throw new RuntimeException("Stub!");
7878
}
7979

@@ -139,7 +139,7 @@ public static final class Builder {
139139
* @throws InvalidParameterException If the provided options are invalid.
140140
*/
141141
public @NonNull Builder setOptions(@Nullable byte[] clientId, @Nullable byte[] serverId,
142-
@NonNull List<PakeOption> options) {
142+
@NonNull List<PakeOption> options) {
143143
throw new RuntimeException("Stub!");
144144
}
145145

android-stub/src/main/java/android/util/StatsEvent.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
package android.util;
1818

19-
@SuppressWarnings({"unused", "DoNotCallSuggester"})
19+
@SuppressWarnings({"unused", "DoNotCallSuggester"})
2020
public final class StatsEvent {
2121
public static StatsEvent.Builder newBuilder() {
2222
throw new RuntimeException("Stub!");
@@ -38,10 +38,9 @@ public void release() {
3838
throw new RuntimeException("Stub!");
3939
}
4040

41-
private static final class Buffer {
42-
}
41+
private static final class Buffer {}
4342

44-
@SuppressWarnings({"unused", "DoNotCallSuggester"})
43+
@SuppressWarnings({"unused", "DoNotCallSuggester"})
4544
public static final class Builder {
4645
public StatsEvent.Builder setAtomId(int atomId) {
4746
throw new RuntimeException("Stub!");

android-stub/src/main/java/com/android/org/conscrypt/NativeCrypto.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.security.cert.CertificateEncodingException;
2020
import java.security.cert.CertificateException;
21+
2122
import javax.net.ssl.SSLException;
2223

2324
@SuppressWarnings("unused")
@@ -31,8 +32,8 @@ public interface SSLHandshakeCallbacks {
3132
*
3233
* @throws CertificateException if the certificate is untrusted
3334
*/
34-
void verifyCertificateChain(byte[][] asn1DerEncodedCertificateChain,
35-
String authMethod) throws CertificateException;
35+
void verifyCertificateChain(byte[][] asn1DerEncodedCertificateChain, String authMethod)
36+
throws CertificateException;
3637
/**
3738
* Called on an SSL client when the server requests (or
3839
* requires a certificate). The client can respond by using
@@ -44,8 +45,7 @@ void verifyCertificateChain(byte[][] asn1DerEncodedCertificateChain,
4445
* convertible to strings with #keyType
4546
* @param asn1DerEncodedX500Principals CAs known to the server
4647
*/
47-
void clientCertificateRequested(
48-
byte[] keyTypes, byte[][] asn1DerEncodedX500Principals)
48+
void clientCertificateRequested(byte[] keyTypes, byte[][] asn1DerEncodedX500Principals)
4949
throws CertificateEncodingException, SSLException;
5050
/**
5151
* Called when SSL handshake is completed. Note that this can

android-stub/src/main/java/com/android/org/conscrypt/OpenSSLSocketImpl.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.security.PrivateKey;
2626
import java.security.cert.CertificateEncodingException;
2727
import java.security.cert.CertificateException;
28+
2829
import javax.net.ssl.HandshakeCompletedListener;
2930
import javax.net.ssl.SSLException;
3031
import javax.net.ssl.SSLSession;
@@ -46,7 +47,7 @@ protected OpenSSLSocketImpl(SSLParametersImpl sslParameters) throws IOException
4647
}
4748

4849
protected OpenSSLSocketImpl(SSLParametersImpl sslParameters, String[] enabledProtocols,
49-
String[] enabledCipherSuites) throws IOException {
50+
String[] enabledCipherSuites) throws IOException {
5051
throw new RuntimeException("Stub!");
5152
}
5253

@@ -61,17 +62,18 @@ protected OpenSSLSocketImpl(InetAddress address, int port, SSLParametersImpl ssl
6162
}
6263

6364
protected OpenSSLSocketImpl(String host, int port, InetAddress clientAddress, int clientPort,
64-
SSLParametersImpl sslParameters) throws IOException {
65+
SSLParametersImpl sslParameters) throws IOException {
6566
throw new RuntimeException("Stub!");
6667
}
6768

6869
protected OpenSSLSocketImpl(InetAddress address, int port, InetAddress clientAddress,
69-
int clientPort, SSLParametersImpl sslParameters) throws IOException {
70+
int clientPort, SSLParametersImpl sslParameters)
71+
throws IOException {
7072
throw new RuntimeException("Stub!");
7173
}
7274

7375
protected OpenSSLSocketImpl(Socket socket, String host, int port, boolean autoClose,
74-
SSLParametersImpl sslParameters) throws IOException {
76+
SSLParametersImpl sslParameters) throws IOException {
7577
throw new RuntimeException("Stub!");
7678
}
7779

android-stub/src/main/java/dalvik/system/BlockGuard.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ public static Policy getThreadPolicy() {
2424
throw new UnsupportedOperationException("Stub!");
2525
}
2626

27-
public interface Policy { void onNetwork(); }
27+
public interface Policy {
28+
void onNetwork();
29+
}
2830

2931
public static class PolicyWrapper implements Policy {
3032
private PolicyWrapper() {}

android/src/main/java/org/conscrypt/BaseOpenSSLSocketAdapterFactory.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
import java.net.InetAddress;
2121
import java.net.Socket;
2222
import java.net.UnknownHostException;
23+
2324
import javax.net.ssl.SSLSocketFactory;
2425

2526
@Internal
2627
public abstract class BaseOpenSSLSocketAdapterFactory extends SSLSocketFactory {
27-
2828
private final OpenSSLSocketFactoryImpl delegate;
2929

3030
protected BaseOpenSSLSocketAdapterFactory(OpenSSLSocketFactoryImpl delegate) {
@@ -47,8 +47,7 @@ public Socket createSocket() throws IOException {
4747
}
4848

4949
@Override
50-
public Socket createSocket(String hostname, int port)
51-
throws IOException, UnknownHostException {
50+
public Socket createSocket(String hostname, int port) throws IOException, UnknownHostException {
5251
return wrap((OpenSSLSocketImpl) delegate.createSocket(hostname, port));
5352
}
5453

@@ -64,11 +63,8 @@ public Socket createSocket(InetAddress address, int port) throws IOException {
6463
}
6564

6665
@Override
67-
public Socket createSocket(InetAddress address,
68-
int port,
69-
InetAddress localAddress,
70-
int localPort)
71-
throws IOException {
66+
public Socket createSocket(InetAddress address, int port, InetAddress localAddress,
67+
int localPort) throws IOException {
7268
return wrap(
7369
(OpenSSLSocketImpl) delegate.createSocket(address, port, localAddress, localPort));
7470
}

android/src/main/java/org/conscrypt/KitKatPlatformOpenSSLSocketAdapterFactory.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*/
2626
@Internal
2727
public class KitKatPlatformOpenSSLSocketAdapterFactory extends BaseOpenSSLSocketAdapterFactory {
28-
2928
public KitKatPlatformOpenSSLSocketAdapterFactory(OpenSSLSocketFactoryImpl delegate) {
3029
super(delegate);
3130
}

android/src/main/java/org/conscrypt/KitKatPlatformOpenSSLSocketImplAdapter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.security.PrivateKey;
2828
import java.security.cert.CertificateEncodingException;
2929
import java.security.cert.CertificateException;
30+
3031
import javax.net.ssl.HandshakeCompletedListener;
3132
import javax.net.ssl.SSLException;
3233
import javax.net.ssl.SSLParameters;
@@ -44,8 +45,6 @@
4445
@Internal
4546
public class KitKatPlatformOpenSSLSocketImplAdapter
4647
extends com.android.org.conscrypt.OpenSSLSocketImpl {
47-
48-
4948
private final AbstractConscryptSocket delegate;
5049

5150
public KitKatPlatformOpenSSLSocketImplAdapter(AbstractConscryptSocket delegate)

0 commit comments

Comments
 (0)