• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CRYPTO_thread_id函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: fips_clear_owning_thread

int fips_clear_owning_thread(void)
	{
	int ret = 0;

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


示例17: myLockingCallback

static void myLockingCallback(int mode, int type, const 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 (mode & CRYPTO_LOCK) {
    pthread_mutex_lock(&(lock_cs[type]));
    lock_count[type]++;
    }
    else {
    pthread_mutex_unlock(&(lock_cs[type]));
    }
}
开发者ID:AGProjects,项目名称:python-sipsimple,代码行数:16,代码来源:InitializeOpenSSL.cpp


示例18: SSL_pthreads_locking_callback

void 
SSL_pthreads_locking_callback(int mode, int type, char *file, int line) 
{
  if( my.debug == 4 ){
    fprintf(
      stderr,"thread=%4d mode=%s lock=%s %s:%d\n", (int)CRYPTO_thread_id(),
      (mode&CRYPTO_LOCK)?"l":"u", (type&CRYPTO_READ)?"r":"w",file,line
    );
  }
  if(mode & CRYPTO_LOCK){
    pthread_mutex_lock(&(lock_cs[type]));
    lock_count[type]++;
  } 
  else{ 
    pthread_mutex_unlock(&(lock_cs[type]));
  }
}
开发者ID:lizconlan,项目名称:siege-2.67-fork,代码行数:17,代码来源:ssl.c


示例19: 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 (dynlock_lock_callback != NULL)
			{
			struct CRYPTO_dynlock_value *pointer
				= CRYPTO_get_dynlock_value(type);

			OPENSSL_assert(pointer != NULL);

			dynlock_lock_callback(mode, pointer, file, line);

			CRYPTO_destroy_dynlockid(type);
			}
		}
	else
		if (locking_callback != NULL)
			locking_callback(mode,type,file,line);
	}
开发者ID:aosm,项目名称:OpenSSL097,代码行数:43,代码来源:cryptlib.c


示例20: ERR_print_errors_cb

void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
			 void *u)
	{
	unsigned long l;
	char buf[256];
	char buf2[4096];
	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)
		{
		ERR_error_string_n(l, buf, sizeof buf);
		BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", es, buf,
			file, line, (flags & ERR_TXT_STRING) ? data : "");
		cb(buf2, strlen(buf2), u);
		}
	}
开发者ID:LucidOne,项目名称:Rovio,代码行数:19,代码来源:err_prn.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CRYPTO_w_lock函数代码示例发布时间:2022-05-30
下一篇:
C++ CRYPTO_set_locking_callback函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap