mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-18 05:42:35 +00:00
cert_audit: Remove merge_auditdata
We maintain a dict with unique AudiData objects (AuditData with unique underlying X.509 objects). We don't need merge_auditdata anymore. Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
This commit is contained in:
parent
e09d27e723
commit
ee870a6e83
@ -73,9 +73,6 @@ class AuditData:
|
|||||||
encoding = cryptography.hazmat.primitives.serialization.Encoding.DER
|
encoding = cryptography.hazmat.primitives.serialization.Encoding.DER
|
||||||
self._identifier = hashlib.sha1(self._obj.public_bytes(encoding)).hexdigest()
|
self._identifier = hashlib.sha1(self._obj.public_bytes(encoding)).hexdigest()
|
||||||
|
|
||||||
def __eq__(self, __value) -> bool:
|
|
||||||
return self._obj == __value._obj
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def identifier(self):
|
def identifier(self):
|
||||||
"""
|
"""
|
||||||
@ -263,7 +260,7 @@ class Auditor:
|
|||||||
Iterate over all the files in the list and get audit data. The
|
Iterate over all the files in the list and get audit data. The
|
||||||
results will be written to `results` passed to this function.
|
results will be written to `results` passed to this function.
|
||||||
|
|
||||||
:param results: The dictionary used to store the parsed
|
:param results: The dictionary used to store the parsed
|
||||||
AuditData. The keys of this dictionary should
|
AuditData. The keys of this dictionary should
|
||||||
be the identifier of the AuditData.
|
be the identifier of the AuditData.
|
||||||
"""
|
"""
|
||||||
@ -376,22 +373,6 @@ class SuiteDataAuditor(Auditor):
|
|||||||
return audit_data_list
|
return audit_data_list
|
||||||
|
|
||||||
|
|
||||||
def merge_auditdata(original: typing.List[AuditData]) \
|
|
||||||
-> typing.List[AuditData]:
|
|
||||||
"""
|
|
||||||
Multiple AuditData might be extracted from different locations for
|
|
||||||
an identical X.509 object. Merge them into one entry in the list.
|
|
||||||
"""
|
|
||||||
results = []
|
|
||||||
for x in original:
|
|
||||||
if x not in results:
|
|
||||||
results.append(x)
|
|
||||||
else:
|
|
||||||
idx = results.index(x)
|
|
||||||
results[idx].locations.extend(x.locations)
|
|
||||||
return results
|
|
||||||
|
|
||||||
|
|
||||||
def list_all(audit_data: AuditData):
|
def list_all(audit_data: AuditData):
|
||||||
for loc in audit_data.locations:
|
for loc in audit_data.locations:
|
||||||
print("{}\t{:20}\t{:20}\t{:3}\t{}".format(
|
print("{}\t{:20}\t{:20}\t{:3}\t{}".format(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user