246 lines
12 KiB
C#
246 lines
12 KiB
C#
using System;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs
|
|
{
|
|
// Token: 0x02001D2E RID: 7470
|
|
[Token(Token = "0x2001D2E")]
|
|
public class Dstu7624Mac : IMac
|
|
{
|
|
// Token: 0x0600B91F RID: 47391 RVA: 0x00282AA8 File Offset: 0x00280CA8
|
|
[Token(Token = "0x600B91F")]
|
|
[Address(RVA = "0x25B7DB0", Offset = "0x25B6DB0", VA = "0x1825B7DB0")]
|
|
public Dstu7624Mac(int blockSizeBits, int q)
|
|
{
|
|
Dstu7624Engine dstu7624Engine = new Dstu7624Engine(blockSizeBits);
|
|
this.engine = dstu7624Engine;
|
|
this.blockSize = dstu7624Engine;
|
|
this.macSize = blockSizeBits;
|
|
byte[] array = new byte[dstu7624Engine];
|
|
int num = this.blockSize;
|
|
this.c = array;
|
|
byte[] array2 = new byte[num];
|
|
int num2 = this.blockSize;
|
|
this.cTemp = array2;
|
|
byte[] array3 = new byte[num2];
|
|
int num3 = this.blockSize;
|
|
this.kDelta = array3;
|
|
byte[] array4 = new byte[num3];
|
|
this.buf = array4;
|
|
}
|
|
|
|
// Token: 0x0600B920 RID: 47392 RVA: 0x00282B2C File Offset: 0x00280D2C
|
|
[Token(Token = "0x600B920")]
|
|
[Address(RVA = "0x25B79B0", Offset = "0x25B69B0", VA = "0x1825B79B0", Slot = "4")]
|
|
public void Init(ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B920)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs.Dstu7624Mac::Init(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_25:
|
|
stloc:ArgumentException(var_6_36, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("invalid parameter passed to Dstu7624Mac init - "), ldloc:string(var_5))))
|
|
}
|
|
|
|
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: 0x17001D2C RID: 7468
|
|
// (get) Token: 0x0600B921 RID: 47393 RVA: 0x00282B70 File Offset: 0x00280D70
|
|
[Token(Token = "0x17001D2C")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B921")]
|
|
[Address(RVA = "0x25B7E90", Offset = "0x25B6E90", VA = "0x1825B7E90", Slot = "5")]
|
|
get
|
|
{
|
|
return "Dstu7624Mac";
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B922 RID: 47394 RVA: 0x00282B84 File Offset: 0x00280D84
|
|
[Token(Token = "0x600B922")]
|
|
[Address(RVA = "0x40F000", Offset = "0x40E000", VA = "0x18040F000", Slot = "6")]
|
|
public int GetMacSize()
|
|
{
|
|
return this.macSize;
|
|
}
|
|
|
|
// Token: 0x0600B923 RID: 47395 RVA: 0x00282B98 File Offset: 0x00280D98
|
|
[Token(Token = "0x600B923")]
|
|
[Address(RVA = "0x25B7C20", Offset = "0x25B6C20", VA = "0x1825B7C20", Slot = "7")]
|
|
public void Update(byte input)
|
|
{
|
|
byte[] array = this.buf;
|
|
int num = this.bufOff;
|
|
if (num == array.Length)
|
|
{
|
|
byte[] array2 = this.cTemp;
|
|
int num2 = 0;
|
|
byte[] array3 = this.c;
|
|
int num3 = 0;
|
|
this.Xor(array3, num3, array, num2, array2);
|
|
Dstu7624Engine dstu7624Engine = this.engine;
|
|
}
|
|
int num4 = num + 1;
|
|
this.bufOff = num4;
|
|
}
|
|
|
|
// Token: 0x0600B924 RID: 47396 RVA: 0x00282BFC File Offset: 0x00280DFC
|
|
[Token(Token = "0x600B924")]
|
|
[Address(RVA = "0x25B7690", Offset = "0x25B6690", VA = "0x1825B7690", Slot = "8")]
|
|
public void BlockUpdate(byte[] input, int inOff, int len)
|
|
{
|
|
string text = this.engine.AlgorithmName;
|
|
int num = this.bufOff;
|
|
int num2 = 0;
|
|
text -= num;
|
|
if (len > text)
|
|
{
|
|
byte[] array = this.buf;
|
|
int num3 = 0;
|
|
this.processBlock(array, num3);
|
|
this.bufOff = num2;
|
|
if (len > text)
|
|
{
|
|
byte[] array2 = this.cTemp;
|
|
byte[] array3 = this.c;
|
|
int num4 = 0;
|
|
this.Xor(array3, num4, input, inOff, array2);
|
|
Dstu7624Engine dstu7624Engine = this.engine;
|
|
}
|
|
}
|
|
byte[] array4 = this.buf;
|
|
Array.Copy(input, inOff, array4, num, len);
|
|
}
|
|
|
|
// Token: 0x0600B925 RID: 47397 RVA: 0x00282C8C File Offset: 0x00280E8C
|
|
[Token(Token = "0x600B925")]
|
|
[Address(RVA = "0x25B7EC0", Offset = "0x25B6EC0", VA = "0x1825B7EC0")]
|
|
private void processBlock(byte[] input, int inOff)
|
|
{
|
|
byte[] array = this.cTemp;
|
|
byte[] array2 = this.c;
|
|
int num = 0;
|
|
this.Xor(array2, num, input, inOff, array);
|
|
Dstu7624Engine dstu7624Engine = this.engine;
|
|
}
|
|
|
|
// Token: 0x0600B926 RID: 47398 RVA: 0x00282CC4 File Offset: 0x00280EC4
|
|
[Token(Token = "0x600B926")]
|
|
[Address(RVA = "0x25B7CE0", Offset = "0x25B6CE0", VA = "0x1825B7CE0")]
|
|
private void Xor(byte[] c, int cOff, byte[] input, int inOff, byte[] xorResult)
|
|
{
|
|
if (this.blockSize > 0)
|
|
{
|
|
byte b;
|
|
input[0] = b;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B927 RID: 47399 RVA: 0x00282CE8 File Offset: 0x00280EE8
|
|
[Token(Token = "0x600B927")]
|
|
[Address(RVA = "0x25B7830", Offset = "0x25B6830", VA = "0x1825B7830", Slot = "9")]
|
|
public int DoFinal(byte[] output, int outOff)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B927)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs.Dstu7624Mac::DoFinal(System.Byte[],System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_89:
|
|
stloc:DataLengthException(var_13_93, newobj:DataLengthException(DataLengthException::.ctor, ldstr:string("Input must be a multiple of blocksize")))
|
|
}
|
|
|
|
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: 0x0600B928 RID: 47400 RVA: 0x00282D8C File Offset: 0x00280F8C
|
|
[Token(Token = "0x600B928")]
|
|
[Address(RVA = "0x25B7B40", Offset = "0x25B6B40", VA = "0x1825B7B40", Slot = "10")]
|
|
public void Reset()
|
|
{
|
|
byte[] array = this.c;
|
|
int num = 0;
|
|
Arrays.Fill(array, (byte)num);
|
|
byte[] array2 = this.cTemp;
|
|
int num2 = 0;
|
|
Arrays.Fill(array2, (byte)num2);
|
|
byte[] array3 = this.kDelta;
|
|
int num3 = 0;
|
|
Arrays.Fill(array3, (byte)num3);
|
|
byte[] array4 = this.buf;
|
|
int num4 = 0;
|
|
Arrays.Fill(array4, (byte)num4);
|
|
bool isPartialBlockOkay = this.engine.IsPartialBlockOkay;
|
|
Dstu7624Engine dstu7624Engine = this.engine;
|
|
int num5 = 0;
|
|
this.bufOff = num5;
|
|
}
|
|
|
|
// Token: 0x040074BE RID: 29886
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40074BE")]
|
|
private int macSize;
|
|
|
|
// Token: 0x040074BF RID: 29887
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40074BF")]
|
|
private Dstu7624Engine engine;
|
|
|
|
// Token: 0x040074C0 RID: 29888
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40074C0")]
|
|
private int blockSize;
|
|
|
|
// Token: 0x040074C1 RID: 29889
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40074C1")]
|
|
private byte[] c;
|
|
|
|
// Token: 0x040074C2 RID: 29890
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40074C2")]
|
|
private byte[] cTemp;
|
|
|
|
// Token: 0x040074C3 RID: 29891
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x40074C3")]
|
|
private byte[] kDelta;
|
|
|
|
// Token: 0x040074C4 RID: 29892
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x40074C4")]
|
|
private byte[] buf;
|
|
|
|
// Token: 0x040074C5 RID: 29893
|
|
[FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x40074C5")]
|
|
private int bufOff;
|
|
}
|
|
}
|