INNER CODE UNIT · Python

UnexpectedExport

BlockstreamResearch/secp256k1-zkp · tools/symbol-check.py:22

class UnexpectedExport(RuntimeError):
    pass


def get_exported_exports(library) -> list[str]:
    """Adapter function to get exported symbols based on the library format."""
    if library.format == lief.Binary.FORMATS.ELF:
        return [symbol.name for symbol in library.exported_symbols]
    elif library.format == lief.Binary.FORMATS.PE:
        return [entry.name for entry in library.get_export().entries]
    elif library.format == lief.Binary.FORMATS.MACHO:
        return [symbol.name[1:] for symbol in library.exported_symbols]
    raise NotImplementedError(f"Unsupported format: {library.format}")


def grep_expected_symbols() -> list[str]:
    """Guess the list of expected exported symbols from the source code."""
    grep_output = subprocess.check_output(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…