227 lines
13 KiB
C#
227 lines
13 KiB
C#
using System;
|
|
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: 0x02001C4D RID: 7245
|
|
[Token(Token = "0x2001C4D")]
|
|
public class Dstu7564Mac : IMac
|
|
{
|
|
// Token: 0x17001C8E RID: 7310
|
|
// (get) Token: 0x0600B547 RID: 46407 RVA: 0x00279550 File Offset: 0x00277750
|
|
[Token(Token = "0x17001C8E")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B547")]
|
|
[Address(RVA = "0x1C206C0", Offset = "0x1C1F4C0", VA = "0x181C206C0", Slot = "5")]
|
|
get
|
|
{
|
|
return "DSTU7564Mac";
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B548 RID: 46408 RVA: 0x00279564 File Offset: 0x00277764
|
|
[Token(Token = "0x600B548")]
|
|
[Address(RVA = "0x1C20640", Offset = "0x1C1F440", VA = "0x181C20640")]
|
|
public Dstu7564Mac(int macSizeBits)
|
|
{
|
|
Dstu7564Digest dstu7564Digest = new Dstu7564Digest(macSizeBits);
|
|
this.engine = dstu7564Digest;
|
|
this.macSize = macSizeBits;
|
|
}
|
|
|
|
// Token: 0x0600B549 RID: 46409 RVA: 0x0027958C File Offset: 0x0027778C
|
|
[Token(Token = "0x600B549")]
|
|
[Address(RVA = "0x1C20090", Offset = "0x1C1EE90", VA = "0x181C20090", Slot = "4")]
|
|
public void Init(ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B549)
|
|
|
|
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 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600B54A RID: 46410 RVA: 0x00279618 File Offset: 0x00277818
|
|
[Token(Token = "0x600B54A")]
|
|
[Address(RVA = "0x40B720", Offset = "0x40A520", VA = "0x18040B720", Slot = "6")]
|
|
public int GetMacSize()
|
|
{
|
|
return this.macSize;
|
|
}
|
|
|
|
// Token: 0x0600B54B RID: 46411 RVA: 0x0027962C File Offset: 0x0027782C
|
|
[Token(Token = "0x600B54B")]
|
|
[Address(RVA = "0x1C1FD40", Offset = "0x1C1EB40", VA = "0x181C1FD40", Slot = "8")]
|
|
public void BlockUpdate(byte[] input, int inOff, int len)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B54B)
|
|
|
|
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 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600B54C RID: 46412 RVA: 0x00279674 File Offset: 0x00277874
|
|
[Token(Token = "0x600B54C")]
|
|
[Address(RVA = "0x1C20600", Offset = "0x1C1F400", VA = "0x181C20600", Slot = "7")]
|
|
public void Update(byte input)
|
|
{
|
|
int byteLength = this.engine.GetByteLength();
|
|
}
|
|
|
|
// Token: 0x0600B54D RID: 46413 RVA: 0x00279694 File Offset: 0x00277894
|
|
[Token(Token = "0x600B54D")]
|
|
[Address(RVA = "0x1C1FE40", Offset = "0x1C1EC40", VA = "0x181C1FE40", Slot = "9")]
|
|
public int DoFinal(byte[] output, int outOff)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B54D)
|
|
|
|
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 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600B54E RID: 46414 RVA: 0x0027977C File Offset: 0x0027797C
|
|
[Token(Token = "0x600B54E")]
|
|
[Address(RVA = "0x1C20590", Offset = "0x1C1F390", VA = "0x181C20590", 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: 0x0600B54F RID: 46415 RVA: 0x002797B8 File Offset: 0x002779B8
|
|
[Token(Token = "0x600B54F")]
|
|
[Address(RVA = "0x1C20460", Offset = "0x1C1F260", VA = "0x181C20460")]
|
|
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: 0x0600B550 RID: 46416 RVA: 0x0027983C File Offset: 0x00277A3C
|
|
[Token(Token = "0x600B550")]
|
|
[Address(RVA = "0x1C202B0", Offset = "0x1C1F0B0", VA = "0x181C202B0")]
|
|
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: 0x04007300 RID: 29440
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007300")]
|
|
private Dstu7564Digest engine;
|
|
|
|
// Token: 0x04007301 RID: 29441
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007301")]
|
|
private int macSize;
|
|
|
|
// Token: 0x04007302 RID: 29442
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007302")]
|
|
private ulong inputLength;
|
|
|
|
// Token: 0x04007303 RID: 29443
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007303")]
|
|
private byte[] paddedKey;
|
|
|
|
// Token: 0x04007304 RID: 29444
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4007304")]
|
|
private byte[] invertedKey;
|
|
}
|
|
}
|