Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -4,7 +4,8 @@ include ../../build/rules.make
LIBRARY = Mono.Security.dll
LOCAL_MCS_FLAGS = -lib:$(the_libdir_base)bare
LIB_MCS_FLAGS = -r:System.dll -unsafe -nowarn:1030
LIB_REFS = System
LIB_MCS_FLAGS = -unsafe -nowarn:1030
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:169,219,618,672
include ../../build/library.make
@@ -14,4 +15,4 @@ $(build_lib): $(the_libdir_base)bare/System.dll
$(the_libdir_base)bare/System.dll:
(cd ../System; $(MAKE) $@)
.NOTPARALLEL: $(the_libdir_base)bare/System.dll
.NOTPARALLEL: $(the_libdir_base)bare/System.dll

View File

@@ -154,7 +154,7 @@ namespace Mono.Security.Cryptography {
throw new ArgumentOutOfRangeException ("inputCount", "< 0");
// ordered to avoid possible integer overflow
if (inputOffset > inputBuffer.Length - inputCount)
throw new ArgumentException ("inputBuffer", Locale.GetText ("Overflow"));
throw new ArgumentException (Locale.GetText ("Overflow"), "inputBuffer");
}
public int TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
@@ -167,7 +167,7 @@ namespace Mono.Security.Cryptography {
throw new ArgumentOutOfRangeException ("outputOffset", "< 0");
// ordered to avoid possible integer overflow
if (outputOffset > outputBuffer.Length - inputCount)
throw new ArgumentException ("outputBuffer", Locale.GetText ("Overflow"));
throw new ArgumentException (Locale.GetText ("Overflow"), "outputBuffer");
return InternalTransformBlock (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
}

View File

@@ -145,7 +145,10 @@ namespace Mono.Security.Cryptography {
// overrides from RSA class
public override int KeySize {
get {
get {
if (m_disposed)
throw new ObjectDisposedException (Locale.GetText ("Keypair was disposed"));
// in case keypair hasn't been (yet) generated
if (keypairGenerated) {
int ks = n.BitCount ();

View File

@@ -601,6 +601,9 @@ namespace Mono.Security.Protocol.Tls
{
asyncResult.SetComplete(preReadSize);
}
else if (recordStream.Position < recordStream.Length) {
InternalReadCallback_inner (asyncResult, recbuf, new object[] { recbuf, asyncResult }, false, 0);
}
else if (!this.context.ReceivedConnectionEnd)
{
// this will read data from the network until we have (at least) one
@@ -650,6 +653,24 @@ namespace Mono.Security.Protocol.Tls
return;
}
InternalReadCallback_inner(internalResult, recbuf, state, true, n);
}
catch (Exception ex)
{
internalResult.SetComplete(ex);
}
}
// read encrypted data until we have enough to decrypt (at least) one
// record and return are the records (may be more than one) we have
private void InternalReadCallback_inner(InternalAsyncResult internalResult, byte[] recbuf, object[] state, bool didRead, int n)
{
if (this.disposed)
return;
try
{
bool dataToReturn = false;
long pos = recordStream.Position;
@@ -713,7 +734,7 @@ namespace Mono.Security.Protocol.Tls
pos = 0;
}
if (!dataToReturn && (n > 0))
if (!dataToReturn && (!didRead || (n > 0)))
{
if (context.ReceivedConnectionEnd) {
internalResult.SetComplete (0);
@@ -744,7 +765,6 @@ namespace Mono.Security.Protocol.Tls
{
internalResult.SetComplete(ex);
}
}
private void InternalBeginWrite(InternalAsyncResult asyncResult)
@@ -1022,6 +1042,7 @@ namespace Mono.Security.Protocol.Tls
if (remainder > 0) {
recordStream.Write (outofrecord, 0, outofrecord.Length);
recordStream.Position = 0;
}
if (dataToReturn) {

View File

@@ -0,0 +1 @@
#include monotouch_Mono.Security.dll.sources