Minor cleanup #335
No reviewers
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!335
Loading…
Reference in a new issue
No description provided.
Delete branch "minor_cleanup"
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?
Minor cleanup&lil'feature PR
The only thing really worth a review is the newly introduced
copy_or_zeromem()The rest is just cosmetics.
Reviews are as always very welcome!
Ad
copy_or_zeromemcopy_or_zeromemis handy in CCM then it should be perhaps also used in other encauth casesI factored this out as I use it in my SIV PR as well, but I thought it doesn't really belong there, so I created this PR with other changes that belong to the features introduced there
I'll make it private for now
I think the name is okay'ish... probably one of the following would be better, not sure though:
mem_copy_or_zeromemcpy_or_zerocopy_or_zerocopy_or_cleanIf you make it private then no need to care about the name.
well I prefer to have a proper name now so we don't have to think about it in case we want to make it public ;)
Edit: I think the current name is fine and represents what the function does. Therefore we could even make it public.
IIUC we are doing: "copy src to dest or zero dest (all that in constant time)" which sounds to me more like
copy_or_zero_destbut I can live withcopy_or_zeromemas well - I leave it up to you.Another thing (UPDATED):
so that unexpected/accidental
coz = 2means zeromem (accidentally zeroing is better that copying)👍