218 lines
10 KiB
C#
218 lines
10 KiB
C#
using System;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
|
|
{
|
|
// Token: 0x02001CBB RID: 7355
|
|
[Token(Token = "0x2001CBB")]
|
|
public class XteaEngine : IBlockCipher
|
|
{
|
|
// Token: 0x0600B95D RID: 47453 RVA: 0x0029A14C File Offset: 0x0029834C
|
|
[Token(Token = "0x600B95D")]
|
|
[Address(RVA = "0x1A42FB0", Offset = "0x1A41DB0", VA = "0x181A42FB0")]
|
|
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: 0x17001D01 RID: 7425
|
|
// (get) Token: 0x0600B95E RID: 47454 RVA: 0x0029A194 File Offset: 0x00298394
|
|
[Token(Token = "0x17001D01")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B95E")]
|
|
[Address(RVA = "0x1A43260", Offset = "0x1A42060", VA = "0x181A43260", Slot = "10")]
|
|
get
|
|
{
|
|
return "XTEA";
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001D02 RID: 7426
|
|
// (get) Token: 0x0600B95F RID: 47455 RVA: 0x0029A1A8 File Offset: 0x002983A8
|
|
[Token(Token = "0x17001D02")]
|
|
public virtual bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x600B95F")]
|
|
[Address(RVA = "0x403930", Offset = "0x402730", VA = "0x180403930", Slot = "11")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B960 RID: 47456 RVA: 0x0029A1B8 File Offset: 0x002983B8
|
|
[Token(Token = "0x600B960")]
|
|
[Address(RVA = "0x4101D0", Offset = "0x40EFD0", VA = "0x1804101D0", Slot = "12")]
|
|
public virtual int GetBlockSize()
|
|
{
|
|
return 8;
|
|
}
|
|
|
|
// Token: 0x0600B961 RID: 47457 RVA: 0x0029A1C8 File Offset: 0x002983C8
|
|
[Token(Token = "0x600B961")]
|
|
[Address(RVA = "0x1A42AA0", Offset = "0x1A418A0", VA = "0x181A42AA0", Slot = "13")]
|
|
public virtual void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B961)
|
|
|
|
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_A2:
|
|
stloc:ArgumentException(var_13_B3, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("invalid parameter passed to TEA init - "), ldloc:string(var_12))))
|
|
}
|
|
|
|
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: 0x0600B962 RID: 47458 RVA: 0x0029A28C File Offset: 0x0029848C
|
|
[Token(Token = "0x600B962")]
|
|
[Address(RVA = "0x1A42D40", Offset = "0x1A41B40", VA = "0x181A42D40", Slot = "14")]
|
|
public virtual int ProcessBlock(byte[] inBytes, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B962)
|
|
|
|
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_7F:
|
|
stloc:InvalidOperationException(var_12_86, newobj:InvalidOperationException(InvalidOperationException::.ctor, 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: 0x0600B963 RID: 47459 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x600B963")]
|
|
[Address(RVA = "0x402080", Offset = "0x400E80", VA = "0x180402080", Slot = "15")]
|
|
public virtual void Reset()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x0600B964 RID: 47460 RVA: 0x0029A320 File Offset: 0x00298520
|
|
[Token(Token = "0x600B964")]
|
|
[Address(RVA = "0x1A43290", Offset = "0x1A42090", VA = "0x181A43290")]
|
|
private void setKey(byte[] key)
|
|
{
|
|
int num = 0;
|
|
uint[] s = this._S;
|
|
uint num2 = Pack.BE_To_UInt32(key, num);
|
|
num += 4;
|
|
num++;
|
|
s[0] = 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: 0x0600B965 RID: 47461 RVA: 0x0029A3AC File Offset: 0x002985AC
|
|
[Token(Token = "0x600B965")]
|
|
[Address(RVA = "0x1A43140", Offset = "0x1A41F40", VA = "0x181A43140")]
|
|
private int encryptBlock(byte[] inBytes, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
uint num = Pack.BE_To_UInt32(inBytes, inOff);
|
|
uint num2 = Pack.BE_To_UInt32(inBytes, inOff);
|
|
uint[] sum = this._sum0;
|
|
int num3 = 0;
|
|
uint[] sum2 = this._sum1;
|
|
num2 += num2;
|
|
num += num2;
|
|
num2 = num;
|
|
num3++;
|
|
num2 += num;
|
|
num2 += num2;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600B966 RID: 47462 RVA: 0x0029A3FC File Offset: 0x002985FC
|
|
[Token(Token = "0x600B966")]
|
|
[Address(RVA = "0x1A43030", Offset = "0x1A41E30", VA = "0x181A43030")]
|
|
private int decryptBlock(byte[] inBytes, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
uint num = Pack.BE_To_UInt32(inBytes, inOff);
|
|
uint num2 = Pack.BE_To_UInt32(inBytes, inOff);
|
|
uint[] sum = this._sum1;
|
|
uint[] sum2 = this._sum0;
|
|
num2 = num;
|
|
num += num;
|
|
num2 -= num;
|
|
num = num2;
|
|
num += num2;
|
|
num -= num;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x040075FA RID: 30202
|
|
[Token(Token = "0x40075FA")]
|
|
private const int rounds = 32;
|
|
|
|
// Token: 0x040075FB RID: 30203
|
|
[Token(Token = "0x40075FB")]
|
|
private const int block_size = 8;
|
|
|
|
// Token: 0x040075FC RID: 30204
|
|
[Token(Token = "0x40075FC")]
|
|
private const int delta = -1640531527;
|
|
|
|
// Token: 0x040075FD RID: 30205
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40075FD")]
|
|
private uint[] _S;
|
|
|
|
// Token: 0x040075FE RID: 30206
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40075FE")]
|
|
private uint[] _sum0;
|
|
|
|
// Token: 0x040075FF RID: 30207
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40075FF")]
|
|
private uint[] _sum1;
|
|
|
|
// Token: 0x04007600 RID: 30208
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007600")]
|
|
private bool _initialised;
|
|
|
|
// Token: 0x04007601 RID: 30209
|
|
[FieldOffset(Offset = "0x29")]
|
|
[Token(Token = "0x4007601")]
|
|
private bool _forEncryption;
|
|
}
|
|
}
|