Preventing Soft Errors and Hardware Trojans in RISC-V Cores