Title: DSA_generate_parameters

Hi all,

I have made program which includes the following code:

// make a ptr to a DSA structure
dsa = DSA_new();    // make a new dsa
      
// GENERATE PARAMETERS

pBits = KEYLENGTH;    // bits in a key (512)
seedLen = 20;        // starting seed for psuedo random generator

dsa = DSA_generate_parameters(pBits, NULL, seedLen, NULL, NULL, NULL, NULL);

The system will eneded up in an indefinite loop, calling from DSA_generate_parameters crypto program  bn_gcd and staying indefinitely  in the loop:

        while (!BN_is_zero(B))
                {
                if (!BN_div(D,M,A,B,ctx)) goto err;
                T=A;
                A=B;
                B=M;
                /* T has a struct, M does not */

                if (!BN_mul(T,D,X,ctx)) goto err;
                if (!BN_add(T,T,Y)) goto err;
                M=Y;
                Y=X;
                X=T;
                sign= -sign;
                }        

I am not able to understand the above algorithm and to see what is wrong with my code. As I understand that program (bn_gcd) calculates the prime number used in the calculation of the public key. If someone could give me the hint on what might be wrong with my code.


Alex

Reply via email to