Skip to content

Delete strong name cruft #1006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/coreclr/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include_directories("inc")
include_directories("strongname/inc")
include_directories("inc/winrt")
include_directories("debug/inc")
include_directories("debug/inc/${ARCH_SOURCES_DIR}")
Expand Down Expand Up @@ -67,7 +66,6 @@ add_subdirectory(vm)
add_subdirectory(md)
add_subdirectory(debug)
add_subdirectory(inc)
add_subdirectory(strongname)
add_subdirectory(binder)
add_subdirectory(classlibnative)
add_subdirectory(dlls)
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/src/binder/assemblybinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#include "variables.hpp"
#include "stringarraylist.h"

#include "strongname.h"

#define APP_DOMAIN_LOCKED_UNLOCKED 0x02
#define APP_DOMAIN_LOCKED_CONTEXT 0x04

Expand Down
24 changes: 2 additions & 22 deletions src/coreclr/src/binder/fusionassemblyname.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include <windows.h>
#include <winerror.h>
#include "strongname.h"
#include "strongnameinternal.h"

#include "fusionhelpers.hpp"
#include "fusionassemblyname.hpp"
Expand All @@ -27,26 +27,6 @@
#define VERSION_STRING_SEGMENTS 4
#define REMAINING_BUFFER_SIZE ((*pccDisplayName) - (pszBuf - szDisplayName))

// ---------------------------------------------------------------------------
// Private Helpers
// ---------------------------------------------------------------------------
namespace
{
HRESULT GetPublicKeyTokenFromPKBlob(LPBYTE pbPublicKeyToken, DWORD cbPublicKeyToken,
LPBYTE *ppbSN, LPDWORD pcbSN)
{
HRESULT hr = S_OK;

// Generate the hash of the public key.
if (!StrongNameTokenFromPublicKey(pbPublicKeyToken, cbPublicKeyToken, ppbSN, pcbSN))
{
hr = StrongNameErrorInfo();
}

return hr;
}
};

// ---------------------------------------------------------------------------
// CPropertyArray ctor
// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -353,7 +333,7 @@ HRESULT CAssemblyName::SetPropertyInternal(DWORD PropertyId,
if (pvProperty && cbProperty)
{
// Generate the public key token from the pk.
if (FAILED(hr = GetPublicKeyTokenFromPKBlob((LPBYTE) pvProperty, cbProperty, &pbSN, &cbSN)))
if (FAILED(hr = StrongNameTokenFromPublicKey((LPBYTE) pvProperty, cbProperty, &pbSN, &cbSN)))
goto exit;

// Set the public key token property.
Expand Down
24 changes: 10 additions & 14 deletions src/coreclr/src/binder/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "utils.hpp"

#include "strongname.h"
#include "strongnameinternal.h"
#include "corpriv.h"

namespace BINDER_SPACE
Expand Down Expand Up @@ -98,19 +98,15 @@ namespace BINDER_SPACE
BYTE *pByteToken = NULL;
DWORD dwTokenLen = 0;

if (!StrongNameTokenFromPublicKey(const_cast<BYTE *>(pByteKey),
dwKeyLen,
&pByteToken,
&dwTokenLen))
{
IF_FAIL_GO(StrongNameErrorInfo());
}
else
{
_ASSERTE(pByteToken != NULL);
publicKeyTokenBLOB.Set(pByteToken, dwTokenLen);
StrongNameFreeBuffer(pByteToken);
}
IF_FAIL_GO(StrongNameTokenFromPublicKey(
const_cast<BYTE*>(pByteKey),
dwKeyLen,
&pByteToken,
&dwTokenLen));

_ASSERTE(pByteToken != NULL);
publicKeyTokenBLOB.Set(pByteToken, dwTokenLen);
StrongNameFreeBuffer(pByteToken);

Exit:
return hr;
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/dlls/mscordac/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ set(COREDAC_LIBRARIES
mdhotdata_dac
mdruntime_dac
mdruntimerw_dac
strongname_dac
utilcode_dac
unwinder_dac
${END_LIBRARY_GROUP} # End group of libraries that have circular references
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ set(CORECLR_LIBRARIES
corguids
gcinfo # Condition="'$(TargetCpu)'=='amd64' or '$(TargetCpu)' == 'arm' or '$(TargetCpu)' == 'arm64'"
ildbsymlib
strongname_wks
utilcode
v3binder
)
Expand Down
4 changes: 0 additions & 4 deletions src/coreclr/src/gc/sample/gcenv.ee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ uint32_t CLREventStatic::Wait(uint32_t dwMilliseconds, bool bAlertable)
return result;
}

#ifndef __GNUC__
__declspec(thread) Thread * pCurrentThread;
#else // !__GNUC__
thread_local Thread * pCurrentThread;
#endif // !__GNUC__

Thread * GetThread()
{
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/ilasm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ set(ILASM_LINK_LIBRARIES
mdcompiler_wks
mdruntime_wks
mdruntimerw_wks
strongname_tool
mdstaticapi
${END_LIBRARY_GROUP} # End group of libraries that have circular references
ceefgen
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/ilasm/asmman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "ilasmpch.h"

#include "assembler.h"
#include "strongname.h"
#include "strongnameinternal.h"
#include <limits.h>
#include <fusion.h>

Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/ilasm/asmman.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#ifndef ASMMAN_HPP
#define ASMMAN_HPP

#include "strongname.h"
#include "specstrings.h"

struct AsmManFile
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/src/ilasm/writer_enc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@

#include "assembler.h"

//#include "ceefilegenwriter.h"
#include "strongname.h"

int ist=0;
#define REPT_STEP //printf("Step %d\n",++ist);

Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/ildasm/exe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ set(ILDASM_LINK_LIBRARIES
mdcompiler_wks
mdruntime_wks
mdruntimerw_wks
strongname_tool
mdstaticapi
${END_LIBRARY_GROUP} # End group of libraries that have circular references
corguids
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/inc/clrconfigvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,6 @@ CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_MaxStackDepth, W("MaxStackDepth"), "")
CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_MaxStubUnwindInfoSegmentSize, W("MaxStubUnwindInfoSegmentSize"), "")
CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_MaxThreadRecord, W("MaxThreadRecord"), "")
CONFIG_DWORD_INFO(INTERNAL_MessageDebugOut, W("MessageDebugOut"), 0, "")
CONFIG_DWORD_INFO_EX(INTERNAL_MscorsnLogging, W("MscorsnLogging"), 0, "Enables strong name logging", CLRConfig::REGUTIL_default)
RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NativeImageRequire, W("NativeImageRequire"), 0, "", CLRConfig::REGUTIL_default)
CONFIG_DWORD_INFO_EX(INTERNAL_NestedEhOom, W("NestedEhOom"), 0, "", CLRConfig::REGUTIL_default)
#define INTERNAL_NoGuiOnAssert_Default 1
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions src/coreclr/src/inc/predeftlsslot.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// them.
enum PredefinedTlsSlots
{
TlsIdx_StrongName,
TlsIdx_OwnedCrstsChain, // slot to store the Crsts owned by this thread
TlsIdx_JitPerf,
TlsIdx_JitX86Perf,
TlsIdx_JitLogEnv,
Expand All @@ -33,7 +33,6 @@ enum PredefinedTlsSlots

// Add more indices here.
TlsIdx_ThreadType, // bit flags to indicate special thread's type
TlsIdx_OwnedCrstsChain, // slot to store the Crsts owned by this thread
TlsIdx_CantAllocCount, //Can't allocate memory on heap in this thread

// A transient thread value that indicates this thread is currently walking its stack
Expand Down
9 changes: 0 additions & 9 deletions src/coreclr/src/inc/strongname.h

This file was deleted.

23 changes: 23 additions & 0 deletions src/coreclr/src/inc/strongnameholders.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#ifndef __STRONGNAME_HOLDERS_H__
#define __STRONGNAME_HOLDERS_H__

#include <holder.h>
#include <strongnameinternal.h>

//
// Holder classes for types returned from and used in strong name APIs
//

// Holder for any memory allocated by the strong name APIs
template<class T>
void VoidStrongNameFreeBuffer(__in T *pBuffer)
{
StrongNameFreeBuffer(reinterpret_cast<BYTE *>(pBuffer));
}
NEW_WRAPPER_TEMPLATE1(StrongNameBufferHolder, VoidStrongNameFreeBuffer<_TYPE>);

#endif // !__STRONGNAME_HOLDERS_H__
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
#ifndef _STRONGNAME_INTERNAL_H
#define _STRONGNAME_INTERNAL_H

#include <strongname.h>
// Public key blob binary format.
typedef struct {
unsigned int SigAlgID; // (ALG_ID) signature algorithm used to create the signature
unsigned int HashAlgID; // (ALG_ID) hash algorithm used to create the signature
ULONG cbPublicKey; // length of the key in bytes
BYTE PublicKey[1]; // variable length byte array containing the key value in format output by CryptoAPI
} PublicKeyBlob;

// Determine the number of bytes in a public key
DWORD StrongNameSizeOfPublicKey(const PublicKeyBlob &keyPublicKey);
Expand All @@ -20,4 +26,11 @@ bool StrongNameIsValidPublicKey(const PublicKeyBlob &keyPublicKey);
bool StrongNameIsEcmaKey(__in_ecount(cbKey) const BYTE *pbKey, DWORD cbKey);
bool StrongNameIsEcmaKey(const PublicKeyBlob &keyPublicKey);

HRESULT StrongNameTokenFromPublicKey(BYTE* pbPublicKeyBlob, // [in] public key blob
ULONG cbPublicKeyBlob,
BYTE** ppbStrongNameToken, // [out] strong name token
ULONG* pcbStrongNameToken);

VOID StrongNameFreeBuffer(BYTE* pbMemory);

#endif // !_STRONGNAME_INTERNAL_H
File renamed without changes.
4 changes: 0 additions & 4 deletions src/coreclr/src/jit/ee_il_dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,7 @@ DLLEXPORT ICorJitCompiler* __stdcall getJit()
// If you are using it more broadly in retail code, you would need to understand the
// performance implications of accessing TLS.

#ifndef __GNUC__
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ifdef cleanup that came along for the ride.

__declspec(thread) void* gJitTls = nullptr;
#else // !__GNUC__
thread_local void* gJitTls = nullptr;
#endif // !__GNUC__

static void* GetJitTls()
{
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/md/compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ set(MDCOMPILER_HEADERS
../../inc/mdcommon.h
../../inc/metadata.h
../../inc/posterror.h
../../inc/strongname.h
../../inc/sstring.h
../../inc/switches.h
../inc/cahlprinternal.h
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/src/md/compiler/assemblymd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#include "mdlog.h"
#include "importhelper.h"

#include <strongname.h>

#ifdef _MSC_VER
#pragma warning(disable: 4102)
#endif
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/src/md/compiler/assemblymd_emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#include "mdlog.h"
#include "importhelper.h"

#include <strongname.h>

#ifdef _MSC_VER
#pragma warning(disable: 4102)
#endif
Expand Down
42 changes: 17 additions & 25 deletions src/coreclr/src/md/compiler/importhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include "mdutil.h"
#include "rwutil.h"
#include "mdlog.h"
#include "strongname.h"
#include "strongnameinternal.h"
#include "sstring.h"

#define COM_RUNTIME_LIBRARY "ComRuntimeLibrary"
Expand Down Expand Up @@ -1397,13 +1397,10 @@ HRESULT ImportHelper::FindAssemblyRef(
return E_FAIL;
#else //!FEATURE_METADATA_EMIT_IN_DEBUGGER || DACCESS_COMPILE
// Need to compress target public key to see if it matches.
if (!StrongNameTokenFromPublicKey((BYTE*)pbTmp,
cbTmp,
(BYTE**)&pbTmpToken,
&cbTmpToken))
{
return StrongNameErrorInfo();
}
IfFailRet(StrongNameTokenFromPublicKey((BYTE*)pbTmp,
cbTmp,
(BYTE**)&pbTmpToken,
&cbTmpToken));
fMatch = cbTmpToken == cbPublicKeyOrToken && !memcmp(pbTmpToken, pbPublicKeyOrToken, cbTmpToken);
StrongNameFreeBuffer((BYTE*)pbTmpToken);
if (!fMatch)
Expand All @@ -1419,13 +1416,10 @@ HRESULT ImportHelper::FindAssemblyRef(
#if defined(FEATURE_METADATA_EMIT_IN_DEBUGGER) && !defined(DACCESS_COMPILE)
return E_FAIL;
#else //!FEATURE_METADATA_EMIT_IN_DEBUGGER || DACCESS_COMPILE
if (!StrongNameTokenFromPublicKey((BYTE*)pbPublicKeyOrToken,
cbPublicKeyOrToken,
(BYTE**)&pbToken,
&cbToken))
{
return StrongNameErrorInfo();
}
IfFailRet(StrongNameTokenFromPublicKey((BYTE*)pbPublicKeyOrToken,
cbPublicKeyOrToken,
(BYTE**)&pbToken,
&cbToken));
#endif //!FEATURE_METADATA_EMIT_IN_DEBUGGER || DACCESS_COMPILE
}
if (cbTmp != cbToken || memcmp(pbTmp, pbToken, cbToken))
Expand Down Expand Up @@ -3254,11 +3248,10 @@ ImportHelper::CreateAssemblyRefFromAssembly(
{
_ASSERTE(IsAfPublicKey(dwFlags));
dwFlags &= ~afPublicKey;
if (!StrongNameTokenFromPublicKey((BYTE*)pbPublicKey,
cbPublicKey,
(BYTE**)&pbToken,
&cbToken))
IfFailGo(StrongNameErrorInfo());
IfFailGo(StrongNameTokenFromPublicKey((BYTE*)pbPublicKey,
cbPublicKey,
(BYTE**)&pbToken,
&cbToken));
}
else
_ASSERTE(!IsAfPublicKey(dwFlags));
Expand Down Expand Up @@ -3393,11 +3386,10 @@ HRESULT ImportHelper::CompareAssemblyRefToAssembly( // S_OK, S_FALSE or error
return S_FALSE;

// Otherwise we need to compress the def public key into a token.
if (!StrongNameTokenFromPublicKey((BYTE*)pbPublicKey2,
cbPublicKey2,
(BYTE**)&pbToken,
&cbToken))
return StrongNameErrorInfo();
IfFailRet(StrongNameTokenFromPublicKey((BYTE*)pbPublicKey2,
cbPublicKey2,
(BYTE**)&pbToken,
&cbToken));

fMatch = cbPublicKeyOrToken1 == cbToken &&
!memcmp(pbPublicKeyOrToken1, pbToken, cbPublicKeyOrToken1);
Expand Down
4 changes: 1 addition & 3 deletions src/coreclr/src/md/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set(MDRUNTIME_SOURCES
recordpool.cpp
mdinternaldisp.cpp
mdinternalro.cpp
strongnameinternal.cpp
)

set(MDRUNTIME_HEADERS
Expand All @@ -33,9 +34,6 @@ set(MDRUNTIME_HEADERS
metamodelcolumndefs.h
mdinternaldisp.h
mdinternalro.h
metamodel.cpp
metamodelro.cpp
recordpool.cpp
)

convert_to_absolute_path(MDRUNTIME_HEADERS ${MDRUNTIME_HEADERS})
Expand Down
Loading