Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 1.00 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.     /*
  2.      * note: openssl and gnutls use 'p' and 'q' with opposite meaning:
  3.      * our 'p' must be equal to 'q' as provided from openssl and viceversa
  4.      */
  5.  
  6. #if (LIBGNUTLS_VERSION_MAJOR>2)||((LIBGNUTLS_VERSION_MAJOR==2)&&(LIBGNUTLS_VERSION_MINOR>=5))
  7.     p_idx = 3; q_idx = 4;
  8. #else /* versions 2.4.x and older need 'p' and 'q' swapped */
  9.     p_idx = 4; q_idx = 3;
  10. #endif
  11.  
  12.     /* RSA get parameter */
  13.     if (gnutls_x509_privkey_export_rsa_raw(priv_key,
  14.                                            &rsa_datum[0],
  15.                                            &rsa_datum[1],
  16.                                            &rsa_datum[2],
  17.                                            &rsa_datum[p_idx],
  18.                                            &rsa_datum[q_idx],
  19.                                            &rsa_datum[5])  != 0) {
  20.         ssl_debug_printf("ssl_load_key: can't export rsa param (is a rsa private key file ?!?)\n");
  21. #ifdef SSL_FAST
  22.         g_free(rsa_params);
  23. #endif
  24.         return NULL;
  25.     }