New functions BN_CTX_start(), BN_CTX_get(), BN_CTX_end() to access
[openssl.git] / crypto / dh / dh_key.c
index 4e6a0fc..0c7eeaf 100644 (file)
@@ -161,7 +161,8 @@ static int compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh)
        int ret= -1;
 
        BN_CTX_init(&ctx);
        int ret= -1;
 
        BN_CTX_init(&ctx);
-       tmp= &(ctx.bn[ctx.tos++]);
+       BN_CTX_start(&ctx);
+       tmp = BN_CTX_get(&ctx);
        
        if (dh->priv_key == NULL)
                {
        
        if (dh->priv_key == NULL)
                {
@@ -184,6 +185,7 @@ static int compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh)
 
        ret=BN_bn2bin(tmp,key);
 err:
 
        ret=BN_bn2bin(tmp,key);
 err:
+       BN_CTX_end(&ctx);
        BN_CTX_free(&ctx);
        return(ret);
        }
        BN_CTX_free(&ctx);
        return(ret);
        }