2012/4/23 Salisbury, Mark <[email protected]>: > I think I didn't explain my concern very well - let me try again with fewer > words :) > > If you are asked to send 100 bytes, which is translated into 125 encrypted > bytes, but only 30 bytes (encrypted) are actually sent, how do you know how > many unencrypted bytes were sent? (how do you know what to return to the > caller for bytes written?) I don’t think the caller cares how many encrypted > bytes were sent. > > If you tell the caller 30 bytes were sent, it will call you back at an offset > 30 bytes into its buffer.
I would tell the caller that 1 byte (>0 to make sure that he does not think it is an error) was send and handle the offset myself. Take a look at my implementation which uses two internal buffers, including offset counters. For decryption I know exactly how many decrypted bytes I returned to the caller and how many bytes were already decrypted from the incoming data stream. The same principle can be applied to the outgoing data stream, but with only one buffer which stores the encrypted data that needs to be sent. Best regards, Marc ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
