239 lines
10 KiB
C#
239 lines
10 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Paddings;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs
|
|
{
|
|
// Token: 0x0200166F RID: 5743
|
|
[Token(Token = "0x200166F")]
|
|
[StructLayout(3)]
|
|
public class CfbBlockCipherMac : IMac
|
|
{
|
|
// Token: 0x06009962 RID: 39266 RVA: 0x00221B6C File Offset: 0x0021FD6C
|
|
[Token(Token = "0x6009962")]
|
|
[Address(RVA = "0x20E7770", Offset = "0x20E6170", VA = "0x1820E7770")]
|
|
public CfbBlockCipherMac(IBlockCipher cipher)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06009963 RID: 39267 RVA: 0x00221B84 File Offset: 0x0021FD84
|
|
[Token(Token = "0x6009963")]
|
|
[Address(RVA = "0x20E77F0", Offset = "0x20E61F0", VA = "0x1820E77F0")]
|
|
public CfbBlockCipherMac(IBlockCipher cipher, IBlockCipherPadding padding)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06009964 RID: 39268 RVA: 0x00221B98 File Offset: 0x0021FD98
|
|
[Token(Token = "0x6009964")]
|
|
[Address(RVA = "0x20E7750", Offset = "0x20E6150", VA = "0x1820E7750")]
|
|
public CfbBlockCipherMac(IBlockCipher cipher, int cfbBitSize, int macSizeInBits)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06009965 RID: 39269 RVA: 0x00221BA8 File Offset: 0x0021FDA8
|
|
[Token(Token = "0x6009965")]
|
|
[Address(RVA = "0x20E7880", Offset = "0x20E6280", VA = "0x1820E7880")]
|
|
public CfbBlockCipherMac(IBlockCipher cipher, int cfbBitSize, int macSizeInBits, IBlockCipherPadding padding)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009965)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs.CfbBlockCipherMac::.ctor(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IBlockCipher,System.Int32,System.Int32,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Paddings.IBlockCipherPadding)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_93:
|
|
stloc:ArgumentException(var_8_9D, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("MAC size must be multiple of 8")))
|
|
}
|
|
|
|
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: 0x1700188C RID: 6284
|
|
// (get) Token: 0x06009966 RID: 39270 RVA: 0x00221C54 File Offset: 0x0021FE54
|
|
[Token(Token = "0x1700188C")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x6009966")]
|
|
[Address(RVA = "0x20E7A50", Offset = "0x20E6450", VA = "0x1820E7A50", Slot = "5")]
|
|
get
|
|
{
|
|
MacCFBBlockCipher macCFBBlockCipher = this.cipher;
|
|
IBlockCipher blockCipher = macCFBBlockCipher.cipher;
|
|
int blockSize = macCFBBlockCipher.blockSize;
|
|
string text;
|
|
return text;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009967 RID: 39271 RVA: 0x00221C80 File Offset: 0x0021FE80
|
|
[Token(Token = "0x6009967")]
|
|
[Address(RVA = "0x20E75F0", Offset = "0x20E5FF0", VA = "0x1820E75F0", Slot = "4")]
|
|
public void Init(ICipherParameters parameters)
|
|
{
|
|
this.Reset();
|
|
this.cipher.Init(true, parameters);
|
|
}
|
|
|
|
// Token: 0x06009968 RID: 39272 RVA: 0x00221CA8 File Offset: 0x0021FEA8
|
|
[Token(Token = "0x6009968")]
|
|
[Address(RVA = "0x3D3FF0", Offset = "0x3D29F0", VA = "0x1803D3FF0", Slot = "6")]
|
|
public int GetMacSize()
|
|
{
|
|
return this.macSize;
|
|
}
|
|
|
|
// Token: 0x06009969 RID: 39273 RVA: 0x00221CBC File Offset: 0x0021FEBC
|
|
[Token(Token = "0x6009969")]
|
|
[Address(RVA = "0x20E76C0", Offset = "0x20E60C0", VA = "0x1820E76C0", Slot = "7")]
|
|
public void Update(byte input)
|
|
{
|
|
byte[] buffer = this.Buffer;
|
|
int num = this.bufOff;
|
|
if (num == buffer.Length)
|
|
{
|
|
MacCFBBlockCipher macCFBBlockCipher = this.cipher;
|
|
byte[] array = this.mac;
|
|
int num2 = 0;
|
|
int num3 = 0;
|
|
int num4 = macCFBBlockCipher.ProcessBlock(buffer, num3, array, num2);
|
|
}
|
|
int num5 = num + 1;
|
|
this.bufOff = num5;
|
|
}
|
|
|
|
// Token: 0x0600996A RID: 39274 RVA: 0x00221D18 File Offset: 0x0021FF18
|
|
[Token(Token = "0x600996A")]
|
|
[Address(RVA = "0x20E7280", Offset = "0x20E5C80", VA = "0x1820E7280", Slot = "8")]
|
|
public void BlockUpdate(byte[] input, int inOff, int len)
|
|
{
|
|
int num = this.cipher.blockSize;
|
|
int num2 = 0;
|
|
int num3 = this.bufOff;
|
|
num -= num3;
|
|
if (len > num)
|
|
{
|
|
byte[] buffer = this.Buffer;
|
|
Array.Copy(input, inOff, buffer, num3, num);
|
|
MacCFBBlockCipher macCFBBlockCipher = this.cipher;
|
|
byte[] array = this.mac;
|
|
int num4 = 0;
|
|
byte[] buffer2 = this.Buffer;
|
|
int num5 = macCFBBlockCipher.ProcessBlock(buffer2, num4, array, num2);
|
|
this.bufOff = num2;
|
|
if (len > num)
|
|
{
|
|
MacCFBBlockCipher macCFBBlockCipher2 = this.cipher;
|
|
byte[] array2 = this.mac;
|
|
int num6 = macCFBBlockCipher2.ProcessBlock(input, inOff, array2, num2);
|
|
}
|
|
}
|
|
byte[] buffer3 = this.Buffer;
|
|
Array.Copy(input, inOff, buffer3, num3, len);
|
|
}
|
|
|
|
// Token: 0x0600996B RID: 39275 RVA: 0x00221DC8 File Offset: 0x0021FFC8
|
|
[Token(Token = "0x600996B")]
|
|
[Address(RVA = "0x20E73F0", Offset = "0x20E5DF0", VA = "0x1820E73F0", Slot = "9")]
|
|
public int DoFinal(byte[] output, int outOff)
|
|
{
|
|
MacCFBBlockCipher macCFBBlockCipher = this.cipher;
|
|
IBlockCipherPadding blockCipherPadding = this.padding;
|
|
int blockSize = macCFBBlockCipher.blockSize;
|
|
int i = this.bufOff;
|
|
if (blockCipherPadding != 0)
|
|
{
|
|
MacCFBBlockCipher macCFBBlockCipher2 = this.cipher;
|
|
byte[] array = this.mac;
|
|
int num = 0;
|
|
byte[] buffer = this.Buffer;
|
|
int num2 = 0;
|
|
int num3 = macCFBBlockCipher2.ProcessBlock(buffer, num2, array, num);
|
|
MacCFBBlockCipher macCFBBlockCipher3 = this.cipher;
|
|
byte[] array2 = this.mac;
|
|
IBlockCipher blockCipher = macCFBBlockCipher3.cipher;
|
|
int num4 = this.macSize;
|
|
byte[] array3 = this.mac;
|
|
int num5 = 0;
|
|
Array.Copy(array3, num5, output, outOff, num4);
|
|
byte[] buffer2 = this.Buffer;
|
|
int length = buffer2.Length;
|
|
int num6 = 0;
|
|
Array.Clear(buffer2, num6, length);
|
|
MacCFBBlockCipher macCFBBlockCipher4 = this.cipher;
|
|
this.bufOff = num;
|
|
byte[] iv = macCFBBlockCipher4.IV;
|
|
byte[] cfbV = macCFBBlockCipher4.cfbV;
|
|
IBlockCipher blockCipher2 = macCFBBlockCipher4.cipher;
|
|
return this.macSize;
|
|
}
|
|
while (i >= blockSize)
|
|
{
|
|
}
|
|
byte[] buffer3 = this.Buffer;
|
|
int num7 = i + 1;
|
|
this.bufOff = num7;
|
|
int num8 = this.bufOff;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600996C RID: 39276 RVA: 0x00221EE0 File Offset: 0x002200E0
|
|
[Token(Token = "0x600996C")]
|
|
[Address(RVA = "0x20E7630", Offset = "0x20E6030", VA = "0x1820E7630", Slot = "10")]
|
|
public void Reset()
|
|
{
|
|
byte[] buffer = this.Buffer;
|
|
int length = buffer.Length;
|
|
int num = 0;
|
|
Array.Clear(buffer, num, length);
|
|
this.bufOff = (int)((ulong)0L);
|
|
MacCFBBlockCipher macCFBBlockCipher = this.cipher;
|
|
byte[] iv = macCFBBlockCipher.IV;
|
|
byte[] cfbV = macCFBBlockCipher.cfbV;
|
|
IBlockCipher blockCipher = macCFBBlockCipher.cipher;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x040064B7 RID: 25783
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40064B7")]
|
|
private byte[] mac;
|
|
|
|
// Token: 0x040064B8 RID: 25784
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40064B8")]
|
|
private byte[] Buffer;
|
|
|
|
// Token: 0x040064B9 RID: 25785
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40064B9")]
|
|
private int bufOff;
|
|
|
|
// Token: 0x040064BA RID: 25786
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40064BA")]
|
|
private MacCFBBlockCipher cipher;
|
|
|
|
// Token: 0x040064BB RID: 25787
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40064BB")]
|
|
private IBlockCipherPadding padding;
|
|
|
|
// Token: 0x040064BC RID: 25788
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x40064BC")]
|
|
private int macSize;
|
|
}
|
|
}
|