-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-1 is not a valid member of type size_t
#3
Comments
I get your point, but I do want to point out you can never in a valid scenario get portable8439/src/portable8439.c Line 106 in 4d11ef4
Regarding the design, I think I based it on existing cryptography libraries. I think I prefer not to use extra out parameters. Maybe the result should be boolean. and the user has to subtract the tag size from the actual size themselves (which they already need to do to allocate enough buffer for the decryption output. |
Perhaps I'm misunderstanding, but shouldn't it be possible to have a message of size |
Ah, true, I only thought about decryption. With encryption -1 is truly an edge case. Only if you pass in overlapping pointers (not respecting the Maybe the size thing should be two macros/functions you can use. And the function can return true/false. |
I know it's a breaking API change, but I think if we should have learned anything from |
Sure, I'm just pointing out it's an edge case, but I'm open to changing it. Maybe instead of a boolean it should return an error code. to leave room for details (like reason for failure) and 2 defines to help the user calculate the size of the output buffer. |
That sounds like a really good idea to me. Plus, enumerated error codes make APIs much clearer in my opinion. |
The
encrypt
function exposed returns typesize_t
, but the documentation specifies that it might return-1
if the operations failed. This will just result in returningSIZE_MAX
which means a successful operation returning the maximum size is indistinguishable from failure.Is there a reason you wanted to avoid an extra out-param for the resulting cipher-text size, freeing the return value to be something like
PORTABLE8439_{OK, ERROR}
instead?The text was updated successfully, but these errors were encountered: