device_google_gs101/conf/Android.bp
Eric Biggers f739cf68c0 Generate a separate fstab file for FIPS mode
Add a file "fstab.gs101-fips" alongside the existing "fstab.gs101" in
order to specify different encryption settings in FIPS mode.

"androidboot.fstab_suffix=gs101-fips" on the kernel command line will be
used to select the FIPS fstab when needed.

As the two fstabs should be otherwise identical, generate them from a
template file so that they will stay in sync.

Note that generating the fstabs requires that they be installed as build
system modules rather than via PRODUCT_COPY_FILES, which results in the
vendor_ramdisk copy of the fstabs being installed to system/etc rather
than /.  This shouldn't cause any problem, now that Android has been
updated to look for the fstab in this location too.

Bug: 191417025
Change-Id: I1d115e014df8ba2fb83046ac0b9b791597364846
2021-08-30 14:09:06 -07:00

55 lines
2 KiB
Text

/*
* Copyright (C) 2021 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.
*/
// By default this device uses hardware-wrapped keys for storage encryption,
// which is intended to offer increased security over the traditional method
// (software keys). However, hardware-wrapped keys aren't compatible with
// FIPS-140 certification of the encryption hardware, and hence we have to
// disable the use of them in FIPS mode. This requires having two fstab files:
// one for the default mode, and one for FIPS mode selectable via
// androidboot.fstab_suffix on the kernel command line. These fstabs should be
// identical with the exception of the encryption settings, so to keep them in
// sync the rules below generate them from a template file.
genrule {
name: "gen_fstab.gs101",
srcs: ["fstab.gs101.in"],
out: ["fstab.gs101"],
cmd: "sed -e s/@fileencryption@/::inlinecrypt_optimized+wrappedkey_v0/" +
" -e s/@metadata_encryption@/:wrappedkey_v0/ $(in) > $(out)",
}
genrule {
name: "gen_fstab.gs101-fips",
srcs: ["fstab.gs101.in"],
out: ["fstab.gs101-fips"],
cmd: "sed -e s/@fileencryption@/aes-256-xts/" +
" -e s/@metadata_encryption@/aes-256-xts/ $(in) > $(out)",
}
prebuilt_etc {
name: "fstab.gs101",
src: ":gen_fstab.gs101",
vendor: true,
vendor_ramdisk_available: true,
}
prebuilt_etc {
name: "fstab.gs101-fips",
src: ":gen_fstab.gs101-fips",
vendor: true,
vendor_ramdisk_available: true,
}