Bad API design for aes-gcm

โš“ rust    ๐Ÿ“… 2025-07-04    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 3      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Bad API design for aes-gcm

Hi everyone.

Has anyone here worked with aes-gcm? As far as I understand, when using encrypt_in_place / decrypt_in_place, Iโ€™m required to implement the Buffer trait only because the library canโ€™t tell in advance whether thereโ€™s enough space for the authentication tag during encryption.

Isnโ€™t that just bad design? It forces me to inject a buffer pool into the object implementing Buffer, just to avoid unnecessary allocations - instead of simply allowing me to pass a &mut [u8] with enough capacity upfront.

1 post - 1 participant

Read full topic

๐Ÿท๏ธ rust_feed