a
This commit is contained in:
@@ -0,0 +1,239 @@
|
||||
using System;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Modes;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
||||
using Cpp2IlInjected;
|
||||
using Hjg.Pngcs;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls
|
||||
{
|
||||
// Token: 0x02001B5F RID: 7007
|
||||
[Token(Token = "0x2001B5F")]
|
||||
public class TlsAeadCipher : TlsCipher
|
||||
{
|
||||
// Token: 0x0600AE17 RID: 44567 RVA: 0x0025DE00 File Offset: 0x0025C000
|
||||
[Token(Token = "0x600AE17")]
|
||||
[Address(RVA = "0x197CCE0", Offset = "0x197BAE0", VA = "0x18197CCE0")]
|
||||
public TlsAeadCipher(TlsContext context, IAeadBlockCipher clientWriteCipher, IAeadBlockCipher serverWriteCipher, int cipherKeySize, int macSize)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600AE18 RID: 44568 RVA: 0x0025DE10 File Offset: 0x0025C010
|
||||
[Token(Token = "0x600AE18")]
|
||||
[Address(RVA = "0x197CD10", Offset = "0x197BB10", VA = "0x18197CD10")]
|
||||
internal TlsAeadCipher(TlsContext context, IAeadBlockCipher clientWriteCipher, IAeadBlockCipher serverWriteCipher, int cipherKeySize, int macSize, int nonceMode)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (0600AE18)
|
||||
|
||||
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls.TlsAeadCipher::.ctor(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls.TlsContext,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Modes.IAeadBlockCipher,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Modes.IAeadBlockCipher,System.Int32,System.Int32,System.Int32)
|
||||
|
||||
---> System.Exception: Basic block has to end with unconditional control flow.
|
||||
{
|
||||
IL_82:
|
||||
stloc:TlsFatalAlert(var_12_89, newobj:TlsFatalAlert(TlsFatalAlert::.ctor, ldloc:uint64[exp:uint8](var_13)))
|
||||
stloc:TlsFatalAlert(var_14_92, newobj:TlsFatalAlert(TlsFatalAlert::.ctor, ldloc:uint64[exp:uint8](var_15)))
|
||||
}
|
||||
|
||||
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
||||
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
||||
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
||||
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
||||
--- End of inner exception stack trace ---
|
||||
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
||||
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1660
|
||||
*/;
|
||||
}
|
||||
|
||||
// Token: 0x0600AE19 RID: 44569 RVA: 0x0025DEB0 File Offset: 0x0025C0B0
|
||||
[Token(Token = "0x600AE19")]
|
||||
[Address(RVA = "0x197CCD0", Offset = "0x197BAD0", VA = "0x18197CCD0", Slot = "7")]
|
||||
public virtual int GetPlaintextLimit(int ciphertextLimit)
|
||||
{
|
||||
return ciphertextLimit;
|
||||
}
|
||||
|
||||
// Token: 0x0600AE1A RID: 44570 RVA: 0x0025DEC0 File Offset: 0x0025C0C0
|
||||
[Token(Token = "0x600AE1A")]
|
||||
[Address(RVA = "0x197C7D0", Offset = "0x197B5D0", VA = "0x18197C7D0", Slot = "8")]
|
||||
public virtual byte[] EncodePlaintext(long seqNo, byte type, byte[] plaintext, int offset, int len)
|
||||
{
|
||||
byte[] array2;
|
||||
byte[] array4;
|
||||
for (;;)
|
||||
{
|
||||
byte[] array = this.encryptImplicitNonce;
|
||||
int num = this.record_iv_length;
|
||||
int length = array.Length;
|
||||
num += length;
|
||||
array2 = new byte[num];
|
||||
int num2 = this.nonceMode;
|
||||
if (num2 == 1)
|
||||
{
|
||||
byte[] array3 = this.encryptImplicitNonce;
|
||||
int length2 = array3.Length;
|
||||
int num3 = 0;
|
||||
int num4 = 0;
|
||||
Array.Copy(array3, num4, array2, num3, length2);
|
||||
int length3 = this.encryptImplicitNonce.Length;
|
||||
TlsUtilities.WriteUint64(seqNo, array2, length3);
|
||||
IAeadBlockCipher aeadBlockCipher = this.encryptCipher;
|
||||
int num5 = this.record_iv_length;
|
||||
num5 += num2;
|
||||
array4 = new byte[num5];
|
||||
int num6 = this.record_iv_length;
|
||||
if (num6 != 0)
|
||||
{
|
||||
int num7 = array2.Length;
|
||||
num7 -= num6;
|
||||
int num8 = 0;
|
||||
Array.Copy(array2, num7, array4, num8, num6);
|
||||
}
|
||||
int num9 = this.macSize;
|
||||
IAeadBlockCipher aeadBlockCipher2 = this.encryptCipher;
|
||||
IAeadBlockCipher aeadBlockCipher3 = this.encryptCipher;
|
||||
IAeadBlockCipher aeadBlockCipher4 = this.encryptCipher;
|
||||
AeadParameters aeadParameters;
|
||||
num9 += aeadParameters;
|
||||
if (num9 == array4.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (num2 == 2)
|
||||
{
|
||||
goto Block_3;
|
||||
}
|
||||
}
|
||||
return array4;
|
||||
Block_3:
|
||||
int length4 = array2.Length;
|
||||
TlsUtilities.WriteUint64(seqNo, array2, length4);
|
||||
int num10 = 0;
|
||||
int i = 0;
|
||||
byte[] array5 = this.encryptImplicitNonce;
|
||||
while (i >= array5.Length)
|
||||
{
|
||||
}
|
||||
num10++;
|
||||
byte[] array6 = this.encryptImplicitNonce;
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x0600AE1B RID: 44571 RVA: 0x0025E008 File Offset: 0x0025C208
|
||||
[Token(Token = "0x600AE1B")]
|
||||
[Address(RVA = "0x197C3B0", Offset = "0x197B1B0", VA = "0x18197C3B0", Slot = "9")]
|
||||
public virtual byte[] DecodeCiphertext(long seqNo, byte type, byte[] ciphertext, int offset, int len)
|
||||
{
|
||||
byte[] array6;
|
||||
for (;;)
|
||||
{
|
||||
byte[] array = this.decryptImplicitNonce;
|
||||
int num = this.record_iv_length;
|
||||
int length = array.Length;
|
||||
num += length;
|
||||
byte[] array2 = new byte[num];
|
||||
int num2 = this.nonceMode;
|
||||
if (num2 == 1)
|
||||
{
|
||||
byte[] array3 = this.decryptImplicitNonce;
|
||||
int length2 = array3.Length;
|
||||
int num3 = 0;
|
||||
int num4 = 0;
|
||||
Array.Copy(array3, num4, array2, num3, length2);
|
||||
int num5 = this.record_iv_length;
|
||||
int num6 = array2.Length;
|
||||
num6 -= num5;
|
||||
Array.Copy(ciphertext, (int)seqNo, array2, num6, num5);
|
||||
}
|
||||
if (num2 == 2)
|
||||
{
|
||||
int length3 = array2.Length;
|
||||
TlsUtilities.WriteUint64(seqNo, array2, length3);
|
||||
int num7 = 0;
|
||||
int num8 = 0;
|
||||
byte[] array4 = this.decryptImplicitNonce;
|
||||
if (num8 < array4.Length)
|
||||
{
|
||||
num7++;
|
||||
byte[] array5 = this.decryptImplicitNonce;
|
||||
}
|
||||
int num9 = this.record_iv_length;
|
||||
IAeadBlockCipher aeadBlockCipher = this.decryptCipher;
|
||||
array6 = new byte[num9];
|
||||
IAeadBlockCipher aeadBlockCipher2 = this.decryptCipher;
|
||||
IAeadBlockCipher aeadBlockCipher3 = this.decryptCipher;
|
||||
IAeadBlockCipher aeadBlockCipher4 = this.decryptCipher;
|
||||
AeadParameters aeadParameters;
|
||||
aeadParameters += aeadParameters;
|
||||
if (aeadParameters == array6.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return array6;
|
||||
}
|
||||
|
||||
// Token: 0x0600AE1C RID: 44572 RVA: 0x0025E128 File Offset: 0x0025C328
|
||||
[Token(Token = "0x600AE1C")]
|
||||
[Address(RVA = "0x197CBD0", Offset = "0x197B9D0", VA = "0x18197CBD0", Slot = "10")]
|
||||
protected virtual byte[] GetAdditionalData(long seqNo, byte type, int len)
|
||||
{
|
||||
byte[] array = new byte[13];
|
||||
int num = 0;
|
||||
TlsUtilities.WriteUint64(seqNo, array, num);
|
||||
TlsUtilities.WriteUint8(type, array, 8);
|
||||
TlsContext tlsContext = this.context;
|
||||
PngHelperInternal.WriteInt2tobytes(len, array, 11);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x04006FDE RID: 28638
|
||||
[Token(Token = "0x4006FDE")]
|
||||
public const int NONCE_RFC5288 = 1;
|
||||
|
||||
// Token: 0x04006FDF RID: 28639
|
||||
[Token(Token = "0x4006FDF")]
|
||||
internal const int NONCE_DRAFT_CHACHA20_POLY1305 = 2;
|
||||
|
||||
// Token: 0x04006FE0 RID: 28640
|
||||
[FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x4006FE0")]
|
||||
protected readonly TlsContext context;
|
||||
|
||||
// Token: 0x04006FE1 RID: 28641
|
||||
[FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4006FE1")]
|
||||
protected readonly int macSize;
|
||||
|
||||
// Token: 0x04006FE2 RID: 28642
|
||||
[FieldOffset(Offset = "0x1C")]
|
||||
[Token(Token = "0x4006FE2")]
|
||||
protected readonly int record_iv_length;
|
||||
|
||||
// Token: 0x04006FE3 RID: 28643
|
||||
[FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x4006FE3")]
|
||||
protected readonly IAeadBlockCipher encryptCipher;
|
||||
|
||||
// Token: 0x04006FE4 RID: 28644
|
||||
[FieldOffset(Offset = "0x28")]
|
||||
[Token(Token = "0x4006FE4")]
|
||||
protected readonly IAeadBlockCipher decryptCipher;
|
||||
|
||||
// Token: 0x04006FE5 RID: 28645
|
||||
[FieldOffset(Offset = "0x30")]
|
||||
[Token(Token = "0x4006FE5")]
|
||||
protected readonly byte[] encryptImplicitNonce;
|
||||
|
||||
// Token: 0x04006FE6 RID: 28646
|
||||
[FieldOffset(Offset = "0x38")]
|
||||
[Token(Token = "0x4006FE6")]
|
||||
protected readonly byte[] decryptImplicitNonce;
|
||||
|
||||
// Token: 0x04006FE7 RID: 28647
|
||||
[FieldOffset(Offset = "0x40")]
|
||||
[Token(Token = "0x4006FE7")]
|
||||
protected readonly int nonceMode;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user