News for hackers. Stuff that matters.
Re:Notes by djb on using Fil-C (2025) by Ar-Curunir on Monday November 03, 2025 @08:32AM (#45798770)
Abstractions are the only way to make sense of cryptography. Pretending otherwise leads to cross layer bugs and vulnerabilities. Of course bad abstractions are bad, but that doesn’t mean no abstraction is good.

Feel free to post your challenge snippet.

Re:Notes by djb on using Fil-C (2025) by johnisgood on Monday November 03, 2025 @10:08AM (#45799868)

  pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
    fn inner(path: &Path) -> io::Result<Vec<u8>> {
      let mut file = File::open(path)?;
      let mut bytes = Vec::new();
      file.read_to_end(&mut bytes)?;
      Ok(bytes)
    }
    inner(path.as_ref())
  }
"aBsTraCtiOnS aRe gOod"... Right.

Reference implementations must NOT have abstractions like this. Rust encourages it. Lots of Rust codebase is filled with them. Your feelings for Rust is irrelevant. C is simple and easy to understand, therefore reference implementations must be in C. Period.

...or Common Lisp, or OCaml... why not?!

Re:Notes by djb on using Fil-C (2025) by Ar-Curunir on Monday November 03, 2025 @08:46PM (#45806655)
(a) that is a fairly easy to understand piece of code. Are you complaining about the definition of the inner function?

(b) the equivalent C code would look pretty similar.

(c) this is not cryptographic code

Re:Notes by djb on using Fil-C (2025) by johnisgood on Tuesday November 04, 2025 @03:10AM (#45808582)
(a) I'm complaining about the messed up syntax and symbol soup.

https://github.com/ioccc-src/winner/blob/master/2024/burton/...

This code is fairly easy to understand, too, then.

(b) No, it would definitely not look "pretty similar".

(c) So what? You talked about abstractions in cryptographic code. Abstractions are layers to hide things. That is bad in crypto code.

Re:Notes by djb on using Fil-C (2025) by Ar-Curunir on Tuesday November 04, 2025 @06:43PM (#45817226)
Hiding things is totally great in crypto code! When I’m implementing signature verification, I shouldn’t have to worry how the underlying, eg, field or elliptic curve algebra is implemented!

In fact there have been many crypto bugs which insufficiently abstract this kind of stuff away.