The general approach is called "software independence"; the integrity of the election outcome shouldn't depend on the integrity of any software used to conduct it. See https://www.nist.gov/system/files/si-in-voting.pdf
This can be achived with certain types of election systems (such as optical-scan paper ballots), with a statistical technique called "risk-limiting audits".
Unfortunately, the current Brazilian voting machine lacks the reliable paper record of the votes required to conduct these audits.