mirror of
https://github.com/itsPLK/ps5-payload-manager.git
synced 2026-10-22 03:42:51 -05:00
Split two monolithic files (main.c 1538→233 lines, payload_mgr.c 2355→467 lines) into 8 single-responsibility modules: - http_server.c: MHD request router and all route handlers - repository.c: repo cache, download, install/commit, self-update - sources.c: multi-source repository management - config.c: PldmgrConfig struct, read/write, JSON config handler - log_server.c: ring buffer, SSE streaming, pldmgr_log() - json_helpers.c: JsonListBuilder, JSON parser, file I/O utilities - sha256.c: SHA256 hash implementation - process_mgr.c: process listing and kill Introduces PldmgrConfig struct to replace the 8-out-param read_next_config_values() pattern. Renames extracted functions to match their new modules (e.g. repository_install_download, sources_add, process_kill). No HTTP route changes — frontend is unaffected.
22 lines
566 B
C
22 lines
566 B
C
#ifndef SHA256_H
|
|
#define SHA256_H
|
|
|
|
#include <stddef.h>
|
|
|
|
typedef struct SHA256_CTX {
|
|
unsigned char data[64];
|
|
unsigned int datalen;
|
|
unsigned long long bitlen;
|
|
unsigned int state[8];
|
|
} SHA256_CTX;
|
|
|
|
void sha256_init(SHA256_CTX *ctx);
|
|
void sha256_update(SHA256_CTX *ctx, const unsigned char data[], size_t len);
|
|
void sha256_final(SHA256_CTX *ctx, unsigned char hash[]);
|
|
|
|
/* Compute SHA256 of a file, writing the 64-char hex string to out_hex.
|
|
* Returns 0 on success, -1 on failure. */
|
|
int compute_sha256_file(const char *path, char out_hex[65]);
|
|
|
|
#endif
|