// Copyright (c) StellaOps. All rights reserved.
// Licensed under BUSL-1.1. See LICENSE in the project root.
using StellaOps.BinaryIndex.Disassembly;
using StellaOps.BinaryIndex.Normalization;
namespace StellaOps.BinaryIndex.DeltaSig;
///
/// Generates delta signatures from binaries for CVE detection.
///
public interface IDeltaSignatureGenerator
{
///
/// Generates signatures for specified symbols in a binary.
///
/// Stream containing the binary data.
/// Signature generation request.
/// Cancellation token.
/// The generated delta signature.
Task GenerateSignaturesAsync(
Stream binaryStream,
DeltaSignatureRequest request,
CancellationToken ct = default);
///
/// Generates a signature for a single symbol given already-disassembled instructions.
///
/// The normalized bytes of the symbol.
/// Name of the symbol.
/// Section containing the symbol.
/// Generation options.
/// The symbol signature.
SymbolSignature GenerateSymbolSignature(
ReadOnlySpan normalizedBytes,
string symbolName,
string scope,
SignatureOptions? options = null);
///
/// Generates a signature for a single symbol with full CFG analysis.
///
/// The normalized function with instructions.
/// Name of the symbol.
/// Section containing the symbol.
/// Generation options.
/// The symbol signature with CFG metrics.
SymbolSignature GenerateSymbolSignature(
NormalizedFunction normalized,
string symbolName,
string scope,
SignatureOptions? options = null);
///
/// Generates a signature for a single symbol with optional semantic analysis.
///
/// The normalized function with instructions.
/// Name of the symbol.
/// Section containing the symbol.
/// Original disassembled instructions for semantic analysis.
/// CPU architecture for IR lifting.
/// Generation options.
/// Cancellation token.
/// The symbol signature with CFG metrics and optional semantic fingerprint.
Task GenerateSymbolSignatureAsync(
NormalizedFunction normalized,
string symbolName,
string scope,
IReadOnlyList originalInstructions,
CpuArchitecture architecture,
SignatureOptions? options = null,
CancellationToken ct = default);
}