205 lines
10 KiB
C#
205 lines
10 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using Cpp2IlInjected;
|
|
using Hjg.Pngcs;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
|
|
{
|
|
// Token: 0x020016DE RID: 5854
|
|
[Token(Token = "0x20016DE")]
|
|
[StructLayout(3)]
|
|
public class XteaEngine : IBlockCipher
|
|
{
|
|
// Token: 0x06009D83 RID: 40323 RVA: 0x002420D0 File Offset: 0x002402D0
|
|
[Token(Token = "0x6009D83")]
|
|
[Address(RVA = "0x1F62CD0", Offset = "0x1F616D0", VA = "0x181F62CD0")]
|
|
public XteaEngine()
|
|
{
|
|
uint[] array = new uint[4];
|
|
this._S = array;
|
|
uint[] array2 = new uint[32];
|
|
this._sum0 = array2;
|
|
uint[] array3 = new uint[32];
|
|
this._sum1 = array3;
|
|
this.Reset();
|
|
this._initialised = false;
|
|
}
|
|
|
|
// Token: 0x17001900 RID: 6400
|
|
// (get) Token: 0x06009D84 RID: 40324 RVA: 0x00242118 File Offset: 0x00240318
|
|
[Token(Token = "0x17001900")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x6009D84")]
|
|
[Address(RVA = "0x1F62F80", Offset = "0x1F61980", VA = "0x181F62F80", Slot = "10")]
|
|
get
|
|
{
|
|
return "XTEA";
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001901 RID: 6401
|
|
// (get) Token: 0x06009D85 RID: 40325 RVA: 0x0024212C File Offset: 0x0024032C
|
|
[Token(Token = "0x17001901")]
|
|
public virtual bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x6009D85")]
|
|
[Address(RVA = "0x413970", Offset = "0x412370", VA = "0x180413970", Slot = "11")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009D86 RID: 40326 RVA: 0x0024213C File Offset: 0x0024033C
|
|
[Token(Token = "0x6009D86")]
|
|
[Address(RVA = "0x56E570", Offset = "0x56CF70", VA = "0x18056E570", Slot = "12")]
|
|
public virtual int GetBlockSize()
|
|
{
|
|
return 8;
|
|
}
|
|
|
|
// Token: 0x06009D87 RID: 40327 RVA: 0x0024214C File Offset: 0x0024034C
|
|
[Token(Token = "0x6009D87")]
|
|
[Address(RVA = "0x1F627C0", Offset = "0x1F611C0", VA = "0x181F627C0", Slot = "13")]
|
|
public virtual void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009D87)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.XteaEngine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_98:
|
|
stloc:ArgumentException(var_12_A9, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("invalid parameter passed to TEA init - "), ldloc:string(var_11))))
|
|
}
|
|
|
|
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 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x06009D88 RID: 40328 RVA: 0x00242204 File Offset: 0x00240404
|
|
[Token(Token = "0x6009D88")]
|
|
[Address(RVA = "0x1F62A60", Offset = "0x1F61460", VA = "0x181F62A60", Slot = "14")]
|
|
public virtual int ProcessBlock(byte[] inBytes, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009D88)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.XteaEngine::ProcessBlock(System.Byte[],System.Int32,System.Byte[],System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_43:
|
|
stloc:InvalidOperationException(var_9_4A, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldloc:string(var_8)))
|
|
}
|
|
|
|
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 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x06009D89 RID: 40329 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x6009D89")]
|
|
[Address(RVA = "0x3C9F60", Offset = "0x3C8960", VA = "0x1803C9F60", Slot = "15")]
|
|
public virtual void Reset()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06009D8A RID: 40330 RVA: 0x0024225C File Offset: 0x0024045C
|
|
[Token(Token = "0x6009D8A")]
|
|
[Address(RVA = "0x1F62FB0", Offset = "0x1F619B0", VA = "0x181F62FB0")]
|
|
private void setKey(byte[] key)
|
|
{
|
|
int num = 0;
|
|
uint[] s = this._S;
|
|
int num2 = PngHelperInternal.ReadInt4fromBytes(key, num);
|
|
num += 4;
|
|
num++;
|
|
s[0] = (uint)num2;
|
|
uint[] s2 = this._S;
|
|
uint[] sum = this._sum0;
|
|
uint num3 = s2[num];
|
|
num3 += (uint)num;
|
|
sum[0] = num3;
|
|
uint[] s3 = this._S;
|
|
uint[] sum2 = this._sum1;
|
|
uint num4 = s3[num];
|
|
num++;
|
|
num4 += (uint)num;
|
|
sum2[0] = num4;
|
|
}
|
|
|
|
// Token: 0x06009D8B RID: 40331 RVA: 0x002422E8 File Offset: 0x002404E8
|
|
[Token(Token = "0x6009D8B")]
|
|
[Address(RVA = "0x1F62E60", Offset = "0x1F61860", VA = "0x181F62E60")]
|
|
private int encryptBlock(byte[] inBytes, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
uint[] sum = this._sum0;
|
|
int num = 0;
|
|
uint[] sum2 = this._sum1;
|
|
num++;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009D8C RID: 40332 RVA: 0x00242310 File Offset: 0x00240510
|
|
[Token(Token = "0x6009D8C")]
|
|
[Address(RVA = "0x1F62D50", Offset = "0x1F61750", VA = "0x181F62D50")]
|
|
private int decryptBlock(byte[] inBytes, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
uint[] sum = this._sum1;
|
|
uint[] sum2 = this._sum0;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x040067B7 RID: 26551
|
|
[Token(Token = "0x40067B7")]
|
|
private const int rounds = 32;
|
|
|
|
// Token: 0x040067B8 RID: 26552
|
|
[Token(Token = "0x40067B8")]
|
|
private const int block_size = 8;
|
|
|
|
// Token: 0x040067B9 RID: 26553
|
|
[Token(Token = "0x40067B9")]
|
|
private const int delta = -1640531527;
|
|
|
|
// Token: 0x040067BA RID: 26554
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40067BA")]
|
|
private uint[] _S;
|
|
|
|
// Token: 0x040067BB RID: 26555
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40067BB")]
|
|
private uint[] _sum0;
|
|
|
|
// Token: 0x040067BC RID: 26556
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40067BC")]
|
|
private uint[] _sum1;
|
|
|
|
// Token: 0x040067BD RID: 26557
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40067BD")]
|
|
private bool _initialised;
|
|
|
|
// Token: 0x040067BE RID: 26558
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x29")]
|
|
[Token(Token = "0x40067BE")]
|
|
private bool _forEncryption;
|
|
}
|
|
}
|