r/asm • • 3d ago

x86-64/x64 A 14 KB HTTPS server OS in x86-64 assembly: boot sector, virtio-net, TCP, TLS 1.3 and HTTP

I wanted to see how good Claude is at sizecoding, so this code is Claude's, not mine. After 5 days there was a static web server that is its own operating system, in 13,859 bytes of NASM:

  • boot sector, long mode, up to 4 processors
  • virtio-net driver, ARP, TCP
  • TLS 1.3 with X25519, ECDSA P-256 and AES-128-GCM (AES-NI, PCLMULQDQ, BMI2, ADX)
  • HTTP GET and HEAD, with the site packed behind the code in the same image

On a 2-vCPU cloud server it does two to three times nginx's new TLS connections and small pages per second. It is clunky on purpose: to renew the certificate you build a new image.

Source: https://github.com/FileSherlock/k15 (start at `src/os.asm`)

It runs at https://15kb.org with a $200 bounty: the server's TLS key is also the private key of the Bitcoin address on the page, until 18 February 2027. No denial of service, please.

Tell me where the assembly is bad.

0 Upvotes

21 comments sorted by

13

u/415646464e4155434f4c 3d ago

Great. Now debug it.

-10

u/JaguarMoe 3d ago

That's what the bounty is for. It passes 59 regression runs, Wycheproof and tlsfuzzer, and there's $200 for whoever finds what those missed.

9

u/AWildTyphlosion 3d ago

Didn't you see my comment? I linked where it is

1

u/JaguarMoe 2d ago

I take the bait for a short discussion. Yes did see you comment.

1

u/AWildTyphlosion 2d ago

There's your answer then. Even if the assembly was perfect, the project is atrocious and unmaintainable. Assembly being used for an entire application isn't a difficult feat, and is pretty moot. 

It also, in my opinion, violates the spirit of this entire subreddit. Nothing impressive has been performed, and the repo is an entire waste of time. It demonstrates nothing of value. 

0

u/JaguarMoe 2d ago

I might make a post asking for updated r/asm rules outlawing pure ai code.

10

u/AWildTyphlosion 3d ago • Heartwarming

Tell me where the assembly is bad.

Here

3

u/ByronScottJones 2d ago

All that's pulling up is a list of contributors.

10

u/Supra-A90 2d ago

That's the joke bro. Claudia wrote it.

0

u/vogelvogelvogelvogel 2d ago

should he write like 14k of modern assembler by hand? back in my days this would have been a long hobby project and then it was the only thing you would do for like months in the attic

2

u/FinancialTrade8197 1d ago

Yes.

Why shouldn't he? The entire point of this project is to do something for fun and flex. If he actually wanted something usable, then he wouldn't have wrote an HTTP server in bare-metal assembly, as that is entirely pointless. The project is just for fun, and having Claude write it ruins the fun. At most it's just flexing the AI model's skills.

If you want something actually usable, get an operating system and have the AI make you a HTTP server in some higher level language that is infinitely easier to maintain and is faster (due to compilers being great at optimization)

0

u/kneelian_ 2d ago edited 2d ago

should he write like 14k of modern assembler by hand?

If you're already producing raw assembly, then yes? Why else do it and post it here? Otherwise it becomes a slop churn demo, and those are a dime a dozen

the only thing you would do for like months in the attic

For a 5KLOC project? You can probably get one done in a month or less, though probably missing some testing

1

u/vogelvogelvogelvogel 2d ago

very intersting project, thanks for sharing!

2

u/JaguarMoe 2d ago

Thanks for the only positive comment here.

2

u/vogelvogelvogelvogel 2d ago

i mean i did only write assembler on ancient machines so out of curiousity i joined this sub and i get it, assembler has gotten rare. but i am amazed how ai is able to do that today (still, or even)

1

u/JaguarMoe 2d ago

Yea projects like this would have been impossible alone without the knowledge and tools we have right now. It can be debated if AI code and writing is a good thing for humanity but its getting used more and more.

1

u/Key_Detail15 2d ago

Well, compilers can write assembly pretty well too!

(What's not clear to me is why AI is generating ASM and not some HLL; what is the advantage?)

2

u/kneelian_ 2d ago

Thanks, Claude, very cool

0

u/kndb 2d ago

But why!???

3

u/JaguarMoe 2d ago

Performance/fun