1
0
mirror of http://git.whoc.org.uk/git/password-manager.git synced 2024-09-21 07:51:34 +02:00

Fixed SRP check for negative values

This commit is contained in:
Giulio Cesare Solaroli 2015-02-16 18:20:49 +01:00
parent acb72cc1e0
commit 2a614c8946
3 changed files with 12 additions and 6 deletions

View File

@ -151,7 +151,8 @@ Clipperz.Crypto.SRP.Connection.prototype = MochiKit.Base.update(null, {
if (this._A == null) {
// Warning: this value should be strictly greater than zero
this._A = Clipperz.Crypto.SRP.g().powerModule(this.a(), Clipperz.Crypto.SRP.n());
if (this._A.equals(0) || negative(this._A)) {
// if (this._A.equals(0) || negative(this._A)) {
if (this._A.compare(Clipperz.Crypto.BigInt.ZERO) <= 0) {
MochiKit.Logging.logError("Clipperz.Crypto.SRP.Connection: trying to set 'A' to 0.");
throw Clipperz.Crypto.SRP.exception.InvalidValue;
}
@ -179,7 +180,8 @@ Clipperz.Crypto.SRP.Connection.prototype = MochiKit.Base.update(null, {
'set_B': function(aValue) {
// Warning: this value should be strictly greater than zero
this._B = aValue;
if (this._B.equals(0) || negative(this._B)) {
// if (this._B.equals(0) || negative(this._B)) {
if (this._B.compare(Clipperz.Crypto.BigInt.ZERO) <= 0) {
MochiKit.Logging.logError("Clipperz.Crypto.SRP.Connection: trying to set 'B' to 0.");
throw Clipperz.Crypto.SRP.exception.InvalidValue;
}

View File

@ -153,7 +153,8 @@ Clipperz.Crypto.SRP.Connection.prototype = MochiKit.Base.update(null, {
if (this._A == null) {
// Warning: this value should be strictly greater than zero
this._A = Clipperz.Crypto.SRP.g().powerModule(this.a(), Clipperz.Crypto.SRP.n());
if (this._A.equals(0) || negative(this._A)) {
// if (this._A.equals(0) || negative(this._A)) {
if (this._A.compare(Clipperz.Crypto.BigInt.ZERO) <= 0) {
Clipperz.logError("Clipperz.Crypto.SRP.Connection: trying to set 'A' to 0.");
throw Clipperz.Crypto.SRP.exception.InvalidValue;
}
@ -181,7 +182,8 @@ Clipperz.Crypto.SRP.Connection.prototype = MochiKit.Base.update(null, {
'set_B': function(aValue) {
// Warning: this value should be strictly greater than zero
this._B = aValue;
if (this._B.equals(0) || negative(this._B)) {
// if (this._B.equals(0) || negative(this._B)) {
if (this._B.compare(Clipperz.Crypto.BigInt.ZERO) <= 0) {
Clipperz.logError("Clipperz.Crypto.SRP.Connection: trying to set 'B' to 0.");
throw Clipperz.Crypto.SRP.exception.InvalidValue;
}

View File

@ -151,7 +151,8 @@ Clipperz.Crypto.SRP.Connection.prototype = MochiKit.Base.update(null, {
if (this._A == null) {
// Warning: this value should be strictly greater than zero
this._A = Clipperz.Crypto.SRP.g().powerModule(this.a(), Clipperz.Crypto.SRP.n());
if (this._A.equals(0) || negative(this._A)) {
// if (this._A.equals(0) || negative(this._A)) {
if (this._A.compare(Clipperz.Crypto.BigInt.ZERO) <= 0) {
Clipperz.logError("Clipperz.Crypto.SRP.Connection: trying to set 'A' to 0.");
throw Clipperz.Crypto.SRP.exception.InvalidValue;
}
@ -179,7 +180,8 @@ Clipperz.Crypto.SRP.Connection.prototype = MochiKit.Base.update(null, {
'set_B': function(aValue) {
// Warning: this value should be strictly greater than zero
this._B = aValue;
if (this._B.equals(0) || negative(this._B)) {
// if (this._B.equals(0) || negative(this._B)) {
if (this._B.compare(Clipperz.Crypto.BigInt.ZERO) <= 0) {
Clipperz.logError("Clipperz.Crypto.SRP.Connection: trying to set 'B' to 0.");
throw Clipperz.Crypto.SRP.exception.InvalidValue;
}