// Called with cleartext data we want to encrypt and send back... extern "C" DLL_PUBLIC int32_t iocba_cleartext_push( buffers_t* buffers, char* in_clr, uint32_t clr_length, char* out_enc_to_send, uint32_t *enc_to_send_length ) { Botan::TLS::Channel* channel = buffers -> channel; // buffers -> enc_cursor = out_enc_to_send; buffers -> enc_end = out_enc_to_send + *enc_to_send_length; try { // TRACE("Before send channel=%p \n", channel); channel->send( (const unsigned char*) in_clr, clr_length); } catch (buffer_override_exception_t const& ) { TRACE("Buffer override trying to encrypt cleartext\n"); } catch (std::exception const& e) { using namespace std; cout << "BotanTLS engine raised exception on send: " << e.what() << endl; // Clear the buffers, they shall not be used again buffers -> clear_cursors(); return -1; } *enc_to_send_length = (uint32_t) ( buffers -> enc_cursor - out_enc_to_send ); buffers -> clear_cursors(); return 0; }
extern "C" void iocba_cleartext_push( void* tls_channel, char* data, int length ) { // TODO: Check for "can send"!!!!! // OTHERWISE THIS WON'T WORK try { Botan::TLS::Channel* channel = (Botan::TLS::Channel*) tls_channel; // printf("Before send channel=%p \n", channel); channel->send( (const unsigned char*) data, length); // printf("After send channel=%p \n", channel); } catch (...) { printf("BotanTLS engine raised exception on send\n"); } }