lib/sm2.js
function _sm2Point(x, y, parity) {
  if (x == null) {
    return SM2.point();
  }

  var pt;
  if (y != null) {
    pt = SM2.point(x, y);
    if (!SM2.validate(pt)) {
      throw 'point is not on curve';
    }
  } else {
    var px = new BN(x, 16).toRed(SM2.red);
    var py = px.redSqr().redMul(px);
    py = py.redIAdd(px.redMul(SM2.a)).redIAdd(SM2.b).redSqrt();
    if ((parity === 'odd') != py.fromRed().isOdd()) {
      py = py.redNeg();
    }
    pt = SM2.point(px, py);
  }

  return pt;
}
function _sm2Point(x, y, parity) {
  if (x == null) {
    return SM2.point();
  }

  var pt;
  if (y != null) {
    pt = SM2.point(x, y);
    if (!SM2.validate(pt)) {
      throw 'point is not on curve';
    }
  } else {
    var px = new BN(x, 16).toRed(SM2.red);
    var py = px.redSqr().redMul(px);
    py = py.redIAdd(px.redMul(SM2.a)).redIAdd(SM2.b).redSqrt();
    if ((parity === 'odd') != py.fromRed().isOdd()) {
      py = py.redNeg();
    }
    pt = SM2.point(px, py);
  }

  return pt;
}
Return a point on the curve.
Will throw error if (x,y) is not on curve.

@param {string} x - coordinate x in hex string, should not be null
@param {string} y - coordinate y in hex string
@param {string='even'} parity - determine the value of y, could be 'odd' or 'even', ignored when y is not null