News for hackers. Stuff that matters.
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by api on Monday April 13, 2020 @09:28AM (#22855635)
I wonder at what point might we implement a very old CPU like the 6502/6510 on this and demonstrate the proof of concept of e.g. a very very slow fully homomorphic Commodore 64 emulator.

Has it been done?

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by mmastrac on Monday April 13, 2020 @11:25AM (#22856641)
ShapeCPU was the first one that I know of (https://github.com/hcrypt-project/obliviousJ).

I built one off the same infrastructure called hideCPU. If you can create AND/XOR/NAND/etc gates _and_ feed-back output into your input, you can create a CPU.

https://github.com/mmastrac/oblivious-cpu

My goal was more to build some open prior art in the space rather than actually build a viable FHE CPU, but there's no reason why you couldn't implement one of these on top of the FHE system.

To answer some statements about FHE computing that come up over and over:

- Yes, you can loop + perform control flow in a FHE-based computer

- Yes, you can recurse in a FHE-based computer as long as you have enough emulated RAM/stack

- Yes, you can store state in a FHE computer

- No, you cannot determine if a FHE computer has reached a certain state (or halted) from the outside without decrypting the system (or at least a state bit)

- Yes, you can emulate RAM in a FHE computer

- Yes, you can emulate a HDD (well, rotating storage) in a certain FHE computer constructions

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by rjeli on Monday April 13, 2020 @12:28PM (#22857243)
From some napkin math and googling, a 6502 has 4.5k transistors, which at 13 ms per gate is about a minute per cycle, divided by how many gates there really are per transistor.

How does your implementation compare?

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by mmastrac on Monday April 13, 2020 @12:36PM (#22857324)
~20k gates total (ShapeCPU was ~30k gates), but the _real_ bottleneck for FHE computing is the longest path from input to output as FHE computers are highly parallel.

I am sure I had a stat for the longest path from input to output, but I'm a few years swapped out on this project.

Note that adding pipelining to a CPU drastically reduces the longest path. ShapeCPU is not pipelined at all which probably means there's a bunch of low-hanging fruit.

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by nindanaoto on Monday April 13, 2020 @01:10PM (#22857674)
We made our original CPU&ISA emulator over TFHE. https://github.com/virtualsecureplatform/kvsp

Because we use chisel to write CPU and we also made LLVM backend for our original CPU, your idea is not so difficult although it may be very slow. Our original CPU is about 4K gates. The most difficult point is building memory because it is most slow part. We used TFHE's LHE mode for it and this is one of the novel points of our work.

(We didn't know about Shape CPU but it seems to be similar to FURISC, which is published and using libScarab.https://eprint.iacr.org/2015/699)

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by mmastrac on Monday April 13, 2020 @09:23PM (#22861923)
Interesting. FURISC looks like it cribbed a lot of ideas off ShapeCPU without referencing prior art. I find it hard to believe someone would be working on a libScarab-based CPU without seeing ShapeCPU as well.

Encrypted termination conditions were definitely in that implementation. The memory mux too.

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by nindanaoto on Tuesday April 14, 2020 @10:27AM (#22866366)
I'm also doubting that but before I knew Shape CPU, I believed because FURISC seems to be based on HEROIC, which is claimed to be the first processor emulation over homomorphic encryption. https://past.date-conference.com/proceedings-archive/PAPERS/... I think FURISC is more like HEROIC than ShapeCPU.

By the way, I feel sad for there is no publication of ShapeCPU. I guess that this is one of the causes of FURISC paper is lacking reference for ShapeCPU.

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by mmastrac on Tuesday April 14, 2020 @04:00PM (#22870723)
It looks like ShapeCPU originated around 2012 but only made it into posters, not papers. It's kind of a shame because I spent quite some time reproducing their work to confirm that it was viable, then building on top of it with HideCPU.

Lots of prior art in that implementation!

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by nindanaoto on Monday April 13, 2020 @01:15PM (#22857721)
Our original CPU, CAHP-emerald is 5 stage pipeline, super-scalar processor. Pipelining improved performance well. https://github.com/virtualsecureplatform/cahp-emerald
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by KenoFischer on Monday April 13, 2020 @09:30AM (#22855650)
You can't do control flow homomorphicly, so that tends to throw a wrench into this kind of thing.
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by heavenlyblue on Monday April 13, 2020 @10:24AM (#22856091)
No, you can. Any control flow program can be converted into a matrix multiplication. Obviously, the matrix size is exponential to the number of if conditions - but that is a pre-requisite for homomorphic encryption anyway, otherwise you would be able to tell which branch was taken.
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by dragonwriter on Monday April 13, 2020 @10:31AM (#22856148)
> Any control flow program can be converted into a matrix multiplication.

Any control flow program, on a set of inputs for which it terminates[0], can be, but it's not true that any control flow program, with unspecified inputs, can be, even with variables for the inputs, since the shape of the multiplication as well as the value of elements in the matrices may depend on the inputs (also, whether it's even a terminating program can obviously depend on the inputs.)

[0] and any program which always terminates can also be, though the general form may be more complex than is necessary for some inputs.

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by heavenlyblue on Monday April 13, 2020 @11:50AM (#22856870)
No, any program can be converted into a matrix form.

Non-terminating programs are modelled as infinitely-sized matrixes, which are obviously not computable; but neither are non-terminating programs computable in the real sense.

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by api on Monday April 13, 2020 @10:43AM (#22856255)
I guess then that my hypothetical fully homomorphic C-64 would be huge and would have a limited run-time?
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by lazersharkman on Monday April 13, 2020 @11:17AM (#22856558)
Yes. No recursion. Essentially what could be fabbed as a circuit
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by api on Monday April 13, 2020 @11:29AM (#22856685)
I get it. I think I had the misconception that you could branch in FHE, but as I think about it this would by its nature reveal quite a lot of information about the plaintext.

Would it perhaps be possible to create a weaker form of homomorphic encryption that could branch? It would not be strong enough for the most serious security use cases (authentication, financial, etc.) but would perhaps be usable for cases where you just want to protect data confidentiality e.g. processing PII. The processor could probably infer the structure of the running program but not necessarily its data if appropriate constant-time comparisons and other constructions were used.

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by heavenlyblue on Monday April 13, 2020 @11:52AM (#22856886)
If you can branch then you can always run a program that compares the encrypted value to a constant, then iterate over the whole space of possible values for the constant and that way decrypt the value
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by heavenlyblue on Monday April 13, 2020 @12:06PM (#22857013)
CPUs are a circuit. What are you on about?

Ergo, you can model anything CPUs do as a matrix.

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by dang on Monday April 13, 2020 @03:05PM (#22858952)
We've asked you before to edit the swipes out of your comments here. If you keep doing it, like here and https://news.ycombinator.com/item?id=22847040 from yesterday, we're going to have to ban you. I don't want to do that, so would you please just make your substantive points thoughtfully?

If you wouldn't mind reviewing https://news.ycombinator.com/newsguidelines.html and sticking to the rules when posting here, we'd be grateful.

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by KenoFischer on Monday April 13, 2020 @01:08PM (#22857657)
Yes, of course you can do if conversion. The exponential increase in execution time is the wrench I was talking about ;).
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by heavenlyblue on Friday April 17, 2020 @07:49PM (#22904086)
Not if you can properly model sparse matrices.
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by artemonster on Monday April 13, 2020 @10:16AM (#22856016)
Please correct me if I am wrong: you can simulate a function built out of binary gates with encrypted data, but you cannot simulate a state machine over encrypted inputs? Since the webpage says "arbitrary circuit", so it can have loops, so it can be stateful, right? Is this somehow fundamental restriction or just not solved yet?
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by lonelappde on Monday April 13, 2020 @10:25AM (#22856097)
Are loops general control flow? Can they do branching?

I don't think so, but not sure.

Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by artemonster on Monday April 13, 2020 @11:13AM (#22856521)
loops as in "feedback in a circuit", not code loops. Feedback is necessary to create stateful circuits, state is necessary for "control flow"
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by nindanaoto on Monday April 13, 2020 @01:23PM (#22857822)
Yes, it can be stateful. We built processor
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by imglorp on Monday April 13, 2020 @10:05AM (#22855908)
What is the set of operations that are supported?
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by nindanaoto on Monday April 13, 2020 @01:26PM (#22857858)
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by imglorp on Monday April 13, 2020 @02:41PM (#22858629)
So it looks like you can have:

    CONSTANT NOT COPY NAND OR AND XOR XNOR NOR ANDNY ANDYN ORNY ORYN MUX
... so pure, combinational logic operators. You can build up some serious functions with these, yes.
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by aneutron on Monday April 13, 2020 @10:30AM (#22856133)
I think the answer to this would be enough to determine if it's a base for the vector space of operations.
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by phkahler on Monday April 13, 2020 @10:47AM (#22856297)
If you can do a NAND gate homomorphically you can do an entire computer.
Re:TFHE: Fast Fully Homomorphic Encryption over the Torus by artemonster on Monday April 13, 2020 @11:14AM (#22856527)
only if you are allowed stateful circuits! if its a FUNCTION i.e. straight input->output mapping, then no, you cannot do a "computer"