
Untitled
By: a guest on
Jun 21st, 2012 | syntax:
None | size: 1.00 KB | hits: 12 | expires: Never
/*
* note: openssl and gnutls use 'p' and 'q' with opposite meaning:
* our 'p' must be equal to 'q' as provided from openssl and viceversa
*/
#if (LIBGNUTLS_VERSION_MAJOR>2)||((LIBGNUTLS_VERSION_MAJOR==2)&&(LIBGNUTLS_VERSION_MINOR>=5))
p_idx = 3; q_idx = 4;
#else /* versions 2.4.x and older need 'p' and 'q' swapped */
p_idx = 4; q_idx = 3;
#endif
/* RSA get parameter */
if (gnutls_x509_privkey_export_rsa_raw(priv_key,
&rsa_datum[0],
&rsa_datum[1],
&rsa_datum[2],
&rsa_datum[p_idx],
&rsa_datum[q_idx],
&rsa_datum[5]) != 0) {
ssl_debug_printf("ssl_load_key: can't export rsa param (is a rsa private key file ?!?)\n");
#ifdef SSL_FAST
g_free(rsa_params);
#endif
return NULL;
}