New functions BN_CTX_start(), BN_CTX_get(), BN_CTX_end() to access
[openssl.git] / crypto / dh / dh_key.c
index 4e6a0fc0ef35a6ac6ee4c5797181b4b05a3f753e..0c7eeaf260b359e8a017cf7249f53bab239f80f0 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);
        }