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: 0x02001D9B RID: 7579
|
|
[Token(Token = "0x2001D9B")]
|
|
public class XteaEngine : IBlockCipher
|
|
{
|
|
// Token: 0x0600BD2B RID: 48427 RVA: 0x002A2AF4 File Offset: 0x002A0CF4
|
|
[Token(Token = "0x600BD2B")]
|
|
[Address(RVA = "0x2595DA0", Offset = "0x2594DA0", VA = "0x182595DA0")]
|
|
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: 0x17001D9E RID: 7582
|
|
// (get) Token: 0x0600BD2C RID: 48428 RVA: 0x002A2B3C File Offset: 0x002A0D3C
|
|
[Token(Token = "0x17001D9E")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600BD2C")]
|
|
[Address(RVA = "0x2596050", Offset = "0x2595050", VA = "0x182596050", Slot = "10")]
|
|
get
|
|
{
|
|
return "XTEA";
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001D9F RID: 7583
|
|
// (get) Token: 0x0600BD2D RID: 48429 RVA: 0x002A2B50 File Offset: 0x002A0D50
|
|
[Token(Token = "0x17001D9F")]
|
|
public virtual bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x600BD2D")]
|
|
[Address(RVA = "0x424690", Offset = "0x423690", VA = "0x180424690", Slot = "11")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600BD2E RID: 48430 RVA: 0x002A2B60 File Offset: 0x002A0D60
|
|
[Token(Token = "0x600BD2E")]
|
|
[Address(RVA = "0x681E00", Offset = "0x680E00", VA = "0x180681E00", Slot = "12")]
|
|
public virtual int GetBlockSize()
|
|
{
|
|
return 8;
|
|
}
|
|
|
|
// Token: 0x0600BD2F RID: 48431 RVA: 0x002A2B70 File Offset: 0x002A0D70
|
|
[Token(Token = "0x600BD2F")]
|
|
[Address(RVA = "0x2595890", Offset = "0x2594890", VA = "0x182595890", Slot = "13")]
|
|
public virtual void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600BD2F)
|
|
|
|
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: 0x0600BD30 RID: 48432 RVA: 0x002A2C34 File Offset: 0x002A0E34
|
|
[Token(Token = "0x600BD30")]
|
|
[Address(RVA = "0x2595B30", Offset = "0x2594B30", VA = "0x182595B30", Slot = "14")]
|
|
public virtual int ProcessBlock(byte[] inBytes, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600BD30)
|
|
|
|
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: 0x0600BD31 RID: 48433 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x600BD31")]
|
|
[Address(RVA = "0x4242D0", Offset = "0x4232D0", VA = "0x1804242D0", Slot = "15")]
|
|
public virtual void Reset()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x0600BD32 RID: 48434 RVA: 0x002A2CC8 File Offset: 0x002A0EC8
|
|
[Token(Token = "0x600BD32")]
|
|
[Address(RVA = "0x2596080", Offset = "0x2595080", VA = "0x182596080")]
|
|
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: 0x0600BD33 RID: 48435 RVA: 0x002A2D54 File Offset: 0x002A0F54
|
|
[Token(Token = "0x600BD33")]
|
|
[Address(RVA = "0x2595F30", Offset = "0x2594F30", VA = "0x182595F30")]
|
|
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: 0x0600BD34 RID: 48436 RVA: 0x002A2DA4 File Offset: 0x002A0FA4
|
|
[Token(Token = "0x600BD34")]
|
|
[Address(RVA = "0x2595E20", Offset = "0x2594E20", VA = "0x182595E20")]
|
|
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: 0x040077B3 RID: 30643
|
|
[Token(Token = "0x40077B3")]
|
|
private const int rounds = 32;
|
|
|
|
// Token: 0x040077B4 RID: 30644
|
|
[Token(Token = "0x40077B4")]
|
|
private const int block_size = 8;
|
|
|
|
// Token: 0x040077B5 RID: 30645
|
|
[Token(Token = "0x40077B5")]
|
|
private const int delta = -1640531527;
|
|
|
|
// Token: 0x040077B6 RID: 30646
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40077B6")]
|
|
private uint[] _S;
|
|
|
|
// Token: 0x040077B7 RID: 30647
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40077B7")]
|
|
private uint[] _sum0;
|
|
|
|
// Token: 0x040077B8 RID: 30648
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40077B8")]
|
|
private uint[] _sum1;
|
|
|
|
// Token: 0x040077B9 RID: 30649
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40077B9")]
|
|
private bool _initialised;
|
|
|
|
// Token: 0x040077BA RID: 30650
|
|
[FieldOffset(Offset = "0x29")]
|
|
[Token(Token = "0x40077BA")]
|
|
private bool _forEncryption;
|
|
}
|
|
}
|