Skip to content

Commit a2a3e64

Browse files
authored
Delete dead strongname-related code (dotnet#24709)
1 parent 03a79f6 commit a2a3e64

File tree

7 files changed

+6
-415
lines changed

7 files changed

+6
-415
lines changed

src/inc/winwrap.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@
5454
// Undefine all of the windows wrappers so you can't use them.
5555
//*****************************************************************************
5656

57-
// wincrypt.h
58-
#undef CryptAcquireContext
59-
#undef CryptSignHash
60-
#undef CryptVerifySignature
61-
6257
// winbase.h
6358
#undef GetBinaryType
6459
#undef GetShortPathName
@@ -146,11 +141,6 @@
146141
// to the *W entry points as macros. This way no client code needs a wrapper on NT.
147142
//
148143

149-
// wincrypt.h
150-
#define WszCryptAcquireContext CryptAcquireContextW
151-
#define WszCryptSignHash CryptSignHashW
152-
#define WszCryptVerifySignature CryptVerifySignatureW
153-
154144
// winbase.h
155145
#define WszGetEnvironmentStrings GetEnvironmentStringsW
156146
#define WszFreeEnvironmentStrings FreeEnvironmentStringsW

src/strongname/api/cryptapis.h

Lines changed: 0 additions & 47 deletions
This file was deleted.

src/strongname/api/strongname.cpp

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,6 @@ void Log(__in_z const WCHAR *wszFormat, ...)
101101
// Size in bytes of strong name token.
102102
#define SN_SIZEOF_TOKEN 8
103103

104-
enum StrongNameCachedCsp {
105-
None = -1,
106-
Sha1CachedCsp = 0,
107-
Sha2CachedCsp = Sha1CachedCsp + 1,
108-
CachedCspCount = Sha2CachedCsp + 1
109-
};
110-
111104
// We cache a couple of things on a per thread basis: the last error encountered
112105
// and (potentially) CSP contexts. The following structure tracks these and is
113106
// allocated lazily as needed.
@@ -119,12 +112,6 @@ struct SN_THREAD_CTX {
119112

120113
// Macro containing common code used at the start of most APIs.
121114
#define SN_COMMON_PROLOG() do { \
122-
HRESULT __hr = InitStrongName(); \
123-
if (FAILED(__hr)) { \
124-
SetStrongNameErrorInfo(__hr); \
125-
retVal = FALSE; \
126-
goto Exit; \
127-
} \
128115
SetStrongNameErrorInfo(S_OK); \
129116
} while (0)
130117

@@ -178,23 +165,6 @@ struct SN_THREAD_CTX {
178165

179166
#define SN_THE_SILVERLIGHT_KEYTOKEN() ((PublicKeyBlob*)g_rbTheSilverlightKeyToken)
180167

181-
#ifdef FEATURE_WINDOWSPHONE
182-
// Microsoft.Phone.* key
183-
#define SN_THE_MICROSOFT_PHONE_KEYTOKEN() ((PublicKeyBlob*)g_rbTheMicrosoftPhoneKeyToken)
184-
185-
#define SN_IS_THE_MICROSOFT_PHONE_KEY(_pk) (SN_SIZEOF_KEY((PublicKeyBlob*)(_pk)) == sizeof(g_rbTheMicrosoftPhoneKey) && \
186-
memcmp((_pk), g_rbTheMicrosoftPhoneKey, sizeof(g_rbTheMicrosoftPhoneKey)) == 0)
187-
188-
// Microsoft.Xna.* key
189-
#define SN_THE_MICROSOFT_XNA_KEYTOKEN() ((PublicKeyBlob*)g_rbTheMicrosoftXNAKeyToken)
190-
191-
#define SN_IS_THE_MICROSOFT_XNA_KEY(_pk) (SN_SIZEOF_KEY((PublicKeyBlob*)(_pk)) == sizeof(g_rbTheMicrosoftXNAKey) && \
192-
memcmp((_pk), g_rbTheMicrosoftXNAKey, sizeof(g_rbTheMicrosoftXNAKey)) == 0)
193-
194-
#endif // FEATURE_WINDOWSPHONE
195-
196-
#define InitStrongName() S_OK
197-
198168

199169
// Free buffer allocated by routines below.
200170
SNAPI_(VOID) StrongNameFreeBuffer(BYTE *pbMemory) // [in] address of memory to free
@@ -294,7 +264,7 @@ SNAPI StrongNameTokenFromPublicKey(BYTE *pbPublicKeyBlob, // [in] publ
294264

295265
if (pbPublicKeyBlob == NULL)
296266
SN_ERROR(E_POINTER);
297-
if (!StrongNameIsValidPublicKey(pbPublicKeyBlob, cbPublicKeyBlob, false))
267+
if (!StrongNameIsValidPublicKey(pbPublicKeyBlob, cbPublicKeyBlob))
298268
SN_ERROR(CORSEC_E_INVALID_PUBLICKEY);
299269
if (ppbStrongNameToken == NULL)
300270
SN_ERROR(E_POINTER);
@@ -336,24 +306,6 @@ SNAPI StrongNameTokenFromPublicKey(BYTE *pbPublicKeyBlob, // [in] publ
336306
goto Exit;
337307
}
338308

339-
#ifdef FEATURE_WINDOWSPHONE
340-
341-
if (SN_IS_THE_MICROSOFT_PHONE_KEY(pbPublicKeyBlob))
342-
{
343-
memcpy_s(*ppbStrongNameToken, *pcbStrongNameToken, SN_THE_MICROSOFT_PHONE_KEYTOKEN(), SN_SIZEOF_TOKEN);
344-
retVal = TRUE;
345-
goto Exit;
346-
}
347-
348-
if (SN_IS_THE_MICROSOFT_XNA_KEY(pbPublicKeyBlob))
349-
{
350-
memcpy_s(*ppbStrongNameToken, *pcbStrongNameToken, SN_THE_MICROSOFT_XNA_KEYTOKEN(), SN_SIZEOF_TOKEN);
351-
retVal = TRUE;
352-
goto Exit;
353-
}
354-
355-
#endif //FEATURE_WINDOWSPHONE
356-
357309
// To compute the correct public key token, we need to make sure the public key blob
358310
// was not padded with extra bytes that CAPI CryptImportKey would've ignored.
359311
// Without this round trip, we would blindly compute the hash over the padded bytes

0 commit comments

Comments
 (0)