当前位置: 首页>>代码示例>>C++>>正文


C++ CRYPTO_thread_id函数代码示例

本文整理汇总了C++中CRYPTO_thread_id函数的典型用法代码示例。如果您正苦于以下问题:C++ CRYPTO_thread_id函数的具体用法?C++ CRYPTO_thread_id怎么用?C++ CRYPTO_thread_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CRYPTO_thread_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: pthreads_locking_callback

void pthreads_locking_callback(int mode, int type, char *file,
	     int line)
      {
#if 0
	TINYCLR_SSL_FPRINTF(OPENSSL_TYPE__FILE_STDERR,"thread=%4d mode=%s lock=%s %s:%d\n",
		CRYPTO_thread_id(),
		(mode&CRYPTO_LOCK)?"l":"u",
		(type&CRYPTO_READ)?"r":"w",file,line);
#endif
#if 0
	if (CRYPTO_LOCK_SSL_CERT == type)
		TINYCLR_SSL_FPRINTF(OPENSSL_TYPE__FILE_STDERR,"(t,m,f,l) %ld %d %s %d\n",
		CRYPTO_thread_id(),
		mode,file,line);
#endif
	if (mode & CRYPTO_LOCK)
		{
		pthread_mutex_lock(&(lock_cs[type]));
		lock_count[type]++;
		}
	else
		{
		pthread_mutex_unlock(&(lock_cs[type]));
		}
	}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:25,代码来源:th-lock.cpp

示例2: pthreads_locking_callback

void pthreads_locking_callback(int mode, int type, char *file,
	     int line)
      {
#if 0
	fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
		CRYPTO_thread_id(),
		(mode&CRYPTO_LOCK)?"l":"u",
		(type&CRYPTO_READ)?"r":"w",file,line);
#endif
#if 0
	if (CRYPTO_LOCK_SSL_CERT == type)
		fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
		CRYPTO_thread_id(),
		mode,file,line);
#endif
	if (mode & CRYPTO_LOCK)
		{
		pthread_mutex_lock(&(lock_cs[type]));
		lock_count[type]++;
		}
	else
		{
		pthread_mutex_unlock(&(lock_cs[type]));
		}
	}
开发者ID:ayufan,项目名称:openssl-win32,代码行数:25,代码来源:th-lock.c

示例3: solaris_locking_callback

void solaris_locking_callback(int mode, int type, char *file, int line)
{
# ifdef undef
    fprintf(stderr, "thread=%4d mode=%s lock=%s %s:%d\n",
            CRYPTO_thread_id(),
            (mode & CRYPTO_LOCK) ? "l" : "u",
            (type & CRYPTO_READ) ? "r" : "w", file, line);
# endif

    /*-
    if (CRYPTO_LOCK_SSL_CERT == type)
    fprintf(stderr,"(t,m,f,l) %ld %d %s %d\n",
            CRYPTO_thread_id(),
            mode,file,line);
    */
    if (mode & CRYPTO_LOCK) {
        /*-
        if (mode & CRYPTO_READ)
                rw_rdlock(&(lock_cs[type]));
        else
                rw_wrlock(&(lock_cs[type])); */

        mutex_lock(&(lock_cs[type]));
        lock_count[type]++;
    } else {
/*      rw_unlock(&(lock_cs[type]));  */
        mutex_unlock(&(lock_cs[type]));
    }
}
开发者ID:johnjohnsp1,项目名称:opensgx,代码行数:29,代码来源:mttest.c

示例4: CRYPTO_lock

void CRYPTO_lock(int mode, int type, const char *file, int line)
	{
#ifdef LOCK_DEBUG
		{
		char *rw_text,*operation_text;

		if (mode & CRYPTO_LOCK)
			operation_text="lock  ";
		else if (mode & CRYPTO_UNLOCK)
			operation_text="unlock";
		else
			operation_text="ERROR ";

		if (mode & CRYPTO_READ)
			rw_text="r";
		else if (mode & CRYPTO_WRITE)
			rw_text="w";
		else
			rw_text="ERROR";

		fprintf(stderr,"lock:%08lx:(%s)%s %-18s %s:%d\n",
			CRYPTO_thread_id(), rw_text, operation_text,
			CRYPTO_get_lock_name(type), file, line);
		}
#endif
	if (type < 0)
		{
		if (do_dynlock_cb)
			do_dynlock_cb(mode, type, file, line);
		}
	else
		if (locking_callback != NULL)
			locking_callback(mode,type,file,line);
	}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:34,代码来源:cryptlib.c

示例5: CRYPTO_r_lock

static BN_BLINDING *rsa_get_blinding(RSA *rsa, int *local, BN_CTX *ctx)
{
	BN_BLINDING *ret;
	int got_write_lock = 0;

	CRYPTO_r_lock(CRYPTO_LOCK_RSA);

	if (rsa->blinding == NULL)
		{
		CRYPTO_r_unlock(CRYPTO_LOCK_RSA);
		CRYPTO_w_lock(CRYPTO_LOCK_RSA);
		got_write_lock = 1;

		if (rsa->blinding == NULL)
			rsa->blinding = RSA_setup_blinding(rsa, ctx);
		}

	ret = rsa->blinding;
	if (ret == NULL)
		goto err;

	if (BN_BLINDING_get_thread_id(ret) == CRYPTO_thread_id())
		{
		/* rsa->blinding is ours! */

		*local = 1;
		}
	else
		{
		/* resort to rsa->mt_blinding instead */

		*local = 0; /* instructs rsa_blinding_convert(), rsa_blinding_invert()
		             * that the BN_BLINDING is shared, meaning that accesses
		             * require locks, and that the blinding factor must be
		             * stored outside the BN_BLINDING
		             */

		if (rsa->mt_blinding == NULL)
			{
			if (!got_write_lock)
				{
				CRYPTO_r_unlock(CRYPTO_LOCK_RSA);
				CRYPTO_w_lock(CRYPTO_LOCK_RSA);
				got_write_lock = 1;
				}
			
			if (rsa->mt_blinding == NULL)
				rsa->mt_blinding = RSA_setup_blinding(rsa, ctx);
			}
		ret = rsa->mt_blinding;
		}

 err:
	if (got_write_lock)
		CRYPTO_w_unlock(CRYPTO_LOCK_RSA);
	else
		CRYPTO_r_unlock(CRYPTO_LOCK_RSA);
	return ret;
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:59,代码来源:rsa_eay.c

示例6: ssleay_rand_status

static int ssleay_rand_status(void)
	{
	int ret;
	int do_not_lock;

	/* check if we already have the lock
	 * (could happen if a RAND_poll() implementation calls RAND_status()) */
	if (crypto_lock_rand)
		{
		CRYPTO_r_lock(CRYPTO_LOCK_RAND2);
		do_not_lock = (locking_thread == CRYPTO_thread_id());
		CRYPTO_r_unlock(CRYPTO_LOCK_RAND2);
		}
	else
		do_not_lock = 0;
	
	if (!do_not_lock)
		{
		CRYPTO_w_lock(CRYPTO_LOCK_RAND);
		
		/* prevent ssleay_rand_bytes() from trying to obtain the lock again */
		CRYPTO_w_lock(CRYPTO_LOCK_RAND2);
		locking_thread = CRYPTO_thread_id();
		CRYPTO_w_unlock(CRYPTO_LOCK_RAND2);
		crypto_lock_rand = 1;
		}
	
	if (!initialized)
		{
		RAND_poll();
		initialized = 1;
		}

	ret = entropy >= ENTROPY_NEEDED;

	if (!do_not_lock)
		{
		/* before unlocking, we must clear 'crypto_lock_rand' */
		crypto_lock_rand = 0;
		
		CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
		}
	
	return ret;
	}
开发者ID:RafaelRMachado,项目名称:MinnowBoard,代码行数:45,代码来源:md_rand.c

示例7:

ERR_STATE *ERR_get_state(void)
	{
	ERR_STATE *ret=NULL,tmp,*tmpp;
	int i;
	unsigned long pid;

	pid=(unsigned long)CRYPTO_thread_id();

	CRYPTO_r_lock(CRYPTO_LOCK_ERR);
	if (thread_hash == NULL)
		{
		CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
		CRYPTO_w_lock(CRYPTO_LOCK_ERR);
		if (thread_hash == NULL)
			{
			MemCheck_off();
			thread_hash=lh_new(pid_hash,pid_cmp);
			MemCheck_on();
			CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
			if (thread_hash == NULL) return(getFallback());
			}
		else
			CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
		}
	else
		{
		tmp.pid=pid;
		ret=(ERR_STATE *)lh_retrieve(thread_hash,&tmp);
		CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
		}

	/* ret == the error state, if NULL, make a new one */
	if (ret == NULL)
		{
		ret=(ERR_STATE *)Malloc(sizeof(ERR_STATE));
		if (ret == NULL) return(getFallback());
		ret->pid=pid;
		ret->top=0;
		ret->bottom=0;
		for (i=0; i<ERR_NUM_ERRORS; i++)
			{
			ret->err_data[i]=NULL;
			ret->err_data_flags[i]=0;
			}
		CRYPTO_w_lock(CRYPTO_LOCK_ERR);
		tmpp=(ERR_STATE *)lh_insert(thread_hash,ret);
		CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
		if (tmpp != NULL) /* old entry - should not happen */
			{
			ERR_STATE_free(tmpp);
			}
		}
	return(ret);
	}
开发者ID:Apple-FOSS-Mirror,项目名称:Security,代码行数:54,代码来源:err.c

示例8: ERR_remove_state

void ERR_remove_state(unsigned long pid)
	{
	ERR_STATE tmp;

	err_fns_check();
	if (pid == 0)
		pid=(unsigned long)CRYPTO_thread_id();
	tmp.pid=pid;
	/* thread_del_item automatically destroys the LHASH if the number of
	 * items reaches zero. */
	ERRFN(thread_del_item)(&tmp);
	}
开发者ID:174high,项目名称:openssl-0.9.8e_linux_porting,代码行数:12,代码来源:err.c

示例9: fips_is_owning_thread

int fips_is_owning_thread(void)
	{
	int ret = 0;

	if (fips_is_started())
		{
		CRYPTO_r_lock(CRYPTO_LOCK_FIPS2);
		if (fips_thread != 0 && fips_thread == CRYPTO_thread_id())
			ret = 1;
		CRYPTO_r_unlock(CRYPTO_LOCK_FIPS2);
		}
	return ret;
	}
开发者ID:aosm,项目名称:OpenSSL097,代码行数:13,代码来源:cryptlib.c

示例10: ssl_pthreads_locking_callback

static void
ssl_pthreads_locking_callback (int mode, int type, char *file, int line)
{
  dmsg (D_OPENSSL_LOCK, "SSL LOCK thread=%4lu mode=%s lock=%s %s:%d",
	   CRYPTO_thread_id (),
	   (mode & CRYPTO_LOCK) ? "l" : "u",
	   (type & CRYPTO_READ) ? "r" : "w", file, line);

  if (mode & CRYPTO_LOCK)
    pthread_mutex_lock (&ssl_mutex[type].mutex);
  else
    pthread_mutex_unlock (&ssl_mutex[type].mutex);
}
开发者ID:VolkerStolz,项目名称:bench,代码行数:13,代码来源:vpn_threads.c

示例11: CRYPTO_add_lock

int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
	     int line)
	{
	int ret = 0;

	if (add_lock_callback != NULL)
		{
#ifdef LOCK_DEBUG
		int before= *pointer;
#endif

		ret=add_lock_callback(pointer,amount,type,file,line);
#ifdef LOCK_DEBUG
		fprintf(stderr,"ladd:%08lx:%2d+%2d->%2d %-18s %s:%d\n",
			CRYPTO_thread_id(),
			before,amount,ret,
			CRYPTO_get_lock_name(type),
			file,line);
#endif
		}
	else
		{
		CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,file,line);

		ret= *pointer+amount;
#ifdef LOCK_DEBUG
		fprintf(stderr,"ladd:%08lx:%2d+%2d->%2d %-18s %s:%d\n",
			CRYPTO_thread_id(),
			*pointer,amount,ret,
			CRYPTO_get_lock_name(type),
			file,line);
#endif
		*pointer=ret;
		CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,file,line);
		}
	return(ret);
	}
开发者ID:SRI-CSL,项目名称:ENCODERS,代码行数:37,代码来源:cryptlib.c

示例12: ERR_remove_state

void ERR_remove_state(unsigned long pid)
	{
	ERR_STATE *p,tmp;

	if (thread_hash == NULL)
		return;
	if (pid == 0)
		pid=(unsigned long)CRYPTO_thread_id();
	tmp.pid=pid;
	CRYPTO_w_lock(CRYPTO_LOCK_ERR);
	p=(ERR_STATE *)lh_delete(thread_hash,&tmp);
	CRYPTO_w_unlock(CRYPTO_LOCK_ERR);

	if (p != NULL) ERR_STATE_free(p);
	}
开发者ID:Apple-FOSS-Mirror,项目名称:Security,代码行数:15,代码来源:err.c

示例13: solaris_locking_callback

static void solaris_locking_callback(int mode, int type, const char *file, int line)
{
#if 0
  fprintf(stderr, "thread=%4d mode=%s lock=%s %s:%d\n",
          CRYPTO_thread_id(),
          (mode & CRYPTO_LOCK) ? "l" : "u",
          (type & CRYPTO_READ) ? "r" : "w", file, line);
#endif

#if 0
  if (CRYPTO_LOCK_SSL_CERT == type)
    fprintf(stderr, "(t,m,f,l) %ld %d %s %d\n",
            CRYPTO_thread_id(),
            mode, file, line);
#endif
  if (mode & CRYPTO_LOCK)
  {
#ifdef USE_MUTEX
    mutex_lock(&(lock_cs[type]));
#else
    if (mode & CRYPTO_READ)
      rw_rdlock(&(lock_cs[type]));
    else
      rw_wrlock(&(lock_cs[type]));
#endif
    lock_count[type]++;
  }
  else
  {
#ifdef USE_MUTEX
    mutex_unlock(&(lock_cs[type]));
#else
    rw_unlock(&(lock_cs[type]));
#endif
  }
}
开发者ID:Shaddy1884,项目名称:lua-openssl,代码行数:36,代码来源:th-lock.c

示例14: beos_locking_callback

void beos_locking_callback(int mode, int type, const char *file, int line)
{
# if 0
    fprintf(stderr, "thread=%4d mode=%s lock=%s %s:%d\n",
            CRYPTO_thread_id(),
            (mode & CRYPTO_LOCK) ? "l" : "u",
            (type & CRYPTO_READ) ? "r" : "w", file, line);
# endif
    if (mode & CRYPTO_LOCK) {
        lock_cs[type]->Lock();
        lock_count[type]++;
    } else {
        lock_cs[type]->Unlock();
    }
}
开发者ID:johnjohnsp1,项目名称:opensgx,代码行数:15,代码来源:mttest.c

示例15: ERR_print_errors_fp

void ERR_print_errors_fp(FILE *fp)
	{
	unsigned long l;
	char buf[200];
	const char *file,*data;
	int line,flags;
	unsigned long es;

	es=CRYPTO_thread_id();
	while ((l=ERR_get_error_line_data(&file,&line,&data,&flags)) != 0)
		{
		fprintf(fp,"%lu:%s:%s:%d:%s\n",es,ERR_error_string(l,buf),
			file,line,(flags&ERR_TXT_STRING)?data:"");
		}
	}
开发者ID:Apple-FOSS-Mirror,项目名称:Security,代码行数:15,代码来源:err_prn.c


注:本文中的CRYPTO_thread_id函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。