in src/mpin192.js [808:893]
SERVER_2: function(date, HID, HTID, Y, SST, xID, xCID, mSEC, E, F, Pa) {
var Q, sQ, R, y, P, g;
if (typeof Pa === "undefined" || Pa == null) {
Q = ctx.ECP4.generator();
} else {
Q = ctx.ECP4.fromBytes(Pa);
if (Q.is_infinity()) {
return this.INVALID_POINT;
}
}
sQ = ctx.ECP4.fromBytes(SST);
if (sQ.is_infinity()) {
return this.INVALID_POINT;
}
if (date !== 0) {
R = ctx.ECP.fromBytes(xCID);
} else {
if (xID == null) {
return this.BAD_PARAMS;
}
R = ctx.ECP.fromBytes(xID);
}
if (R.is_infinity()) {
return this.INVALID_POINT;
}
y = ctx.BIG.fromBytes(Y);
if (date != 0) {
P = ctx.ECP.fromBytes(HTID);
} else {
if (HID == null) {
return this.BAD_PARAMS;
}
P = ctx.ECP.fromBytes(HID);
}
if (P.is_infinity()) {
return this.INVALID_POINT;
}
P = ctx.PAIR192.G1mul(P, y);
P.add(R);
//P.affine();
R = ctx.ECP.fromBytes(mSEC);
if (R.is_infinity()) {
return this.INVALID_POINT;
}
g = ctx.PAIR192.ate2(Q, R, sQ, P);
g = ctx.PAIR192.fexp(g);
if (!g.isunity()) {
if (HID != null && xID != null && E != null && F != null) {
g.toBytes(E);
if (date !== 0) {
P = ctx.ECP.fromBytes(HID);
if (P.is_infinity()) {
return this.INVALID_POINT;
}
R = ctx.ECP.fromBytes(xID);
if (R.is_infinity()) {
return this.INVALID_POINT;
}
P = ctx.PAIR192.G1mul(P, y);
P.add(R);
}
g = ctx.PAIR192.ate(Q, P);
g = ctx.PAIR192.fexp(g);
g.toBytes(F);
}
return this.BAD_PIN;
}
return 0;
},