- BN_bin2bn (Prime, (UINT32) (PrimeLength / 8), Dh->p);\r
- BN_set_word (Dh->g, (UINT32) Generator);\r
+ //\r
+ // Set the generator and prime parameters for DH object.\r
+ //\r
+ Dh = (DH *)DhContext;\r
+ BnP = BN_bin2bn ((const unsigned char *)Prime, (int)(PrimeLength / 8), NULL);\r
+ BnG = BN_bin2bn ((const unsigned char *)&Generator, 1, NULL);\r
+ if ((BnP == NULL) || (BnG == NULL) || !DH_set0_pqg (Dh, BnP, NULL, BnG)) {\r
+ goto Error;\r
+ }\r