HN Simulatornew | past | comments | lists | submit | wahern's commentslogin

Yes, they collaborate. BoringSSL and libressl especially, which IIRC share some of the same developers. But OpenSSL has it's own priorities and vision, which sometimes (often?) clashes with the sensibilities of the BoringSSL and libressl developers. Because OpenSSL is still the de facto standard bearer and developer target, it can get frustrating for the libressl and BoringSSL developers, especially when they zig and OpenSSL decides to zag.

Not everybody recommends size_t. There's a sizeable community of people absolutely convinced most integers, including length and capacity integers, should be signed. And they stick to their guns even for C and C++. They have some very compelling logical arguments on their side, but IMO in languages like C and C++ they're just fatally unrealistic.

This is anachronistic imo. There is no point of using signed or larger than needed integers when programming in a modern way.

You have fuzzing, test coverage checks, overflow checks, static analysis, llm review. There is no conceivable reason why you might have a problem with using an u16 for a buffer length.

Even reading the PR comments shows that these libraries are just really low quality.

They are discussing if they should check the error return on callsites now that they made a function fallible.

Even a library like openssl using raw arithmetic operators all over the place is just weird imo. Every arithmetic operation should be checked version of the operation unless there is a provable performance hit. Languages should just not have operators


Why unrealistic? I was in the unsigned camp a long time ago and switched to signed types for indexing and sizes, and this made many problems go a way.

There was just a nginx issue that highlights how problematic the use of unsigned is in this context: CVE -2026-123007


From a brief look, I'd say there were several wrong turns made that led to the CVE-2026-123007 overflow bug.

For why I think it's unrealistic to go all-in on signed integers in C, it's because sizeof is unsigned, and most APIs dealing with lengths use size_t, and there are many pitfalls when mixing signed and unsigned types.

But I agree that there's a good case for using signed for the task behind that CVE. As I said, there are compelling reasons.

OpenSSL is a case study in the pitfalls with mixing signed and unsigned in C code. A major reason is the careful dance it has to do mixing signed and unsigned, and it stumbles. There's no substitute for being careful with arithmetic, and at least for me, when I expend that effort I also tend to use overflow checking APIs, clamping, etc, because it's less prone to error. Do that and the benefits of signed start to disappear, or at least the debate starts to lose relevance. Why OpenSSL doesn't create and use a set of overflow checking routines is beyond me as it would simplify an incredible amount of very hairy and brittle code.


The way to deal with APIs which use size_t and which works for me is to convert at the last moment.

I'll have to more carefully read some of your code sometime. Any links to good exemplars? I'll admit I should be more amenable to making use of signed, and I wouldn't have said that several years ago.

At the same time, the more I employ overflow checking routines[1], the less interest I have in the whole debate. Those routines cut both ways as they also make it safer to mix signed and unsigned.

[1] GCC/clang builtins, which IIUC the new C2y API mirrors. The return value semantic is unfortunate, especially in C2y where they lack the "overflow" name prefix, but it's understandable why C2y had to copy it.


Why would anyone prefer signed for indexing and sizes?

With unsigned you only need one check: 'i < bound', it works always, regardless how i is computed, and it doesn't matter if the calculation overflowed or wrapped around, still works.

With signed you need: 'i >= 0 && i < bound', and you need to be very careful how you calculate i because overflow is undefined behavior.


The issue with accidental overflow leading to wrap-around is also relevant to the value of `bound`.

If `bound` is unsigned and experiences accidental wrap-around due to underflow, the simple `i < bound` check fails open: most values of i pass against the unintentionally-huge `bound`. The signed version fails closed (no i passes both i >= 0 and i < bound), which is usually safer.

That’s how the argument goes, anyway. You’re right that using signed means a missing `>= 0` check can be a problem, as well as all the risks of signed-overflow UB.

No perfect solution in C.


The N >= 0 check you often get automatically using sanitizers, e.g. when using an array [N] somewhere, or by concerting to size_t at last moment and then getting a size which is so big that allocation is guaranteed to fail.

Not that are wraparound CVEs in Rust as well, so there is no perfect solution even outside of C.


True. For example, it's trivial to underflow a size_t into (size_t)-1 and now you have a problem, they'll say. They're not entirely wrong. In fact, they're right: if you want to protect against these bugs then we need either to a) explicitly check for overflows all the time, or b) have integral types that trap / throw / raise a signal / panic when you exceed / would exceed minima/maxima.

ssize_t

To be fair, frustrations with OpenSSL long preceded Heartbleed. Heartbleed was just the final straw for those who forked libressl and BoringSSL.

And to be fair to OpenSSL, it was one of the first widely used crypto libraries, along with Netscape's NSS. Setting aside the reasonablebess of the initial choices, the rapid uptake meant those choices were difficult if not impossible to completely unwind, particularly the style and typing of parameters and error reporting. Even today debates rage about signed vs unsigned, etc, in C and other languages. (But suffice it to say there are still alot of unforced errors, IMO, such as implicit output buffer sizes.)


> The Port of San Francisco used to be a major port. But, when containers came along, a new container port was built in Oakland. One that didn't have an entrenched longshoreman's union.

Unlike the east coast longshoremen's unions, the west coast unions saw the writing on the wall. The Port of San Francisco containerized (the first one to start, IIRC), but couldn't handle the volume, thus the shift to Oakland. Other west coast ports managed to expand and prosper. By contrast, the Port of New York and other east coast port unions strongly resisted, and ended up with nothing as new containerized ports came online.

I don't remember if I read it in The Box or Philip Dray's There is Power in a Union, but notwithstanding the early radicalism of the longshoremen's union in SF and other lore, west coast unions, at least mid century, were much more cooperative with industry than on the east coast and their members faired technology transitions fairly well. It had alot to do with smart leadership during that period, but perhaps also just the growth of the economy on the west coast.


It's a system that's changing, though, becoming closer to the US. Frances' village shops culture has been in terminal decline for many years, losing business to big box stores: https://www.nytimes.com/2017/02/28/world/europe/france-albi-...

It's happening fast, but maybe not so fast that people realize their lived environment is evolving into something much closer to what the US has.


> I just cannot imagine the error correction on those packets. I mean if anything goes wrong that's a lot to toss away.

I think the original jumbogram work occurred back when alot of people were still convinced end-to-end IP alone wasn't suitable for many uses. This was the era when, e.g., people were still pitching ATM or exploring bespoke solutions for linking research centers. So basically jumbograms were presumed to be delivered atop another long-haul, multi-link protocol that would provide reliability. Jumbograms were a way to improve the throughput and latency between IP peers with minimal but high-impact changes to application and kernel network stacks (presuming IPv6 adoption), placing most of the complexity in the network transit layers. What we ended up with, ironically, was the reverse, everything IP and below largely ossified from software perspective, some minor evolution at the TCP layer, but most progress happening above TCP/UDP, and alot of work invested in local hardware link layers that remains opaque to IP or even the ethernet software stack, effectively placing a ceiling on dividends.


> Why the government can’t/won’t verify their own IDs they hand-out boggles the mind.

Slow your horses. To answer your question, I for one refuse to get a Real ID drivers license. (I do have a passport, but that's beside the point.)


What does one have to do with the other? They make the damn things but then pawn off verification to sleazy corporations. A standard ID has the same problem as a Real ID in this case.

I didn't mean to excuse ID.me. Just that the question seemed to presume a national ID card, or that it should be trivial for the federal government to verify a state ID[1]. IOW, it presumed something like REAL ID.

[1] At least without a sophisticated system in place with the states that allows verification without just handing over all the data.


I'm curious, what is your main reason for skipping REAL ID?

Principle. I'm not in favor of a ubiquitous national ID that everybody will by necessity need to carry around.

Can you elaborate? First, nobody is required to carry around a driver's license; it's only needed for when you drive. And in the cases where you need to show a government ID, a driver's license (assuming it's a REAL ID) is just as good as a passport. So I don't really understand your position.

ICE has proven people's fears about the Federal government compiling databases and using facial recognition systems with handheld readers and massive surveillance networks so they can sic jack-booted thugs on people. It doesn't matter they were "targeting" illegals, every aspect of the fear was proven out in horrible fidelity, and nobody was able to pump the breaks before scores of people were murdered in cold blood. REAL ID isn't strictly necessary for that to happen, but it certainly helps[1], and it moves us in the wrong direction. There's a similar threat from states, but that's a separate problem and doesn't justify letting the Federal government have its way.

Also, they will make it increasingly difficult to move around without a REAL ID. This year I took a flight and forgot my passport. SFO was okay with me boarding without a REAL ID. But SAN (San Diego) TSA wouldn't let me through security without REAL ID or purchasing a $50 wavier, which I couldn't do because I couldn't access an e-mail account from my phone and I didn't have access to my laptop, so I had to rent a car to drive back, forfeiting my return ticket. But renting a car without a REAL ID is almost certainly on someone's list of things to fix.

[1] That's why they wanted it in the first place, to make it easier for them to hunt down terrorists and make it harder for people to slip under the radar of pervasive surveillance.


Agreed and also it's obvious overreach. State governments already collect and retain more information than necessary for drivers licenses. Why would we want to make things worse?

For international travel I have a passport, for driving my vehicle and purchasing booze I have a not-REAL-ID drivers license. Other than that only the bank gets to see my ID.


> Now the messaging channel is encrypted. At this point you have the same confidence in security as you do when looking at https web sites.

It's not end-to-end encrypted, nor authenticated for that matter. There's no substitute for DNSSEC, though like a VPN, DoH makes it easier to evade local or regional interventions. (And because I know DNSSEC triggers some peope, I'll point out myself that WebPKI is a proper end-to-end solution that prevents using DNS to MiTM... mostly. Without DNSSEC acme verification techniques are less than ideal.)

Does anyone know how the automatic (non-system) built-in DoH in browsers selects a resolver? I assume they don't globally utilize the same DNS resolvers, as that would break GeoDNS and cause performance issues; at least if those resolvers aren't doing the backend resolution in a way that preserves locality.


You're describing Go. Only difference was Go settled on GC, to avoid alot of semantic complexity with memory management across threads.

Go would be nice if they didn't ditch stuff that was already present in Pascal (proper enums, sets, variant records/unions).

Spot on, that ridiculous iota/const boilerplate "best practices" pattern.

This is a great tutorial on imaginary numbers illustrating how complex numbers : integers :: integers : natural numbers (apologies for not figuring out how to use reals instead integers in that simile).

https://acko.net/blog/how-to-fold-a-julia-fractal/

Note the meat of the tutorial is contained in the frames that you navigate with the arrows on some of the illustrations. It doesn't display well on mobile.


Guidelines | FAQ | Lists | API | Security | DMCA | Apply to YC | Contact

Search: