Skip to content

Commit

Permalink
Remove unused left assignment in CapiHelper
Browse files Browse the repository at this point in the history
related issue is dotnet#30457
  • Loading branch information
KimKiHyuk committed Aug 7, 2020
1 parent b497143 commit a74ed69
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ internal static DSAParameters ToDSAParameters(this byte[] cspBlob, bool includeP
// BYTE[lenP] Y
// BYTE[lenX] X (if private)

int magic = br.ReadInt32(); // Expected to be DSS_PUB_MAGIC_VER3 or DSS_PRIV_MAGIC_VER3
br.ReadInt32(); // Expected to be DSS_PUB_MAGIC_VER3 or DSS_PRIV_MAGIC_VER3
int lenP = (br.ReadInt32() + 7) / 8;
int lenQ = (br.ReadInt32() + 7) / 8;
int lenJ = (br.ReadInt32() + 7) / 8;
Expand Down Expand Up @@ -220,7 +220,7 @@ internal static DSAParameters ToDSAParameters(this byte[] cspBlob, bool includeP
// DWORD counter (DSSSEED)
// BYTE[20] seed (DSSSEED)

int magic = br.ReadInt32(); // Expected to be DSS_MAGIC or DSS_PRIVATE_MAGIC
br.ReadInt32(); // Expected to be DSS_MAGIC or DSS_PRIVATE_MAGIC
int len = (br.ReadInt32() + 7) / 8;
dsaParameters.P = br.ReadReversed(len);
dsaParameters.Q = br.ReadReversed(DSS_Q_LEN);
Expand Down Expand Up @@ -279,7 +279,7 @@ private static void ReadKeyBlobHeader(BinaryReader br, out byte bVersion)
// WORD reserved
// ALG_ID aiKeyAlg

byte bType = br.ReadByte(); // BLOBHEADER.bType: Expected to be 0x6 (PUBLICKEYBLOB) or 0x7 (PRIVATEKEYBLOB), though there's no check for backward compat reasons.
br.ReadByte(); // BLOBHEADER.bType: Expected to be 0x6 (PUBLICKEYBLOB) or 0x7 (PRIVATEKEYBLOB), though there's no check for backward compat reasons.
bVersion = br.ReadByte(); // BLOBHEADER.bVersion: Expected to be 0x2 or 0x3, though there's no check for backward compat reasons.
br.BaseStream.Position += sizeof(ushort); // BLOBHEADER.wReserved
int algId = br.ReadInt32(); // BLOBHEADER.aiKeyAlg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ internal static RSAParameters ToRSAParameters(this byte[] cspBlob, bool includeP
{
BinaryReader br = new BinaryReader(new MemoryStream(cspBlob));

byte bType = br.ReadByte(); // BLOBHEADER.bType: Expected to be 0x6 (PUBLICKEYBLOB) or 0x7 (PRIVATEKEYBLOB), though there's no check for backward compat reasons.
byte bVersion = br.ReadByte(); // BLOBHEADER.bVersion: Expected to be 0x2, though there's no check for backward compat reasons.
br.ReadByte(); // BLOBHEADER.bType: Expected to be 0x6 (PUBLICKEYBLOB) or 0x7 (PRIVATEKEYBLOB), though there's no check for backward compat reasons.
br.ReadByte(); // BLOBHEADER.bVersion: Expected to be 0x2, though there's no check for backward compat reasons.
br.ReadUInt16(); // BLOBHEADER.wReserved
int algId = br.ReadInt32(); // BLOBHEADER.aiKeyAlg
if (algId != CALG_RSA_KEYX && algId != CALG_RSA_SIGN)
throw new PlatformNotSupportedException(); // The FCall this code was ported from supports other algid's but we're only porting what we use.

int magic = br.ReadInt32(); // RSAPubKey.magic: Expected to be 0x31415352 ('RSA1') or 0x32415352 ('RSA2')
br.ReadInt32(); // RSAPubKey.magic: Expected to be 0x31415352 ('RSA1') or 0x32415352 ('RSA2')
int bitLen = br.ReadInt32(); // RSAPubKey.bitLen

int modulusLength = bitLen / 8;
Expand Down

0 comments on commit a74ed69

Please sign in to comment.