/* PE parser for POSIX
   Copyright (C) 2026 Alexander Larsson <alexl@redhat.com>

   This file is free software: you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.

   This file is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public License
   along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

#include <stdbool.h>
#include <stdint.h>
#include <sys/types.h>

#define PE_SECTION_NAME_SIZE 8

typedef struct {
    char name[PE_SECTION_NAME_SIZE + 1];
    uint32_t file_offset;
    uint32_t size;
} PeSectionInfo;

extern bool
pe_parse_sections(int fd,
		  off_t base_offset,
		  PeSectionInfo **sections_out,
		  uint32_t *n_sections_out);

extern bool
pe_verify_signature(int fd, off_t base_offset, const char *cert_path);
