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: 0x02001C49 RID: 7241
|
|
[Token(Token = "0x2001C49")]
|
|
public class CMac : IMac
|
|
{
|
|
// Token: 0x0600B51E RID: 46366 RVA: 0x00278950 File Offset: 0x00276B50
|
|
[Token(Token = "0x600B51E")]
|
|
[Address(RVA = "0x1C1A7A0", Offset = "0x1C195A0", VA = "0x181C1A7A0")]
|
|
public CMac(IBlockCipher cipher)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600B51F RID: 46367 RVA: 0x00278964 File Offset: 0x00276B64
|
|
[Token(Token = "0x600B51F")]
|
|
[Address(RVA = "0x1C1A810", Offset = "0x1C19610", VA = "0x181C1A810")]
|
|
public CMac(IBlockCipher cipher, int macSizeInBits)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B51F)
|
|
|
|
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: 0x17001C89 RID: 7305
|
|
// (get) Token: 0x0600B520 RID: 46368 RVA: 0x002789E0 File Offset: 0x00276BE0
|
|
[Token(Token = "0x17001C89")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B520")]
|
|
[Address(RVA = "0x1C1AA70", Offset = "0x1C19870", VA = "0x181C1AA70", Slot = "5")]
|
|
get
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B521 RID: 46369 RVA: 0x002789FC File Offset: 0x00276BFC
|
|
[Token(Token = "0x600B521")]
|
|
[Address(RVA = "0x1C1A670", Offset = "0x1C19470", VA = "0x181C1A670")]
|
|
private static int ShiftLeft(byte[] block, byte[] output)
|
|
{
|
|
int length = block.Length;
|
|
byte b;
|
|
b += b;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600B522 RID: 46370 RVA: 0x00278A1C File Offset: 0x00276C1C
|
|
[Token(Token = "0x600B522")]
|
|
[Address(RVA = "0x1C1A340", Offset = "0x1C19140", VA = "0x181C1A340")]
|
|
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: 0x0600B523 RID: 46371 RVA: 0x00278A54 File Offset: 0x00276C54
|
|
[Token(Token = "0x600B523")]
|
|
[Address(RVA = "0x1C1A450", Offset = "0x1C19250", VA = "0x181C1A450", Slot = "4")]
|
|
public void Init(ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B523)
|
|
|
|
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: 0x0600B524 RID: 46372 RVA: 0x00278B00 File Offset: 0x00276D00
|
|
[Token(Token = "0x600B524")]
|
|
[Address(RVA = "0x40FFE0", Offset = "0x40EDE0", VA = "0x18040FFE0", Slot = "6")]
|
|
public int GetMacSize()
|
|
{
|
|
return this.macSize;
|
|
}
|
|
|
|
// Token: 0x0600B525 RID: 46373 RVA: 0x00278B14 File Offset: 0x00276D14
|
|
[Token(Token = "0x600B525")]
|
|
[Address(RVA = "0x1C1A6F0", Offset = "0x1C194F0", VA = "0x181C1A6F0", 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: 0x0600B526 RID: 46374 RVA: 0x00278B60 File Offset: 0x00276D60
|
|
[Token(Token = "0x600B526")]
|
|
[Address(RVA = "0x1C19F50", Offset = "0x1C18D50", VA = "0x181C19F50", 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: 0x0600B527 RID: 46375 RVA: 0x00278BC8 File Offset: 0x00276DC8
|
|
[Token(Token = "0x600B527")]
|
|
[Address(RVA = "0x1C1A160", Offset = "0x1C18F60", VA = "0x181C1A160", 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: 0x0600B528 RID: 46376 RVA: 0x00278C94 File Offset: 0x00276E94
|
|
[Token(Token = "0x600B528")]
|
|
[Address(RVA = "0x1C1A600", Offset = "0x1C19400", VA = "0x181C1A600", 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: 0x040072E5 RID: 29413
|
|
[Token(Token = "0x40072E5")]
|
|
private const byte CONSTANT_128 = 135;
|
|
|
|
// Token: 0x040072E6 RID: 29414
|
|
[Token(Token = "0x40072E6")]
|
|
private const byte CONSTANT_64 = 27;
|
|
|
|
// Token: 0x040072E7 RID: 29415
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40072E7")]
|
|
private byte[] ZEROES;
|
|
|
|
// Token: 0x040072E8 RID: 29416
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40072E8")]
|
|
private byte[] mac;
|
|
|
|
// Token: 0x040072E9 RID: 29417
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40072E9")]
|
|
private byte[] buf;
|
|
|
|
// Token: 0x040072EA RID: 29418
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40072EA")]
|
|
private int bufOff;
|
|
|
|
// Token: 0x040072EB RID: 29419
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40072EB")]
|
|
private IBlockCipher cipher;
|
|
|
|
// Token: 0x040072EC RID: 29420
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x40072EC")]
|
|
private int macSize;
|
|
|
|
// Token: 0x040072ED RID: 29421
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x40072ED")]
|
|
private byte[] L;
|
|
|
|
// Token: 0x040072EE RID: 29422
|
|
[FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x40072EE")]
|
|
private byte[] Lu;
|
|
|
|
// Token: 0x040072EF RID: 29423
|
|
[FieldOffset(Offset = "0x50")]
|
|
[Token(Token = "0x40072EF")]
|
|
private byte[] Lu2;
|
|
}
|
|
}
|