1#! /usr/bin/env perl 2# Copyright 2006-2020 The OpenSSL Project Authors. All Rights Reserved. 3# 4# Licensed under the OpenSSL license (the "License"). You may not use 5# this file except in compliance with the License. You can obtain a copy 6# in the file LICENSE in the source distribution or at 7# https://www.openssl.org/source/license.html 8 9use strict; 10use warnings; 11use lib "."; 12use configdata; 13use File::Spec::Functions; 14 15my $versionfile = catfile( $config{sourcedir}, "include/openssl/opensslv.h" ); 16 17my ( $ver, $v1, $v2, $v3, $v4, $beta, $version ); 18 19open FD, $versionfile or die "Couldn't open include/openssl/opensslv.h: $!\n"; 20while (<FD>) { 21 if (/OPENSSL_VERSION_NUMBER\s+(0x[0-9a-f]+)/i) { 22 $ver = hex($1); 23 $v1 = ( $ver >> 28 ); 24 $v2 = ( $ver >> 20 ) & 0xff; 25 $v3 = ( $ver >> 12 ) & 0xff; 26 $v4 = ( $ver >> 4 ) & 0xff; 27 $beta = $ver & 0xf; 28 $version = "$v1.$v2.$v3"; 29 if ( $beta == 0xf ) { 30 $version .= chr( ord('a') + $v4 - 1 ) if ($v4); 31 } elsif ( $beta == 0 ) { 32 $version .= "-dev"; 33 } else { 34 $version .= "-beta$beta"; 35 } 36 last; 37 } 38} 39close(FD); 40 41my $filename = $ARGV[0]; 42my $description = "OpenSSL library"; 43my $vft = "VFT_DLL"; 44if ( $filename =~ /openssl/i ) { 45 $description = "OpenSSL application"; 46 $vft = "VFT_APP"; 47} 48 49my $YEAR = [gmtime($ENV{SOURCE_DATE_EPOCH} || time())]->[5] + 1900; 50print <<___; 51#include <winver.h> 52 53LANGUAGE 0x09,0x01 54 551 VERSIONINFO 56 FILEVERSION $v1,$v2,$v3,$v4 57 PRODUCTVERSION $v1,$v2,$v3,$v4 58 FILEFLAGSMASK 0x3fL 59#ifdef _DEBUG 60 FILEFLAGS 0x01L 61#else 62 FILEFLAGS 0x00L 63#endif 64 FILEOS VOS__WINDOWS32 65 FILETYPE $vft 66 FILESUBTYPE 0x0L 67BEGIN 68 BLOCK "StringFileInfo" 69 BEGIN 70 BLOCK "040904b0" 71 BEGIN 72 // Required: 73 VALUE "CompanyName", "The OpenSSL Project, https://www.openssl.org/\\0" 74 VALUE "FileDescription", "$description\\0" 75 VALUE "FileVersion", "$version\\0" 76 VALUE "InternalName", "$filename\\0" 77 VALUE "OriginalFilename", "$filename\\0" 78 VALUE "ProductName", "The OpenSSL Toolkit\\0" 79 VALUE "ProductVersion", "$version\\0" 80 // Optional: 81 //VALUE "Comments", "\\0" 82 VALUE "LegalCopyright", "Copyright 1998-$YEAR The OpenSSL Authors. All rights reserved.\\0" 83 //VALUE "LegalTrademarks", "\\0" 84 //VALUE "PrivateBuild", "\\0" 85 //VALUE "SpecialBuild", "\\0" 86 END 87 END 88 BLOCK "VarFileInfo" 89 BEGIN 90 VALUE "Translation", 0x409, 0x4b0 91 END 92END 93___ 94