𝑠𝑝 ← 8530092
▷ I.e. 0b100000100010100010101100: for all primes 𝑝 ≤ 23,
TestBit(𝑠𝑝, 𝑝) = true
if 𝑛 ≤ 23 then
▷ Quick check for small values, simpler and faster
than testing equality on each option
return TestBit(𝑠𝑝, 𝑛)
end if
if ¬TestBit(𝑛, 0) then return ⊥
▷ I.e. 𝑛 is even and, as per line 2, 𝑛 > 2 thus composite
end if
And it indeed is a bug. The function guarantees to return false “if the number can be determined to be composite” and true for all primes, so it should err in only one way.I would further improve the code by having it shortcut for all primes smaller than 31 (adding 29 and 31) or 63.
This is step 1 of the algorithm they're using: https://en.wikipedia.org/wiki/Baillie%E2%80%93PSW_primality_...
* The function will return True for all primes.
* The function will return False if the number is detected as a composite by some tests.
* The function can return True or False for all other numbers.
* For numbers<=23 they implemented a shortcut using a lookup table which is implemented as bits in a number.
* The bit for number 19 is wrong. It returns false for a prime number which violates "return True for all prime numbers".
This is indeed quite shoddy programming for such an essential and easily testable piece of software.
>2.3 E-voting
>The option to vote online in federal votes and elections has been on hold since mid-2019.
>Adjustments are to be made to the pilot scheme by the end of 2020. The aim is to establish a stable scheme, using the latest technology, and create an accurate and transparent end-to-end voting system that also preserves the secrecy of the ballot. Efforts are also being made to raise levels of public confidence in e-voting by extending independent monitoring, ensuring greater transparency with regard to e-voting systems and how they operate, and involving the scientific community more effectively. The necessary conditions for resuming the e-voting trials will be redefined by 2020.
Is the government information out of date? If so, this should be reported.
Do the bare minimum research before posting please.
https://www.evoting.ch/en#transparenz
Voting in Switzerland is either in person or by mail.
Looks like they had it in varying number of areas from 2003 to 2019. Then all systems were withdrawn due to security concerns.
https://en.wikipedia.org/wiki/Electronic_voting_in_Switzerla...
https://www.ch.ch/en/votes-and-elections/e-voting/#revision-...
Isn't it the Swiss post?
And given what they show off, they should abstain from it for the next 1000 years.
That is one modest reviewer!
19 should have been tested by a lookup table, there's no need to apply such heavy test to it
However, by changing that constant (if not properly verified) I'd worry it might change the primality test for some classes of numbers. Where this might be later manipulated to produce a weak key
They intended to do 2^2+2^3+2^5+2^7+2^11+2^13+2^17+2^19+2^23 = 9054380, but they accidentally left out 2^19, and got 2^2+2^3+2^5+2^7+2^11+2^13+2^17+2^23 = 8530092.
You can see the problematic Algorithm 4.16 on p31 here: https://gitlab.com/swisspost-evoting/crypto-primitives/crypt...
I don't know much about Swiss e-voting, but seems even the most brain-dead unit test of the IsProbablePrime function should have caught this.
I highly doubt we will see e-voting here until there is a verifiable proof that it is verifiable. There was a lot of bad press about this and people don't trust this crap.
They tried a similar thing for E-ID which was supposed to be built by some private cooperation and run on some centralized servers. The people voted against it and now the government has done the right thing and is building an E-ID system that is decentralized and government run. It still has some quirks but it's going in the right direction.
The sad thing is for the governments first version (outsource to private industry) their claim at the poles was that it would take many years for an E-ID if we don't do it this way. Now only 1 year later we have a very good proposal. There is too much corporate interest pushing around pawns in Government at this time even in a direct democracy like Switzerland.
https://www.srf.ch/news/schweiz/elektronische-stimmabgabe-ha...
https://www.heise.de/news/Schweizer-Post-Hacker-konnten-E-Vo...
Sorry for being a bit of a pedant but: A pole is a simple structure (eg flag pole), a Pole is a person from Poland and a poll is what you meant 8)
There is also a question of impact - i think that 19 does not really cause any harm there.
I mean sure, but it's pretty simple to at least enumerate the primes < 100 and test those...
You better have your crypto _primitives_ rock solid
https://www.post.ch/en/business-solutions/e-voting?shortcut=...
>It plans to make the system available to the cantons for the trial operation once the development and evaluation of the system has been completed.
https://www.post.ch/en/business-solutions/e-voting
In addition, another page on the same website says:
>The cantons of Neuchâtel, Fribourg, Thurgau and Basel-Stadt used Swiss Post’s previous e-voting system until 2019. The following cantons (among others) are planning to use the new Swiss Post system once this becomes legally and technically possible: [list of cantons follows]
>https://www.post.ch/en/business-solutions/e-voting/success-t...
A Swiss Post press statement says:
>Since the beginning of 2021, Swiss Post’s future e-voting system has been put through its paces by independent experts from all over the world. Another testing opportunity is now available: in addition to the ongoing test options, ethical hackers can now attack the e-voting infrastructure for a period of four weeks. This means that, for the first time, they can accurately simulate and target the vote casting process on the voting portal using sample voting cards. The aim is to detect potential vulnerabilities and rectify them in good time. Swiss Post expects to make its new e-voting system available for use by interested cantons during the course of 2023.
https://www.post.ch/en/about-us/media/press-releases/2022/et...
I don't understand why you must be so haughty (vide "Do the bare minimum research before posting please."). Certainly, you are correct for some definition of "Switzerland has an e-voting system" --- there is one under development, and it had been piloted for a limited time period. However, at the moment, it's only in the public testing stage, it's not officially recognized, cannot be used to cast votes, and there is no guarantee that it will get a green light. I think that's the more accepted definition of "to have an e-voting system", in which case the OP was right, and it was you who did not do adequate research.
They made an open public intrusion test with a bug bounty and they released the sources. And so far no one could find a real weakness.
(classic spycraft, blackmailing of key persons, intercept mailvoting, etc.)
Nothing is 100% secure.
So the question is, is it good enough?
They said they took great effort to verificate the voting and detect manipulation. I cannot confirm or verify it, but since it is open, I could. That is a great step forward, compared to the closed black boxes, e-voting systems I have heard of before.
> That is a great step forward, compared to the closed black boxes, e-voting systems I have heard of before.
It's still a black box. You have only their word to go that the published source is what is actually running on the machine in front of you in the voting booth. And they have only the word of their computers.
So yes, it's a great step forward, in the same way that going up a flight of stairs is a great step towards reaching orbit.
Less scalable likely yes, but easier to detect depends. How would I know, if my local vote regulator is a russian asset?
"You have only their word to go that the published source is what is actually running on the machine in front of you in the voting booth."
That can be changed. In a way, that I also can voluntarily help with the voting and vote count today, you could have community based people overwatching the technical deployment of the machines.
I am not saying, that what the swiss are doing is enough. But I like voting and I would like voting to happen more often. That would be way easier with digital secure solutions. We can transfer our money digital securly, so why not also our vote?
(well yes, anonymity of vote makes it harder, but not impossible)
More voting, more democracy.
In contrast, paper and mail voting are things that are technically less secure than a well-designed e-voting system, but they can be understood by laypeople. In Switzerland, my vote goes into a ballot box, guarded by people from different parties. They are counted by citizens from different parties, with many people in the same room. Manipulation has happened in the past, but it has always happened in a constrained scope (e.g. people fishing voting ballots out of the mailboxes of their neighbors). And if it happens large-scale in a single town, this may be detected by statistical analysis ("the number of votes for a certain party is unusually high or low compared to other similar towns"). If citizens don't trust the count, they can request a re-count of the sealed voting ballots by other people.
Making voting simpler is a good thing. In Switzerland, we have had mail voting for a long time now. Yes, you still need to fill out a piece of paper and bring it to a post box, but the thing that takes the most time is actually informing yourself about the things/laws/referendums you're voting on, not filling out the paper. And the attack vector on mail voting is easy to understand.
The problem with e-voting is not security, it's trust. If we erode trust in our voting systems, we erode trust in our democracy. This has already started to happen in a few places, most notably in some areas in the US where e-voting systems are deployed, and where certain groups of people keep repeating their allegations of voter fraud. (They can claim this about regular voting as well, but it's easier to disprove than with closed e-voting systems that only very few "experts" can understand.)
I very much agree to your point, that laypersons need to be able to understand the system. At least the basic concept. No dark magic.
After all a vote is just encrypted information going to a server.
The details are more complex, sure, but there is a growing number of tech literate people.
So not all people might understand it all directly, but if their neigbhor does (and indeed also checks occasionally), then this might be enough.
I have yet to find someone that can explain me how homomorphic encryption works in a way that I fully understand. And I'm a software engineer. I understand RSA or Diffie Hellman. A lot of people understand RSA or Diffie Hellman. Almost nobody understands homomorphic encryption. This means that almost nobody even has the necessary base knowledge to even being able to review an e-voting system.
Without voting secrecy, I'd say that building a robust system would work reasonably well. With voting secrecy, it's a different story.
Sadly this is true and I agree to that. I am also a fan of open voting, but I can see that general society is not ready for that.
And to your other points I mainly agree, but I am a bit more optimistic, than one can build a system of open trust, even though I have to admit, that I also do not understand the specific system, but I also did not really look into it.