<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Weird Openmp bug in Intel® Moderncode for Parallel Architectures</title>
    <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Weird-Openmp-bug/m-p/934828#M5008</link>
    <description>&lt;P&gt;&lt;!--?xml version="1.0" encoding="UTF-8" standalone="no"?--&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;Dear all,&lt;/SPAN&gt;&lt;/P&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;I want to combine OpenMP and RSA_public_encrypt and RSA_private_decrypt routines. However, I was confused by a weird bug for a few days.&amp;nbsp;&lt;/DIV&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;In the attached program, if I generated 2 threads for parallel encryption and decryption, everything works well. If I generated 3 or more threads, the RSA_public_encrypt routine works fine. All strings are successfully encrypted (encrypt_len=256). However, the RSA_private_decrypt routine went wrong, that is, only one thread works properly, all the other threads failed to decrypt some of the strings (decrypt_len=-1, rsa_eay_private_decrypt padding check failed). If there are 1000 strings and 4 threads, the total number of string failed to decrypt went around 710 (some times as low as around 200). So as expected, if I use 4 threads for parallel RSA_public_encrypt and one thread for RSA_private_decrypt, nothing went wrong.&lt;/DIV&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;It would be great if you could give some ideas. Thanks very much.&amp;nbsp;&lt;/DIV&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;
	&lt;P&gt;#include &amp;lt;openssl/rsa.h&amp;gt;&lt;BR /&gt;
		#include &amp;lt;openssl/rand.h&amp;gt;&lt;BR /&gt;
		#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;
		#include &amp;lt;string.h&amp;gt;&lt;BR /&gt;
		#include &amp;lt;omp.h&amp;gt;&lt;/P&gt;

	&lt;P&gt;#define KEY_LENGTH &amp;nbsp; 2048&lt;BR /&gt;
		#define EN_SIZE &amp;nbsp; &amp;nbsp; &amp;nbsp;200 &amp;nbsp;//number of chars in a string&lt;BR /&gt;
		#define STR_NUM &amp;nbsp; &amp;nbsp; &amp;nbsp;1000 //number of strings to be encrypted&lt;BR /&gt;
		#define PUB_EXP &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;

	&lt;P&gt;int main() {&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; int &amp;nbsp; &amp;nbsp;i, j, k;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; int &amp;nbsp; &amp;nbsp;encrypt_len;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; int &amp;nbsp; &amp;nbsp;decrypt_len;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; char *en_m[STR_NUM]; //array of pointers for the input strings&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; char *tm_m[STR_NUM]; //array of pointers for the encrypted strings&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; char *rm_m[STR_NUM]; //array of pointers for the encrypted strings&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; // rm_m read back tm_m through a .txt file&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; char *de_m[STR_NUM]; //array of pointers for the decrypted strings&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; // Generate key pair&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; RSA *keypair = RSA_generate_key(KEY_LENGTH, PUB_EXP, NULL, NULL);&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; FILE *f;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; f = fopen("message.txt", "r");&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; if(f==NULL){&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; perror ("Error in locating the file to be encrypted");&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; return(-1);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; }&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; for (k=0; k&amp;lt;STR_NUM; k++){&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; en_m&lt;K&gt; = malloc(sizeof(char)*(EN_SIZE+1));&amp;nbsp;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tm_m&lt;K&gt; = malloc(sizeof(char)*(RSA_size(keypair)));&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; de_m&lt;K&gt; = malloc(sizeof(char)*(EN_SIZE+1));&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fread(en_m&lt;K&gt;, 1, EN_SIZE, f);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; en_m&lt;K&gt;[EN_SIZE] = '\0';&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; fclose(f);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; printf("The length of string to be encrypted in each encryption = %d bytes\n", EN_SIZE);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; printf("Total number of the string message to be encrypted = %d\n", STR_NUM);&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; omp_set_num_threads(4); //set up 4 threads&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; kmp_set_defaults("KMP_AFFINITY=scatter");&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; // Encryption&amp;nbsp;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; #pragma omp parallel for shared(en_m, tm_m, keypair) private(i, encrypt_len) schedule(static)&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; for(i=0; i&amp;lt;STR_NUM; i++)&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; encrypt_len = RSA_public_encrypt(EN_SIZE, (unsigned char*)en_m&lt;I&gt;, (unsigned char*)tm_m&lt;I&gt;, keypair, RSA_PKCS1_OAEP_PADDING);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; printf("Encryption has been finished\n");&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; f = fopen("en_message.txt", "w");&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; for (k=0; k&amp;lt;STR_NUM; k++){&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fwrite(tm_m&lt;K&gt;, sizeof(*tm_m&lt;K&gt;), RSA_size(keypair), f);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; fclose(f);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
		/************************************************************************************************/&lt;/K&gt;&lt;/K&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; f = fopen("en_message.txt", "r");&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; for (k=0; k&amp;lt;STR_NUM; k++){&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rm_m&lt;K&gt; = malloc(sizeof(char)*(RSA_size(keypair)));&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fread(rm_m&lt;K&gt;, 1, RSA_size(keypair), f);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; fclose(f);&lt;/K&gt;&lt;/K&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; // Decryption&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; #pragma omp parallel for shared(rm_m, de_m, keypair) private(j, decrypt_len) schedule(static)&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; for (j=0; j&amp;lt;STR_NUM; j++)&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; decrypt_len = RSA_private_decrypt(RSA_size(keypair), (unsigned char*)rm_m&lt;J&gt;, (unsigned char*)de_m&lt;J&gt;, keypair, RSA_PKCS1_OAEP_PADDING);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; printf("Decryption has been finished.\n");&lt;/J&gt;&lt;/J&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; int temp = 0;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; for (k=0; k&amp;lt;STR_NUM; k++){&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (strcmp(en_m&lt;K&gt;, de_m&lt;K&gt;)!=0)&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; temp += 1;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; printf("Total number of dismatch = %d\n", temp);&lt;/K&gt;&lt;/K&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; RSA_free(keypair);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; for (k=0; k&amp;lt;STR_NUM; k++){&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(en_m&lt;K&gt;);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(de_m&lt;K&gt;);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(tm_m&lt;K&gt;);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(rm_m&lt;K&gt;);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; }&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; return 0;&lt;/P&gt;

	&lt;P&gt;}&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Tue, 04 Mar 2014 03:04:11 GMT</pubDate>
    <dc:creator>Cheng_C_</dc:creator>
    <dc:date>2014-03-04T03:04:11Z</dc:date>
    <item>
      <title>Weird Openmp bug</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Weird-Openmp-bug/m-p/934828#M5008</link>
      <description>&lt;P&gt;&lt;!--?xml version="1.0" encoding="UTF-8" standalone="no"?--&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;Dear all,&lt;/SPAN&gt;&lt;/P&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;I want to combine OpenMP and RSA_public_encrypt and RSA_private_decrypt routines. However, I was confused by a weird bug for a few days.&amp;nbsp;&lt;/DIV&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;In the attached program, if I generated 2 threads for parallel encryption and decryption, everything works well. If I generated 3 or more threads, the RSA_public_encrypt routine works fine. All strings are successfully encrypted (encrypt_len=256). However, the RSA_private_decrypt routine went wrong, that is, only one thread works properly, all the other threads failed to decrypt some of the strings (decrypt_len=-1, rsa_eay_private_decrypt padding check failed). If there are 1000 strings and 4 threads, the total number of string failed to decrypt went around 710 (some times as low as around 200). So as expected, if I use 4 threads for parallel RSA_public_encrypt and one thread for RSA_private_decrypt, nothing went wrong.&lt;/DIV&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;It would be great if you could give some ideas. Thanks very much.&amp;nbsp;&lt;/DIV&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;&amp;nbsp;&lt;/DIV&gt;

&lt;DIV style="color: rgb(0, 0, 0); font-family: Arial; font-size: medium; line-height: normal;"&gt;
	&lt;P&gt;#include &amp;lt;openssl/rsa.h&amp;gt;&lt;BR /&gt;
		#include &amp;lt;openssl/rand.h&amp;gt;&lt;BR /&gt;
		#include &amp;lt;stdio.h&amp;gt;&lt;BR /&gt;
		#include &amp;lt;string.h&amp;gt;&lt;BR /&gt;
		#include &amp;lt;omp.h&amp;gt;&lt;/P&gt;

	&lt;P&gt;#define KEY_LENGTH &amp;nbsp; 2048&lt;BR /&gt;
		#define EN_SIZE &amp;nbsp; &amp;nbsp; &amp;nbsp;200 &amp;nbsp;//number of chars in a string&lt;BR /&gt;
		#define STR_NUM &amp;nbsp; &amp;nbsp; &amp;nbsp;1000 //number of strings to be encrypted&lt;BR /&gt;
		#define PUB_EXP &amp;nbsp; &amp;nbsp; &amp;nbsp;3&lt;/P&gt;

	&lt;P&gt;int main() {&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; int &amp;nbsp; &amp;nbsp;i, j, k;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; int &amp;nbsp; &amp;nbsp;encrypt_len;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; int &amp;nbsp; &amp;nbsp;decrypt_len;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; char *en_m[STR_NUM]; //array of pointers for the input strings&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; char *tm_m[STR_NUM]; //array of pointers for the encrypted strings&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; char *rm_m[STR_NUM]; //array of pointers for the encrypted strings&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; // rm_m read back tm_m through a .txt file&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; char *de_m[STR_NUM]; //array of pointers for the decrypted strings&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; // Generate key pair&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; RSA *keypair = RSA_generate_key(KEY_LENGTH, PUB_EXP, NULL, NULL);&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; FILE *f;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; f = fopen("message.txt", "r");&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; if(f==NULL){&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; perror ("Error in locating the file to be encrypted");&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; return(-1);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; }&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; for (k=0; k&amp;lt;STR_NUM; k++){&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; en_m&lt;K&gt; = malloc(sizeof(char)*(EN_SIZE+1));&amp;nbsp;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tm_m&lt;K&gt; = malloc(sizeof(char)*(RSA_size(keypair)));&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; de_m&lt;K&gt; = malloc(sizeof(char)*(EN_SIZE+1));&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fread(en_m&lt;K&gt;, 1, EN_SIZE, f);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; en_m&lt;K&gt;[EN_SIZE] = '\0';&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; fclose(f);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; printf("The length of string to be encrypted in each encryption = %d bytes\n", EN_SIZE);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; printf("Total number of the string message to be encrypted = %d\n", STR_NUM);&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; omp_set_num_threads(4); //set up 4 threads&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; kmp_set_defaults("KMP_AFFINITY=scatter");&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; // Encryption&amp;nbsp;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; #pragma omp parallel for shared(en_m, tm_m, keypair) private(i, encrypt_len) schedule(static)&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; for(i=0; i&amp;lt;STR_NUM; i++)&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; encrypt_len = RSA_public_encrypt(EN_SIZE, (unsigned char*)en_m&lt;I&gt;, (unsigned char*)tm_m&lt;I&gt;, keypair, RSA_PKCS1_OAEP_PADDING);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; printf("Encryption has been finished\n");&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; f = fopen("en_message.txt", "w");&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; for (k=0; k&amp;lt;STR_NUM; k++){&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fwrite(tm_m&lt;K&gt;, sizeof(*tm_m&lt;K&gt;), RSA_size(keypair), f);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; fclose(f);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;
		/************************************************************************************************/&lt;/K&gt;&lt;/K&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; f = fopen("en_message.txt", "r");&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; for (k=0; k&amp;lt;STR_NUM; k++){&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rm_m&lt;K&gt; = malloc(sizeof(char)*(RSA_size(keypair)));&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; fread(rm_m&lt;K&gt;, 1, RSA_size(keypair), f);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; fclose(f);&lt;/K&gt;&lt;/K&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; // Decryption&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; #pragma omp parallel for shared(rm_m, de_m, keypair) private(j, decrypt_len) schedule(static)&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; for (j=0; j&amp;lt;STR_NUM; j++)&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; decrypt_len = RSA_private_decrypt(RSA_size(keypair), (unsigned char*)rm_m&lt;J&gt;, (unsigned char*)de_m&lt;J&gt;, keypair, RSA_PKCS1_OAEP_PADDING);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; printf("Decryption has been finished.\n");&lt;/J&gt;&lt;/J&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; int temp = 0;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; for (k=0; k&amp;lt;STR_NUM; k++){&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (strcmp(en_m&lt;K&gt;, de_m&lt;K&gt;)!=0)&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; temp += 1;&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; }&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; printf("Total number of dismatch = %d\n", temp);&lt;/K&gt;&lt;/K&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; RSA_free(keypair);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; for (k=0; k&amp;lt;STR_NUM; k++){&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(en_m&lt;K&gt;);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(de_m&lt;K&gt;);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(tm_m&lt;K&gt;);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; free(rm_m&lt;K&gt;);&lt;BR /&gt;
		&amp;nbsp; &amp;nbsp; }&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/P&gt;

	&lt;P&gt;&amp;nbsp; &amp;nbsp; return 0;&lt;/P&gt;

	&lt;P&gt;}&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Mar 2014 03:04:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Weird-Openmp-bug/m-p/934828#M5008</guid>
      <dc:creator>Cheng_C_</dc:creator>
      <dc:date>2014-03-04T03:04:11Z</dc:date>
    </item>
    <item>
      <title>You might find this pertinent</title>
      <link>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Weird-Openmp-bug/m-p/934829#M5009</link>
      <description>&lt;P&gt;You might find this pertinent: &lt;A href="http://www.openssl.org/docs/crypto/threads.html"&gt;http://www.openssl.org/docs/crypto/threads.html&lt;/A&gt;#&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Sat, 29 Mar 2014 16:43:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Moderncode-for-Parallel/Weird-Openmp-bug/m-p/934829#M5009</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-03-29T16:43:47Z</dc:date>
    </item>
  </channel>
</rss>

