Browse Source

Add error message

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
tags/3.3
Syrone Wong 8 years ago
parent
commit
e30487207b
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      shadowsocks-csharp/Encryption/MbedTLSEncryptor.cs

+ 5
- 5
shadowsocks-csharp/Encryption/MbedTLSEncryptor.cs View File

@@ -72,7 +72,7 @@ namespace Shadowsocks.Encryption
}
MbedTLS.cipher_init(ctx);
if (MbedTLS.cipher_setup( ctx, MbedTLS.cipher_info_from_string( _cipherMbedName ) ) != 0 )
throw new Exception();
throw new Exception("Cannot initialize mbed TLS cipher context");
/*
* MbedTLS takes key length by bit
* cipher_setkey() will set the correct key schedule
@@ -85,11 +85,11 @@ namespace Shadowsocks.Encryption
*
*/
if (MbedTLS.cipher_setkey(ctx, realkey, keyLen * 8, isCipher ? MbedTLS.MBEDTLS_ENCRYPT : MbedTLS.MBEDTLS_DECRYPT) != 0 )
throw new Exception();
throw new Exception("Cannot set mbed TLS cipher key");
if (MbedTLS.cipher_set_iv(ctx, iv, ivLen) != 0)
throw new Exception();
throw new Exception("Cannot set mbed TLS cipher IV");
if (MbedTLS.cipher_reset(ctx) != 0)
throw new Exception();
throw new Exception("Cannot finalize mbed TLS cipher context");
}
protected override void cipherUpdate(bool isCipher, int length, byte[] buf, byte[] outbuf)
@@ -109,7 +109,7 @@ namespace Shadowsocks.Encryption
ctx = _decryptCtx;
}
if (MbedTLS.cipher_update(ctx, buf, length, outbuf, ref length) != 0 )
throw new Exception();
throw new Exception("Cannot update mbed TLS cipher context");
}
#region IDisposable


Loading…
Cancel
Save