Skip to content

Commit

Permalink
c++ compilation errors fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mom040267 committed Sep 24, 2018
1 parent 943d243 commit 766d094
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/apps/relay/dbdrivers/dbd_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static void MyconninfoFree(Myconninfo *co) {
ns_bzero(co,sizeof(Myconninfo));
}
}
struct ctr_state state;

char* decryptPassword(char* in, const unsigned char* mykey){

char *out;
Expand All @@ -85,6 +85,7 @@ char* decryptPassword(char* in, const unsigned char* mykey){
int bytes_to_decode = strlen(in);
unsigned char *encryptedText = base64decode(in, bytes_to_decode); //changed
char last[1024]="";
struct ctr_state state;
init_ctr(&state, iv);
memset(outdata,'\0', sizeof(outdata));

Expand All @@ -95,7 +96,7 @@ char* decryptPassword(char* in, const unsigned char* mykey){
#endif

strcat(last,(char*)outdata);
out=malloc(sizeof(char)*strlen(last));
out=(char*)malloc(sizeof(char)*strlen(last));
strcpy(out,last);
return out;
}
Expand Down
7 changes: 4 additions & 3 deletions src/apps/relay/mainrelay.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,15 +943,14 @@ static const struct myoption admin_long_options[] = {
{ NULL, no_argument, NULL, 0 }
};


struct ctr_state state;
int init_ctr(struct ctr_state *state, const unsigned char iv[8]){
state->num = 0;
memset(state->ecount, 0, 16);
memset(state->ivec + 8, 0, 8);
memcpy(state->ivec, iv, 8);
return 1;
}

unsigned char *base64encode (const void *b64_encode_this, int encode_this_many_bytes){
BIO *b64_bio, *mem_bio; //Declares two OpenSSL BIOs: a base64 filter and a memory BIO.
BUF_MEM *mem_bio_mem_ptr; //Pointer to a "memory BIO" structure holding our base64 data.
Expand All @@ -978,6 +977,7 @@ void encrypt_aes_128(unsigned char* in, const unsigned char* mykey){
AES_set_encrypt_key(mykey, 128, &key);
char total[256];
int size=0;
struct ctr_state state;
init_ctr(&state, iv);

#if OPENSSL_VERSION_NUMBER >= 0x10100000L
Expand Down Expand Up @@ -1031,7 +1031,7 @@ void generate_aes_128_key(char* filePath, unsigned char* returnedKey){

unsigned char *base64decode (const void *b64_decode_this, int decode_this_many_bytes){
BIO *b64_bio, *mem_bio; //Declares two OpenSSL BIOs: a base64 filter and a memory BIO.
unsigned char *base64_decoded = calloc( (decode_this_many_bytes*3)/4+1, sizeof(char) ); //+1 = null.
unsigned char *base64_decoded = (unsigned char*)calloc( (decode_this_many_bytes*3)/4+1, sizeof(char) ); //+1 = null.
b64_bio = BIO_new(BIO_f_base64()); //Initialize our base64 filter BIO.
mem_bio = BIO_new(BIO_s_mem()); //Initialize our memory source BIO.
BIO_write(mem_bio, b64_decode_this, decode_this_many_bytes); //Base64 data saved in source.
Expand Down Expand Up @@ -1066,6 +1066,7 @@ void decrypt_aes_128(char* in, const unsigned char* mykey){
int bytes_to_decode = strlen(in);
unsigned char *encryptedText = base64decode(in, bytes_to_decode);
char last[1024]="";
struct ctr_state state;
init_ctr(&state, iv);
memset(outdata,'\0', sizeof(outdata));

Expand Down

0 comments on commit 766d094

Please sign in to comment.