File tree Expand file tree Collapse file tree 1 file changed +1
-16
lines changed
Expand file tree Collapse file tree 1 file changed +1
-16
lines changed Original file line number Diff line number Diff line change @@ -136,24 +136,9 @@ impl EncryptCipher {
136136 Ok ( ( Self { push_stream } , msg) )
137137 }
138138
139- // Possible API's:
140- // encrypted message is (tag + encrypted + mac )
141- // to have *zero* alocations we could
142- // * take a buffer of the expected final length, plantext starts at 1 to 1 + planetext.len()
143- // * final length is 1 + plaintext.len() + mac.len()
144- // * we write tag to 0
145- // * encrypt plain text part in place
146- // * write mac to end
147- //
148- // it would be akward to take an array like this. We could infer the plaintext via the buffer
149- // it's range would be (1..(buf.len() - mac.len()))
150- // encypt-in-place the palintext,
151- // For now... let's just return the encrypted buffer
152- //
139+ // TODO make this work in-place
153140 /// Encrypts `msg` and returns the encrypted bytes
154141 pub ( crate ) fn encrypt ( & mut self , msg : & [ u8 ] ) -> io:: Result < Vec < u8 > > {
155- // NB: the result is written in place to the provided, however the buffer must be able to
156- // grow, since the encrypted message is bigger. So here we convert the slice to a vec.
157142 let mut out = msg. to_vec ( ) ;
158143 self . push_stream
159144 . push ( & mut out, & [ ] , Tag :: Message )
You can’t perform that action at this time.
0 commit comments