@@ -8,13 +8,13 @@ plugins {
8
8
id ' maven-publish'
9
9
id ' signing'
10
10
id " com.diffplug.spotless" version " 6.18.0"
11
- id " com.google.osdetector" version " 1.7.0 "
11
+ id " com.google.osdetector" version " 1.7.3 "
12
12
id " io.github.gradle-nexus.publish-plugin" version " 1.1.0"
13
13
}
14
14
15
15
group = ' software.amazon.cryptools'
16
16
version = ' 2.5.0'
17
- ext. awsLcMainTag = ' v1.46.0 '
17
+ ext. awsLcMainTag = ' v1.48.2 '
18
18
ext. awsLcFipsTag = ' AWS-LC-FIPS-3.0.0'
19
19
ext. isExperimentalFips = Boolean . getBoolean(' EXPERIMENTAL_FIPS' )
20
20
ext. isFips = ext. isExperimentalFips || Boolean . getBoolean(' FIPS' )
@@ -32,6 +32,16 @@ if (System.properties["AWSLC_GITVERSION"]) {
32
32
}
33
33
34
34
ext. isLegacyBuild = Boolean . getBoolean(' LEGACY_BUILD' )
35
+ ext. allowFipsTestBreak = Boolean . getBoolean(' ALLOW_FIPS_TEST_BREAK' )
36
+ ext. isFipsSelfTestFailureSkipAbort = Boolean . getBoolean(' FIPS_SELF_TEST_SKIP_ABORT' )
37
+
38
+ if (allowFipsTestBreak && ! isFips) {
39
+ throw new GradleException (" ALLOW_FIPS_TEST_BREAK can only be set if FIPS is also set to true" )
40
+ }
41
+
42
+ if (isFipsSelfTestFailureSkipAbort && ! isFips) {
43
+ throw new GradleException (" FIPS_SELF_TEST_SKIP_ABORT can only be set if FIPS is also set to true" )
44
+ }
35
45
36
46
ext. lcovIgnore = System . properties[' LCOV_IGNORE' ]
37
47
if (ext. lcovIgnore == null ) {
@@ -78,6 +88,7 @@ spotless {
78
88
target ' csrc/*'
79
89
licenseHeaderFile ' build-tools/license-headers/LicenseHeader.h'
80
90
clangFormat(clangFormatVersion)
91
+ toggleOffOn()
81
92
}
82
93
}
83
94
}
@@ -90,13 +101,11 @@ spotless {
90
101
*/
91
102
def getClangFormatVersion () {
92
103
def version_command = ' clang-format --version'
93
- def shell_output = new ByteArrayOutputStream ()
94
- exec {
104
+ def version_exec = providers. exec {
95
105
commandLine " bash" , " -c" , version_command
96
- standardOutput = shell_output
97
- ignoreExitValue true
106
+ ignoreExitValue = true
98
107
}
99
- def shell_output_string = shell_output . toString (). trim()
108
+ def shell_output_string = version_exec . standardOutput . asText . get (). trim()
100
109
def matcher = shell_output_string =~ / version ([\w\. -]+)/
101
110
if (matcher. find()) {
102
111
return matcher. group(1 )
@@ -114,13 +123,11 @@ if (System.properties["AWSLC_SRC_DIR"]) {
114
123
115
124
// Execute cmake3 command to see if it exists. Mainly to support AL2.
116
125
def detect_cmake3 = {
117
- def exec_cmake3 = exec {
126
+ def cmake3_exec = providers . exec {
118
127
executable " bash" args " -l" , " -c" , ' command -v cmake3'
119
- ignoreExitValue true
120
- standardOutput = new ByteArrayOutputStream ()
121
- errorOutput = standardOutput
128
+ ignoreExitValue = true
122
129
}
123
- if (exec_cmake3 . getExitValue() == 0 ) {
130
+ if (cmake3_exec . result . get() . exitValue == 0 ) {
124
131
return " cmake3"
125
132
}
126
133
return " cmake"
@@ -249,12 +256,27 @@ task buildAwsLc {
249
256
args ' -DCMAKE_BUILD_TYPE=RelWithDebInfo'
250
257
args " -DCMAKE_INSTALL_PREFIX=${ sharedObjectOutDir} "
251
258
args " -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
252
-
259
+ def cmakeCFlags = " "
253
260
254
261
if (isFips) {
262
+ println " Building AWS-LC in FIPS mode"
255
263
args ' -DFIPS=1'
256
264
}
257
265
266
+ if (allowFipsTestBreak) {
267
+ println " Building AWS-LC with hooks to break FIPS tests"
268
+ cmakeCFlags + = ' -DBORINGSSL_FIPS_BREAK_TESTS '
269
+ }
270
+
271
+ if (isFipsSelfTestFailureSkipAbort) {
272
+ println " Building AWS-LC to enable CPU jitter sampling when seeding its DRBG"
273
+ args ' -DENABLE_FIPS_ENTROPY_CPU_JITTER=ON'
274
+ println " Building AWS-LC to call callback instead of aborting on self-test failure"
275
+ cmakeCFlags + = ' -DAWSLC_FIPS_FAILURE_CALLBACK '
276
+ }
277
+
278
+ args " -DCMAKE_C_FLAGS='${ cmakeCFlags} '"
279
+
258
280
args ' .'
259
281
}
260
282
}
@@ -341,6 +363,11 @@ task executeCmake(type: Exec) {
341
363
if (isExperimentalFips) {
342
364
args ' -DEXPERIMENTAL_FIPS=ON'
343
365
}
366
+
367
+ if (isFipsSelfTestFailureSkipAbort) {
368
+ args ' -DFIPS_SELF_TEST_SKIP_ABORT=ON'
369
+ }
370
+
344
371
if (prebuiltJar != null ) {
345
372
args ' -DSIGNED_JAR=' + prebuiltJar
346
373
println " Using SIGNED_JAR=${ prebuiltJar} "
@@ -478,8 +505,8 @@ task unit_tests(type: Copy) {
478
505
test. dependsOn unit_tests
479
506
480
507
task singleTest (type : Exec ) {
481
- group ' Verification'
482
- description ' Pass in the test class using -DSINGLE_TEST=${fully_qualified_test_class}'
508
+ group = ' Verification'
509
+ description = ' Pass in the test class using -DSINGLE_TEST=${fully_qualified_test_class}'
483
510
dependsOn executeCmake
484
511
workingDir " ${ buildDir} /cmake"
485
512
// Our cmake doesn't properly react java source changes, but it will rebuild them if the jars are missing
@@ -552,11 +579,9 @@ task coverage_cmake(type: Exec) {
552
579
if (isExperimentalFips) {
553
580
args ' -DEXPERIMENTAL_FIPS=ON'
554
581
}
555
-
556
582
if (System . properties[' JAVA_HOME' ] != null ) {
557
583
args ' -DJAVA_HOME=' + System . properties[' JAVA_HOME' ]
558
584
}
559
-
560
585
if (System . properties[' SINGLE_TEST' ] != null ) {
561
586
args ' -DSINGLE_TEST=' + System . properties[' SINGLE_TEST' ]
562
587
0 commit comments