c++ compilation errors fixed

This commit is contained in:
Oleg Moskalenko 2018-09-23 21:44:34 -07:00
parent 943d2435df
commit 766d094a0e
2 changed files with 7 additions and 5 deletions

View File

@ -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;
@ -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));
@ -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;
}

View File

@ -943,8 +943,6 @@ 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);
@ -952,6 +950,7 @@ int init_ctr(struct ctr_state *state, const unsigned char iv[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.
@ -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
@ -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.
@ -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));