260 lines
12 KiB
C#
260 lines
12 KiB
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
|
|
{
|
|
// Token: 0x02001D8F RID: 7567
|
|
[Token(Token = "0x2001D8F")]
|
|
public class SkipjackEngine : IBlockCipher
|
|
{
|
|
// Token: 0x0600BCCC RID: 48332 RVA: 0x0029DCF4 File Offset: 0x0029BEF4
|
|
[Token(Token = "0x600BCCC")]
|
|
[Address(RVA = "0x2744EA0", Offset = "0x2743EA0", VA = "0x182744EA0", Slot = "10")]
|
|
public virtual void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600BCCC)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.SkipjackEngine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_10A:
|
|
stloc:ArgumentException(var_26_11B, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("invalid parameter passed to SKIPJACK init - "), ldloc:string(var_25))))
|
|
}
|
|
|
|
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: 0x17001D91 RID: 7569
|
|
// (get) Token: 0x0600BCCD RID: 48333 RVA: 0x0029DE20 File Offset: 0x0029C020
|
|
[Token(Token = "0x17001D91")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600BCCD")]
|
|
[Address(RVA = "0x27453E0", Offset = "0x27443E0", VA = "0x1827453E0", Slot = "11")]
|
|
get
|
|
{
|
|
return "SKIPJACK";
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001D92 RID: 7570
|
|
// (get) Token: 0x0600BCCE RID: 48334 RVA: 0x0029DE34 File Offset: 0x0029C034
|
|
[Token(Token = "0x17001D92")]
|
|
public virtual bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x600BCCE")]
|
|
[Address(RVA = "0x424690", Offset = "0x423690", VA = "0x180424690", Slot = "12")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600BCCF RID: 48335 RVA: 0x0029DE44 File Offset: 0x0029C044
|
|
[Token(Token = "0x600BCCF")]
|
|
[Address(RVA = "0x681E00", Offset = "0x680E00", VA = "0x180681E00", Slot = "13")]
|
|
public virtual int GetBlockSize()
|
|
{
|
|
return 8;
|
|
}
|
|
|
|
// Token: 0x0600BCD0 RID: 48336 RVA: 0x0029DE54 File Offset: 0x0029C054
|
|
[Token(Token = "0x600BCD0")]
|
|
[Address(RVA = "0x2745250", Offset = "0x2744250", VA = "0x182745250", Slot = "14")]
|
|
public virtual int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600BCD0)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.SkipjackEngine::ProcessBlock(System.Byte[],System.Int32,System.Byte[],System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_2B:
|
|
stloc:InvalidOperationException(var_2_35, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("SKIPJACK 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.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
|
|
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: 0x0600BCD1 RID: 48337 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x600BCD1")]
|
|
[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: 0x0600BCD2 RID: 48338 RVA: 0x0029DE98 File Offset: 0x0029C098
|
|
[Token(Token = "0x600BCD2")]
|
|
[Address(RVA = "0x2744A90", Offset = "0x2743A90", VA = "0x182744A90")]
|
|
private int G(int k, int w)
|
|
{
|
|
short[] array = SkipjackEngine.ftable;
|
|
int num = this.key0[k];
|
|
int length = array.Length;
|
|
int num2 = this.key1[k];
|
|
int num3 = this.key2[k];
|
|
int num4 = this.key3[k];
|
|
return num3 + num3;
|
|
}
|
|
|
|
// Token: 0x0600BCD3 RID: 48339 RVA: 0x0029DEF8 File Offset: 0x0029C0F8
|
|
[Token(Token = "0x600BCD3")]
|
|
[Address(RVA = "0x2744740", Offset = "0x2743740", VA = "0x182744740", Slot = "16")]
|
|
public virtual int EncryptBlock(byte[] input, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
int length = input.Length;
|
|
int num = inOff + 1;
|
|
byte b;
|
|
byte b2;
|
|
b += b2;
|
|
byte b3;
|
|
b3 += b2;
|
|
byte b4;
|
|
b4 += b2;
|
|
byte b5;
|
|
b5 += b2;
|
|
int num2 = 0;
|
|
b5 = b4;
|
|
b4 = b3;
|
|
int num3 = this.G(num2, (int)b);
|
|
num2++;
|
|
while (inOff != length)
|
|
{
|
|
}
|
|
b5 = b4;
|
|
int num4 = this.G(num2, num2);
|
|
num2++;
|
|
while (inOff != length)
|
|
{
|
|
}
|
|
while (inOff != length)
|
|
{
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600BCD4 RID: 48340 RVA: 0x0029DF6C File Offset: 0x0029C16C
|
|
[Token(Token = "0x600BCD4")]
|
|
[Address(RVA = "0x2744C90", Offset = "0x2743C90", VA = "0x182744C90")]
|
|
private int H(int k, int w)
|
|
{
|
|
short[] array = SkipjackEngine.ftable;
|
|
int num = this.key3[k];
|
|
int length = array.Length;
|
|
int num2 = this.key2[k];
|
|
int num3 = this.key1[k];
|
|
int num4 = this.key0[k];
|
|
return w;
|
|
}
|
|
|
|
// Token: 0x0600BCD5 RID: 48341 RVA: 0x0029DFC4 File Offset: 0x0029C1C4
|
|
[Token(Token = "0x600BCD5")]
|
|
[Address(RVA = "0x27443E0", Offset = "0x27433E0", VA = "0x1827443E0", Slot = "17")]
|
|
public virtual int DecryptBlock(byte[] input, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
int length = input.Length;
|
|
int num = inOff + 1;
|
|
byte b;
|
|
byte b2;
|
|
b += b2;
|
|
byte b3;
|
|
b3 += b2;
|
|
byte b4;
|
|
b4 += b2;
|
|
byte b5;
|
|
b5 += b2;
|
|
b4 = b5;
|
|
b5 = b;
|
|
uint num3;
|
|
int num2 = this.H((int)num3, (int)b3);
|
|
uint num4 = num3 + 1U;
|
|
while (inOff != length)
|
|
{
|
|
}
|
|
uint num5 = num3 + 1U;
|
|
b4 = b5;
|
|
int num6 = this.H((int)num3, (int)num4);
|
|
while (inOff != length)
|
|
{
|
|
}
|
|
while (inOff != length)
|
|
{
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600BCD6 RID: 48342 RVA: 0x0029E034 File Offset: 0x0029C234
|
|
[Token(Token = "0x600BCD6")]
|
|
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
|
public SkipjackEngine()
|
|
{
|
|
this.Reset();
|
|
}
|
|
|
|
// Token: 0x0600BCD7 RID: 48343 RVA: 0x0029E048 File Offset: 0x0029C248
|
|
// Note: this type is marked as 'beforefieldinit'.
|
|
[Token(Token = "0x600BCD7")]
|
|
[Address(RVA = "0x2745380", Offset = "0x2744380", VA = "0x182745380")]
|
|
static SkipjackEngine()
|
|
{
|
|
short[] array = new short[256];
|
|
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.21A3E0CD2847E2F12EEE37749A9E206494A55100).FieldHandle);
|
|
SkipjackEngine.ftable = array;
|
|
}
|
|
|
|
// Token: 0x040076E9 RID: 30441
|
|
[Token(Token = "0x40076E9")]
|
|
private const int BLOCK_SIZE = 8;
|
|
|
|
// Token: 0x040076EA RID: 30442
|
|
[Token(Token = "0x40076EA")]
|
|
private static readonly short[] ftable;
|
|
|
|
// Token: 0x040076EB RID: 30443
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40076EB")]
|
|
private int[] key0;
|
|
|
|
// Token: 0x040076EC RID: 30444
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40076EC")]
|
|
private int[] key1;
|
|
|
|
// Token: 0x040076ED RID: 30445
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40076ED")]
|
|
private int[] key2;
|
|
|
|
// Token: 0x040076EE RID: 30446
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40076EE")]
|
|
private int[] key3;
|
|
|
|
// Token: 0x040076EF RID: 30447
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40076EF")]
|
|
private bool encrypting;
|
|
}
|
|
}
|