Merge "Stop verifying fs-verity signature in kernel"

This commit is contained in:
Treehugger Robot
2022-12-14 02:31:57 +00:00
committed by Gerrit Code Review
3 changed files with 13 additions and 15 deletions

View File

@@ -186,8 +186,8 @@ public final class FontManagerService extends IFontManager.Stub {
} }
@Override @Override
public void setUpFsverity(String filePath, byte[] pkcs7Signature) throws IOException { public void setUpFsverity(String filePath) throws IOException {
VerityUtils.setUpFsverity(filePath, pkcs7Signature); VerityUtils.setUpFsverity(filePath, /* signature */ (byte[]) null);
} }
@Override @Override

View File

@@ -78,7 +78,7 @@ final class UpdatableFontDir {
interface FsverityUtil { interface FsverityUtil {
boolean isFromTrustedProvider(String path, byte[] pkcs7Signature); boolean isFromTrustedProvider(String path, byte[] pkcs7Signature);
void setUpFsverity(String path, byte[] pkcs7Signature) throws IOException; void setUpFsverity(String path) throws IOException;
boolean rename(File src, File dest); boolean rename(File src, File dest);
} }
@@ -354,8 +354,7 @@ final class UpdatableFontDir {
try { try {
// Do not parse font file before setting up fs-verity. // Do not parse font file before setting up fs-verity.
// setUpFsverity throws IOException if failed. // setUpFsverity throws IOException if failed.
mFsverityUtil.setUpFsverity(tempNewFontFile.getAbsolutePath(), mFsverityUtil.setUpFsverity(tempNewFontFile.getAbsolutePath());
pkcs7Signature);
} catch (IOException e) { } catch (IOException e) {
throw new SystemFontException( throw new SystemFontException(
FontManager.RESULT_ERROR_VERIFICATION_FAILURE, FontManager.RESULT_ERROR_VERIFICATION_FAILURE,

View File

@@ -109,17 +109,16 @@ public final class UpdatableFontDirTest {
@Override @Override
public boolean isFromTrustedProvider(String path, byte[] signature) { public boolean isFromTrustedProvider(String path, byte[] signature) {
return mHasFsverityPaths.contains(path); if (!mHasFsverityPaths.contains(path)) {
return false;
}
String fakeSignature = new String(signature, StandardCharsets.UTF_8);
return GOOD_SIGNATURE.equals(fakeSignature);
} }
@Override @Override
public void setUpFsverity(String path, byte[] pkcs7Signature) throws IOException { public void setUpFsverity(String path) throws IOException {
String fakeSignature = new String(pkcs7Signature, StandardCharsets.UTF_8); mHasFsverityPaths.add(path);
if (GOOD_SIGNATURE.equals(fakeSignature)) {
mHasFsverityPaths.add(path);
} else {
throw new IOException("Failed to set up fake fs-verity");
}
} }
@Override @Override
@@ -813,8 +812,8 @@ public final class UpdatableFontDirTest {
} }
@Override @Override
public void setUpFsverity(String path, byte[] pkcs7Signature) throws IOException { public void setUpFsverity(String path) throws IOException {
mFakeFsverityUtil.setUpFsverity(path, pkcs7Signature); mFakeFsverityUtil.setUpFsverity(path);
} }
@Override @Override