c2rust
c2rust copied to clipboard
analyze: tracking issue for lighttpd algo_md5
We'd like to be able to fully refactor lighttpd's algo_md5 module into safe Rust. This tracking issue covers analysis features that will be required to support that:
- [x] Casts from
Singleto non-SingleQuantity. This may be a bug, possibly with our handling ofarray.as_mut_ptr(); if the cast's output hasPermissionSet::OFFSET(causing it to have non-SingleQuantity), then the input should have that permission as well.- [ ] Investigate to determine why the analysis wants to insert this cast
- [ ]
void*arguments for local functions. Specifically,MD5_Updatetakes a pointer to bytes as the argumentvoid* _input.- [ ] Track concrete pointee types through
void*andchar*casts - [ ] Rewrite argument types from
*mut c_voidto a more specific safe type
- [ ] Track concrete pointee types through
- [ ] Rewrite
memcpyintocopy_from_slice. - [ ] Rewrite
memset(&s, 0, sizeof(s))into zero-initialization of each field ofs. - [x] Fix
unsupported cast kind: TypeDesc- [ ] Investigate further - which
TypeDescs is it failing on?
- [ ] Investigate further - which
- [x] Fix
unlower_map has no origin- possibly fixed by #1020 - [x] Figure out why the
contextpointer is gettingOFFSETpermission in several functions - [ ] Fix bad cast in
MD5_Update's call toli_MD5Transform:
The final// old: ((*context).buffer).as_mut_ptr() as *const libc::c_uchar // new: &*(&mut (((*context).buffer)) as &mut [u8]) as *const libc::c_uchar... as *const libc::c_ucharshould be removed.
Just merged #1022 which lets algo_md5 pass without modifications.