int ncsd_signature_verify(const void* blob, rsakey2048* key) { u8* message = (u8*)blob + 0x100; u8* sig = (u8*)blob; u8 hash[0x20]; ctr_sha_256(message, 0x100, hash); return ctr_rsa_verify_hash(sig, hash, key); }
void firm_signature_verify(firm_context* ctx) { u8 hash[0x20]; if (ctx->usersettings) { ctr_sha_256(ctx->header.magic, 0x100, hash); ctx->headersigcheck = ctr_rsa_verify_hash(ctx->header.signature, hash, &ctx->usersettings->keys.firmrsakey); } }
void ivfc_hash(ivfc_context* ctx, u64 offset, u64 size, u8* hash) { if (size > IVFC_MAX_BUFFERSIZE) { fprintf(stderr, "Error, IVFC hash block size too big.\n"); return; } ivfc_read(ctx, offset, size, ctx->buffer); ctr_sha_256(ctx->buffer, (u32) size, hash); }
void exefs_calculate_hash(exefs_context* ctx, u8 hash[32]) { ctr_sha_256((const u8*)&ctx->header, sizeof(exefs_header), hash); }