Click here to Skip to main content
15,896,372 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: RE: how to run C++ code on linux Pin
savitha87k19-May-09 17:02
savitha87k19-May-09 17:02 
GeneralRe: RE: how to run C++ code on linux Pin
Sebastian Schneider22-May-09 1:15
Sebastian Schneider22-May-09 1:15 
GeneralRe: RE: how to run C++ code on linux Pin
N a v a n e e t h1-Jun-09 0:56
N a v a n e e t h1-Jun-09 0:56 
GeneralRe: RE: how to run C++ code on linux Pin
cludwig14620-Jun-09 6:07
cludwig14620-Jun-09 6:07 
QuestionCombining Command Lines Pin
See_Sharp15-May-09 20:17
See_Sharp15-May-09 20:17 
Answerone way to do it Pin
Jimmanuel16-May-09 0:55
Jimmanuel16-May-09 0:55 
Questioncommands not working if the executed from forked process Pin
shekharban11-May-09 21:23
shekharban11-May-09 21:23 
Questionsegmentation error while using mpz_powm in a loop Pin
shrims4u8-May-09 3:53
shrims4u8-May-09 3:53 
i am writing a milter which decrypts the email message.
For decryption i am using GMP library...

The code which gives the error is as follows:


mpz_t bigbody,encbody,decbody,n,d,e;



mpz_init_set_str (e, "5", 10);

mpz_init_set_str (n, "81072118814004638617775947138239917744589505176471539666269773100315781097546894455560658571445286325125766632676152452856383447352821337178984474781813475276075048299705214136395672502245955793627681061360075723595075874516950614187016991430293887968216015097675955399134514678660046996064181098182893072761", 10);

mpz_init_set_str (d, "32428847525601855447110378855295967097835802070588615866507909240126312439018757782224263428578114530050306653070460981142553378941128534871593789912725382636961637010791821646038659077539848411532121133465246631106852802485583932352673149866783600963924490576147444236696494852521901563664557493382382127469", 10);



char *STR;
STR=(char*)malloc(1000);




mpz_t array[10];
//mpz_array_init (array, 10, 308);
mpz_t array1[10];
//mpz_array_init (array1, 10, 100000);

char substring[400];
int i=0,lower=0,upper=308;

while(i
{

strncpy(substring, data_buffer + lower, upper);
*(substring+308)='\0';
syslog( LOG_INFO, "conn# %d - substring = %s", cd->connection_num, substring );

lower=upper;
upper=upper+308;

mpz_init_set_str(array[i],substring,10);

mpz_get_str (STR, 10, array[i]);
strcat(STR,"\0");
syslog( LOG_INFO, "conn# %d - Encrypted-Biginteger = %s", cd->connection_num, STR );


mpz_init(array1[i]);
mpz_powm (array1[i], array[i], d, n);

mpz_get_str (STR, 10, array1[i]);
syslog( LOG_INFO, "conn# %d - Decrypted-Biginteger = %s", cd->connection_num, STR );

size_t length;
void *ret;
char *decrypted;
decrypted=(char*)malloc(1000);

ret=mpz_export (decrypted, &length, 1,sizeof(data_buffer[0]), 0, 0, array1[i]);
//ret=mpz_export (decrypted, &length, 1,sizeof(data_buffer[0]), 0, 0, array1[i]);

strncpy(decrypted,ret,length);
*(decrypted+length)='\0';


syslog( LOG_INFO, "conn# %d - size decrypted = %d Decrypted = %s", cd->connection_num,length, (char *)ret );
fflush(stdout);


free(decrypted);
fflush(stdin);
mpz_clear(array[i]);
mpz_clear(array1[i]);
i++;

}

This code executes for 2 iterations and then give segmentation fault at mpz_powm( )
QuestionPHP code for change date from gregorian to shamsi (jalali) Pin
Juni77777778-May-09 1:07
Juni77777778-May-09 1:07 
AnswerRe: PHP code for change date from gregorian to shamsi (jalali) Pin
Marc Firth27-May-09 21:52
Marc Firth27-May-09 21:52 
AnswerRe: PHP code for change date from gregorian to shamsi (jalali) Pin
Marc Firth27-May-09 21:56
Marc Firth27-May-09 21:56 
AnswerRe: PHP code for change date from gregorian to shamsi (jalali) Pin
Mohammad Dayyan5-Jun-09 21:56
Mohammad Dayyan5-Jun-09 21:56 
QuestionRe: PHP code for change date from gregorian to shamsi (jalali) Pin
Elham M30-Mar-11 22:23
Elham M30-Mar-11 22:23 
QuestionHow to open in local existing site created by joomla? Pin
foryou6-May-09 2:07
foryou6-May-09 2:07 
AnswerRe: How to open in local existing site created by joomla? Pin
Marc Firth6-May-09 23:04
Marc Firth6-May-09 23:04 
QuestionRe: How to open in local existing site created by joomla? Pin
foryou7-May-09 0:00
foryou7-May-09 0:00 
AnswerRe: How to open in local existing site created by joomla? Pin
Marc Firth7-May-09 0:31
Marc Firth7-May-09 0:31 
AnswerRe: How to open in local existing site created by joomla? Pin
Marc Firth7-May-09 0:32
Marc Firth7-May-09 0:32 
GeneralRe: How to open in local existing site created by joomla? Pin
foryou7-May-09 0:52
foryou7-May-09 0:52 
QuestionSQL queries Templates and perpfocessor Pin
mrassel5-May-09 9:19
mrassel5-May-09 9:19 
AnswerRe: SQL queries Templates and perpfocessor Pin
fly9045-May-09 9:55
fly9045-May-09 9:55 
QuestioneXaro Pin
rastaVnuce4-May-09 2:08
rastaVnuce4-May-09 2:08 
Questiontyping special character in ie 7 and above Pin
jhyn3-May-09 21:52
jhyn3-May-09 21:52 
AnswerRe: typing special character in ie 7 and above Pin
Marc Firth4-May-09 21:45
Marc Firth4-May-09 21:45 
AnswerRe: typing special character in ie 7 and above Pin
Marc Firth5-May-09 3:16
Marc Firth5-May-09 3:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.