262 lines
12 KiB
C#
262 lines
12 KiB
C#
using System;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Paddings;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs
|
|
{
|
|
// Token: 0x02001D29 RID: 7465
|
|
[Token(Token = "0x2001D29")]
|
|
public class CMac : IMac
|
|
{
|
|
// Token: 0x0600B8EC RID: 47340 RVA: 0x00281AEC File Offset: 0x0027FCEC
|
|
[Token(Token = "0x600B8EC")]
|
|
[Address(RVA = "0x25B1740", Offset = "0x25B0740", VA = "0x1825B1740")]
|
|
public CMac(IBlockCipher cipher)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600B8ED RID: 47341 RVA: 0x00281B00 File Offset: 0x0027FD00
|
|
[Token(Token = "0x600B8ED")]
|
|
[Address(RVA = "0x25B17B0", Offset = "0x25B07B0", VA = "0x1825B17B0")]
|
|
public CMac(IBlockCipher cipher, int macSizeInBits)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B8ED)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs.CMac::.ctor(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IBlockCipher,System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_63:
|
|
stloc:ArgumentException(var_6_6D, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("Block size must be either 64 or 128 bits")))
|
|
}
|
|
|
|
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: 0x17001D26 RID: 7462
|
|
// (get) Token: 0x0600B8EE RID: 47342 RVA: 0x00281B7C File Offset: 0x0027FD7C
|
|
[Token(Token = "0x17001D26")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B8EE")]
|
|
[Address(RVA = "0x25B1A10", Offset = "0x25B0A10", VA = "0x1825B1A10", Slot = "5")]
|
|
get
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B8EF RID: 47343 RVA: 0x00281B98 File Offset: 0x0027FD98
|
|
[Token(Token = "0x600B8EF")]
|
|
[Address(RVA = "0x25B1610", Offset = "0x25B0610", VA = "0x1825B1610")]
|
|
private static int ShiftLeft(byte[] block, byte[] output)
|
|
{
|
|
int length = block.Length;
|
|
byte b;
|
|
b += b;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600B8F0 RID: 47344 RVA: 0x00281BB8 File Offset: 0x0027FDB8
|
|
[Token(Token = "0x600B8F0")]
|
|
[Address(RVA = "0x25B12E0", Offset = "0x25B02E0", VA = "0x1825B12E0")]
|
|
private static byte[] DoubleLu(byte[] input)
|
|
{
|
|
byte[] array = new byte[input.Length];
|
|
int num = input.Length - 1;
|
|
byte b;
|
|
b += b;
|
|
num = input.Length;
|
|
uint num2;
|
|
num2 -= (uint)b;
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x0600B8F1 RID: 47345 RVA: 0x00281BF0 File Offset: 0x0027FDF0
|
|
[Token(Token = "0x600B8F1")]
|
|
[Address(RVA = "0x25B13F0", Offset = "0x25B03F0", VA = "0x1825B13F0", Slot = "4")]
|
|
public void Init(ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B8F1)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs.CMac::Init(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_8F:
|
|
stloc:ArgumentException(var_12_9E, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("CMac mode only permits key to be set."), ldstr:string("parameters")))
|
|
}
|
|
|
|
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.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: 0x0600B8F2 RID: 47346 RVA: 0x00281C9C File Offset: 0x0027FE9C
|
|
[Token(Token = "0x600B8F2")]
|
|
[Address(RVA = "0x42B830", Offset = "0x42A830", VA = "0x18042B830", Slot = "6")]
|
|
public int GetMacSize()
|
|
{
|
|
return this.macSize;
|
|
}
|
|
|
|
// Token: 0x0600B8F3 RID: 47347 RVA: 0x00281CB0 File Offset: 0x0027FEB0
|
|
[Token(Token = "0x600B8F3")]
|
|
[Address(RVA = "0x25B1690", Offset = "0x25B0690", VA = "0x1825B1690", Slot = "7")]
|
|
public void Update(byte input)
|
|
{
|
|
byte[] array = this.buf;
|
|
int num = this.bufOff;
|
|
if (num == array.Length)
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
byte[] array2 = this.mac;
|
|
}
|
|
int num2 = num + 1;
|
|
this.bufOff = num2;
|
|
}
|
|
|
|
// Token: 0x0600B8F4 RID: 47348 RVA: 0x00281CFC File Offset: 0x0027FEFC
|
|
[Token(Token = "0x600B8F4")]
|
|
[Address(RVA = "0x25B0EF0", Offset = "0x25AFEF0", VA = "0x1825B0EF0", Slot = "8")]
|
|
public void BlockUpdate(byte[] inBytes, int inOff, int len)
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
int num = this.bufOff;
|
|
int num2 = 0;
|
|
IBlockCipher blockCipher2 = this.cipher;
|
|
byte[] array = this.mac;
|
|
this.bufOff = num2;
|
|
IBlockCipher blockCipher3 = this.cipher;
|
|
if (num2 < blockCipher2)
|
|
{
|
|
num2 += num2;
|
|
num2++;
|
|
}
|
|
byte[] array2 = this.buf;
|
|
Array.Copy(inBytes, inOff, array2, num, len);
|
|
}
|
|
|
|
// Token: 0x0600B8F5 RID: 47349 RVA: 0x00281D64 File Offset: 0x0027FF64
|
|
[Token(Token = "0x600B8F5")]
|
|
[Address(RVA = "0x25B1100", Offset = "0x25B0100", VA = "0x1825B1100", Slot = "9")]
|
|
public int DoFinal(byte[] outBytes, int outOff)
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
ISO7816d4Padding iso7816d4Padding = new ISO7816d4Padding();
|
|
int num = this.bufOff;
|
|
byte[] array = this.buf;
|
|
int num2 = iso7816d4Padding.AddPadding(array, num);
|
|
byte[] lu = this.Lu;
|
|
byte[] array2 = this.mac;
|
|
int num3 = 0;
|
|
if (num3 < array2.Length)
|
|
{
|
|
byte[] array3 = this.buf;
|
|
num3++;
|
|
byte[] array4 = this.mac;
|
|
}
|
|
IBlockCipher blockCipher2 = this.cipher;
|
|
int num4 = this.macSize;
|
|
byte[] array5 = this.mac;
|
|
int num5 = 0;
|
|
Array.Copy(array5, num5, outBytes, outOff, num4);
|
|
byte[] array6 = this.buf;
|
|
int length = array6.Length;
|
|
int num6 = 0;
|
|
Array.Clear(array6, num6, length);
|
|
IBlockCipher blockCipher3 = this.cipher;
|
|
this.bufOff = num3;
|
|
return this.macSize;
|
|
}
|
|
|
|
// Token: 0x0600B8F6 RID: 47350 RVA: 0x00281E30 File Offset: 0x00280030
|
|
[Token(Token = "0x600B8F6")]
|
|
[Address(RVA = "0x25B15A0", Offset = "0x25B05A0", VA = "0x1825B15A0", Slot = "10")]
|
|
public void Reset()
|
|
{
|
|
byte[] array = this.buf;
|
|
int length = array.Length;
|
|
int num = 0;
|
|
Array.Clear(array, num, length);
|
|
IBlockCipher blockCipher = this.cipher;
|
|
this.bufOff = (int)((ulong)0L);
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0400749E RID: 29854
|
|
[Token(Token = "0x400749E")]
|
|
private const byte CONSTANT_128 = 135;
|
|
|
|
// Token: 0x0400749F RID: 29855
|
|
[Token(Token = "0x400749F")]
|
|
private const byte CONSTANT_64 = 27;
|
|
|
|
// Token: 0x040074A0 RID: 29856
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40074A0")]
|
|
private byte[] ZEROES;
|
|
|
|
// Token: 0x040074A1 RID: 29857
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40074A1")]
|
|
private byte[] mac;
|
|
|
|
// Token: 0x040074A2 RID: 29858
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40074A2")]
|
|
private byte[] buf;
|
|
|
|
// Token: 0x040074A3 RID: 29859
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40074A3")]
|
|
private int bufOff;
|
|
|
|
// Token: 0x040074A4 RID: 29860
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40074A4")]
|
|
private IBlockCipher cipher;
|
|
|
|
// Token: 0x040074A5 RID: 29861
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x40074A5")]
|
|
private int macSize;
|
|
|
|
// Token: 0x040074A6 RID: 29862
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x40074A6")]
|
|
private byte[] L;
|
|
|
|
// Token: 0x040074A7 RID: 29863
|
|
[FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x40074A7")]
|
|
private byte[] Lu;
|
|
|
|
// Token: 0x040074A8 RID: 29864
|
|
[FieldOffset(Offset = "0x50")]
|
|
[Token(Token = "0x40074A8")]
|
|
private byte[] Lu2;
|
|
}
|
|
}
|