/**
 * Module deactivation
 *
 */
static
int
globus_l_openssl_deactivate(void)
{
    int                                 i;

    OBJ_cleanup();

    ERR_clear_error();

    X509V3_EXT_cleanup();

    if (CRYPTO_get_id_callback() == globus_l_openssl_thread_id)
    {
        CRYPTO_set_id_callback(NULL);
    }
    if (CRYPTO_get_locking_callback() == globus_l_openssl_locking_cb)
    {
        CRYPTO_set_locking_callback(NULL);
    }

    for (i=0; i<CRYPTO_num_locks(); i++)
    {
        globus_mutex_destroy(&(mutex_pool[i]));
    }

    free(mutex_pool);

    globus_module_deactivate(GLOBUS_GSI_OPENSSL_ERROR_MODULE);
    globus_module_deactivate(GLOBUS_COMMON_MODULE);

    return GLOBUS_SUCCESS;
}
Ejemplo n.º 2
0
int main()
{
    BIO *bio_err;
    X509 *x509 = NULL;
    EVP_PKEY *pkey = NULL;

    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);

    bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);

    mkit(&x509, &pkey, 512, 0, 365);

    RSA_print_fp(stdout, pkey->pkey.rsa, 0);
    X509_print_fp(stdout, x509);

    PEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL, NULL);
    PEM_write_X509(stdout, x509);

    X509_free(x509);
    EVP_PKEY_free(pkey);

#ifdef CUSTOM_EXT
    /* Only needed if we add objects or custom extensions */
    X509V3_EXT_cleanup();
    OBJ_cleanup();
#endif

    CRYPTO_mem_leaks(bio_err);
    BIO_free(bio_err);
    return (0);
}