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


C++ BN_BLINDING_free函数代码示例

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


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

示例1: RSA_free

void
RSA_free(RSA *r)
{
	int i;

	if (r == NULL)
		return;

	i = CRYPTO_add(&r->references, -1, CRYPTO_LOCK_RSA);
	if (i > 0)
		return;

	if (r->meth->finish)
		r->meth->finish(r);
#ifndef OPENSSL_NO_ENGINE
	if (r->engine)
		ENGINE_finish(r->engine);
#endif

	CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data);

	BN_clear_free(r->n);
	BN_clear_free(r->e);
	BN_clear_free(r->d);
	BN_clear_free(r->p);
	BN_clear_free(r->q);
	BN_clear_free(r->dmp1);
	BN_clear_free(r->dmq1);
	BN_clear_free(r->iqmp);
	BN_BLINDING_free(r->blinding);
	BN_BLINDING_free(r->mt_blinding);
	free(r);
}
开发者ID:DiamondLovesYou,项目名称:libressl-pnacl-sys,代码行数:33,代码来源:rsa_lib.c

示例2: RSA_free

void RSA_free(RSA *r)
{
    int i;

    if (r == NULL) return;

    i=CRYPTO_add(&r->references,-1,CRYPTO_LOCK_RSA);
#ifdef REF_PRINT
    REF_PRINT("RSA",r);
#endif
    if (i > 0) return;
#ifdef REF_CHECK
    if (i < 0)
    {
        fprintf(stderr,"RSA_free, bad reference count\n");
        abort();
    }
#endif

    if (r->meth->finish)
        r->meth->finish(r);
#ifndef OPENSSL_NO_ENGINE
    if (r->engine)
        ENGINE_finish(r->engine);
#endif

    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data);

    if (r->n != NULL) BN_clear_free(r->n);
    if (r->e != NULL) BN_clear_free(r->e);
    if (r->d != NULL) BN_clear_free(r->d);
    if (r->p != NULL) BN_clear_free(r->p);
    if (r->q != NULL) BN_clear_free(r->q);
    if (r->dmp1 != NULL) BN_clear_free(r->dmp1);
    if (r->dmq1 != NULL) BN_clear_free(r->dmq1);
    if (r->iqmp != NULL) BN_clear_free(r->iqmp);
    if (r->blinding != NULL) BN_BLINDING_free(r->blinding);
    if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding);
    if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data);

    if (r->additional_primes != NULL)
    {
        int j;
        for (j = 0; j < sk_RSA_additional_prime_num(r->additional_primes); j++)
        {
            RSA_additional_prime *ap = sk_RSA_additional_prime_value(r->additional_primes, j);
            BN_clear_free(ap->prime);
            BN_clear_free(ap->exp);
            BN_clear_free(ap->coeff);
            BN_clear_free(ap->r);
        }
        sk_RSA_additional_prime_pop_free(r->additional_primes, int_rsa_free_additional_prime);
    }

    OPENSSL_free(r);
}
开发者ID:kaxtone,项目名称:appengine-php,代码行数:56,代码来源:rsa_lib.c

示例3: RSA_free

void RSA_free(RSA *rsa) {
  unsigned u;

  if (rsa == NULL) {
    return;
  }

  if (CRYPTO_add(&rsa->references, -1, CRYPTO_LOCK_RSA) > 0) {
    return;
  }

  if (rsa->meth->finish) {
    rsa->meth->finish(rsa);
  }
  METHOD_unref(rsa->meth);

  CRYPTO_free_ex_data(&g_ex_data_class, rsa, &rsa->ex_data);

  BN_clear_free(rsa->n);
  BN_clear_free(rsa->e);
  BN_clear_free(rsa->d);
  BN_clear_free(rsa->p);
  BN_clear_free(rsa->q);
  BN_clear_free(rsa->dmp1);
  BN_clear_free(rsa->dmq1);
  BN_clear_free(rsa->iqmp);
  for (u = 0; u < rsa->num_blindings; u++) {
    BN_BLINDING_free(rsa->blindings[u]);
  }
  OPENSSL_free(rsa->blindings);
  OPENSSL_free(rsa->blindings_inuse);
  CRYPTO_MUTEX_cleanup(&rsa->lock);
  OPENSSL_free(rsa);
}
开发者ID:hoangmichel,项目名称:webrtc,代码行数:34,代码来源:rsa.c

示例4: OPENSSL_malloc

BN_BLINDING *BN_BLINDING_new(void) {
  BN_BLINDING *ret = OPENSSL_malloc(sizeof(BN_BLINDING));
  if (ret == NULL) {
    OPENSSL_PUT_ERROR(RSA, ERR_R_MALLOC_FAILURE);
    return NULL;
  }
  memset(ret, 0, sizeof(BN_BLINDING));

  ret->A = BN_new();
  if (ret->A == NULL) {
    goto err;
  }
  BN_set_flags(ret->A, BN_FLG_CONSTTIME);

  ret->Ai = BN_new();
  if (ret->Ai == NULL) {
    goto err;
  }
  BN_set_flags(ret->Ai, BN_FLG_CONSTTIME);

  /* The blinding values need to be created before this blinding can be used. */
  ret->counter = BN_BLINDING_COUNTER - 1;

  return ret;

err:
  BN_BLINDING_free(ret);
  return NULL;
}
开发者ID:Ms2ger,项目名称:ring,代码行数:29,代码来源:blinding.c

示例5: RSA_free_thread_blinding_ptr

void RSA_free_thread_blinding_ptr(RSA *r)
{
	// look for storage for the current thread
	pthread_t current = pthread_self();
	
	int i;
	for (i = 0; i < r->num_blinding_threads; ++i)
	{
		if (pthread_equal(current, r->blinding_array[i].thread_ID)) // do we have storage for this thread?
		{
			BN_BLINDING_free(r->blinding_array[i].blinding);
			
			int new_count = r->num_blinding_threads - 1;
			if (new_count == 0)
			{
				// no more thread storage, just blow our array away
				free(r->blinding_array);
				r->blinding_array = NULL;
				r->num_blinding_threads = 0;
			}
			else
			{
				r->blinding_array[i] = r->blinding_array[new_count];
				r->num_blinding_threads = new_count;
			}
			break;
		}
	}
}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:29,代码来源:rsa_lib.c

示例6: bn_check_top

BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod)
	{
	BN_BLINDING *ret=NULL;

	bn_check_top(mod);

	if ((ret=(BN_BLINDING *)OPENSSL_malloc(sizeof(BN_BLINDING))) == NULL)
		{
		BNerr(BN_F_BN_BLINDING_NEW,ERR_R_MALLOC_FAILURE);
		return(NULL);
		}
	memset(ret,0,sizeof(BN_BLINDING));
	if (A != NULL)
		{
		if ((ret->A  = BN_dup(A))  == NULL) goto err;
		}
	if (Ai != NULL)
		{
		if ((ret->Ai = BN_dup(Ai)) == NULL) goto err;
		}

	/* save a copy of mod in the BN_BLINDING structure */
	if ((ret->mod = BN_dup(mod)) == NULL) goto err;
	if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
		BN_set_flags(ret->mod, BN_FLG_CONSTTIME);

	ret->counter = BN_BLINDING_COUNTER;
	CRYPTO_THREADID_current(&ret->tid);
	return(ret);
err:
	if (ret != NULL) BN_BLINDING_free(ret);
	return(NULL);
	}
开发者ID:CoryXie,项目名称:BarrelfishOS,代码行数:33,代码来源:bn_blind.c

示例7: RSA_blinding_off

void RSA_blinding_off(RSA *rsa)
{
    BN_BLINDING_free(rsa->blinding);
    rsa->blinding = NULL;
    rsa->flags &= ~RSA_FLAG_BLINDING;
    rsa->flags |= RSA_FLAG_NO_BLINDING;
}
开发者ID:Vonage,项目名称:openssl,代码行数:7,代码来源:rsa_crpt.c

示例8: bn_check_top

BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod)
  {
  BN_BLINDING *ret=NULL;

  bn_check_top(mod);

  if ((ret=(BN_BLINDING *)OPENSSL_malloc(sizeof(BN_BLINDING))) == NULL)
    {
    BNerr(BN_F_BN_BLINDING_NEW,ERR_R_MALLOC_FAILURE);
    return(NULL);
    }
  memset(ret,0,sizeof(BN_BLINDING));
  if (A != NULL)
    {
    if ((ret->A  = BN_dup(A))  == NULL) goto err;
    }
  if (Ai != NULL)
    {
    if ((ret->Ai = BN_dup(Ai)) == NULL) goto err;
    }
  ret->mod = mod;
  ret->counter = BN_BLINDING_COUNTER;
  return(ret);
err:
  if (ret != NULL) BN_BLINDING_free(ret);
  return(NULL);
  }
开发者ID:yyyyyao,项目名称:Slicer3-lib-mirrors,代码行数:27,代码来源:bn_blind.c

示例9: FIPS_rsa_free

void FIPS_rsa_free(RSA *r)
	{
	if (!r)
		return;
	if (r->meth->finish)
		r->meth->finish(r);
	if (r->n != NULL) BN_clear_free(r->n);
	if (r->e != NULL) BN_clear_free(r->e);
	if (r->d != NULL) BN_clear_free(r->d);
	if (r->p != NULL) BN_clear_free(r->p);
	if (r->q != NULL) BN_clear_free(r->q);
	if (r->dmp1 != NULL) BN_clear_free(r->dmp1);
	if (r->dmq1 != NULL) BN_clear_free(r->dmq1);
	if (r->iqmp != NULL) BN_clear_free(r->iqmp);
	if (r->blinding != NULL) BN_BLINDING_free(r->blinding);
	if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding);
	if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data);
	OPENSSL_free(r);
	}
开发者ID:alisw,项目名称:alice-openssl,代码行数:19,代码来源:fips_rsa_lib.c

示例10: RSA_free

void RSA_free(RSA *r)
	{
	int i;

	if (r == NULL) return;

	i=CRYPTO_add(&r->references,-1,CRYPTO_LOCK_RSA);
#ifdef REF_PRINT
	REF_PRINT("RSA",r);
#endif
	if (i > 0) return;
#ifdef REF_CHECK
	if (i < 0)
		{
		fprintf(stderr,"RSA_free, bad reference count\n");
		abort();
		}
#endif

	if (r->meth->finish)
		r->meth->finish(r);
#ifndef OPENSSL_NO_ENGINE
	if (r->engine)
		ENGINE_finish(r->engine);
#endif

	CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data);

	if (r->n != NULL) BN_clear_free(r->n);
	if (r->e != NULL) BN_clear_free(r->e);
	if (r->d != NULL) BN_clear_free(r->d);
	if (r->p != NULL) BN_clear_free(r->p);
	if (r->q != NULL) BN_clear_free(r->q);
	if (r->dmp1 != NULL) BN_clear_free(r->dmp1);
	if (r->dmq1 != NULL) BN_clear_free(r->dmq1);
	if (r->iqmp != NULL) BN_clear_free(r->iqmp);
#ifndef OPERA_SMALL_VERSION
	if (r->blinding != NULL) BN_BLINDING_free(r->blinding);
	if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding);
	if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data);
#endif
	OPENSSL_free(r);
	}
开发者ID:prestocore,项目名称:browser,代码行数:43,代码来源:rsa_lib.c

示例11: RSA_free

void RSA_free(RSA *r)
	{
	int i;

	if (r == NULL) return;

	i=CRYPTO_add(&r->references,-1,CRYPTO_LOCK_RSA);
#ifdef REF_PRINT
	REF_PRINT("RSA",r);
#endif
	if (i > 0) return;
#ifdef REF_CHECK
	if (i < 0)
		{
		TINYCLR_SSL_FPRINTF(OPENSSL_TYPE__FILE_STDERR,"RSA_free, bad reference count\n");
		TINYCLR_SSL_ABORT();
		}
#endif

	if (r->meth->finish)
		r->meth->finish(r);
#ifndef OPENSSL_NO_ENGINE
	if (r->engine)
		ENGINE_finish(r->engine);
#endif

	CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data);

	if (r->n != NULL) BN_clear_free(r->n);
	if (r->e != NULL) BN_clear_free(r->e);
	if (r->d != NULL) BN_clear_free(r->d);
	if (r->p != NULL) BN_clear_free(r->p);
	if (r->q != NULL) BN_clear_free(r->q);
	if (r->dmp1 != NULL) BN_clear_free(r->dmp1);
	if (r->dmq1 != NULL) BN_clear_free(r->dmq1);
	if (r->iqmp != NULL) BN_clear_free(r->iqmp);
	if (r->blinding != NULL) BN_BLINDING_free(r->blinding);
	if (r->mt_blinding != NULL) BN_BLINDING_free(r->mt_blinding);
	if (r->bignum_data != NULL) OPENSSL_free_locked(r->bignum_data);
	OPENSSL_free(r);
	}
开发者ID:Sorcha,项目名称:NETMF-LPC,代码行数:41,代码来源:rsa_lib.cpp

示例12: rsa_blinding_release

/* rsa_blinding_release marks the cached BN_BLINDING at the given index as free
 * for other threads to use. */
static void rsa_blinding_release(RSA *rsa, BN_BLINDING *blinding,
                                 unsigned blinding_index) {
  if (blinding_index == MAX_BLINDINGS_PER_RSA) {
    /* This blinding wasn't cached. */
    BN_BLINDING_free(blinding);
    return;
  }

  CRYPTO_MUTEX_lock_write(&rsa->lock);
  rsa->blindings_inuse[blinding_index] = 0;
  CRYPTO_MUTEX_unlock_write(&rsa->lock);
}
开发者ID:caiolima,项目名称:webkit,代码行数:14,代码来源:rsa_impl.c

示例13: RSA_free

void RSA_free(RSA *r)
{
    int i;

    if (r == NULL)
        return;

    CRYPTO_DOWN_REF(&r->references, &i, r->lock);
    REF_PRINT_COUNT("RSA", r);
    if (i > 0)
        return;
    REF_ASSERT_ISNT(i < 0);

    if (r->meth->finish)
        r->meth->finish(r);
#ifndef OPENSSL_NO_ENGINE
    ENGINE_finish(r->engine);
#endif

    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data);

    CRYPTO_THREAD_lock_free(r->lock);

    BN_clear_free(r->n);
    BN_clear_free(r->e);
    BN_clear_free(r->d);
    BN_clear_free(r->p);
    BN_clear_free(r->q);
    BN_clear_free(r->dmp1);
    BN_clear_free(r->dmq1);
    BN_clear_free(r->iqmp);
    RSA_PSS_PARAMS_free(r->pss);
    sk_RSA_PRIME_INFO_pop_free(r->prime_infos, rsa_multip_info_free);
    BN_BLINDING_free(r->blinding);
    BN_BLINDING_free(r->mt_blinding);
    OPENSSL_free(r->bignum_data);
    OPENSSL_free(r);
}
开发者ID:Bilibili,项目名称:openssl,代码行数:38,代码来源:rsa_lib.c

示例14: bn_check_top

BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod)
{
    BN_BLINDING *ret = NULL;

    bn_check_top(mod);

    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
        BNerr(BN_F_BN_BLINDING_NEW, ERR_R_MALLOC_FAILURE);
        return NULL;
    }

    ret->lock = CRYPTO_THREAD_lock_new();
    if (ret->lock == NULL) {
        BNerr(BN_F_BN_BLINDING_NEW, ERR_R_MALLOC_FAILURE);
        OPENSSL_free(ret);
        return NULL;
    }

    BN_BLINDING_set_current_thread(ret);

    if (A != NULL) {
        if ((ret->A = BN_dup(A)) == NULL)
            goto err;
    }

    if (Ai != NULL) {
        if ((ret->Ai = BN_dup(Ai)) == NULL)
            goto err;
    }

    /* save a copy of mod in the BN_BLINDING structure */
    if ((ret->mod = BN_dup(mod)) == NULL)
        goto err;

    if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0)
        BN_set_flags(ret->mod, BN_FLG_CONSTTIME);

    /*
     * Set the counter to the special value -1 to indicate that this is
     * never-used fresh blinding that does not need updating before first
     * use.
     */
    ret->counter = -1;

    return ret;

 err:
    BN_BLINDING_free(ret);
    return NULL;
}
开发者ID:277800076,项目名称:openssl,代码行数:50,代码来源:bn_blind.c

示例15: assert

BN_BLINDING *BN_BLINDING_new(const RSA *rsa, BN_CTX *ctx) {
  assert(ctx != NULL);

  BN_BLINDING *ret = OPENSSL_malloc(sizeof(BN_BLINDING));
  if (ret == NULL) {
    OPENSSL_PUT_ERROR(RSA, ERR_R_MALLOC_FAILURE);
    return NULL;
  }
  memset(ret, 0, sizeof(BN_BLINDING));

  ret->A = BN_new();
  if (ret->A == NULL) {
    goto err;
  }

  ret->Ai = BN_new();
  if (ret->Ai == NULL) {
    goto err;
  }

  if (rsa->e != NULL) {
    ret->e = BN_dup(rsa->e);
    if (ret->e == NULL) {
      goto err;
    }
  } else {
    ret->e = rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx);
    if (ret->e == NULL) {
      OPENSSL_PUT_ERROR(RSA, RSA_R_NO_PUBLIC_EXPONENT);
      goto err;
    }
  }

  /* save a copy of mod in the BN_BLINDING structure */
  ret->mod = BN_dup(rsa->n);
  if (ret->mod == NULL) {
    goto err;
  }
  BN_set_flags(ret->mod, BN_FLG_CONSTTIME);

  /* The blinding values need to be created before this blinding can be used. */
  ret->counter = BN_BLINDING_COUNTER - 1;

  return ret;

err:
  BN_BLINDING_free(ret);
  return NULL;
}
开发者ID:Wendy1106,项目名称:Emma,代码行数:49,代码来源:blinding.c


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