Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
fc35ff40
F
fsharp
项目概览
dotNET Platform
/
fsharp
11 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
fc35ff40
编写于
12月 15, 2022
作者:
D
dotnet bot
提交者:
GitHub
12月 15, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #14475 from dotnet/merges/main-to-release/dev17.5
Merge main to release/dev17.5
上级
ad3033a5
3794da39
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
46 deletion
+27
-46
src/Compiler/AbstractIL/ilsign.fs
src/Compiler/AbstractIL/ilsign.fs
+3
-25
src/Compiler/AbstractIL/ilsign.fsi
src/Compiler/AbstractIL/ilsign.fsi
+4
-2
src/Compiler/AbstractIL/ilwrite.fs
src/Compiler/AbstractIL/ilwrite.fs
+20
-19
未找到文件。
src/Compiler/AbstractIL/ilsign.fs
浏览文件 @
fc35ff40
...
...
@@ -297,12 +297,6 @@ let signStream stream keyBlob =
let
signature
=
createSignature
hash
keyBlob
KeyType
.
KeyPair
patchSignature
stream
peReader
signature
let
signFile
fileName
keyBlob
=
use
fs
=
FileSystem
.
OpenFileForWriteShim
(
fileName
,
FileMode
.
Open
,
FileAccess
.
ReadWrite
)
signStream
fs
keyBlob
let
signatureSize
(
pk
:
byte
[]
)
=
if
pk
.
Length
<
25
then
raise
(
CryptographicException
(
getResourceString
(
FSComp
.
SR
.
ilSignInvalidPKBlob
()
)))
...
...
@@ -339,18 +333,9 @@ let signerOpenKeyPairFile filePath =
let
signerGetPublicKeyForKeyPair
(
kp
:
keyPair
)
:
pubkey
=
getPublicKeyForKeyPair
kp
let
signerGetPublicKeyForKeyContainer
(_
kcName
:
keyContainerName
)
:
pubkey
=
raise
(
NotImplementedException
(
"signerGetPublicKeyForKeyContainer is not yet implemented"
))
let
signerCloseKeyContainer
(_
kc
:
keyContainerName
)
:
unit
=
raise
(
NotImplementedException
(
"signerCloseKeyContainer is not yet implemented"
))
let
signerSignatureSize
(
pk
:
pubkey
)
:
int
=
signatureSize
pk
let
signerSignFileWithKeyPair
(
fileName
:
string
)
(
kp
:
keyPair
)
:
unit
=
signFile
fileName
kp
let
signerSignFileWithKeyContainer
(_
fileName
:
string
)
(_
kcName
:
keyContainerName
)
:
unit
=
raise
(
NotImplementedException
(
"signerSignFileWithKeyContainer is not yet implemented"
))
let
signerSignStreamWithKeyPair
stream
keyBlob
=
signStream
stream
keyBlob
let
failWithContainerSigningUnsupportedOnThisPlatform
()
=
failwith
(
FSComp
.
SR
.
containerSigningUnsupportedOnThisPlatform
()
|>
snd
)
...
...
@@ -371,13 +356,6 @@ type ILStrongNameSigner =
static
member
OpenKeyPairFile
s
=
KeyPair
(
signerOpenKeyPairFile
s
)
static
member
OpenKeyContainer
s
=
KeyContainer
s
member
s
.
Close
()
=
match
s
with
|
PublicKeySigner
_
|
PublicKeyOptionsSigner
_
|
KeyPair
_
->
()
|
KeyContainer
_
->
failWithContainerSigningUnsupportedOnThisPlatform
()
member
s
.
IsFullySigned
=
match
s
with
|
PublicKeySigner
_
->
false
...
...
@@ -412,9 +390,9 @@ type ILStrongNameSigner =
|
KeyPair
kp
->
pkSignatureSize
(
signerGetPublicKeyForKeyPair
kp
)
|
KeyContainer
_
->
failWithContainerSigningUnsupportedOnThisPlatform
()
member
s
.
Sign
File
file
=
member
s
.
Sign
Stream
stream
=
match
s
with
|
PublicKeySigner
_
->
()
|
PublicKeyOptionsSigner
_
->
()
|
KeyPair
kp
->
signerSign
FileWithKeyPair
file
kp
|
KeyPair
kp
->
signerSign
StreamWithKeyPair
stream
kp
|
KeyContainer
_
->
failWithContainerSigningUnsupportedOnThisPlatform
()
src/Compiler/AbstractIL/ilsign.fsi
浏览文件 @
fc35ff40
...
...
@@ -7,6 +7,9 @@
module
internal
FSharp
.
Compiler
.
AbstractIL
.
StrongNameSign
open
System
open
System
.
IO
//---------------------------------------------------------------------
// Strong name signing
//---------------------------------------------------------------------
...
...
@@ -17,8 +20,7 @@ type ILStrongNameSigner =
static
member
OpenPublicKey
:
byte
[]
->
ILStrongNameSigner
static
member
OpenKeyPairFile
:
string
->
ILStrongNameSigner
static
member
OpenKeyContainer
:
string
->
ILStrongNameSigner
member
Close
:
unit
->
unit
member
IsFullySigned
:
bool
member
PublicKey
:
byte
[]
member
SignatureSize
:
int
member
Sign
File
:
string
->
unit
member
Sign
Stream
:
Stream
->
unit
src/Compiler/AbstractIL/ilwrite.fs
浏览文件 @
fc35ff40
...
...
@@ -3714,9 +3714,22 @@ let writePdb (
// Used to capture the pdb file bytes in the case we're generating in-memory
let
mutable
pdbBytes
=
None
let
signImage
()
=
// Sign the binary. No further changes to binary allowed past this point!
match
signer
with
|
None
->
()
|
Some
s
->
use
fs
=
reopenOutput
()
try
s
.
SignStream
fs
with
exn
->
failwith
($
"Warning: A call to SignFile failed ({exn.Message})"
)
reportTime
showTimes
"Signing Image"
// Now we've done the bulk of the binary, do the PDB file and fixup the binary.
match
pdbfile
with
|
None
->
()
|
None
->
signImage
()
|
Some
pdbfile
->
let
idd
=
match
pdbInfoOpt
with
...
...
@@ -3766,28 +3779,14 @@ let writePdb (
os2
.
BaseStream
.
Seek
(
int64
(
textV2P
i
.
iddChunk
.
addr
),
SeekOrigin
.
Begin
)
|>
ignore
if
i
.
iddChunk
.
size
<
i
.
iddData
.
Length
then
failwith
"Debug data area is not big enough. Debug info may not be usable"
writeBytes
os2
i
.
iddData
reportTime
showTimes
"Finalize PDB"
signImage
()
os2
.
Dispose
()
with
exn
->
failwith
(
"Error while writing debug directory entry: "
+
exn
.
Message
)
(
try
os2
.
Dispose
()
;
FileSystem
.
FileDeleteShim
outfile
with
_
->
()
)
reraise
()
reportTime
showTimes
"Finalize PDB"
// Sign the binary. No further changes to binary allowed past this point!
match
signer
with
|
None
->
()
|
Some
s
->
try
s
.
SignFile
outfile
s
.
Close
()
with
exn
->
failwith
(
"Warning: A call to SignFile failed ("
+
exn
.
Message
+
")"
)
(
try
s
.
Close
()
with
_
->
()
)
(
try
FileSystem
.
FileDeleteShim
outfile
with
_
->
()
)
()
reportTime
showTimes
"Signing Image"
pdbBytes
type
options
=
...
...
@@ -4531,7 +4530,7 @@ let writeBinaryFiles (options: options, modul, normalizeAssemblyRefs) =
reraise
()
let
reopenOutput
()
=
FileSystem
.
OpenFileForWriteShim
(
options
.
outfile
,
FileMode
.
Open
,
FileAccess
.
Write
,
FileShare
.
Read
)
FileSystem
.
OpenFileForWriteShim
(
options
.
outfile
,
FileMode
.
Open
,
FileAccess
.
Read
Write
,
FileShare
.
Read
)
writePdb
(
options
.
dumpDebugInfo
,
options
.
showTimes
,
...
...
@@ -4561,7 +4560,9 @@ let writeBinaryInMemory (options: options, modul, normalizeAssemblyRefs) =
let
pdbData
,
pdbInfoOpt
,
debugDirectoryChunk
,
debugDataChunk
,
debugChecksumPdbChunk
,
debugEmbeddedPdbChunk
,
debugDeterministicPdbChunk
,
textV2P
,
_
mappings
=
writeBinaryAux
(
stream
,
options
,
modul
,
normalizeAssemblyRefs
)
let
reopenOutput
()
=
stream
let
reopenOutput
()
=
stream
.
Seek
(
0
,
SeekOrigin
.
Begin
)
|>
ignore
stream
let
pdbBytes
=
writePdb
(
options
.
dumpDebugInfo
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录