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: 0x02001CAF RID: 7343
|
|
[Token(Token = "0x2001CAF")]
|
|
public class SkipjackEngine : IBlockCipher
|
|
{
|
|
// Token: 0x0600B8FE RID: 47358 RVA: 0x00294BE0 File Offset: 0x00292DE0
|
|
[Token(Token = "0x600B8FE")]
|
|
[Address(RVA = "0x1E08120", Offset = "0x1E06F20", VA = "0x181E08120", Slot = "10")]
|
|
public virtual void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B8FE)
|
|
|
|
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: 0x17001CF4 RID: 7412
|
|
// (get) Token: 0x0600B8FF RID: 47359 RVA: 0x00294D0C File Offset: 0x00292F0C
|
|
[Token(Token = "0x17001CF4")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B8FF")]
|
|
[Address(RVA = "0x1E08660", Offset = "0x1E07460", VA = "0x181E08660", Slot = "11")]
|
|
get
|
|
{
|
|
return "SKIPJACK";
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001CF5 RID: 7413
|
|
// (get) Token: 0x0600B900 RID: 47360 RVA: 0x00294D20 File Offset: 0x00292F20
|
|
[Token(Token = "0x17001CF5")]
|
|
public virtual bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x600B900")]
|
|
[Address(RVA = "0x403930", Offset = "0x402730", VA = "0x180403930", Slot = "12")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B901 RID: 47361 RVA: 0x00294D30 File Offset: 0x00292F30
|
|
[Token(Token = "0x600B901")]
|
|
[Address(RVA = "0x4101D0", Offset = "0x40EFD0", VA = "0x1804101D0", Slot = "13")]
|
|
public virtual int GetBlockSize()
|
|
{
|
|
return 8;
|
|
}
|
|
|
|
// Token: 0x0600B902 RID: 47362 RVA: 0x00294D40 File Offset: 0x00292F40
|
|
[Token(Token = "0x600B902")]
|
|
[Address(RVA = "0x1E084D0", Offset = "0x1E072D0", VA = "0x181E084D0", Slot = "14")]
|
|
public virtual int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B902)
|
|
|
|
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: 0x0600B903 RID: 47363 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x600B903")]
|
|
[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: 0x0600B904 RID: 47364 RVA: 0x00294D84 File Offset: 0x00292F84
|
|
[Token(Token = "0x600B904")]
|
|
[Address(RVA = "0x1E07D10", Offset = "0x1E06B10", VA = "0x181E07D10")]
|
|
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: 0x0600B905 RID: 47365 RVA: 0x00294DE4 File Offset: 0x00292FE4
|
|
[Token(Token = "0x600B905")]
|
|
[Address(RVA = "0x1E079C0", Offset = "0x1E067C0", VA = "0x181E079C0", 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: 0x0600B906 RID: 47366 RVA: 0x00294E58 File Offset: 0x00293058
|
|
[Token(Token = "0x600B906")]
|
|
[Address(RVA = "0x1E07F10", Offset = "0x1E06D10", VA = "0x181E07F10")]
|
|
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: 0x0600B907 RID: 47367 RVA: 0x00294EB0 File Offset: 0x002930B0
|
|
[Token(Token = "0x600B907")]
|
|
[Address(RVA = "0x1E07660", Offset = "0x1E06460", VA = "0x181E07660", 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: 0x0600B908 RID: 47368 RVA: 0x00294F20 File Offset: 0x00293120
|
|
[Token(Token = "0x600B908")]
|
|
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
|
|
public SkipjackEngine()
|
|
{
|
|
this.Reset();
|
|
}
|
|
|
|
// Token: 0x0600B909 RID: 47369 RVA: 0x00294F34 File Offset: 0x00293134
|
|
// Note: this type is marked as 'beforefieldinit'.
|
|
[Token(Token = "0x600B909")]
|
|
[Address(RVA = "0x1E08600", Offset = "0x1E07400", VA = "0x181E08600")]
|
|
static SkipjackEngine()
|
|
{
|
|
short[] array = new short[256];
|
|
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.21A3E0CD2847E2F12EEE37749A9E206494A55100).FieldHandle);
|
|
SkipjackEngine.ftable = array;
|
|
}
|
|
|
|
// Token: 0x04007530 RID: 30000
|
|
[Token(Token = "0x4007530")]
|
|
private const int BLOCK_SIZE = 8;
|
|
|
|
// Token: 0x04007531 RID: 30001
|
|
[Token(Token = "0x4007531")]
|
|
private static readonly short[] ftable;
|
|
|
|
// Token: 0x04007532 RID: 30002
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007532")]
|
|
private int[] key0;
|
|
|
|
// Token: 0x04007533 RID: 30003
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007533")]
|
|
private int[] key1;
|
|
|
|
// Token: 0x04007534 RID: 30004
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007534")]
|
|
private int[] key2;
|
|
|
|
// Token: 0x04007535 RID: 30005
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007535")]
|
|
private int[] key3;
|
|
|
|
// Token: 0x04007536 RID: 30006
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4007536")]
|
|
private bool encrypting;
|
|
}
|
|
}
|