12 ms·
I once had the pleasure of using the Microsoft C API for creating an HMAC: https://docs.microsoft.com/en-us/windows/win32/seccrypto/example-c-program--creating
by koyote 4y ago
I once had the pleasure of using the Microsoft C API for creating an HMAC:
https://docs.microsoft.com/en-us/windows/win32/seccrypto/example-c-program--creating-an-hmac https://docs.microsoft.com/en-us/windows/win32/seccrypto/exa...
They managed to mix both patterns into a ghastly 9 function call!
The example above speaks for itself but I kind of see the "we provide you with memory you need to call 'FreeX' on" and the "call the function twice, once to find out how much memory you need to allocate" patterns to be equally annoying to use.
- gnubison 4y agoIt’s nice if you would prefer to use a custom allocator, or put small buffers on the stack. But yeah, it is more annoying to use.
- tinus_hn 4y agoYou can’t just dump ‘small’ buffers on the stack in security sensitive code; you never know how big ‘small’ can get and you have to define what happens if it’s too big anyway.