Squared result was stored in the wrong variable
diff --git a/bn_mp_expt_d.c b/bn_mp_expt_d.c
index 427ef06..2b0b095 100644
--- a/bn_mp_expt_d.c
+++ b/bn_mp_expt_d.c
@@ -38,7 +38,7 @@ int mp_expt_d (mp_int * a, mp_digit b, mp_int * c)
}
/* square */
- if (b > 1 && (res = mp_sqr (c, c)) != MP_OKAY) {
+ if (b > 1 && (res = mp_sqr (&g, &g)) != MP_OKAY) {
mp_clear (&g);
return res;
}