Exemplo n.º 1
0
BIGNUM *BN_CTX_get(BN_CTX *ctx)
	{
	BIGNUM *ret;
	CTXDBG_ENTRY("BN_CTX_get", ctx);
	if(ctx->err_stack || ctx->too_many) return NULL;
	if((ret = BN_POOL_get(&ctx->pool)) == NULL)
		{
		/* Setting too_many prevents repeated "get" attempts from
		 * cluttering the error stack. */
		ctx->too_many = 1;
		BNerr(BN_F_BN_CTX_GET,BN_R_TOO_MANY_TEMPORARY_VARIABLES);
		return NULL;
		}
	/* OK, make sure the returned bignum is "zero" */
	BN_zero(ret);
	ctx->used++;
	CTXDBG_RET(ctx, ret);
	return ret;
	}
Exemplo n.º 2
0
Arquivo: ctx.c Projeto: DemiMarie/ring
BIGNUM *BN_CTX_get(BN_CTX *ctx) {
  BIGNUM *ret;
  if (ctx->err_stack || ctx->too_many) {
    return NULL;
  }

  ret = BN_POOL_get(&ctx->pool);
  if (ret == NULL) {
    /* Setting too_many prevents repeated "get" attempts from
     * cluttering the error stack. */
    ctx->too_many = 1;
    OPENSSL_PUT_ERROR(BN, BN_R_TOO_MANY_TEMPORARY_VARIABLES);
    return NULL;
  }

  /* OK, make sure the returned bignum is "zero" */
  BN_zero(ret);
  ctx->used++;
  return ret;
}