336 lines
13 KiB
C#
336 lines
13 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
|
|
{
|
|
// Token: 0x020016C3 RID: 5827
|
|
[Token(Token = "0x20016C3")]
|
|
[StructLayout(3)]
|
|
public class RC6Engine : IBlockCipher
|
|
{
|
|
// Token: 0x06009C6D RID: 40045 RVA: 0x00237894 File Offset: 0x00235A94
|
|
[Token(Token = "0x6009C6D")]
|
|
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
|
|
public RC6Engine()
|
|
{
|
|
this.Reset();
|
|
}
|
|
|
|
// Token: 0x170018E2 RID: 6370
|
|
// (get) Token: 0x06009C6E RID: 40046 RVA: 0x002378A8 File Offset: 0x00235AA8
|
|
[Token(Token = "0x170018E2")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x6009C6E")]
|
|
[Address(RVA = "0x212EE70", Offset = "0x212D870", VA = "0x18212EE70", Slot = "10")]
|
|
get
|
|
{
|
|
return "RC6";
|
|
}
|
|
}
|
|
|
|
// Token: 0x170018E3 RID: 6371
|
|
// (get) Token: 0x06009C6F RID: 40047 RVA: 0x002378BC File Offset: 0x00235ABC
|
|
[Token(Token = "0x170018E3")]
|
|
public virtual bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x6009C6F")]
|
|
[Address(RVA = "0x413970", Offset = "0x412370", VA = "0x180413970", Slot = "11")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009C70 RID: 40048 RVA: 0x002378CC File Offset: 0x00235ACC
|
|
[Token(Token = "0x6009C70")]
|
|
[Address(RVA = "0x212E4B0", Offset = "0x212CEB0", VA = "0x18212E4B0", Slot = "12")]
|
|
public virtual int GetBlockSize()
|
|
{
|
|
return RC6Engine.bytesPerWord;
|
|
}
|
|
|
|
// Token: 0x06009C71 RID: 40049 RVA: 0x002378E0 File Offset: 0x00235AE0
|
|
[Token(Token = "0x6009C71")]
|
|
[Address(RVA = "0x212E510", Offset = "0x212CF10", VA = "0x18212E510", Slot = "13")]
|
|
public virtual void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009C71)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.RC6Engine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_1F:
|
|
stloc:ArgumentException(var_4_2F, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("invalid parameter passed to RC6 init - "), ldloc:string(var_3))))
|
|
}
|
|
|
|
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: 0x06009C72 RID: 40050 RVA: 0x00237920 File Offset: 0x00235B20
|
|
[Token(Token = "0x6009C72")]
|
|
[Address(RVA = "0x212E670", Offset = "0x212D070", VA = "0x18212E670", Slot = "14")]
|
|
public virtual int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009C72)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.RC6Engine::ProcessBlock(System.Byte[],System.Int32,System.Byte[],System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_2C:
|
|
stloc:InvalidOperationException(var_4_36, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("RC6 engine not initialised")))
|
|
}
|
|
|
|
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: 0x06009C73 RID: 40051 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x6009C73")]
|
|
[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: 0x06009C74 RID: 40052 RVA: 0x00237964 File Offset: 0x00235B64
|
|
[Token(Token = "0x6009C74")]
|
|
[Address(RVA = "0x212E880", Offset = "0x212D280", VA = "0x18212E880")]
|
|
private void SetKey(byte[] key)
|
|
{
|
|
int num = RC6Engine.bytesPerWord;
|
|
int num2 = key.Length;
|
|
num2 += num;
|
|
int[] array = new int[num2];
|
|
num2 = key.Length;
|
|
int num3 = array[num2];
|
|
byte b = (byte)((int)b + num3);
|
|
array[0] = (int)b;
|
|
int[] array2 = new int[RC6Engine._noRounds];
|
|
this._S = array2;
|
|
int p = RC6Engine.P32;
|
|
array2[0] = p;
|
|
int[] s = this._S;
|
|
uint num4;
|
|
int[] s2;
|
|
if (num4 < (uint)s.Length)
|
|
{
|
|
int length = s.Length;
|
|
uint num5 = num4 - 1U;
|
|
int num6 = s[(int)num5];
|
|
int length2 = s.Length;
|
|
num4 += (uint)1;
|
|
int num7 = RC6Engine.Q32;
|
|
num7 += num6;
|
|
s[0] = num7;
|
|
s2 = this._S;
|
|
}
|
|
int length3 = s2.Length;
|
|
if (array.Length > length3)
|
|
{
|
|
}
|
|
int num8 = 0;
|
|
if (s2 > 0)
|
|
{
|
|
int num9 = s2[num8];
|
|
num9 += num8;
|
|
num9 += num8;
|
|
int num10 = RC6Engine.wordSize;
|
|
int num11 = num10 - 1;
|
|
num10 -= num11;
|
|
s2[0] = num9;
|
|
int num12 = array[num8];
|
|
num12 += num9;
|
|
num12 += num8;
|
|
int num13 = RC6Engine.wordSize;
|
|
int num14 = num13 - 1;
|
|
num13 -= num14;
|
|
array[0] = num12;
|
|
num8++;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009C75 RID: 40053 RVA: 0x00237AC4 File Offset: 0x00235CC4
|
|
[Token(Token = "0x6009C75")]
|
|
[Address(RVA = "0x212DDA0", Offset = "0x212C7A0", VA = "0x18212DDA0")]
|
|
private int EncryptBlock(byte[] input, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
int num = this.BytesToWord(input, inOff);
|
|
int num2 = RC6Engine.bytesPerWord;
|
|
num2 += inOff;
|
|
int num3 = this.BytesToWord(input, num2);
|
|
int num4 = this.BytesToWord(input, num2);
|
|
int num5 = RC6Engine.bytesPerWord;
|
|
num5 += typeof(RC6Engine).TypeHandle;
|
|
int num6 = this.BytesToWord(input, num5);
|
|
int length = this._S.Length;
|
|
int num7 = RC6Engine.wordSize;
|
|
int num8 = num7 - 1;
|
|
num7 -= num8;
|
|
int num9 = RC6Engine.wordSize;
|
|
int num10 = num9 - 1;
|
|
num9 -= num10;
|
|
int[] s = this._S;
|
|
int num11 = RC6Engine.wordSize;
|
|
int num12 = num11 - 1;
|
|
num11 -= num12;
|
|
ulong num14;
|
|
ulong num13 = num14 + 1UL;
|
|
int num15 = RC6Engine.wordSize;
|
|
int num16 = num15 - 1;
|
|
num15 -= num16;
|
|
uint num17;
|
|
num17 += (uint)1;
|
|
int num18 = RC6Engine._noRounds;
|
|
num18 += num18;
|
|
num18 += 3;
|
|
num3 += num16;
|
|
int num19 = RC6Engine.bytesPerWord;
|
|
int num20 = 0;
|
|
int num21 = RC6Engine.bytesPerWord;
|
|
if (num20 < num21)
|
|
{
|
|
num20++;
|
|
}
|
|
int num22 = RC6Engine.bytesPerWord;
|
|
if (num20 < num22)
|
|
{
|
|
num20++;
|
|
}
|
|
int num23 = RC6Engine.bytesPerWord;
|
|
if (num20 < num23)
|
|
{
|
|
num20++;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
// Token: 0x06009C76 RID: 40054 RVA: 0x00237BFC File Offset: 0x00235DFC
|
|
[Token(Token = "0x6009C76")]
|
|
[Address(RVA = "0x212D9D0", Offset = "0x212C3D0", VA = "0x18212D9D0")]
|
|
private int DecryptBlock(byte[] input, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
int num = this.BytesToWord(input, inOff);
|
|
int num2 = RC6Engine.bytesPerWord;
|
|
num2 += inOff;
|
|
int num3 = this.BytesToWord(input, num2);
|
|
int num4 = this.BytesToWord(input, num2);
|
|
int num5 = RC6Engine.bytesPerWord;
|
|
num5 += typeof(RC6Engine).TypeHandle;
|
|
int num6 = this.BytesToWord(input, num5);
|
|
int length = this._S.Length;
|
|
int noRounds = RC6Engine._noRounds;
|
|
num6 = num4;
|
|
int num7 = num4 * num;
|
|
int lgw = RC6Engine.LGW;
|
|
num7 = this.RotateLeft(num7, lgw);
|
|
int num8 = RC6Engine.LGW;
|
|
int[] s = this._S;
|
|
int num9 = inOff + 1;
|
|
num8 = num7;
|
|
num7 = this.RotateRight(num3, num8);
|
|
int[] s2 = this._S;
|
|
num3 = num6;
|
|
int num10;
|
|
num = this.RotateRight(num3, num10);
|
|
int[] s3 = this._S;
|
|
int num11 = s3[0];
|
|
num -= num11;
|
|
int num12 = RC6Engine.bytesPerWord;
|
|
int num13 = RC6Engine.bytesPerWord;
|
|
num13 += typeof(RC6Engine).TypeHandle;
|
|
return RC6Engine.bytesPerWord;
|
|
}
|
|
|
|
// Token: 0x06009C77 RID: 40055 RVA: 0x00237D00 File Offset: 0x00235F00
|
|
[Token(Token = "0x6009C77")]
|
|
[Address(RVA = "0x212E780", Offset = "0x212D180", VA = "0x18212E780")]
|
|
private int RotateLeft(int x, int y)
|
|
{
|
|
int num = RC6Engine.wordSize;
|
|
int num2 = num - 1;
|
|
num -= num2;
|
|
return x;
|
|
}
|
|
|
|
// Token: 0x06009C78 RID: 40056 RVA: 0x00237D20 File Offset: 0x00235F20
|
|
[Token(Token = "0x6009C78")]
|
|
[Address(RVA = "0x212E800", Offset = "0x212D200", VA = "0x18212E800")]
|
|
private int RotateRight(int x, int y)
|
|
{
|
|
int num = RC6Engine.wordSize;
|
|
int num2 = num - 1;
|
|
num -= num2;
|
|
return x;
|
|
}
|
|
|
|
// Token: 0x06009C79 RID: 40057 RVA: 0x00237D40 File Offset: 0x00235F40
|
|
[Token(Token = "0x6009C79")]
|
|
[Address(RVA = "0x212D910", Offset = "0x212C310", VA = "0x18212D910")]
|
|
private int BytesToWord(byte[] src, int srcOff)
|
|
{
|
|
int num = 0;
|
|
byte b = src[src];
|
|
return num + (int)b;
|
|
}
|
|
|
|
// Token: 0x06009C7A RID: 40058 RVA: 0x00237D64 File Offset: 0x00235F64
|
|
[Token(Token = "0x6009C7A")]
|
|
[Address(RVA = "0x212ED00", Offset = "0x212D700", VA = "0x18212ED00")]
|
|
private void WordToBytes(int word, byte[] dst, int dstOff)
|
|
{
|
|
}
|
|
|
|
// Token: 0x04006693 RID: 26259
|
|
[Token(Token = "0x4006693")]
|
|
private static readonly int wordSize;
|
|
|
|
// Token: 0x04006694 RID: 26260
|
|
[Token(Token = "0x4006694")]
|
|
private static readonly int bytesPerWord = RC6Engine.wordSize;
|
|
|
|
// Token: 0x04006695 RID: 26261
|
|
[Token(Token = "0x4006695")]
|
|
private static readonly int _noRounds;
|
|
|
|
// Token: 0x04006696 RID: 26262
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006696")]
|
|
private int[] _S;
|
|
|
|
// Token: 0x04006697 RID: 26263
|
|
[Token(Token = "0x4006697")]
|
|
private static readonly int P32;
|
|
|
|
// Token: 0x04006698 RID: 26264
|
|
[Token(Token = "0x4006698")]
|
|
private static readonly int Q32;
|
|
|
|
// Token: 0x04006699 RID: 26265
|
|
[Token(Token = "0x4006699")]
|
|
private static readonly int LGW;
|
|
|
|
// Token: 0x0400669A RID: 26266
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400669A")]
|
|
private bool forEncryption;
|
|
}
|
|
}
|