229 lines
14 KiB
C#
229 lines
14 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Digests;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC.Rfc8032;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs
|
|
{
|
|
// Token: 0x02001670 RID: 5744
|
|
[Token(Token = "0x2001670")]
|
|
[StructLayout(3)]
|
|
public class Dstu7564Mac : IMac
|
|
{
|
|
// Token: 0x1700188D RID: 6285
|
|
// (get) Token: 0x0600996D RID: 39277 RVA: 0x00221F38 File Offset: 0x00220138
|
|
[Token(Token = "0x1700188D")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600996D")]
|
|
[Address(RVA = "0x20E9630", Offset = "0x20E8030", VA = "0x1820E9630", Slot = "5")]
|
|
get
|
|
{
|
|
return "DSTU7564Mac";
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600996E RID: 39278 RVA: 0x00221F4C File Offset: 0x0022014C
|
|
[Token(Token = "0x600996E")]
|
|
[Address(RVA = "0x20E95B0", Offset = "0x20E7FB0", VA = "0x1820E95B0")]
|
|
public Dstu7564Mac(int macSizeBits)
|
|
{
|
|
Dstu7564Digest dstu7564Digest = new Dstu7564Digest(macSizeBits);
|
|
this.engine = dstu7564Digest;
|
|
this.macSize = macSizeBits;
|
|
}
|
|
|
|
// Token: 0x0600996F RID: 39279 RVA: 0x00221F74 File Offset: 0x00220174
|
|
[Token(Token = "0x600996F")]
|
|
[Address(RVA = "0x20E9000", Offset = "0x20E7A00", VA = "0x1820E9000", Slot = "4")]
|
|
public void Init(ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600996F)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs.Dstu7564Mac::Init(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_74:
|
|
stloc:ArgumentException(var_11_7E, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("Bad parameter passed")))
|
|
}
|
|
|
|
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: 0x06009970 RID: 39280 RVA: 0x00222000 File Offset: 0x00220200
|
|
[Token(Token = "0x6009970")]
|
|
[Address(RVA = "0x3EE8D0", Offset = "0x3ED2D0", VA = "0x1803EE8D0", Slot = "6")]
|
|
public int GetMacSize()
|
|
{
|
|
return this.macSize;
|
|
}
|
|
|
|
// Token: 0x06009971 RID: 39281 RVA: 0x00222014 File Offset: 0x00220214
|
|
[Token(Token = "0x6009971")]
|
|
[Address(RVA = "0x20E8CB0", Offset = "0x20E76B0", VA = "0x1820E8CB0", Slot = "8")]
|
|
public void BlockUpdate(byte[] input, int inOff, int len)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009971)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs.Dstu7564Mac::BlockUpdate(System.Byte[],System.Int32,System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_25:
|
|
stloc:InvalidOperationException(var_1_3A, newobj:InvalidOperationException(InvalidOperationException::.ctor, call:string(string::Concat, callgetter:string(Dstu7564Mac::get_AlgorithmName, ldloc:Dstu7564Mac(this)), ldstr:string(" 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: 0x06009972 RID: 39282 RVA: 0x0022205C File Offset: 0x0022025C
|
|
[Token(Token = "0x6009972")]
|
|
[Address(RVA = "0x20E9570", Offset = "0x20E7F70", VA = "0x1820E9570", Slot = "7")]
|
|
public void Update(byte input)
|
|
{
|
|
int byteLength = this.engine.GetByteLength();
|
|
}
|
|
|
|
// Token: 0x06009973 RID: 39283 RVA: 0x0022207C File Offset: 0x0022027C
|
|
[Token(Token = "0x6009973")]
|
|
[Address(RVA = "0x20E8DB0", Offset = "0x20E77B0", VA = "0x1820E8DB0", Slot = "9")]
|
|
public int DoFinal(byte[] output, int outOff)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009973)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs.Dstu7564Mac::DoFinal(System.Byte[],System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_C4:
|
|
stloc:InvalidOperationException(var_11_D9, newobj:InvalidOperationException(InvalidOperationException::.ctor, call:string(string::Concat, callgetter:string(Dstu7564Mac::get_AlgorithmName, ldloc:Dstu7564Mac(this)), ldstr:string(" 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: 0x06009974 RID: 39284 RVA: 0x00222164 File Offset: 0x00220364
|
|
[Token(Token = "0x6009974")]
|
|
[Address(RVA = "0x20E9500", Offset = "0x20E7F00", VA = "0x1820E9500", Slot = "10")]
|
|
public void Reset()
|
|
{
|
|
this.inputLength = (ulong)0L;
|
|
Dstu7564Digest dstu7564Digest = this.engine;
|
|
byte[] array = this.paddedKey;
|
|
if (array != 0)
|
|
{
|
|
this.engine.Update(array);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009975 RID: 39285 RVA: 0x002221A0 File Offset: 0x002203A0
|
|
[Token(Token = "0x6009975")]
|
|
[Address(RVA = "0x20E93D0", Offset = "0x20E7DD0", VA = "0x1820E93D0")]
|
|
private void Pad()
|
|
{
|
|
int num = this.engine.GetDigestSize();
|
|
int digestSize = this.engine.GetDigestSize();
|
|
int num2 = 0;
|
|
num -= num2;
|
|
if (num < 13)
|
|
{
|
|
int digestSize2 = this.engine.GetDigestSize();
|
|
num += digestSize2;
|
|
}
|
|
byte[] array = new byte[num];
|
|
array[0] = (byte)((ulong)128L);
|
|
int length = array.Length;
|
|
Pack.UInt64_To_LE(this.inputLength, array, length);
|
|
this.engine.Update(array);
|
|
}
|
|
|
|
// Token: 0x06009976 RID: 39286 RVA: 0x00222224 File Offset: 0x00220424
|
|
[Token(Token = "0x6009976")]
|
|
[Address(RVA = "0x20E9220", Offset = "0x20E7C20", VA = "0x1820E9220")]
|
|
private byte[] PadKey(byte[] input)
|
|
{
|
|
int num = this.engine.GetDigestSize();
|
|
int num2 = this.engine.GetDigestSize();
|
|
int digestSize = this.engine.GetDigestSize();
|
|
Dstu7564Digest dstu7564Digest = this.engine;
|
|
int num3 = input.Length;
|
|
num3 += num;
|
|
num2 = num3;
|
|
int num4 = num2 * digestSize;
|
|
int digestSize2 = dstu7564Digest.GetDigestSize();
|
|
Dstu7564Digest dstu7564Digest2 = this.engine;
|
|
num = digestSize2;
|
|
int digestSize3 = dstu7564Digest2.GetDigestSize();
|
|
if (num < 13)
|
|
{
|
|
int digestSize4 = this.engine.GetDigestSize();
|
|
num4 += digestSize4;
|
|
}
|
|
byte[] array = new byte[num4];
|
|
int length = input.Length;
|
|
int num5 = 0;
|
|
int num6 = 0;
|
|
Array.Copy(input, num6, array, num5, length);
|
|
int length2 = input.Length;
|
|
int length3 = array.Length;
|
|
Ed25519.Encode32((uint)input.Length, array, length3);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x040064BD RID: 25789
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40064BD")]
|
|
private Dstu7564Digest engine;
|
|
|
|
// Token: 0x040064BE RID: 25790
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40064BE")]
|
|
private int macSize;
|
|
|
|
// Token: 0x040064BF RID: 25791
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40064BF")]
|
|
private ulong inputLength;
|
|
|
|
// Token: 0x040064C0 RID: 25792
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40064C0")]
|
|
private byte[] paddedKey;
|
|
|
|
// Token: 0x040064C1 RID: 25793
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40064C1")]
|
|
private byte[] invertedKey;
|
|
}
|
|
}
|