Add support for AES-GCM-ESP as an IPSec algorithm
Allows native AES-GCM-ESP to be used as an IPSec transport/tunnel mode algorithm with kernel support Bug: 63589918 Test: IPsecService tests added, existing ones pass Change-Id: Ie1a9a902be205f269aa37bf956198f2e5b177c21
This commit is contained in:
@@ -882,8 +882,14 @@ public class IpSecService extends IIpSecService.Stub {
|
||||
for (int direction : DIRECTIONS) {
|
||||
IpSecAlgorithm crypt = config.getEncryption(direction);
|
||||
IpSecAlgorithm auth = config.getAuthentication(direction);
|
||||
if (crypt == null && auth == null) {
|
||||
throw new IllegalArgumentException("Encryption and Authentication are both null");
|
||||
IpSecAlgorithm authenticatedEncryption = config.getAuthenticatedEncryption(direction);
|
||||
if (authenticatedEncryption == null && crypt == null && auth == null) {
|
||||
throw new IllegalArgumentException(
|
||||
"No Encryption or Authentication algorithms specified");
|
||||
} else if (authenticatedEncryption != null && (auth != null || crypt != null)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Authenticated Encryption is mutually"
|
||||
+ " exclusive with other Authentication or Encryption algorithms");
|
||||
}
|
||||
|
||||
if (mSpiRecords.getAndCheckOwner(config.getSpiResourceId(direction)) == null) {
|
||||
@@ -922,6 +928,7 @@ public class IpSecService extends IIpSecService.Stub {
|
||||
for (int direction : DIRECTIONS) {
|
||||
IpSecAlgorithm auth = c.getAuthentication(direction);
|
||||
IpSecAlgorithm crypt = c.getEncryption(direction);
|
||||
IpSecAlgorithm authCrypt = c.getAuthenticatedEncryption(direction);
|
||||
|
||||
spis[direction] = mSpiRecords.getAndCheckOwner(c.getSpiResourceId(direction));
|
||||
int spi = spis[direction].getSpi();
|
||||
@@ -942,6 +949,9 @@ public class IpSecService extends IIpSecService.Stub {
|
||||
(crypt != null) ? crypt.getName() : "",
|
||||
(crypt != null) ? crypt.getKey() : null,
|
||||
(crypt != null) ? crypt.getTruncationLengthBits() : 0,
|
||||
(authCrypt != null) ? authCrypt.getName() : "",
|
||||
(authCrypt != null) ? authCrypt.getKey() : null,
|
||||
(authCrypt != null) ? authCrypt.getTruncationLengthBits() : 0,
|
||||
encapType,
|
||||
encapLocalPort,
|
||||
encapRemotePort);
|
||||
|
||||
Reference in New Issue
Block a user