mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-21 23:05:55 +03:00
cert_audit: Fix DER files missed from parsing
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
This commit is contained in:
parent
ee870a6e83
commit
a57f677474
@ -302,12 +302,22 @@ class TestDataAuditor(Auditor):
|
|||||||
data = f.read()
|
data = f.read()
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
|
# Try to parse all PEM blocks.
|
||||||
|
is_pem = False
|
||||||
for idx, m in enumerate(re.finditer(X509Parser.PEM_REGEX, data, flags=re.S), 1):
|
for idx, m in enumerate(re.finditer(X509Parser.PEM_REGEX, data, flags=re.S), 1):
|
||||||
|
is_pem = True
|
||||||
result = self.parse_bytes(data[m.start():m.end()])
|
result = self.parse_bytes(data[m.start():m.end()])
|
||||||
if result is not None:
|
if result is not None:
|
||||||
result.locations.append("{}#{}".format(filename, idx))
|
result.locations.append("{}#{}".format(filename, idx))
|
||||||
results.append(result)
|
results.append(result)
|
||||||
|
|
||||||
|
# Might be DER format.
|
||||||
|
if not is_pem:
|
||||||
|
result = self.parse_bytes(data)
|
||||||
|
if result is not None:
|
||||||
|
result.locations.append("{}".format(filename))
|
||||||
|
results.append(result)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user