Polish API char* vs. unsigned char* #361
Labels
No labels
bug
duplicate
enhancement
feature
help wanted
improve API
invalid
needs documentation
not-planned
rtfm
stale
support
wishlist
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libtom/libtomcrypt#361
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
e.g. the Base64 API uses
unsigned char*wherechar*should have been used.Check all API's that work with "strings" and correct this.
The only issue I see with
char*case is the fact that some people may assume thatchar*means passing/returning a string withNULbyte at the end, which is not our current behaviour.For example libsodium adds
NULbyte when encoding B64/HEX - https://download.libsodium.org/doc/helpers/well that's only true for our decoders, the encoders already
NUL-terminate the output...You are right
base64_encodeandbase64url_encodedo append NUL byte; however,base32_encodedoes not (it should at least for consistency).Decoders are IMO not a problem.
yeah, it should! you can add it to #353 if you want to :)
nope, but I'd say either we change the existing API or we add
base64_decode_str()etc. (which I'd prefer as the existing API has also its valid use-cases)I think #353 seems like ready to merge, I'd fix it in a separate PR. I also plan to suggest a small change to
base64_decodewhere the relaxed mode seems to be more relaxed than it should be.oh kay... now I'm curious :)
@sjaeckel do you see any troubles with switching to use 'char*' in base64_* ?
not really
FYI: there are two related PR #366 and #367
I would like to propose changing:
to:
It will be consistent with base64_encode and base32_encode and IMO it is also a bit more developer-friendly as you do not need to safe-check
inbuffer before callingbase16_decode.