]> WPIA git - cassiopeia.git/blobdiff - src/slipBio.cpp
chg: Tamper with the signature more efficiently
[cassiopeia.git] / src / slipBio.cpp
index 725e837a228122da085b14a3f4f88e581d7f34e3..da1253a6b1aa04695f8a297f6f447a337ff63077 100644 (file)
@@ -1,8 +1,10 @@
 #include "slipBio.h"
 
+#include <unistd.h>
+
 #include <iostream>
 
-#include <unistd.h>
+#define BUFFER_SIZE 8192
 
 char hexDigit( char c ) {
     if( c < 0 ) {
@@ -33,10 +35,11 @@ std::string toHex( const char* buf, int len ) {
 }
 
 SlipBIO::SlipBIO() {
-    this->buffer = std::vector<char>( 4096 );
+    this->buffer = std::vector<char>( BUFFER_SIZE );
     this->decodeTarget = 0;
     this->decodePos = 0;
     this->rawPos = 0;
+    this->failed = false;
 }
 
 void SlipBIO::setTarget( std::shared_ptr<OpensslBIO> target ) {
@@ -45,7 +48,8 @@ void SlipBIO::setTarget( std::shared_ptr<OpensslBIO> target ) {
 
 SlipBIO::SlipBIO( std::shared_ptr<OpensslBIO> target ) {
     this->target = target;
-    this->buffer = std::vector<char>( 4096 );
+
+    this->buffer = std::vector<char>( BUFFER_SIZE );
     this->decodeTarget = 0;
     this->decodePos = 0;
     this->rawPos = 0;
@@ -56,6 +60,7 @@ SlipBIO::SlipBIO( std::shared_ptr<OpensslBIO> target ) {
 SlipBIO::~SlipBIO() {}
 
 int SlipBIO::write( const char* buf, int num ) {
+    std::cout << "Out: " << toHex( buf, num ) << std::endl;
     int badOnes = 0;
 
     for( int i = 0; i < num; i++ ) {