Skip to content

Commit

Permalink
Merge branch 'release/dev17.5' of https://github.com/dotnet/fsharp in…
Browse files Browse the repository at this point in the history
…to release/dev17.5
  • Loading branch information
vzarytovskii committed Jan 9, 2023
2 parents 2e92791 + d7ebfd6 commit 4d222de
Show file tree
Hide file tree
Showing 175 changed files with 3,271 additions and 1,703 deletions.
1 change: 1 addition & 0 deletions FSharpBuild.Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<OtherFlags>$(OtherFlags) --nowarn:3384</OtherFlags>
<OtherFlags>$(OtherFlags) --times --nowarn:75</OtherFlags>
<OtherFlags Condition="$(ParallelCheckingWithSignatureFilesOn) == 'true'">$(OtherFlags) --test:ParallelCheckingWithSignatureFilesOn</OtherFlags>
<OtherFlags Condition="$(AdditionalFscCmdFlags) != ''">$(OtherFlags) $(AdditionalFscCmdFlags)</OtherFlags>
</PropertyGroup>

<!-- nuget -->
Expand Down
Binary file added a
Binary file not shown.
35 changes: 6 additions & 29 deletions src/Compiler/AbstractIL/ilsign.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ())))
Expand Down Expand Up @@ -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)
Expand All @@ -364,20 +349,12 @@ type ILStrongNameSigner =
| KeyPair of keyPair
| KeyContainer of keyContainerName

static member OpenPublicKeyOptions s p =
PublicKeyOptionsSigner((signerOpenPublicKeyFile s), p)
static member OpenPublicKeyOptions kp p = PublicKeyOptionsSigner(kp, p)

static member OpenPublicKey pubkey = PublicKeySigner pubkey
static member OpenKeyPairFile s = KeyPair(signerOpenKeyPairFile s)
static member OpenPublicKey bytes = PublicKeySigner bytes
static member OpenKeyPairFile bytes = KeyPair(bytes)
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
Expand Down Expand Up @@ -412,9 +389,9 @@ type ILStrongNameSigner =
| KeyPair kp -> pkSignatureSize (signerGetPublicKeyForKeyPair kp)
| KeyContainer _ -> failWithContainerSigningUnsupportedOnThisPlatform ()

member s.SignFile file =
member s.SignStream stream =
match s with
| PublicKeySigner _ -> ()
| PublicKeyOptionsSigner _ -> ()
| KeyPair kp -> signerSignFileWithKeyPair file kp
| KeyPair kp -> signerSignStreamWithKeyPair stream kp
| KeyContainer _ -> failWithContainerSigningUnsupportedOnThisPlatform ()
10 changes: 6 additions & 4 deletions src/Compiler/AbstractIL/ilsign.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@
module internal FSharp.Compiler.AbstractIL.StrongNameSign

open System
open System.IO

//---------------------------------------------------------------------
// Strong name signing
//---------------------------------------------------------------------
[<Sealed>]
type ILStrongNameSigner =
member PublicKey: byte[]
static member OpenPublicKeyOptions: string -> bool -> ILStrongNameSigner
static member OpenPublicKeyOptions: byte array -> bool -> ILStrongNameSigner
static member OpenPublicKey: byte[] -> ILStrongNameSigner
static member OpenKeyPairFile: string -> ILStrongNameSigner
static member OpenKeyPairFile: byte[] -> ILStrongNameSigner
static member OpenKeyContainer: string -> ILStrongNameSigner
member Close: unit -> unit
member IsFullySigned: bool
member PublicKey: byte[]
member SignatureSize: int
member SignFile: string -> unit
member SignStream: Stream -> unit
Loading

0 comments on commit 4d222de

Please sign in to comment.