Re: Diverse Double-Compiling, --with-c-toolchain and trusting trust

2020-10-16 Thread Ludovic Courtès
Hi!

Nice challenge! :-)

zimoun  skribis:

> Well, the idea is to implement the procedure with Guix: step #1,
>
>   guix build tcc --with-c-toolchain=tcc=clang-toolchain
>
> but then I do not know how to use the output to complete the step #2.
> Is it possible to do it at the CLI level?  Or do I have to write some
> Scheme?

I think you’ll have to write Scheme because you really need to construct
a graph with leading to the diversely-compiled compiler.

Ludo’.



Re: Diverse Double-Compiling, --with-c-toolchain and trusting trust

2020-10-14 Thread zimoun
Dear,

On Wed, 14 Oct 2020 at 20:12, Joshua Branson  wrote:

> This reminds me of the reflections on trusting trust:

Hehe!  The Diverse Double-Compiling (DDC) is a countermeasure against
Trusting Trust attack. :-)If you are interested by the topic, one
entry point is one of this links:

1: 

2: 

3: 

> If you get something like this working, and you'd like some help
> assembling it into a blog post, please let me know!

Thanks for the offer.  I will keep it in mind.


All the best,
simon



Re: Diverse Double-Compiling, --with-c-toolchain and trusting trust

2020-10-14 Thread Joshua Branson


Hey zimoun!

This reminds me of the reflections on trusting trust:

https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_ReflectionsonTrustingTrust.pdf

If you get something like this working, and you'd like some help
assembling it into a blog post, please let me know!

Thanks,

--
Joshua Branson
Sent from Emacs and Gnus
https://gnucode.me
https://video.hardlimit.com/accounts/joshua_branson/video-channels
"You can have whatever you want, as long as you help enough other people get 
what they want." - Zig Ziglar



Diverse Double-Compiling, --with-c-toolchain and trusting trust

2020-10-14 Thread zimoun
Hi,

Reading the recent discussions about Reproducible Builds, see [1, 2, 3],
I was in the mood to use the recent option ’–with-c-toolchain’ to
demonstrate how Guix is cool!  But I have failed because I miss some UI,
I guess.

Well, my understanding of Diverse Double-Compiling can be summarized as:

Let’s consider that you have the source code of compiler (say ’tcc’
because it compiles fast) and 2 another compilers (say ’clang’ and
’gcc’).

| step | source | compiled with | produces |
|--++---+--|
| #1   | tcc| clang | tcc-A|
| #2   | tcc| tcc-A | tcc-B|
| #3   | tcc| gcc   | tcc-C|

Nothing ensures that tcc-{A,B,C} are bit-to-bit identical –– even they
should have different binary code –– but they are functionally
equivalent, or something is already wrong.

The next steps is to recompile:

| step | source | compiled with | produces |
|--++---+--|
| #4   | tcc| tcc-B | tcc-1|
| #5   | tcc| tcc-C | tcc-2|

And now, if everything is ok, then ’tcc-1’ and ’tcc-2’ must be
bit-identical.  Otherwise, the binaries ’clang’ *or* ’gcc’ are
compromised.  Assuming that the source code of ’tcc’ is audited and not
compromised. ;-)

If the source of the compilers used at step #1 and #2 are available,
then the same procedure can be applied to detect an attack.


Well, the idea is to implement the procedure with Guix: step #1,

  guix build tcc --with-c-toolchain=tcc=clang-toolchain

but then I do not know how to use the output to complete the step #2.
Is it possible to do it at the CLI level?  Or do I have to write some
Scheme?


Thank you in advance for any tips.

All the best,
simon

1: 

2: 

3: