ATF and OP-TEE Firewalling for K3 devices.
v3 cover ATF and OP-TEE Firewalling for K3 devices.
K3 devices have firewalls that are used to prevent illegal accesses to memory regions that are deemed secure. The series prevents the illegal accesses to ATF and OP-TEE regions that are present in different K3 devices.
AM62X, AM62AX and AM64X are currently in hold due to some firewall configurations that our System Controller (TIFS) needs to handle. The devices that are not configured with the firewalling nodes will not be affected and can continue to work fine until the firewall nodes are added so will be a non-blocking merge.
Test Logs: https://gist.github.com/manorit2001/c929e6ccab03f55b3828896fbd04184b
---
Changes in v3:
* Andrew
- Fix tabs and spaces
* Simon
- Remove parantheses wherever suggested
- Take the ideas for GetHexOctet and remove the patch
- Add Reviewed-by
- Align the commit messages for all the commits
- Fix comment styling
- Remove am62x also as it has some dhcp failure with firewalls likely
due to TIFS configurations
- Rename 311_ti_secure_firewall.dts to 319_ti_secure_firewall.dts after
rebase.
- Migrate to non-RFC version
- Link to v2: https://serenity.dal.design.ti.com/lore/linux-patch-review/[email protected]
---
Manorit Chawdhry (6):
binman: ti-secure: Add support for firewalling entities
binman: ftest: Add test for ti-secure firewall node
binman: k3: Add k3-security.h and include it in k3-binman.dtsi
binman: j721e: Add firewall configurations
binman: j721s2: Add firewall configurations
binman: j7200: Add firewall configurations
arch/arm/dts/k3-binman.dtsi | 2 + arch/arm/dts/k3-j7200-binman.dtsi | 143 ++++++++++++++++++ arch/arm/dts/k3-j721e-binman.dtsi | 187 ++++++++++++++++++++++++ arch/arm/dts/k3-j721s2-binman.dtsi | 208 +++++++++++++++++++++++++++ arch/arm/dts/k3-security.h | 58 ++++++++ tools/binman/btool/openssl.py | 16 ++- tools/binman/etype/ti_secure.py | 85 +++++++++++ tools/binman/etype/x509_cert.py | 3 +- tools/binman/ftest.py | 12 ++ tools/binman/test/319_ti_secure_firewall.dts | 28 ++++ 10 files changed, 739 insertions(+), 3 deletions(-)
---
base-commit: b05a184379631d13c4a49e423aa1324dc1ae6158
change-id: 20230724-binman-firewalling-65ecdb23ec0a
Best regards,
Signature · 1 line
Manorit Chawdhry <[email protected]>
PATCH v3 1/6 binman: ti-secure: Add support for firewalling entities
We can now firewall entities while loading them through our secure entity TIFS, the required information should be present in the certificate that is being parsed by TIFS.
The following commit adds the support to enable the certificates to be generated if the firewall configurations are present in the binman dtsi nodes.
--- tools/binman/btool/openssl.py | 16 +++++++- tools/binman/etype/ti_secure.py | 85 +++++++++++++++++++++++++++++++++++++++++ tools/binman/etype/x509_cert.py | 3 +- 3 files changed, 101 insertions(+), 3 deletions(-)
tools/binman/btool/openssl.py +14 -2
@@ -82,7 +82,7 @@ imageSize = INTEGER:{len(indata)} return self.run_cmd(*args) def x509_cert_sysfw(self, cert_fname, input_fname, key_fname, sw_rev, - config_fname, req_dist_name_dict): + config_fname, req_dist_name_dict, firewall_cert_data): """Create a certificate to be booted by system firmware Args:
@@ -94,6 +94,13 @@ imageSize = INTEGER:{len(indata)} req_dist_name_dict (dict): Dictionary containing key-value pairs of req_distinguished_name section extensions, must contain extensions for C, ST, L, O, OU, CN and emailAddress + firewall_cert_data (dict): + - auth_in_place (int): The Priv ID for copying as the + specific host in firewall protected region + - num_firewalls (int): The number of firewalls in the + extended certificate + - certificate (str): Extended firewall certificate with + the information for the firewall configurations. Returns: str: Tool output
@@ -121,6 +128,7 @@ basicConstraints = CA:true 1.3.6.1.4.1.294.1.3 = ASN1:SEQUENCE:swrv 1.3.6.1.4.1.294.1.34 = ASN1:SEQUENCE:sysfw_image_integrity 1.3.6.1.4.1.294.1.35 = ASN1:SEQUENCE:sysfw_image_load +1.3.6.1.4.1.294.1.37 = ASN1:SEQUENCE:firewall [ swrv ] swrv = INTEGER:{sw_rev}
@@ -132,7 +140,11 @@ imageSize = INTEGER:{len(indata)} [ sysfw_image_load ] destAddr = FORMAT:HEX,OCT:00000000 -authInPlace = INTEGER:2 +authInPlace = INTEGER:{hex(firewall_cert_data['auth_in_place'])} + +[ firewall ] +numFirewallRegions = INTEGER:{firewall_cert_data['num_firewalls']} +{firewall_cert_data['certificate']} ''', file=outf) args = ['req', '-new', '-x509', '-key', key_fname, '-nodes', '-outform', 'DER', '-out', cert_fname, '-config', config_fname,
tools/binman/etype/ti_secure.py +85 -0
123 lines not on this page · raw message
tools/binman/etype/x509_cert.py +2 -1
@@ -98,7 +98,8 @@ class Entry_x509_cert(Entry_collection): key_fname=self.key_fname, config_fname=config_fname, sw_rev=self.sw_rev, - req_dist_name_dict=self.req_dist_name) + req_dist_name_dict=self.req_dist_name, + firewall_cert_data=self.firewall_cert_data) elif type == 'rom': stdout = self.openssl.x509_cert_rom( cert_fname=output_fname,
Signature · 1 line
2.41.0
Re: [PATCH v3 1/6] binman: ti-secure: Add support for firewalling entities
Hi Manorit,
Quoted 52 lines · Manorit Chawdhry
We can now firewall entities while loading them through our secure entity TIFS, the required information should be present in the certificate that is being parsed by TIFS.
The following commit adds the support to enable the certificates to be generated if the firewall configurations are present in the binman dtsi nodes.
Signed-off-by Manorit Chawdhry <[email protected]>--- tools/binman/btool/openssl.py | 16 +++++++- tools/binman/etype/ti_secure.py | 85 +++++++++++++++++++++++++++++++++++++++++ tools/binman/etype/x509_cert.py | 3 +- 3 files changed, 101 insertions(+), 3 deletions(-)tools/binman/btool/openssl.py +9
-1@@ -82,7 +82,7 @@ imageSize = INTEGER:{len(indata)} return self.run_cmd(*args) def x509_cert_sysfw(self, cert_fname, input_fname, key_fname, sw_rev, - config_fname, req_dist_name_dict): + config_fname, req_dist_name_dict, firewall_cert_data): """Create a certificate to be booted by system firmware Args:@@ -94,6 +94,13 @@ imageSize = INTEGER:{len(indata)} req_dist_name_dict (dict): Dictionary containing key-value pairs of req_distinguished_name section extensions, must contain extensions for C, ST, L, O, OU, CN and emailAddress + firewall_cert_data (dict): + - auth_in_place (int): The Priv ID for copying as the + specific host in firewall protected region + - num_firewalls (int): The number of firewalls in the + extended certificate + - certificate (str): Extended firewall certificate with + the information for the firewall configurations. Returns: str: Tool output@@ -121,6 +128,7 @@ basicConstraints = CA:true 1.3.6.1.4.1.294.1.3 = ASN1:SEQUENCE:swrv 1.3.6.1.4.1.294.1.34 = ASN1:SEQUENCE:sysfw_image_integrity 1.3.6.1.4.1.294.1.35 = ASN1:SEQUENCE:sysfw_image_load +1.3.6.1.4.1.294.1.37 = ASN1:SEQUENCE:firewall [ swrv ] swrv = INTEGER:{sw_rev}
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 147
Quoted 9 lines
tools/binman/btool/openssl.py +5
-1@@ -132,7 +140,11 @@ imageSize = INTEGER:{len(indata)} [ sysfw_image_load ] destAddr = FORMAT:HEX,OCT:00000000 -authInPlace = INTEGER:2 +authInPlace = INTEGER:{hex(firewall_cert_data['auth_in_place'])} + +[ firewall ] +numFirewallRegions = INTEGER:{firewall_cert_data['num_firewalls']} +{firewall_cert_data['certificate']}
Do we want the text above if there is no firewall info?
Quoted 96 lines
tools/binman/btool/openssl.py +0
-0''', file=outf) args = ['req', '-new', '-x509', '-key', key_fname, '-nodes', '-outform', 'DER', '-out', cert_fname, '-config', config_fname,tools/binman/etype/ti_secure.py +61
-0@@ -7,9 +7,35 @@ from binman.entry import EntryArg from binman.etype.x509_cert import Entry_x509_cert +from dataclasses import dataclass from dtoc import fdt_util +@dataclass +class Firewall(): + id: int + region: int + control : int + permissions: list[hex] + start_address: str + end_address: str + + def get_certificate(self) -> str: + unique_identifier = f"{self.id}{self.region}" + cert = f""" +firewallID{unique_identifier} = INTEGER:{self.id} +region{unique_identifier} = INTEGER:{self.region} +control{unique_identifier} = INTEGER:{hex(self.control)} +nPermissionRegs{unique_identifier} = INTEGER:{len(self.permissions)} +""" + for index, permission in enumerate(self.permissions): + cert += f"""permissions{unique_identifier}{index} = INTEGER:{hex(permission)} +""" + cert += f"""startAddress{unique_identifier} = FORMAT:HEX,OCT:{self.start_address:02x} +endAddress{unique_identifier} = FORMAT:HEX,OCT:{self.end_address:02x} +""" + return cert + class Entry_ti_secure(Entry_x509_cert): """Entry containing a TI x509 certificate binary@@ -17,6 +43,11 @@ class Entry_ti_secure(Entry_x509_cert): - content: List of phandles to entries to sign - keyfile: Filename of file containing key to sign binary with - sha: Hash function to be used for signing + - auth_in_place: This is an integer field that contains two pieces + of information + Lower Byte - Remains 0x02 as per our use case + ( 0x02: Move the authenticated binary back to the header ) + Upper Byte - The Host ID of the core owning the firewall Output files: - input.<unique_name> - input file passed to openssl@@ -25,6 +56,35 @@ class Entry_ti_secure(Entry_x509_cert): - cert.<unique_name> - output file generated by openssl (which is used as the entry contents) + Depending on auth_in_place information in the inputs, we read the + firewall nodes that describe the configurations of firewall that TIFS + will be doing after reading the certificate. + + The syntax of the firewall nodes are as such: + + firewall-257-0 { + id = <257>; /* The ID of the firewall being configured */ + region = <0>; /* Region number to configure */ + + control = /* The control register */ + <(FWCTRL_EN | FWCTRL_LOCK | FWCTRL_BG | FWCTRL_CACHE)>; + + permissions = /* The permission registers */ + <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + + /* More defines can be found in k3-security.h */ + + start_address = /* The Start Address of the firewall */ + <0x0 0x0>; + end_address = /* The End Address of the firewall */ + <0xff 0xffffffff>; + }; + + openssl signs the provided data, using the TI templated config file and writes the signature in this entry. This allows verification that the data is genuine.@@ -32,11 +92,20 @@ class Entry_ti_secure(Entry_x509_cert): def __init__(self, section, etype, node): super().__init__(section, etype, node) self.openssl = None + self.firewall_cert_data: dict = {
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 105
Quoted 10 lines
tools/binman/etype/ti_secure.py +5
-0+ 'auth_in_place': 0x02, + 'num_firewalls': 0, + 'certificate': "", + } def ReadNode(self): super().ReadNode() self.key_fname = self.GetEntryArgsOrProps([ EntryArg('keyfile', str)], required=True)[0] + auth_in_place = fdt_util.GetInt(self._node, "auth_in_place")
Please use hyphens in properties. If that is a bool, use GetBool()
Quoted 12 lines
tools/binman/etype/ti_secure.py +5
-0+ if auth_in_place: + self.firewall_cert_data['auth_in_place'] = auth_in_place + self.ReadFirewallNode() self.sha = fdt_util.GetInt(self._node, 'sha', 512) self.req_dist_name = {'C': 'US', 'ST': 'TX',@@ -46,6 +115,22 @@ class Entry_ti_secure(Entry_x509_cert): 'CN': 'TI Support', 'emailAddress': '[email protected]'} + def ReadFirewallNode(self): + self.firewall_cert_data['certificate'] = ""
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 129
Quoted 10 lines
tools/binman/etype/ti_secure.py +10
-0+ self.firewall_cert_data['num_firewalls'] = 0 + for node in self._node.subnodes: + if 'firewall' in node.name: + firewall = Firewall( + fdt_util.GetInt(node, 'id'), + fdt_util.GetInt(node, 'region'), + fdt_util.GetInt(node, 'control'), + fdt_util.GetPhandleList(node, 'permissions'), + fdt_util.GetInt64(node, 'start_address'), + fdt_util.GetInt64(node, 'end_address'),
What happens if some of these properties are missing?
Quoted 23 lines
tools/binman/etype/ti_secure.py +4
-0+ ) + self.firewall_cert_data['num_firewalls'] += 1 + self.firewall_cert_data['certificate'] += firewall.get_certificate() + def GetCertificate(self, required): """Get the contents of this entrytools/binman/etype/x509_cert.py +2
-2@@ -98,7 +98,8 @@ class Entry_x509_cert(Entry_collection): key_fname=self.key_fname, config_fname=config_fname, sw_rev=self.sw_rev, - req_dist_name_dict=self.req_dist_name) + req_dist_name_dict=self.req_dist_name, + firewall_cert_data=self.firewall_cert_data) elif type == 'rom': stdout = self.openssl.x509_cert_rom( cert_fname=output_fname, --
Quoted 2 lines
2.41.0
Regards,
Simon
Re: [PATCH v3 1/6] binman: ti-secure: Add support for firewalling entities
Hi Simon,
Quoted 56 lines · Simon Glass
Hi Manorit,
Quoted 53 lines · Manorit Chawdhry
We can now firewall entities while loading them through our secure entity TIFS, the required information should be present in the certificate that is being parsed by TIFS.
The following commit adds the support to enable the certificates to be generated if the firewall configurations are present in the binman dtsi nodes.
Signed-off-by Manorit Chawdhry <[email protected]>--- tools/binman/btool/openssl.py | 16 +++++++- tools/binman/etype/ti_secure.py | 85 +++++++++++++++++++++++++++++++++++++++++ tools/binman/etype/x509_cert.py | 3 +- 3 files changed, 101 insertions(+), 3 deletions(-)tools/binman/btool/openssl.py +9
-1@@ -82,7 +82,7 @@ imageSize = INTEGER:{len(indata)} return self.run_cmd(*args) def x509_cert_sysfw(self, cert_fname, input_fname, key_fname, sw_rev, - config_fname, req_dist_name_dict): + config_fname, req_dist_name_dict, firewall_cert_data): """Create a certificate to be booted by system firmware Args:@@ -94,6 +94,13 @@ imageSize = INTEGER:{len(indata)} req_dist_name_dict (dict): Dictionary containing key-value pairs of req_distinguished_name section extensions, must contain extensions for C, ST, L, O, OU, CN and emailAddress + firewall_cert_data (dict): + - auth_in_place (int): The Priv ID for copying as the + specific host in firewall protected region + - num_firewalls (int): The number of firewalls in the + extended certificate + - certificate (str): Extended firewall certificate with + the information for the firewall configurations. Returns: str: Tool output@@ -121,6 +128,7 @@ basicConstraints = CA:true 1.3.6.1.4.1.294.1.3 = ASN1:SEQUENCE:swrv 1.3.6.1.4.1.294.1.34 = ASN1:SEQUENCE:sysfw_image_integrity 1.3.6.1.4.1.294.1.35 = ASN1:SEQUENCE:sysfw_image_load +1.3.6.1.4.1.294.1.37 = ASN1:SEQUENCE:firewall [ swrv ] swrv = INTEGER:{sw_rev}@@ -132,7 +140,11 @@ imageSize = INTEGER:{len(indata)}
Quoted 11 lines
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 147
Quoted 8 lines
tools/binman/btool/openssl.py +5
-1[ sysfw_image_load ] destAddr = FORMAT:HEX,OCT:00000000 -authInPlace = INTEGER:2 +authInPlace = INTEGER:{hex(firewall_cert_data['auth_in_place'])} + +[ firewall ] +numFirewallRegions = INTEGER:{firewall_cert_data['num_firewalls']} +{firewall_cert_data['certificate']}Do we want the text above if there is no firewall info?
Yes, keeping numFirewallRegions = INTEGER:0 is valid. The other way would be to remove OIDs and everything that we have kept in the certificate when firewall nodes are not present but that seems a bit more difficult given that we have an easy fix keeping the numFirewallRegions as 0.
Quoted 101 lines
Quoted 101 lines
tools/binman/btool/openssl.py +0
-0''', file=outf) args = ['req', '-new', '-x509', '-key', key_fname, '-nodes', '-outform', 'DER', '-out', cert_fname, '-config', config_fname,tools/binman/etype/ti_secure.py +65
-0@@ -7,9 +7,35 @@ from binman.entry import EntryArg from binman.etype.x509_cert import Entry_x509_cert +from dataclasses import dataclass from dtoc import fdt_util +@dataclass +class Firewall(): + id: int + region: int + control : int + permissions: list[hex] + start_address: str + end_address: str + + def get_certificate(self) -> str: + unique_identifier = f"{self.id}{self.region}" + cert = f""" +firewallID{unique_identifier} = INTEGER:{self.id} +region{unique_identifier} = INTEGER:{self.region} +control{unique_identifier} = INTEGER:{hex(self.control)} +nPermissionRegs{unique_identifier} = INTEGER:{len(self.permissions)} +""" + for index, permission in enumerate(self.permissions): + cert += f"""permissions{unique_identifier}{index} = INTEGER:{hex(permission)} +""" + cert += f"""startAddress{unique_identifier} = FORMAT:HEX,OCT:{self.start_address:02x} +endAddress{unique_identifier} = FORMAT:HEX,OCT:{self.end_address:02x} +""" + return cert + class Entry_ti_secure(Entry_x509_cert): """Entry containing a TI x509 certificate binary@@ -17,6 +43,11 @@ class Entry_ti_secure(Entry_x509_cert): - content: List of phandles to entries to sign - keyfile: Filename of file containing key to sign binary with - sha: Hash function to be used for signing + - auth_in_place: This is an integer field that contains two pieces + of information + Lower Byte - Remains 0x02 as per our use case + ( 0x02: Move the authenticated binary back to the header ) + Upper Byte - The Host ID of the core owning the firewall Output files: - input.<unique_name> - input file passed to openssl@@ -25,6 +56,35 @@ class Entry_ti_secure(Entry_x509_cert): - cert.<unique_name> - output file generated by openssl (which is used as the entry contents) + Depending on auth_in_place information in the inputs, we read the + firewall nodes that describe the configurations of firewall that TIFS + will be doing after reading the certificate. + + The syntax of the firewall nodes are as such: + + firewall-257-0 { + id = <257>; /* The ID of the firewall being configured */ + region = <0>; /* Region number to configure */ + + control = /* The control register */ + <(FWCTRL_EN | FWCTRL_LOCK | FWCTRL_BG | FWCTRL_CACHE)>; + + permissions = /* The permission registers */ + <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + + /* More defines can be found in k3-security.h */ + + start_address = /* The Start Address of the firewall */ + <0x0 0x0>; + end_address = /* The End Address of the firewall */ + <0xff 0xffffffff>; + }; + + openssl signs the provided data, using the TI templated config file and writes the signature in this entry. This allows verification that the data is genuine.@@ -32,11 +92,20 @@ class Entry_ti_secure(Entry_x509_cert): def __init__(self, section, etype, node): super().__init__(section, etype, node) self.openssl = None + self.firewall_cert_data: dict = { + 'auth_in_place': 0x02, + 'num_firewalls': 0, + 'certificate': "", + }
Quoted 7 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 105
Quoted 5 lines
tools/binman/etype/ti_secure.py +1
-0def ReadNode(self): super().ReadNode() self.key_fname = self.GetEntryArgsOrProps([ EntryArg('keyfile', str)], required=True)[0] + auth_in_place = fdt_util.GetInt(self._node, "auth_in_place")Please use hyphens in properties. If that is a bool, use
GetBool()
I will use hyphens, the property is supposed to be int. Maybe doesn't convey what it really is by the name but hoping the documentation around it makes it clear.
Quoted 12 lines
Quoted 12 lines
tools/binman/etype/ti_secure.py +3
-0+ if auth_in_place: + self.firewall_cert_data['auth_in_place'] = auth_in_place + self.ReadFirewallNode() self.sha = fdt_util.GetInt(self._node, 'sha', 512) self.req_dist_name = {'C': 'US', 'ST': 'TX',@@ -46,6 +115,22 @@ class Entry_ti_secure(Entry_x509_cert): 'CN': 'TI Support', 'emailAddress': '[email protected]'}
Quoted 14 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 129
Quoted 12 lines
tools/binman/etype/ti_secure.py +12
-0+ def ReadFirewallNode(self): + self.firewall_cert_data['certificate'] = "" + self.firewall_cert_data['num_firewalls'] = 0 + for node in self._node.subnodes: + if 'firewall' in node.name: + firewall = Firewall( + fdt_util.GetInt(node, 'id'), + fdt_util.GetInt(node, 'region'), + fdt_util.GetInt(node, 'control'), + fdt_util.GetPhandleList(node, 'permissions'), + fdt_util.GetInt64(node, 'start_address'), + fdt_util.GetInt64(node, 'end_address'),What happens if some of these properties are missing?
Should be an error as the firewall would'nt be configurable without these properties. Though am not sure why am not getting an error while passing None to the dataclass, ideally it should..
Regards,
Manorit
Quoted 29 lines
Quoted 24 lines
tools/binman/etype/ti_secure.py +4
-0+ ) + self.firewall_cert_data['num_firewalls'] += 1 + self.firewall_cert_data['certificate'] += firewall.get_certificate() + def GetCertificate(self, required): """Get the contents of this entrytools/binman/etype/x509_cert.py +2
-2@@ -98,7 +98,8 @@ class Entry_x509_cert(Entry_collection): key_fname=self.key_fname, config_fname=config_fname, sw_rev=self.sw_rev, - req_dist_name_dict=self.req_dist_name) + req_dist_name_dict=self.req_dist_name, + firewall_cert_data=self.firewall_cert_data) elif type == 'rom': stdout = self.openssl.x509_cert_rom( cert_fname=output_fname, --Quoted 2 lines
2.41.0
Regards,
Simon
Re: [PATCH v3 1/6] binman: ti-secure: Add support for firewalling entities
Hi Manorit,
Quoted 14 lines · Manorit Chawdhry
Hi Simon,
Quoted 10 lines · Simon Glass
Hi Manorit,
Quoted 7 lines · Manorit Chawdhry
We can now firewall entities while loading them through our secure entity TIFS, the required information should be present in the certificate that is being parsed by TIFS.
The following commit adds the support to enable the certificates to be generated if the firewall configurations are present in the binman
dtsi
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
nodes.
Signed-off-by Manorit Chawdhry <[email protected]>--- tools/binman/btool/openssl.py | 16 +++++++- tools/binman/etype/ti_secure.py | 85
+++++++++++++++++++++++++++++++++++++++++
Quoted 4 lines
Quoted 4 lines
Review
Quoted 4 lines
tools/binman/etype/x509_cert.py | 3 +- 3 files changed, 101 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/tools/binman/btool/openssl.py
Quoted 7 lines
Quoted 7 lines
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 84
Quoted 7 lines
index
aad3b61ae27c..dff439df211f100644tools/binman/btool/openssl.py +0
-0@@ -82,7 +82,7 @@ imageSize = INTEGER:{len(indata)} return self.run_cmd(*args) def x509_cert_sysfw(self, cert_fname, input_fname, key_fname,
sw_rev,
Quoted 2 lines
Quoted 2 lines
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 85
Quoted 2 lines
tools/binman/btool/openssl.py +1
-1- config_fname, req_dist_name_dict): + config_fname, req_dist_name_dict,
firewall_cert_data):
Quoted 5 lines
Quoted 5 lines
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 94
Quoted 5 lines
tools/binman/btool/openssl.py +0
-0"""Create a certificate to be booted by system firmware Args:@@ -94,6 +94,13 @@ imageSize = INTEGER:{len(indata)} req_dist_name_dict (dict): Dictionary containing
key-value pairs of
Quoted 1 line
Quoted 1 line
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 95
Quoted 1 line
tools/binman/btool/openssl.py +0
-0req_distinguished_name section extensions, must contain
extensions for
Quoted 33 lines
Quoted 21 lines
Quoted 21 lines
tools/binman/btool/openssl.py +8
-0C, ST, L, O, OU, CN and emailAddress + firewall_cert_data (dict): + - auth_in_place (int): The Priv ID for copying as the + specific host in firewall protected region + - num_firewalls (int): The number of firewalls in the + extended certificate + - certificate (str): Extended firewall certificate with + the information for the firewall configurations. Returns: str: Tool output@@ -121,6 +128,7 @@ basicConstraints = CA:true 1.3.6.1.4.1.294.1.3 = ASN1:SEQUENCE:swrv 1.3.6.1.4.1.294.1.34 = ASN1:SEQUENCE:sysfw_image_integrity 1.3.6.1.4.1.294.1.35 = ASN1:SEQUENCE:sysfw_image_load +1.3.6.1.4.1.294.1.37 = ASN1:SEQUENCE:firewall [ swrv ] swrv = INTEGER:{sw_rev}@@ -132,7 +140,11 @@ imageSize = INTEGER:{len(indata)}Quoted 11 lines
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 147
Quoted 8 lines
tools/binman/btool/openssl.py +5
-1[ sysfw_image_load ] destAddr = FORMAT:HEX,OCT:00000000 -authInPlace = INTEGER:2 +authInPlace = INTEGER:{hex(firewall_cert_data['auth_in_place'])} + +[ firewall ] +numFirewallRegions = INTEGER:{firewall_cert_data['num_firewalls']} +{firewall_cert_data['certificate']}Do we want the text above if there is no firewall info?
Quoted 1 line
Yes, keeping numFirewallRegions = INTEGER:0 is valid. The other way would
be
Quoted 3 lines
to remove OIDs and everything that we have kept in the certificate when firewall nodes are not present but that seems a bit more difficult given that we have an easy fix keeping the numFirewallRegions as 0.
OK
Quoted 4 lines
Quoted 4 lines
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)}
Quoted 4 lines
tools/binman/btool/openssl.py +0
-0''', file=outf) args = ['req', '-new', '-x509', '-key', key_fname, '-nodes', '-outform', 'DER', '-out', cert_fname, '-config',
config_fname,
Quoted 1 line
Quoted 1 line
Review
Quoted 1 line
(quoted diff) +0
-0
b/tools/binman/etype/ti_secure.py
Quoted 22 lines
Quoted 22 lines
Quoted 22 lines
index
d939dce57139..a7409023fa55100644tools/binman/etype/ti_secure.py +12
-0@@ -7,9 +7,35 @@ from binman.entry import EntryArg from binman.etype.x509_cert import Entry_x509_cert +from dataclasses import dataclass from dtoc import fdt_util +@dataclass +class Firewall(): + id: int + region: int + control : int + permissions: list[hex] + start_address: str + end_address: str + + def get_certificate(self) -> str: + unique_identifier = f"{self.id}{self.region}"
Quoted 8 lines
Quoted 8 lines
tools/binman/etype/ti_secure.py
Quoted 8 lines
tools/binman/etype/ti_secure.py +8
-0+ cert = f""" +firewallID{unique_identifier} = INTEGER:{self.id} +region{unique_identifier} = INTEGER:{self.region} +control{unique_identifier} = INTEGER:{hex(self.control)} +nPermissionRegs{unique_identifier} = INTEGER:{len(self.permissions)} +""" + for index, permission in enumerate(self.permissions): + cert += f"""permissions{unique_identifier}{index} =
INTEGER:{hex(permission)}
Quoted 2 lines
Quoted 2 lines
tools/binman/etype/ti_secure.py line 34
Quoted 2 lines
tools/binman/etype/ti_secure.py +2
-0+""" + cert += f"""startAddress{unique_identifier} =
FORMAT:HEX,OCT:{self.start_address:02x}
Quoted 10 lines
Quoted 10 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 44
Quoted 10 lines
tools/binman/etype/ti_secure.py +4
-0+endAddress{unique_identifier} = FORMAT:HEX,OCT:{self.end_address:02x} +""" + return cert + class Entry_ti_secure(Entry_x509_cert): """Entry containing a TI x509 certificate binary@@ -17,6 +43,11 @@ class Entry_ti_secure(Entry_x509_cert): - content: List of phandles to entries to sign - keyfile: Filename of file containing key to sign binary
with
Quoted 2 lines
Quoted 2 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 46
Quoted 2 lines
tools/binman/etype/ti_secure.py +1
-0- sha: Hash function to be used for signing + - auth_in_place: This is an integer field that contains two
pieces
Quoted 3 lines
Quoted 3 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert):
Quoted 3 lines
tools/binman/etype/ti_secure.py +3
-0+ of information + Lower Byte - Remains 0x02 as per our use case + ( 0x02: Move the authenticated binary back to the header
)
Quoted 6 lines
Quoted 6 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 56
Quoted 6 lines
tools/binman/etype/ti_secure.py +1
-0+ Upper Byte - The Host ID of the core owning the firewall Output files: - input.<unique_name> - input file passed to openssl@@ -25,6 +56,35 @@ class Entry_ti_secure(Entry_x509_cert): - cert.<unique_name> - output file generated by openssl
(which is
Quoted 4 lines
Quoted 4 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert):
Quoted 4 lines
tools/binman/etype/ti_secure.py +2
-0used as the entry contents) + Depending on auth_in_place information in the inputs, we read the + firewall nodes that describe the configurations of firewall that
TIFS
Quoted 6 lines
Quoted 6 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert):
Quoted 6 lines
tools/binman/etype/ti_secure.py +6
-0+ will be doing after reading the certificate. + + The syntax of the firewall nodes are as such: + + firewall-257-0 { + id = <257>; /* The ID of the firewall being
configured */
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
tools/binman/etype/ti_secure.py +7
-0+ region = <0>; /* Region number to configure */ + + control = /* The control register */ + <(FWCTRL_EN | FWCTRL_LOCK | FWCTRL_BG | FWCTRL_CACHE)>; + + permissions = /* The permission registers */ + <((FWPRIVID_ALL << FWPRIVID_SHIFT) |
Quoted 8 lines
Quoted 8 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert):
Quoted 8 lines
tools/binman/etype/ti_secure.py +8
-0+ FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + + /* More defines can be found in k3-security.h */ + + start_address = /* The Start Address of the firewall
*/
Quoted 7 lines
Quoted 7 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert):
Quoted 7 lines
tools/binman/etype/ti_secure.py +6
-0+ <0x0 0x0>; + end_address = /* The End Address of the firewall */ + <0xff 0xffffffff>; + }; + + openssl signs the provided data, using the TI templated config
file and
Quoted 1 line
Quoted 1 line
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 89
Quoted 1 line
tools/binman/etype/ti_secure.py +0
-0writes the signature in this entry. This allows verification
that the
Quoted 19 lines
Quoted 11 lines
Quoted 11 lines
tools/binman/etype/ti_secure.py +5
-0data is genuine.@@ -32,11 +92,20 @@ class Entry_ti_secure(Entry_x509_cert): def __init__(self, section, etype, node): super().__init__(section, etype, node) self.openssl = None + self.firewall_cert_data: dict = { + 'auth_in_place': 0x02, + 'num_firewalls': 0, + 'certificate': "", + }Quoted 7 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 105
Quoted 5 lines
tools/binman/etype/ti_secure.py +1
-0def ReadNode(self): super().ReadNode() self.key_fname = self.GetEntryArgsOrProps([ EntryArg('keyfile', str)], required=True)[0] + auth_in_place = fdt_util.GetInt(self._node, "auth_in_place")Please use hyphens in properties. If that is a bool, use
GetBool()
Quoted 3 lines
I will use hyphens, the property is supposed to be int. Maybe doesn't convey what it really is by the name but hoping the documentation around it makes it clear.
No, but you can't use a property name in the DT called 'auth_in_place' (please use single quotes BTW). It should have hyphens. Of course the Python var will have underscore. but not the property.
Quoted 28 lines
Quoted 13 lines
Quoted 13 lines
tools/binman/etype/ti_secure.py +3
-0+ if auth_in_place: + self.firewall_cert_data['auth_in_place'] = auth_in_place + self.ReadFirewallNode() self.sha = fdt_util.GetInt(self._node, 'sha', 512) self.req_dist_name = {'C': 'US', 'ST': 'TX',@@ -46,6 +115,22 @@ class Entry_ti_secure(Entry_x509_cert): 'CN': 'TI Support', 'emailAddress': '[email protected]'}Quoted 14 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 129
Quoted 12 lines
tools/binman/etype/ti_secure.py +12
-0+ def ReadFirewallNode(self): + self.firewall_cert_data['certificate'] = "" + self.firewall_cert_data['num_firewalls'] = 0 + for node in self._node.subnodes: + if 'firewall' in node.name: + firewall = Firewall( + fdt_util.GetInt(node, 'id'), + fdt_util.GetInt(node, 'region'), + fdt_util.GetInt(node, 'control'), + fdt_util.GetPhandleList(node, 'permissions'), + fdt_util.GetInt64(node, 'start_address'), + fdt_util.GetInt64(node, 'end_address'),What happens if some of these properties are missing?
Quoted 10 lines
Should be an error as the firewall would'nt be configurable without these properties. Though am not sure why am not getting an error while passing None to the dataclass, ideally it should..
Regards,
ManoritQuoted 4 lines
Quoted 4 lines
tools/binman/etype/ti_secure.py +3
-0+ ) + self.firewall_cert_data['num_firewalls'] += 1 + self.firewall_cert_data['certificate'] +=
firewall.get_certificate()
Quoted 5 lines
Quoted 5 lines
Review
Quoted 5 lines
tools/binman/etype/ti_secure.py +1
-0+ def GetCertificate(self, required): """Get the contents of this entry(quoted diff) +0
-0
b/tools/binman/etype/x509_cert.py
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
index
d028cfe38cd9..9e1cf479023b100644tools/binman/etype/x509_cert.py +2
-1@@ -98,7 +98,8 @@ class Entry_x509_cert(Entry_collection): key_fname=self.key_fname, config_fname=config_fname, sw_rev=self.sw_rev, - req_dist_name_dict=self.req_dist_name) + req_dist_name_dict=self.req_dist_name, + firewall_cert_data=self.firewall_cert_data) elif type == 'rom': stdout = self.openssl.x509_cert_rom( cert_fname=output_fname,
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
--
2.41.0Regards,
Simon
Regards,
Simon
Re: [PATCH v3 1/6] binman: ti-secure: Add support for firewalling entities
Hi Simon,
Quoted 213 lines · Simon Glass
Hi Manorit,
Quoted 14 lines · Manorit Chawdhry
Hi Simon,
Quoted 10 lines · Simon Glass
Hi Manorit,
Quoted 7 lines · Manorit Chawdhry
We can now firewall entities while loading them through our secure entity TIFS, the required information should be present in the certificate that is being parsed by TIFS.
The following commit adds the support to enable the certificates to be generated if the firewall configurations are present in the binman
dtsi
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
nodes.
Signed-off-by Manorit Chawdhry <[email protected]>--- tools/binman/btool/openssl.py | 16 +++++++- tools/binman/etype/ti_secure.py | 85+++++++++++++++++++++++++++++++++++++++++
Quoted 4 lines
Quoted 4 lines
Review
Quoted 4 lines
tools/binman/etype/x509_cert.py | 3 +- 3 files changed, 101 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/tools/binman/btool/openssl.pyQuoted 7 lines
Quoted 7 lines
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 84
Quoted 7 lines
index
aad3b61ae27c..dff439df211f100644tools/binman/btool/openssl.py +0
-0@@ -82,7 +82,7 @@ imageSize = INTEGER:{len(indata)} return self.run_cmd(*args) def x509_cert_sysfw(self, cert_fname, input_fname, key_fname,
sw_rev,Quoted 2 lines
Quoted 2 lines
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 85
Quoted 2 lines
tools/binman/btool/openssl.py +1
-1- config_fname, req_dist_name_dict): + config_fname, req_dist_name_dict,
firewall_cert_data):Quoted 5 lines
Quoted 5 lines
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 94
Quoted 5 lines
tools/binman/btool/openssl.py +0
-0"""Create a certificate to be booted by system firmware Args:@@ -94,6 +94,13 @@ imageSize = INTEGER:{len(indata)} req_dist_name_dict (dict): Dictionary containingkey-value pairs of
Quoted 1 line
Quoted 1 line
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 95
Quoted 1 line
tools/binman/btool/openssl.py +0
-0req_distinguished_name section extensions, must containextensions for
Quoted 33 lines
Quoted 21 lines
Quoted 21 lines
tools/binman/btool/openssl.py +8
-0C, ST, L, O, OU, CN and emailAddress + firewall_cert_data (dict): + - auth_in_place (int): The Priv ID for copying as the + specific host in firewall protected region + - num_firewalls (int): The number of firewalls in the + extended certificate + - certificate (str): Extended firewall certificate with + the information for the firewall configurations. Returns: str: Tool output@@ -121,6 +128,7 @@ basicConstraints = CA:true 1.3.6.1.4.1.294.1.3 = ASN1:SEQUENCE:swrv 1.3.6.1.4.1.294.1.34 = ASN1:SEQUENCE:sysfw_image_integrity 1.3.6.1.4.1.294.1.35 = ASN1:SEQUENCE:sysfw_image_load +1.3.6.1.4.1.294.1.37 = ASN1:SEQUENCE:firewall [ swrv ] swrv = INTEGER:{sw_rev}@@ -132,7 +140,11 @@ imageSize = INTEGER:{len(indata)}Quoted 11 lines
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)} · line 147
Quoted 8 lines
tools/binman/btool/openssl.py +5
-1[ sysfw_image_load ] destAddr = FORMAT:HEX,OCT:00000000 -authInPlace = INTEGER:2 +authInPlace = INTEGER:{hex(firewall_cert_data['auth_in_place'])} + +[ firewall ] +numFirewallRegions = INTEGER:{firewall_cert_data['num_firewalls']} +{firewall_cert_data['certificate']}Do we want the text above if there is no firewall info?
Quoted 1 line
Yes, keeping numFirewallRegions = INTEGER:0 is valid. The other way would
be
Quoted 3 lines
to remove OIDs and everything that we have kept in the certificate when firewall nodes are not present but that seems a bit more difficult given that we have an easy fix keeping the numFirewallRegions as 0.
OK
Quoted 4 lines
Quoted 4 lines
tools/binman/btool/openssl.py imageSize = INTEGER:{len(indata)}
Quoted 4 lines
tools/binman/btool/openssl.py +0
-0''', file=outf) args = ['req', '-new', '-x509', '-key', key_fname, '-nodes', '-outform', 'DER', '-out', cert_fname, '-config',
config_fname,Quoted 1 line
Quoted 1 line
Review
Quoted 1 line
(quoted diff) +0
-0
b/tools/binman/etype/ti_secure.pyQuoted 22 lines
Quoted 22 lines
Quoted 22 lines
index
d939dce57139..a7409023fa55100644tools/binman/etype/ti_secure.py +12
-0@@ -7,9 +7,35 @@ from binman.entry import EntryArg from binman.etype.x509_cert import Entry_x509_cert +from dataclasses import dataclass from dtoc import fdt_util +@dataclass +class Firewall(): + id: int + region: int + control : int + permissions: list[hex] + start_address: str + end_address: str + + def get_certificate(self) -> str: + unique_identifier = f"{self.id}{self.region}"Quoted 8 lines
Quoted 8 lines
tools/binman/etype/ti_secure.py
Quoted 8 lines
tools/binman/etype/ti_secure.py +8
-0+ cert = f""" +firewallID{unique_identifier} = INTEGER:{self.id} +region{unique_identifier} = INTEGER:{self.region} +control{unique_identifier} = INTEGER:{hex(self.control)} +nPermissionRegs{unique_identifier} = INTEGER:{len(self.permissions)} +""" + for index, permission in enumerate(self.permissions): + cert += f"""permissions{unique_identifier}{index} =INTEGER:{hex(permission)}
Quoted 2 lines
Quoted 2 lines
tools/binman/etype/ti_secure.py line 34
Quoted 2 lines
tools/binman/etype/ti_secure.py +2
-0+""" + cert += f"""startAddress{unique_identifier} =FORMAT:HEX,OCT:{self.start_address:02x}
Quoted 10 lines
Quoted 10 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 44
Quoted 10 lines
tools/binman/etype/ti_secure.py +4
-0+endAddress{unique_identifier} = FORMAT:HEX,OCT:{self.end_address:02x} +""" + return cert + class Entry_ti_secure(Entry_x509_cert): """Entry containing a TI x509 certificate binary@@ -17,6 +43,11 @@ class Entry_ti_secure(Entry_x509_cert): - content: List of phandles to entries to sign - keyfile: Filename of file containing key to sign binarywith
Quoted 2 lines
Quoted 2 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 46
Quoted 2 lines
tools/binman/etype/ti_secure.py +1
-0- sha: Hash function to be used for signing + - auth_in_place: This is an integer field that contains twopieces
Quoted 3 lines
Quoted 3 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert):
Quoted 3 lines
tools/binman/etype/ti_secure.py +3
-0+ of information + Lower Byte - Remains 0x02 as per our use case + ( 0x02: Move the authenticated binary back to the header)
Quoted 6 lines
Quoted 6 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 56
Quoted 6 lines
tools/binman/etype/ti_secure.py +1
-0+ Upper Byte - The Host ID of the core owning the firewall Output files: - input.<unique_name> - input file passed to openssl@@ -25,6 +56,35 @@ class Entry_ti_secure(Entry_x509_cert): - cert.<unique_name> - output file generated by openssl(which is
Quoted 4 lines
Quoted 4 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert):
Quoted 4 lines
tools/binman/etype/ti_secure.py +2
-0used as the entry contents) + Depending on auth_in_place information in the inputs, we read the + firewall nodes that describe the configurations of firewall thatTIFS
Quoted 6 lines
Quoted 6 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert):
Quoted 6 lines
tools/binman/etype/ti_secure.py +6
-0+ will be doing after reading the certificate. + + The syntax of the firewall nodes are as such: + + firewall-257-0 { + id = <257>; /* The ID of the firewall beingconfigured */
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
tools/binman/etype/ti_secure.py +7
-0+ region = <0>; /* Region number to configure */ + + control = /* The control register */ + <(FWCTRL_EN | FWCTRL_LOCK | FWCTRL_BG | FWCTRL_CACHE)>; + + permissions = /* The permission registers */ + <((FWPRIVID_ALL << FWPRIVID_SHIFT) |Quoted 8 lines
Quoted 8 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert):
Quoted 8 lines
tools/binman/etype/ti_secure.py +8
-0+ FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + + /* More defines can be found in k3-security.h */ + + start_address = /* The Start Address of the firewall*/
Quoted 7 lines
Quoted 7 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert):
Quoted 7 lines
tools/binman/etype/ti_secure.py +6
-0+ <0x0 0x0>; + end_address = /* The End Address of the firewall */ + <0xff 0xffffffff>; + }; + + openssl signs the provided data, using the TI templated configfile and
Quoted 1 line
Quoted 1 line
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 89
Quoted 1 line
tools/binman/etype/ti_secure.py +0
-0writes the signature in this entry. This allows verificationthat the
Quoted 19 lines
Quoted 18 lines
Quoted 6 lines
tools/binman/etype/ti_secure.py +1
-0data is genuine.@@ -32,11 +92,20 @@ class Entry_ti_secure(Entry_x509_cert): def __init__(self, section, etype, node): super().__init__(section, etype, node) self.openssl = None + self.firewall_cert_data: dict = {tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 105
Quoted 10 lines
tools/binman/etype/ti_secure.py +5
-0+ 'auth_in_place': 0x02, + 'num_firewalls': 0, + 'certificate': "", + } def ReadNode(self): super().ReadNode() self.key_fname = self.GetEntryArgsOrProps([ EntryArg('keyfile', str)], required=True)[0] + auth_in_place = fdt_util.GetInt(self._node, "auth_in_place")Please use hyphens in properties. If that is a bool, use
GetBool()
Quoted 8 lines
Quoted 3 lines
I will use hyphens, the property is supposed to be int. Maybe doesn't convey what it really is by the name but hoping the documentation around it makes it clear.
No, but you can't use a property name in the DT called '
auth_in_place' (please use single quotes BTW). It should have hyphens. Of course the Python var will have underscore. but not the property.
I think there has been some miscommunication but I believe we are both in agreement for the change unless I understood something incorrectly, would be sending a v4 with the change.
Thanks and Regards,
Manorit
Quoted 68 lines
Quoted 28 lines
Quoted 13 lines
Quoted 13 lines
tools/binman/etype/ti_secure.py +3
-0+ if auth_in_place: + self.firewall_cert_data['auth_in_place'] = auth_in_place + self.ReadFirewallNode() self.sha = fdt_util.GetInt(self._node, 'sha', 512) self.req_dist_name = {'C': 'US', 'ST': 'TX',@@ -46,6 +115,22 @@ class Entry_ti_secure(Entry_x509_cert): 'CN': 'TI Support', 'emailAddress': '[email protected]'}Quoted 14 lines
tools/binman/etype/ti_secure.py class Entry_ti_secure(Entry_x509_cert): · line 129
Quoted 12 lines
tools/binman/etype/ti_secure.py +12
-0+ def ReadFirewallNode(self): + self.firewall_cert_data['certificate'] = "" + self.firewall_cert_data['num_firewalls'] = 0 + for node in self._node.subnodes: + if 'firewall' in node.name: + firewall = Firewall( + fdt_util.GetInt(node, 'id'), + fdt_util.GetInt(node, 'region'), + fdt_util.GetInt(node, 'control'), + fdt_util.GetPhandleList(node, 'permissions'), + fdt_util.GetInt64(node, 'start_address'), + fdt_util.GetInt64(node, 'end_address'),What happens if some of these properties are missing?
Quoted 10 lines
Should be an error as the firewall would'nt be configurable without these properties. Though am not sure why am not getting an error while passing None to the dataclass, ideally it should..
Regards,
ManoritQuoted 4 lines
Quoted 4 lines
tools/binman/etype/ti_secure.py +3
-0+ ) + self.firewall_cert_data['num_firewalls'] += 1 + self.firewall_cert_data['certificate'] +=
firewall.get_certificate()Quoted 5 lines
Quoted 5 lines
Review
Quoted 5 lines
tools/binman/etype/ti_secure.py +1
-0+ def GetCertificate(self, required): """Get the contents of this entry(quoted diff) +0
-0
b/tools/binman/etype/x509_cert.pyQuoted 14 lines
Quoted 14 lines
Quoted 14 lines
index
d028cfe38cd9..9e1cf479023b100644tools/binman/etype/x509_cert.py +2
-1@@ -98,7 +98,8 @@ class Entry_x509_cert(Entry_collection): key_fname=self.key_fname, config_fname=config_fname, sw_rev=self.sw_rev, - req_dist_name_dict=self.req_dist_name) + req_dist_name_dict=self.req_dist_name, + firewall_cert_data=self.firewall_cert_data) elif type == 'rom': stdout = self.openssl.x509_cert_rom( cert_fname=output_fname,Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
--
2.41.0Regards,
SimonRegards,
Simon
PATCH v3 2/6 binman: ftest: Add test for ti-secure firewall node
In reply to Manorit ChawdhryAdd test for TI firewalling node in ti-secure.
--- tools/binman/ftest.py | 12 ++++++++++++ tools/binman/test/319_ti_secure_firewall.dts | 28 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)
tools/binman/ftest.py +12 -0
@@ -7030,6 +7030,18 @@ fdt fdtmap Extract the devicetree blob from the fdtmap entry_args=entry_args)[0] self.assertGreater(len(data), len(TI_UNSECURE_DATA)) + def testPackTiSecureFirewall(self): + """Test that an image with a TI secured binary can be created""" + keyfile = self.TestFile('key.key') + entry_args = { + 'keyfile': keyfile, + } + data_no_firewall = self._DoReadFileDtb('296_ti_secure.dts', + entry_args=entry_args)[0] + data_firewall = self._DoReadFileDtb('319_ti_secure_firewall.dts', + entry_args=entry_args)[0] + self.assertGreater(len(data_firewall),len(data_no_firewall)) + def testPackTiSecureMissingTool(self): """Test that an image with a TI secured binary (non-functional) can be created when openssl is missing"""
tools/binman/test/319_ti_secure_firewall.dts new file +28 -0
@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + ti-secure { + content = <&unsecure_binary>; + auth_in_place = <0xa02>; + + firewall-0-2 { + id = <0>; + region = <2>; + control = <0x31a>; + permissions = <0xc3ffff>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + }; + unsecure_binary: blob-ext { + filename = "ti_unsecure.bin"; + }; + }; +};
Signature · 1 line
2.41.0
PATCH v3 3/6 binman: k3: Add k3-security.h and include it in k3-binman.dtsi
In reply to Manorit ChawdhryFor readability during configuring firewalls, adding k3-security.h file and including it in k3-binman.dtsi to be accessible across K3 SoCs
--- arch/arm/dts/k3-binman.dtsi | 2 ++ arch/arm/dts/k3-security.h | 58 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+)
arch/arm/dts/k3-binman.dtsi +2 -0
@@ -3,6 +3,8 @@ * Copyright (C) 2022-2023 Texas Instruments Incorporated - https://www.ti.com/ */ +#include "k3-security.h" + / { binman: binman { multiple-images;
arch/arm/dts/k3-security.h new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
2.41.0
PATCH v3 4/6 binman: j721e: Add firewall configurations
In reply to Manorit ChawdhryThe following commits adds the configuration of firewalls required to protect ATF and OP-TEE memory region from non-secure reads and writes using master and slave firewalls present in our K3 SOCs.
--- arch/arm/dts/k3-j721e-binman.dtsi | 187 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+)
arch/arm/dts/k3-j721e-binman.dtsi +187 -0
@@ -330,6 +330,102 @@ ti-secure { content = <&atf>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + firewall-257-0 { + /* cpu_0_cpu_0_msmc Background Firewall */ + id = <257>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-257-1 { + /* cpu_0_cpu_0_msmc Foreground Firewall */ + id = <257>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + firewall-284-0 { + /* dru_0_msmc Background Firewall */ + id = <284>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-284-1 { + /* dru_0_msmc Foreground Firewall */ + id = <284>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + /* firewall-4760-0 { + * nb_slv0__mem0 Background Firewall + * Already configured by the secure entity + * }; + */ + + firewall-4760-1 { + /* nb_slv0__mem0 Foreground Firewall */ + id = <4760>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + /* firewall-4761-0 { + * nb_slv1__mem0 Background Firewall + * Already configured by the secure entity + * }; + */ + + firewall-4761-1 { + /* nb_slv1__mem0 Foreground Firewall */ + id = <4761>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + }; atf: atf-bl31 { };
@@ -346,6 +442,97 @@ ti-secure { content = <&tee>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + /* cpu_0_cpu_0_msmc region 0 and 1 configured + * during ATF Firewalling + */ + + firewall-257-2 { + /* cpu_0_cpu_0_msmc Foreground Firewall */ + id = <257>; + region = <2>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + /* dru_0_msmc region 0 and 1 configured + * during ATF Firewalling + */ + + firewall-284-2 { + /* dru_0_msmc Foreground Firewall */ + id = <284>; + region = <2>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-4762-0 { + /* nb_slv2__mem0 Background Firewall */ + id = <4762>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-4762-1 { + /* nb_slv2__mem0 Foreground Firewall */ + id = <4762>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-4763-0 { + /* nb_slv3__mem0 Background Firewall */ + id = <4763>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-4763-1 { + /* nb_slv3__mem0 Foreground Firewall */ + id = <4763>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; }; tee: tee-os { };
Signature · 1 line
2.41.0
PATCH v3 5/6 binman: j721s2: Add firewall configurations
In reply to Manorit ChawdhryThe following commits adds the configuration of firewalls required to protect ATF and OP-TEE memory region from non-secure reads and writes using master and slave firewalls present in our K3 SOCs.
--- arch/arm/dts/k3-j721s2-binman.dtsi | 208 +++++++++++++++++++++++++++++++++++++ 1 file changed, 208 insertions(+)
arch/arm/dts/k3-j721s2-binman.dtsi +208 -0
@@ -177,6 +177,102 @@ ti-secure { content = <&atf>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + firewall-257-0 { + /* cpu_0_cpu_0_msmc Background Firewall */ + id = <257>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-257-1 { + /* cpu_0_cpu_0_msmc Foreground Firewall */ + id = <257>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + firewall-284-0 { + /* dru_0_msmc Background Firewall */ + id = <284>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-284-1 { + /* dru_0_msmc Foreground Firewall */ + id = <284>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + /* firewall-5140-0 { + * nb_slv0__mem0 Background Firewall + * Already configured by the secure entity + * }; + */ + + firewall-5140-1 { + /* nb_slv0__mem0 Foreground Firewall */ + id = <5140>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + /* firewall-5140-0 { + * nb_slv1__mem0 Background Firewall + * Already configured by the secure entity + * }; + */ + + firewall-5141-1 { + /* nb_slv1__mem0 Foreground Firewall */ + id = <5141>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + }; atf: atf-bl31 { };
@@ -193,6 +289,118 @@ ti-secure { content = <&tee>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + firewall-257-2 { + /* cpu_0_cpu_0_msmc Foreground Firewall */ + id = <257>; + region = <2>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-284-2 { + /* dru_0_msmc Foreground Firewall */ + id = <284>; + region = <2>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-5142-0 { + /* nb_slv2__mem0 Background Firewall - 0 */ + id = <5142>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-5142-1 { + /* nb_slv2__mem0 Foreground Firewall */ + id = <5142>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-5143-0 { + /* nb_slv3__mem0 Background Firewall - 0 */ + id = <5143>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-5143-1 { + /* nb_slv3__mem0 Foreground Firewall */ + id = <5143>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-5144-0 { + /* nb_slv4__mem0 Background Firewall - 0 */ + id = <5144>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-5144-1 { + /* nb_slv4__mem0 Foreground Firewall */ + id = <5144>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + }; tee: tee-os { };
Signature · 1 line
2.41.0
PATCH v3 6/6 binman: j7200: Add firewall configurations
In reply to Manorit ChawdhryThe following commits adds the configuration of firewalls required to protect ATF and OP-TEE memory region from non-secure reads and writes using master and slave firewalls present in our K3 SOCs.
--- arch/arm/dts/k3-j7200-binman.dtsi | 143 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+)
arch/arm/dts/k3-j7200-binman.dtsi +143 -0
@@ -214,6 +214,74 @@ ti-secure { content = <&atf>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + firewall-257-0 { + /* cpu_0_cpu_0_msmc Background Firewall */ + id = <257>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-257-1 { + /* cpu_0_cpu_0_msmc Foreground Firewall */ + id = <257>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + /* firewall-4760-0 { + * nb_slv0__mem0 Background Firewall + * Already configured by the secure entity + * }; + */ + + firewall-4760-1 { + /* nb_slv0__mem0 Foreground Firewall */ + id = <4760>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + + /* firewall-4761-0 { + * nb_slv1__mem0 Background Firewall + * Already configured by the secure entity + * }; + */ + + firewall-4761-1 { + /* nb_slv1__mem0 Foreground Firewall */ + id = <4761>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x70000000>; + end_address = <0x0 0x7001ffff>; + }; + }; atf: atf-bl31 { };
@@ -230,6 +298,81 @@ ti-secure { content = <&tee>; keyfile = "custMpk.pem"; + auth_in_place = <0xa02>; + + /* cpu_0_cpu_0_msmc region 0 and 1 configured + * during ATF Firewalling + */ + + firewall-257-2 { + /* cpu_0_cpu_0_msmc Foreground Firewall */ + id = <257>; + region = <2>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-4762-0 { + /* nb_slv2__mem0 Background Firewall - 0 */ + id = <4762>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-4762-1 { + /* nb_slv2__mem0 Foreground Firewall */ + id = <4762>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + + firewall-4763-0 { + /* nb_slv3__mem0 Background Firewall - 0 */ + id = <4763>; + region = <0>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_BG | FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ALL << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD | + FWPERM_NON_SECURE_PRIV_RWCD | + FWPERM_NON_SECURE_USER_RWCD)>; + start_address = <0x0 0x0>; + end_address = <0xff 0xffffffff>; + }; + + firewall-4763-1 { + /* nb_slv3__mem0 Foreground Firewall */ + id = <4763>; + region = <1>; + control = <(FWCTRL_EN | FWCTRL_LOCK | + FWCTRL_CACHE)>; + permissions = <((FWPRIVID_ARMV8 << FWPRIVID_SHIFT) | + FWPERM_SECURE_PRIV_RWCD | + FWPERM_SECURE_USER_RWCD)>; + start_address = <0x0 0x9e800000>; + end_address = <0x0 0x9fffffff>; + }; + }; tee: tee-os { };
Signature · 1 line
2.41.0