Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Uncategorized
  3. I guess people are just going to keep discovering that you can't really make a C compiler do constant time

I guess people are just going to keep discovering that you can't really make a C compiler do constant time

Scheduled Pinned Locked Moved Uncategorized
31 Posts 14 Posters 69 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Rachel BarkerR Rachel Barker

    @regehr Do you think it would be possible to make a special-purpose optimization mode that only makes changes which are "safe" for cryptographic code? Or is that too underspecified/hard of a problem?

    John RegehrR This user is from outside of this forum
    John RegehrR This user is from outside of this forum
    John Regehr
    wrote last edited by
    #3

    @rachelplusplus there's some work in this direction in the LLVM community!

    https://discourse.llvm.org/t/rfc-constant-time-coding-support/87781

    1 Reply Last reply
    0
    • John RegehrR John Regehr

      I guess people are just going to keep discovering that you can't really make a C compiler do constant time

      https://www.theregister.com/2026/02/09/compilers_undermine_encryption/

      John RegehrR This user is from outside of this forum
      John RegehrR This user is from outside of this forum
      John Regehr
      wrote last edited by
      #4

      "Can it be fair to require the average programmer to understand inline assembly, or any of these other inherently obtuse obfuscation techniques?"

      can it be fair for the average programmer (if they don't understand this stuff) to just not write code where timing channels matter? who even writes these articles

      David BeazleyD SiguzaS 2 Replies Last reply
      0
      • John RegehrR John Regehr

        I guess people are just going to keep discovering that you can't really make a C compiler do constant time

        https://www.theregister.com/2026/02/09/compilers_undermine_encryption/

        ashA This user is from outside of this forum
        ashA This user is from outside of this forum
        ash
        wrote last edited by
        #5

        @regehr I would be interested to see the same article focused on CompCert instead. Otherwise, cryptographers might need to... roll their own assembly? Crazy idea in 2026 if true

        John RegehrR 1 Reply Last reply
        0
        • ashA ash

          @regehr I would be interested to see the same article focused on CompCert instead. Otherwise, cryptographers might need to... roll their own assembly? Crazy idea in 2026 if true

          John RegehrR This user is from outside of this forum
          John RegehrR This user is from outside of this forum
          John Regehr
          wrote last edited by
          #6

          @ashguy CompCert absolutely makes no promises about this, and (in most cases) neither does the hardware -- which absolutely matters

          people who care about this need to work in actual solutions, not faith-based efforts like obfuscating the code

          1 Reply Last reply
          0
          • John RegehrR This user is from outside of this forum
            John RegehrR This user is from outside of this forum
            John Regehr
            wrote last edited by
            #7

            @secretasianman it's really bad

            1 Reply Last reply
            0
            • John RegehrR This user is from outside of this forum
              John RegehrR This user is from outside of this forum
              John Regehr
              wrote last edited by
              #8

              @rygorous sure, and the right answer is to figure out real solutions (as seems to be happening in LLVM, for constant time), not complaining about the optimizer

              1 Reply Last reply
              0
              • John RegehrR This user is from outside of this forum
                John RegehrR This user is from outside of this forum
                John Regehr
                wrote last edited by
                #9

                @rygorous don't worry the LLMs will do this asm rewriting for us

                1 Reply Last reply
                0
                • Per VognsenP This user is from outside of this forum
                  Per VognsenP This user is from outside of this forum
                  Per Vognsen
                  wrote last edited by
                  #10

                  @rygorous @regehr Regarding diffing, the thread I had with John the other day got me thinking about using FileCheck for that kind of thing and I want to try it out, but I suspect the problem is that it's either too loose or too strict in terms of the matching depending on how many matches you specify, across compilers. Either way, too much work on maintain.

                  1 Reply Last reply
                  0
                  • John RegehrR John Regehr

                    "Can it be fair to require the average programmer to understand inline assembly, or any of these other inherently obtuse obfuscation techniques?"

                    can it be fair for the average programmer (if they don't understand this stuff) to just not write code where timing channels matter? who even writes these articles

                    David BeazleyD This user is from outside of this forum
                    David BeazleyD This user is from outside of this forum
                    David Beazley
                    wrote last edited by
                    #11

                    @regehr What about fractions?

                    ROTOPE~1 ⭐️R 1 Reply Last reply
                    0
                    • David BeazleyD David Beazley

                      @regehr What about fractions?

                      ROTOPE~1 ⭐️R This user is from outside of this forum
                      ROTOPE~1 ⭐️R This user is from outside of this forum
                      ROTOPE~1 ⭐️
                      wrote last edited by
                      #12

                      @dabeaz 🐸

                      1 Reply Last reply
                      0
                      • DougallD This user is from outside of this forum
                        DougallD This user is from outside of this forum
                        Dougall
                        wrote last edited by
                        #13

                        @rygorous @regehr And ABI-related bugs can be much more insidious than I once thought, since they're not guaranteed to actually crash as one might expect. They can just lurk there as vulnerabilities, potentially causing crashes in totally unrelated code:

                        https://randomascii.wordpress.com/2022/11/21/please-restore-our-registers-when-youre-done-with-them/

                        1 Reply Last reply
                        0
                        • John RegehrR John Regehr

                          "Can it be fair to require the average programmer to understand inline assembly, or any of these other inherently obtuse obfuscation techniques?"

                          can it be fair for the average programmer (if they don't understand this stuff) to just not write code where timing channels matter? who even writes these articles

                          SiguzaS This user is from outside of this forum
                          SiguzaS This user is from outside of this forum
                          Siguza
                          wrote last edited by
                          #14

                          @regehr even the best programmers in the world struggle with this kind of stuff, ffs...

                          1 Reply Last reply
                          0
                          • Per VognsenP This user is from outside of this forum
                            Per VognsenP This user is from outside of this forum
                            Per Vognsen
                            wrote last edited by
                            #15

                            @rygorous @regehr Petition to rename to -fun-math.

                            1 Reply Last reply
                            0
                            • Per VognsenP This user is from outside of this forum
                              Per VognsenP This user is from outside of this forum
                              Per Vognsen
                              wrote last edited by
                              #16

                              @rygorous @regehr -fhonor-yahweh -fhonor-buddha -fhonor-brahma just to be safe. You need all the help you can get with -ffast-math.

                              1 Reply Last reply
                              0
                              • John RegehrR This user is from outside of this forum
                                John RegehrR This user is from outside of this forum
                                John Regehr
                                wrote last edited by
                                #17

                                @rygorous

                                well, if the problems are important enough, something like this:

                                https://discourse.llvm.org/t/rfc-constant-time-coding-support/87781

                                1 Reply Last reply
                                0
                                • John RegehrR John Regehr

                                  I guess people are just going to keep discovering that you can't really make a C compiler do constant time

                                  https://www.theregister.com/2026/02/09/compilers_undermine_encryption/

                                  kaoudisK This user is from outside of this forum
                                  kaoudisK This user is from outside of this forum
                                  kaoudis
                                  wrote last edited by
                                  #18

                                  @regehr all I will say to that is eyup

                                  John RegehrR 1 Reply Last reply
                                  0
                                  • John RegehrR This user is from outside of this forum
                                    John RegehrR This user is from outside of this forum
                                    John Regehr
                                    wrote last edited by
                                    #19

                                    @rygorous @pervognsen aw, look at all the little nans and infs flying and being free!!!

                                    Per VognsenP 1 Reply Last reply
                                    0
                                    • kaoudisK kaoudis

                                      @regehr all I will say to that is eyup

                                      John RegehrR This user is from outside of this forum
                                      John RegehrR This user is from outside of this forum
                                      John Regehr
                                      wrote last edited by
                                      #20

                                      @kaoudis I've not been paying too much attention to the LLVM effort-- anything interesting going on there? or should I just dig into the discourse?

                                      kaoudisK 1 Reply Last reply
                                      0
                                      • John RegehrR John Regehr

                                        @rygorous @pervognsen aw, look at all the little nans and infs flying and being free!!!

                                        Per VognsenP This user is from outside of this forum
                                        Per VognsenP This user is from outside of this forum
                                        Per Vognsen
                                        wrote last edited by
                                        #21

                                        @regehr @rygorous My first thought was, if this is meant for the far future, assuming they retain our current warning symbol for radiation seems a bit hopeful.

                                        1 Reply Last reply
                                        0
                                        • John RegehrR John Regehr

                                          @kaoudis I've not been paying too much attention to the LLVM effort-- anything interesting going on there? or should I just dig into the discourse?

                                          kaoudisK This user is from outside of this forum
                                          kaoudisK This user is from outside of this forum
                                          kaoudis
                                          wrote last edited by
                                          #22

                                          @regehr I think* @wizardengineer landed the first bits of that work!

                                          *I left trail of bits voluntarily (and for reasons unrelated) a bit before this happened though

                                          John RegehrR 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          Powered by NodeBB Contributors
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups