Compare commits

..

No commits in common. "proton_8.0" and "proton-3.16-7" have entirely different histories.

1863 changed files with 23842 additions and 830537 deletions

2
.gitattributes vendored
View File

@ -1,2 +0,0 @@
*.sc linguist-detectable=false
*.SC linguist-detectable=false

View File

@ -10,7 +10,7 @@ about: Game compatibility issues.
## System Information
- GPU: <!-- e.g. RX 580 or GTX 970 -->
- Video driver version: <!-- e.g. Mesa 18.2 or nvidia 396.54 -->
- Driver/LLVM version: <!-- e.g. Mesa 18.2/7.0.0 or nvidia 396.54 -->
- Kernel version: <!-- e.g. 4.17 -->
- Link to full system information report as [Gist](https://gist.github.com/):
- Proton version:
@ -19,9 +19,8 @@ about: Game compatibility issues.
- [ ] that I haven't found an existing compatibility report for this game.
- [ ] that I have checked whether there are updates for my system available.
<!-- Please add `PROTON_LOG=1 %command%` to the game's launch options and
attach the generated $HOME/steam-$APPID.log to this issue report as a file.
(Proton logs compress well if needed.)-->
<!-- Please add `PROTON_LOG=1 %command%` to the game's launch options and drag
and drop the generated `$HOME/steam-$APPID.log` into this issue report -->
## Symptoms <!-- What's the problem? -->
@ -39,8 +38,6 @@ attach the generated $HOME/steam-$APPID.log to this issue report as a file.
4. Please copy it to your clipboard by pressing `Ctrl+A` and then `Ctrl+C`.
Then paste it in a [Gist](https://gist.github.com/) and post the link in
this issue.
5. Also, please copy the contents of `Help` > `Steam Runtime Information` to
the gist.
6. Please search for open issues and pull requests by the name of the game and
5. Please search for open issues and pull requests by the name of the game and
find out whether they are relevant and should be referenced above.
-->

View File

@ -1 +0,0 @@
blank_issues_enabled: false

View File

@ -1,9 +0,0 @@
---
name: Other
about: No other issue template makes sense
---
<!--
Please always mention the Proton version and the titles of any games you are seeing an issue with.
-->

View File

@ -10,7 +10,7 @@ about: Games tested and found to have no issues.
## System Information
- GPU: <!-- e.g. RX 580 or GTX 970 -->
- Video driver version: <!-- e.g. Mesa 18.2 or nvidia 396.54 -->
- Driver/LLVM version: <!-- e.g. Mesa 18.2/7.0.0 or nvidia 396.54 -->
- Distro version: <!-- e.g. Ubuntu 18.04 -->
- Link to full system information report as [Gist](https://gist.github.com/):
- Proton version:

5
.gitignore vendored
View File

@ -1,8 +1,7 @@
/dist
/build
/dist-*
/obj-*
/syn-*
/.vagrant/
/vagrant_share/
/build/
/vrclient_x64/vrclient_x64/Makefile

63
.gitmodules vendored
View File

@ -1,57 +1,24 @@
[submodule "wine"]
path = wine
url = ../wine
path = wine
url = https://github.com/ValveSoftware/wine/
[submodule "dxvk"]
path = dxvk
url = ../dxvk
url = https://github.com/ValveSoftware/dxvk/
[submodule "openal-soft"]
path = openal-soft
url = https://github.com/kcat/openal-soft.git
[submodule "ffmpeg"]
path = ffmpeg
url = https://git.ffmpeg.org/ffmpeg.git
[submodule "openvr"]
path = openvr
url = https://github.com/ValveSoftware/openvr
[submodule "cmake"]
path = cmake
url = https://github.com/Kitware/CMake
[submodule "fonts/liberation-fonts"]
path = fonts/liberation-fonts
url = https://github.com/liberationfonts/liberation-fonts
[submodule "gstreamer"]
path = gstreamer
url = https://github.com/GStreamer/gstreamer.git
[submodule "gst-orc"]
path = gst-orc
url = https://github.com/GStreamer/orc.git
[submodule "vkd3d-proton"]
path = vkd3d-proton
url = https://github.com/HansKristian-Work/vkd3d-proton
[submodule "OpenXR-SDK"]
path = OpenXR-SDK
url = https://github.com/KhronosGroup/OpenXR-SDK
[submodule "dxvk-nvapi"]
path = dxvk-nvapi
url = https://github.com/jp7677/dxvk-nvapi
[submodule "vkd3d"]
path = vkd3d
url = https://github.com/ValveSoftware/vkd3d
[submodule "Vulkan-Headers"]
path = Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers
[submodule "SPIRV-Headers"]
path = SPIRV-Headers
url = https://github.com/KhronosGroup/SPIRV-Headers
[submodule "Vulkan-Loader"]
path = Vulkan-Loader
url = https://github.com/KhronosGroup/Vulkan-Loader
[submodule "gst-libav"]
path = gst-libav
url = https://github.com/GStreamer/gst-libav
[submodule "ffmpeg"]
path = ffmpeg
url = https://github.com/FFmpeg/FFmpeg
[submodule "dav1d"]
path = dav1d
url = https://github.com/videolan/dav1d.git
[submodule "gst-plugins-rs"]
path = gst-plugins-rs
url = https://github.com/sdroege/gst-plugin-rs
[submodule "graphene"]
path = graphene
url = https://github.com/ebassi/graphene
[submodule "glslang"]
path = glslang
url = https://github.com/KhronosGroup/glslang
[submodule "FAudio"]
path = FAudio
url = https://github.com/FNA-XNA/FAudio/

1
FAudio Submodule

@ -0,0 +1 @@
Subproject commit 126cd0e5b5508c2f5317e81120fd517f3615174d

View File

@ -1,10 +1,10 @@
Copyright (c) 2018-2022, Valve Corporation
Copyright (c) 2018, Valve Corporation
All rights reserved.
Redistribution and use of Proton in source and binary forms is governed
by a variety of licenses.
Refer to the contents of LICENSE.proton for the license for the top
Refer to the contents of LICENCE.proton for the license for the top
level contents of the Proton project.
Proton uses a variety of other software, each of which is governed

View File

@ -1,4 +1,4 @@
Copyright (c) 2018-2022, Valve Corporation
Copyright (c) 2018, Valve Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,

246
Makefile
View File

@ -1,224 +1,42 @@
#See help target below for documentation
# "Quick start" Makefile targets:
# install - install Proton into current user's Steam installation
# deploy - build deployment files into tagged directory
#
# Development targts:
# vagrant - start Vagrant VM
# proton - build Proton
# module - build a single Wine module and copy into the shared directory.
# note: this is a development loop target. use it only after building all of wine with one of the other targets
# specify module variable: make module=kernel32 module
ifeq ($(build_name),)
_build_name := $(shell git symbolic-ref --short HEAD 2>/dev/null)-local
else
_build_name := $(build_name)
endif
ifeq ($(_build_name),)
$(error ERROR: Unable to auto-detect build name. Check out a branch or specify with "build_name=...")
endif
# remove special chars
override _build_name := $(shell echo $(_build_name) | tr -dc '[:alnum:] ._-')
BUILD_ROOT := build
# make doesn't handle spaces well... replace them with underscores in paths
BUILD_DIR := $(BUILD_ROOT)/build-$(shell echo $(_build_name) | sed -e 's/ /_/g')
STEAM_DIR := $(HOME)/.steam/root
DEPLOY_DIR := $(shell git describe --tags --always)
ifeq ($(build_name),)
DEPLOY_DIR := $(shell git describe --tags --always --exclude proton-sdk*)
else
DEPLOY_DIR := $(_build_name)
endif
all: proton
ifneq ($(module),)
ifneq ($(findstring .drv,$(module)),)
MODULE_PEFILE := $(module)
MODULE_SOFILE := $(subst .drv,.so,$(module))
else ifneq ($(findstring .sys,$(module)),)
MODULE_PEFILE := $(module)
MODULE_SOFILE := $(subst .sys,.so,$(module))
else
MODULE_PEFILE := $(module).dll
MODULE_SOFILE := $(module).so
endif
endif
.PHONY: vagrant proton install proton_build deploy
ifneq ($(unstripped),)
UNSTRIPPED := UNSTRIPPED_BUILD=1
DEPLOY_DIR := $(DEPLOY_DIR)_unstripped
endif
vagrant:
vagrant up
vagrant rsync
CONFIGURE_CMD := ../../configure.sh \
--build-name="$(_build_name)"
proton: vagrant
vagrant ssh -c "make -C build/ dist"
echo "Proton built in VM. Use 'install' or 'deploy' targets to retrieve the build."
ifneq ($(protonsdk_version),)
CONFIGURE_CMD += --proton-sdk-image=registry.gitlab.steamos.cloud/proton/soldier/sdk:$(protonsdk_version)
else
protonsdk_version := $(shell grep '^arg_protonsdk_image=' configure.sh|xargs echo|cut -d: -f2)
endif
enable_ccache := 1
ifneq ($(enable_ccache),0)
CONFIGURE_CMD += --enable-ccache
endif
TOPLEVELGOALS := all any clean configure deploy downloads help install module proton protonsdk redist
CONTAINERGOALS := $(filter-out $(TOPLEVELGOALS),$(MAKECMDGOALS))
CONTAINERGOALS := $(filter-out $(BUILD_ROOT)/%,$(CONTAINERGOALS))
all: help
.PHONY: $(TOPLEVELGOALS)
help:
@echo "Proton Makefile instructions"
@echo ""
@echo "\"Quick start\" Makefile targets:"
@echo " install - Install Proton into current user's Steam installation"
@echo " redist - Build a package suitable for manual installation or distribution"
@echo " to other users in $(BUILD_ROOT)/ named after the nearest git tag"
@echo " deploy - Build Steam deployment files into a directory in $(BUILD_ROOT)/ named"
@echo " after the nearest git tag"
@echo " clean - Delete the Proton build directory"
@echo ""
@echo "Configuration variables:"
@echo " build_name - The name of the build, will be displayed in Steam. Defaults to"
@echo " current proton.git branch name if available. A new build dir"
@echo " will be created for each build_name, so if you override this,"
@echo " remember to always set it!"
@echo " Current build name: $(_build_name)"
@echo " unstripped - Set to non-empty to avoid stripping installed library files."
@echo " enable_ccache - Enabled by default, set to 0 prior to configuring to disable ccache."
@echo " protonsdk_version - Version of the proton sdk image to use for building,"
@echo " use protonsdk_version=local to build it locally."
@echo ""
@echo "Development targets:"
@echo " configure - Configure Proton build directory"
@echo " proton - Build Proton"
@echo ""
@echo " The following targets are development targets only useful after building Proton."
@echo " module - Rebuild a single Wine module and copy into $(BUILD_ROOT)/<module>/."
@echo " Specify module variable: make module=kernel32 module"
@echo " dxvk - Rebuild DXVK and copy it into $(BUILD_ROOT)/."
@echo " lsteamclient - Rebuild the Steam client wrapper and copy it into $(BUILD_ROOT)/."
@echo ""
@echo "Examples:"
@echo " make install - Build Proton and install into this user's Steam installation,"
@echo " with the current Proton branch name as the tool's name."
@echo ""
@echo " make redist - Build a Proton redistribution package in a tagged directory"
@echo " in $(BUILD_ROOT)/."
@echo ""
@echo " make build_name=mytest install - Build Proton with the tool name \"mytest\" and"
@echo " install into this user's Steam installation."
@echo ""
@echo " make build_name=mytest module=dsound module - Build only the dsound module"
@echo " in the \"mytest\" build directory and place it into $(BUILD_ROOT)/dsound/."
clean:
rm -rf $(BUILD_DIR)
protonsdk:
$(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C docker $(UNSTRIPPED) PROTONSDK_VERSION=$(protonsdk_version) proton
configure: | $(BUILD_DIR)
if [ ! -e $(BUILD_DIR)/Makefile ]; then \
(cd $(BUILD_DIR) && $(CONFIGURE_CMD)); \
fi
ifeq ($(protonsdk_version),local)
configure: protonsdk
endif
proton: configure
$(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) dist && \
echo "Proton built locally. Use 'install', 'deploy' or 'redist' targets."
install: configure
$(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) install
install: vagrant
vagrant ssh -c "make -C build/ STEAM_DIR=/vagrant/ install"
cp -R vagrant_share/compatibilitytools.d/ $(STEAM_DIR)
echo "Proton installed to your local Steam installation"
redist: | $(BUILD_ROOT)/$(DEPLOY_DIR)
redist: configure
rm -rf $(BUILD_ROOT)/$(DEPLOY_DIR)/* && \
$(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) redist && \
cp -Rf $(BUILD_DIR)/redist/* $(BUILD_ROOT)/$(DEPLOY_DIR) && \
echo "Proton build available at $(BUILD_ROOT)/$(DEPLOY_DIR)"
deploy: vagrant
vagrant ssh -c "make -C build/ deploy"
mkdir -p vagrant_share/$(DEPLOY_DIR)
vagrant ssh -c "cp -a build/deploy/* /vagrant/$(DEPLOY_DIR)"
echo "Proton deployed to vagrant_share/$(DEPLOY_DIR)"
deploy: | $(BUILD_ROOT)/$(DEPLOY_DIR)-deploy
deploy: configure
rm -rf $(BUILD_ROOT)/$(DEPLOY_DIR)-deploy/* && \
$(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) deploy && \
cp -Rf $(BUILD_DIR)/deploy/* $(BUILD_ROOT)/$(DEPLOY_DIR)-deploy && \
echo "Proton deployed to $(BUILD_ROOT)/$(DEPLOY_DIR)-deploy"
module: | $(BUILD_ROOT)/$(module)/lib/wine/i386-windows
module: | $(BUILD_ROOT)/$(module)/lib/wine/i386-unix
module: | $(BUILD_ROOT)/$(module)/lib64/wine/x86_64-windows
module: | $(BUILD_ROOT)/$(module)/lib64/wine/x86_64-unix
module: configure
$(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) module=$(module) module && \
cp -f $(BUILD_DIR)/obj-wine32/dlls/$(module)/$(MODULE_PEFILE) $(BUILD_ROOT)/$(module)/lib/wine/i386-windows/ && \
cp -f $(BUILD_DIR)/obj-wine64/dlls/$(module)/$(MODULE_PEFILE) $(BUILD_ROOT)/$(module)/lib64/wine/x86_64-windows/ && \
if [ -e $(BUILD_DIR)/obj-wine32/dlls/$(module)/$(MODULE_PEFILE).so ]; then \
cp -f $(BUILD_DIR)/obj-wine32/dlls/$(module)/$(MODULE_PEFILE).so $(BUILD_ROOT)/$(module)/lib/wine/i386-unix/ && \
cp -f $(BUILD_DIR)/obj-wine64/dlls/$(module)/$(MODULE_PEFILE).so $(BUILD_ROOT)/$(module)/lib64/wine/x86_64-unix/; \
fi
if [ -e $(BUILD_DIR)/obj-wine32/dlls/$(module)/$(MODULE_SOFILE) ]; then \
cp -f $(BUILD_DIR)/obj-wine32/dlls/$(module)/$(MODULE_SOFILE) $(BUILD_ROOT)/$(module)/lib/wine/i386-unix/ && \
cp -f $(BUILD_DIR)/obj-wine64/dlls/$(module)/$(MODULE_SOFILE) $(BUILD_ROOT)/$(module)/lib64/wine/x86_64-unix/; \
fi
any $(CONTAINERGOALS): configure
$(MAKE) $(MFLAGS) $(MAKEOVERRIDES) -C $(BUILD_DIR)/ $(UNSTRIPPED) $(CONTAINERGOALS)
dxvk: | $(BUILD_ROOT)/dxvk/lib/wine/dxvk
dxvk: | $(BUILD_ROOT)/dxvk/lib64/wine/dxvk
dxvk: any
cp -f $(BUILD_DIR)/dist/dist/lib/wine/dxvk/*.dll $(BUILD_ROOT)/dxvk/lib/wine/dxvk/ && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/dxvk/*.dll $(BUILD_ROOT)/dxvk/lib64/wine/dxvk/
dxvk-nvapi: | $(BUILD_ROOT)/dxvk-nvapi/lib/wine/nvapi
dxvk-nvapi: | $(BUILD_ROOT)/dxvk-nvapi/lib64/wine/nvapi
dxvk-nvapi: any
cp -f $(BUILD_DIR)/dist/files/lib/wine/nvapi/*.dll $(BUILD_ROOT)/dxvk-nvapi/lib/wine/nvapi/ && \
cp -f $(BUILD_DIR)/dist/files/lib64/wine/nvapi/*.dll $(BUILD_ROOT)/dxvk-nvapi/lib64/wine/nvapi/
vkd3d-proton: | $(BUILD_ROOT)/vkd3d-proton/lib/wine/vkd3d-proton
vkd3d-proton: | $(BUILD_ROOT)/vkd3d-proton/lib64/wine/vkd3d-proton
vkd3d-proton: any
cp -f $(BUILD_DIR)/dist/dist/lib/wine/vkd3d-proton/*.dll $(BUILD_ROOT)/vkd3d-proton/lib/wine/vkd3d-proton/ && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/vkd3d-proton/*.dll $(BUILD_ROOT)/vkd3d-proton/lib64/wine/vkd3d-proton/
lsteamclient: | $(BUILD_ROOT)/lsteamclient/lib/wine/i386-windows
lsteamclient: | $(BUILD_ROOT)/lsteamclient/lib/wine/i386-unix
lsteamclient: | $(BUILD_ROOT)/lsteamclient/lib64/wine/x86_64-windows
lsteamclient: | $(BUILD_ROOT)/lsteamclient/lib64/wine/x86_64-unix
lsteamclient: any
cp -f $(BUILD_DIR)/dist/dist/lib/wine/i386-windows/lsteamclient.dll $(BUILD_ROOT)/lsteamclient/lib/wine/i386-windows/ && \
cp -f $(BUILD_DIR)/dist/dist/lib/wine/i386-unix/lsteamclient.dll.so $(BUILD_ROOT)/lsteamclient/lib/wine/i386-unix/ && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/x86_64-windows/lsteamclient.dll $(BUILD_ROOT)/lsteamclient/lib64/wine/x86_64-windows/ && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/x86_64-unix/lsteamclient.dll.so $(BUILD_ROOT)/lsteamclient/lib64/wine/x86_64-unix/
vrclient: | $(BUILD_ROOT)/vrclient/lib/wine/i386-windows
vrclient: | $(BUILD_ROOT)/vrclient/lib/wine/i386-unix
vrclient: | $(BUILD_ROOT)/vrclient/lib64/wine/x86_64-windows
vrclient: | $(BUILD_ROOT)/vrclient/lib64/wine/x86_64-unix
vrclient: any
cp -f $(BUILD_DIR)/dist/dist/lib/wine/i386-windows/vrclient.dll $(BUILD_ROOT)/vrclient/lib/wine/i386-windows/ && \
cp -f $(BUILD_DIR)/dist/dist/lib/wine/i386-unix/vrclient.dll.so $(BUILD_ROOT)/vrclient/lib/wine/i386-unix/ && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/x86_64-windows/vrclient_x64.dll $(BUILD_ROOT)/vrclient/lib64/wine/x86_64-windows/ && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/x86_64-unix/vrclient_x64.dll.so $(BUILD_ROOT)/vrclient/lib64/wine/x86_64-unix/
wineopenxr: | $(BUILD_ROOT)/wineopenxr/lib64/wine/x86_64-windows
wineopenxr: | $(BUILD_ROOT)/wineopenxr/lib64/wine/x86_64-unix
wineopenxr: any
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/x86_64-windows/wineopenxr.dll $(BUILD_ROOT)/wineopenxr/lib64/wine/x86_64-windows/ && \
cp -f $(BUILD_DIR)/dist/dist/lib64/wine/x86_64-unix/wineopenxr.dll.so $(BUILD_ROOT)/wineopenxr/lib64/wine/x86_64-unix/
battleye: | $(BUILD_ROOT)/battleye/v1/lib/wine/i386-windows
battleye: | $(BUILD_ROOT)/battleye/v1/lib/wine/i386-unix
battleye: | $(BUILD_ROOT)/battleye/v1/lib64/wine/x86_64-windows
battleye: | $(BUILD_ROOT)/battleye/v1/lib64/wine/x86_64-unix
battleye: any
cp -f $(BUILD_DIR)/dist-battleye/v1/lib/wine/i386-windows/beclient.dll $(BUILD_ROOT)/battleye/v1/lib/wine/i386-windows/ && \
cp -f $(BUILD_DIR)/dist-battleye/v1/lib/wine/i386-unix/beclient.dll.so $(BUILD_ROOT)/battleye/v1/lib/wine/i386-unix/ && \
cp -f $(BUILD_DIR)/dist-battleye/v1/lib64/wine/x86_64-windows/beclient_x64.dll $(BUILD_ROOT)/battleye/v1/lib64/wine/x86_64-windows/ && \
cp -f $(BUILD_DIR)/dist-battleye/v1/lib64/wine/x86_64-unix/beclient_x64.dll.so $(BUILD_ROOT)/battleye/v1/lib64/wine/x86_64-unix/
$(BUILD_ROOT)/%:
mkdir -p $@
module: vagrant
vagrant ssh -c "make -C build/ module=$(module) module"
mkdir -p vagrant_share/$(module)/lib{,64}/wine/
vagrant ssh -c "cp -a build/obj-wine32/dlls/$(module)/$(module)*.so /vagrant/$(module)/lib/wine/"
vagrant ssh -c "cp -a build/obj-wine64/dlls/$(module)/$(module)*.so /vagrant/$(module)/lib64/wine/"

File diff suppressed because it is too large Load Diff

@ -1 +0,0 @@
Subproject commit 58a00cf85c39ad5ec4dc43a769624e420c06179a

429
README.md
View File

@ -1,316 +1,265 @@
---
Introduction
------------
**Proton** is a tool for use with the Steam client which allows games which are
---
Proton is a tool for use with the Steam client which allows games which are
exclusive to Windows to run on the Linux operating system. It uses Wine to
facilitate this.
**Most users should use Proton provided by the Steam Client itself.** See
[this Steam Community post][steam-play-introduction] for more details.
Most users will prefer to use Proton provided by the Steam client itself. The
source code is provided to enable advanced users the ability to alter
Proton. For example, some users may wish to use a different version of Wine with
a particular title.
The source code is provided to enable advanced users the ability to alter
Proton. For example, some users may wish to use a different version of Wine
with a particular title.
---
Getting Started with Proton from Steam Play
---
* As the new Steam Play is still in Beta, it is recommended that you opt into the [Steam Client Beta](https://steamcommunity.com/sharedfiles/filedetails/?id=182912431) for the latest features and fixes.
* Proton requires graphics drivers that are more recent than what is typically packaged in most distributions; please read the [list of requirements and quickstart for Ubuntu 18.04 users](https://github.com/ValveSoftware/Proton/wiki/Requirements)
* Install and play games! Please refer to [this post](https://steamcommunity.com/games/221410/announcements/detail/1696055855739350561) for more information.
* Visit the [changelog](https://github.com/ValveSoftware/Proton/wiki/Changelog) for information about recent updates.
**The changelog** is available on [our wiki][changelog].
---
Obtaining Proton from source
---
**NOTE:** If you are not comfortable in a command line terminal, or if you find
any of the information presented in here strange and uncomfortable, then
this is probably not for you. The instructions are likely to be incomplete
and require some knowledge and skill on your part, and there is no warranty
or guarantee that anyone will help you with this process.
[steam-play-introduction]: https://steamcommunity.com/games/221410/announcements/detail/1696055855739350561
[changelog]: https://github.com/ValveSoftware/Proton/wiki/Changelog
We strongly recommend that most users use the production build of Proton.
The most current source for Proton is here:
<https://github.com/ValveSoftware/Proton>
Obtaining Proton sources
------------------------
Which you can clone to your system with this command:
Acquire Proton's source by cloning <https://github.com/ValveSoftware/Proton>
and checking out the branch you desire.
git clone https://github.com/ValveSoftware/Proton.git proton
You can clone the latest Proton to your system with this command:
After cloning the Proton git repository, the next step will be to
obtain the various submodules that go into building Proton:
```bash
git clone --recurse-submodules https://github.com/ValveSoftware/Proton.git proton
```
cd proton
git submodule update --init
Be sure to update submodules when switching between branches:
If you wish to change any subcomponent, now is the time to do so.
For example, if you wish make changes to Wine, you would apply those
changes to the <tt>wine/</tt> directory.
```bash
git checkout experimental_6.3
git submodule update --init --recursive
```
---
Easy build path
---
If you want to change any subcomponent, now is the time to do so. For
example, if you wish to make changes to Wine, you would apply them to the
`wine/` directory.
Building Proton is quite complicated. We now provide a top-level Makefile which
will execute most of the build commands for you. This section describes how to
use this Makefile for simple Proton builds.
This Makefile uses a virtual machine to create a consistent build environment.
The VM is managed with [Vagrant](https://www.vagrantup.com/), which you will
need to install before invoking these commands. While Vagrant supports several
VM software backends, Proton's build system has been tested only with its
VirtualBox backend. You may run into problems with the shared folder
(`vagrant_share`) and/or CPU and memory usage with other backends.
Building Proton
---------------
If your build VM gets cluttered, or falls out of date, you can use `vagrant
destroy` to wipe the VM clean, then invoke one of the below commands to start
over.
Most of Proton builds inside the Proton SDK container with very few
dependencies on the host side.
After checking out Proton and updating its submodules, you can use these
targets to build Proton:
## Preparing the build environment
`make install` - This will install Proton into your user's Steam directory.
You may need to restart the Steam client to see it. It will be called
`proton-localbuild`. Subsequent `make install` invocations will overwrite
this installation.
You need either a Docker or a Podman setup. We highly recommend [the rootless
Podman setup][rootless-podman]. Please refer to your distribution's
documentation for setup instructions (e.g. Arch [Podman][arch-podman] /
[Docker][arch-docker], Debian [Podman][debian-podman] /
[Docker][debian-docker]).
`make deploy` - This will create a deployment tarball and set of files which
can be distributed as a Proton package. This is what we use to deploy Proton to
Steam users. The package will be dropped into a new directory in
`vagrant_share/`, named after the nearest Git tag (see `git describe`).
[rootless-podman]: https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md
[arch-podman]: https://wiki.archlinux.org/title/Podman
[arch-docker]: https://wiki.archlinux.org/title/Docker
[debian-podman]: https://wiki.debian.org/Podman
[debian-docker]: https://wiki.debian.org/Docker
We also provide targets useful for simple Wine development:
`make proton` - This will build Proton without copying its files out of the VM.
## The Easy Way
`make module=<module> module` - This will build both 32- and 64-bit versions of
the specified module, and copy the result into the `vagrant_share` directory.
This allows rapid iteration on one module. This target is only useful after
building Proton.
We provide a top-level Makefile which will execute most of the build commands
for you.
If you are doing significant Wine development or want to control the build with
more fine detail, see the full documentation below.
After checking out the repository and updating its submodules, assuming that
you have a working Docker or Podman setup, you can build and install Proton
with a simple:
---
Building
---
At a high level, the build instructions are:
```bash
make install
```
1. Set up your build environment
1. Configure the build
1. Build Proton
1. Install Proton locally (optional)
If your build system is missing dependencies, it will fail quickly with a clear
error message.
See below for more details on all of these steps. Please read all of the
instructions before proceeding.
After the build finishes, you may need to restart the Steam client to see the
new Proton tool. The tool's name in the Steam client will be based on the
currently checked out branch of Proton. You can override this name using the
`build_name` variable.
---
Set up the build environment
---
Proton has a lot of build-time dependencies. The following instructions
describe how we create the build environment for the production builds of
Proton. For reproducibility and security reasons, we will be setting up a
Debian 9 virtual machine. However, you should be able to follow these
instructions on other distributions as well.
See `make help` for other build targets and options.
Proton provides a Vagrantfile, which will automatically set up the Debian 9 VM
for you. After installing [Vagrant](https://www.vagrantup.com/), initialize the
VM by running from within the Proton directory:
vagrant up
It will take a long time to download and install the Steam runtime containers
and so on. Eventually it will complete. You can SSH into the virtual machine
with:
## Manual building
vagrant ssh
### Configuring the build
The Vagrantfile is set up to rsync the `proton` directory into the VM on boot,
and it will create a `build` directory in `$HOME` that is ready for you to run
`make`. On the host machine, you can use `vagrant rsync-auto` to have Vagrant
automatically sync changes on your host machine into the build machine. It is
recommended that you make changes on your host machine, and then perform the
build in the VM. Any changes you make in the `proton` directory on the VM may
be overwritten by later rsync updates from the host machine.
```bash
mkdir ../build && cd ../build
../proton/configure.sh --enable-ccache --build-name=my_build
```
The Vagrantfile also creates a directory called `vagrant_share` in the `proton`
directory of your host machine, which is mounted at `/vagrant` within the VM.
You can use this shared folder to move your Proton build out of the VM, or as
one way to copy files into the VM.
Running `configure.sh` will create a `Makefile` allowing you to build Proton.
The scripts checks if containers are functional and prompt you if any
host-side dependencies are missing. You should run the command from a
directory created specifically for your build.
When you are done with the VM, you can shut it down from the host machine:
The configuration script tries to discover a working Docker or Podman setup
to use, but you can force a compatible engine with
`--container-engine=<executable_name>`.
vagrant halt
You can enable ccache with `--enable-cache` flag. This will mount your
`$CCACHE_DIR` or `$HOME/.ccache` inside the container.
Please read the Vagrant documentation for more information about how to use
Vagrant VMs.
`--proton-sdk-image=registry.gitlab.steamos.cloud/proton/soldier/sdk:<version>`
can be used to build with a custom version of the Proton SDK images.
If you do not wish to use Vagrant, you can read through both Vagrantfile and
`vagrant-user-setup.sh` for the list of dependencies and instructions on how to
set up your own machine or another VM of your choosing. It is aimed at Debian
9, but you should be able to adapt them for other distributions.
Check `--help` for other configuration options.
---
Alternative: Building without the Steam Runtime
---
The Steam Runtime provides a clean and consistent set of libraries. Software
distributed through Steam should depend only on libraries available through the
runtime, and so we build in that environment for production Proton builds. The
Vagrantfile described above will set this up for you. However, if you are
simply making a build for yourself, you may want to skip setting up the Steam
runtime, as it takes a very long time to set up. To do this, edit the
`vagrant-user-setup.sh` script appropriately before running `vagrant up`.
NOTE: If **SELinux** is in use, the Proton build container may fail to access
your user's files. This is caused by [SELinux's filesystem
labels][selinux-labels]. You may pass the `--relabel-volumes` switch to
configure to cause the [container engine to relabel its
bind-mounts][bind-mounts] and allow access to those files from within the
container. This can be dangerous when used with system directories. Proceed
with caution and refer your container engine's manual.
---
Configure the build
---
After setting up the build system, it is time to run the configure script which
will generate the Makefile to build your project. The Vagrantfile is set up to
do this automatically for you in a directory called `$HOME/build` within the
VM. If you are configuring manually, run these steps:
[selinux-labels]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/security-enhanced_linux/sect-security-enhanced_linux-working_with_selinux-selinux_contexts_labeling_files
[bind-mounts]: https://docs.docker.com/storage/bind-mounts/
mkdir proton/mybuild/
cd proton/mybuild
../configure.sh --steam-runtime64=docker:steam-proton-dev-beta --steam-runtime32=docker:steam-proton-dev32-beta --steam-runtime=$HOME/steam-runtime/runtime/
If you are building without the Steam runtime, then instead use:
### Building
../configure.sh --no-steam-runtime
```
make
```
**Tip**: If you are building without the Steam runtime, you should now run
`make obj-wine64/Makefile obj-wine32/Makefile` and check the files
`obj-wine64/config.log` and `obj-wine32/config.log` for missing packages.
Search for `won't be supported`. A couple of missing packages are normal:
`opencv`, `gstreamer`, `vkd3d`, `oss`. More than that may indicate a problem.
Please see your distro's documentation to acquire the considerable build
dependencies for Wine.
**Important make targets:**
---
Build Proton
---
A couple of Makefile targets are provided.
`make install` - install Proton into your user's Steam directory, see the [install Proton
locally](#install-proton-locally) section for details.
`make redist` - create a redistribute build (`redist/`) that can be copied to
`~/.steam/root/compatibilitytools.d/`.
`make deploy` - create a deployment build (`deploy/`). This is what we use to
deploy Proton to Steam users via Steamworks.
`make module=<module> module` - build both 32- and 64-bit versions of the
specified wine module. This allows rapid iteration on one module. This target
is only useful after building Proton.
`make dxvk` / `make vkd3d-proton` - rebuild DXVK / vkd3d-proton.
### Debug Builds
To prevent symbol stripping add `UNSTRIPPED_BUILD=1` to the `make`
invocation. This should be used only with a clean build directory.
E.g.:
```
mkdir ../debug-proton-build && cd ../debug-proton-build
../proton/configure.sh --enable-ccache --build-name=debug_build
make UNSTRIPPED_BUILD=1 install
```
`make dist` will create a Proton installation in `dist/` that you can install
manually (see below), or automatically with `make install`.
`make deploy` will package Proton up for distribution via Steamworks.
---
Install Proton locally
----------------------
---
Steam ships with several versions of Proton, which games will use by default or
that you can select in Steam Settings' Steam Play page. Steam also supports
that you can select in Steam Settings's SteamPlay page. Steam also supports
running games with local builds of Proton, which you can install on your
machine.
machine. The `install` target will perform the below steps for you.
To install a local build of Proton into Steam, make a new directory in
`~/.steam/root/compatibilitytools.d/` with a tool name of your choosing and
place the directory containing your redistributable build under that path.
place the contents of `dist` into that folder. The `make install` target will
perform this task for you, installing the Proton build into the Steam folder
for the current user. You will have to restart the Steam client for it to pick
up on a new tool.
The `make install` target will perform this task for you, installing the
Proton build into the Steam folder for the current user. You will have to
restart the Steam client for it to pick up on a new tool.
A correct local tool installation should look like this:
A correct local tool installation should look similar to this:
```
compatibilitytools.d/my_proton/
├── compatibilitytool.vdf
├── filelock.py
├── LICENSE
├── proton
├── proton_dist.tar
├── toolmanifest.vdf
├── user_settings.sample.py
└── version
```
compatibilitytools.d/my_proton/
├── compatibilitytool.vdf
├── filelock.py
├── LICENSE
├── proton
├── proton_dist.tar.gz
├── toolmanifest.vdf
├── user_settings.sample.py
└── version
To enable your local build in Steam, go to the Steam Play section of the
Settings window. If the build was correctly installed, you should see
"proton-localbuild" in the drop-down list of compatibility tools.
Each component of this software is used under the terms of their licenses.
See the `LICENSE` files here, as well as the `LICENSE`, `COPYING`, etc files
in each submodule and directory for details. If you distribute a built
version of Proton to other users, you must adhere to the terms of these
licenses.
Debugging
---------
Proton builds have their symbols stripped by default. You can switch to
"debug" beta branch in Steam (search for Proton in your library,
Properties... -> BETAS -> select "debug") or build without stripping (see
[Debug Builds section](#debug-builds)).
The symbols are provided through the accompanying `.debug` files which may
need to be explicitly loaded by the debugging tools. For GDB there's a helper
script `wine/tools/gdbinit.py` (source it) that provides `load-symbol-files`
(or `lsf` for short) command which loads the symbols for all the mapped files.
`compile_commands.json`
-----------------------
For use with [clangd](https://clangd.llvm.org/) LSP server and similar tooling.
Projects built using cmake or meson (e.g. vkd3d-proton) automatically come with
`compile_commands.json`. For autotools (e.g. wine) you have to [configure the
build](#configuring-the-build) with `--enable-bear` that uses
[bear](https://github.com/rizsotto/Bear) to create the compilation database.
It's not on by default as it make the build slightly slower.
The build system collects all the created compile_commands.json files in a
build subdirectory named `compile_commands/`.
The paths are translated to point to the real source (i.e. not the rsynced
copy). It still may depend on build directory for things like auto-generated
`config.h` though and for wine it may be beneficial to run `tools/make_requests`
in you source directories as those changes are not committed.
You can then configure your editor to use that file for clangd in a few ways:
1) directly - some editors/plugins allow you to specify the path to `compile_commands.json`
2) via `.clangd` file, e.g.
```bash
cd src/proton/wine/
cat > .clangd <<EOF
CompileFlags:
CompilationDatabase: ../build/current-dev/compile_commands/wine64/
EOF
```
3) by symlinking:
```bash
ln -s ../build/current-dev/compile_commands/wine64/compile_commands.json .
```
Each component of this software is used under the terms of their licenses. See
the <tt>LICENSE</tt> files here, as well as the <tt>LICENSE</tt>,
<tt>COPYING</tt>, etc files in each submodule and directory for details. If you
distribute a built version of Proton to other users, you must adhere to the
terms of these licenses.
----
Runtime Config Options
----------------------
----
Proton can be tuned at runtime to help certain games run. The Steam client sets
some options for known games using the `STEAM_COMPAT_CONFIG` variable.
some options for known games using the <tt>STEAM_COMPAT_CONFIG</tt> variable.
You can override these options using the environment variables described below.
The best way to set these environment overrides for all games is by renaming
`user_settings.sample.py` to `user_settings.py` and modifying it appropriately.
This file is located in the Proton installation directory in your Steam library
(often `~/.steam/steam/steamapps/common/Proton #.#`).
If you want to change the runtime configuration for a specific game, you can
use the `Set Launch Options` setting in the game's `Properties` dialog in the
Steam client. Set the variable, followed by `%command%`. For example, input
"`PROTON_USE_WINED3D=1 %command%`" to use the OpenGL-based wined3d renderer
instead of the Vulkan-based DXVK renderer.
use the `Set Launch Options` setting in the game's `Properties` dialog in the Steam client. You can launch the
game as you would with "`PROTON_VARIABLE=1 %command%`" [(source)](https://superuser.com/questions/954041/how-to-set-an-environment-variable-for-an-specific-game-on-steam-for-linux#980437).
To enable an option, set the variable to a non-`0` value. To disable an
option, set the variable to `0`. To use Steam's default configuration, do
To enable an option, set the variable to a non-<tt>0</tt> value. To disable an
option, set the variable to <tt>0</tt>. To use Steam's default configuration, do
not specify the variable at all.
All of the below are runtime options. They do not effect permanent changes to
the Wine prefix. Removing the option will revert to the previous behavior.
| Compat config string | Environment Variable | Description |
| :-------------------- | :--------------------------------- | :----------- |
| | `PROTON_LOG` | Convenience method for dumping a useful debug log to `$PROTON_LOG_DIR/steam-$APPID.log`. Set to `1` to enable default logging, or set to a string to be appended to the default `WINEDEBUG` channels. |
| | `PROTON_LOG_DIR` | Output log files into the directory specified. Defaults to your home directory. |
| | `PROTON_DUMP_DEBUG_COMMANDS` | When running a game, Proton will write some useful debug scripts for that game into `$PROTON_DEBUG_DIR/proton_$USER/`. |
| | `PROTON_DEBUG_DIR` | Root directory for the Proton debug scripts, `/tmp` by default. |
| | `PROTON_WAIT_ATTACH` | Wait for a debugger to attach to steam.exe before launching the game process. To attach to the game process at startup, debuggers should be set to follow child processes. |
| | `PROTON_CRASH_REPORT_DIR` | Write crash logs into this directory. Does not clean up old logs, so may eat all your disk space eventually. |
| `wined3d` | `PROTON_USE_WINED3D` | Use OpenGL-based wined3d instead of Vulkan-based DXVK for d3d11, d3d10, and d3d9. |
| `nod3d11` | `PROTON_NO_D3D11` | Disable `d3d11.dll`, for d3d11 games which can fall back to and run better with d3d9. |
| `nod3d10` | `PROTON_NO_D3D10` | Disable `d3d10.dll` and `dxgi.dll`, for d3d10 games which can fall back to and run better with d3d9. |
| `noesync` | `PROTON_NO_ESYNC` | Do not use eventfd-based in-process synchronization primitives. |
| `nofsync` | `PROTON_NO_FSYNC` | Do not use futex-based in-process synchronization primitives. (Automatically disabled on systems with no `FUTEX_WAIT_MULTIPLE` support.) |
| `noxim` | `PROTON_NO_XIM` | Enabled by default. Do not attempt to use XIM (X Input Methods) support. XIM support is known to cause crashes with libx11 older than version 1.7. |
| `enablenvapi` | `PROTON_ENABLE_NVAPI` | Enable NVIDIA's NVAPI GPU support library. |
| `nativevulkanloader` | | Use the Vulkan loader shipped with the game instead of Proton's built-in Vulkan loader. This breaks VR support, but is required by a few games. |
| `forcelgadd` | `PROTON_FORCE_LARGE_ADDRESS_AWARE` | Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. Enabled by default. |
| `heapdelayfree` | `PROTON_HEAP_DELAY_FREE` | Delay freeing some memory, to work around application use-after-free bugs. |
| `gamedrive` | `PROTON_SET_GAME_DRIVE` | Create an S: drive which points to the Steam Library which contains the game. |
| `noforcelgadd` | | Disable forcelgadd. If both this and `forcelgadd` are set, enabled wins. |
| `oldglstr` | `PROTON_OLD_GL_STRING` | Set some driver overrides to limit the length of the GL extension string, for old games that crash on very long extension strings. |
| `vkd3dfl12` | | Force the Direct3D 12 feature level to 12, regardless of driver support. |
| `vkd3dbindlesstb` | | Put `force_bindless_texel_buffer` into `VKD3D_CONFIG`. |
| `nomfdxgiman` | `WINE_DO_NOT_CREATE_DXGI_DEVICE_MANAGER` | Enable hack to work around video issues in some games due to incomplete IMFDXGIDeviceManager support. |
| `noopwr` | `WINE_DISABLE_VULKAN_OPWR` | Enable hack to disable Vulkan other process window rendering which sometimes causes issues on Wayland due to blit being one frame behind. |
| `hidenvgpu` | `PROTON_HIDE_NVIDIA_GPU` | Force Nvidia GPUs to always be reported as AMD GPUs. Some games require this if they depend on Windows-only Nvidia driver functionality. See also DXVK's nvapiHack config, which only affects reporting from Direct3D. |
| | `WINE_FULLSCREEN_INTEGER_SCALING` | Enable integer scaling mode, to give sharp pixels when upscaling. |
| `cmdlineappend:` | | Append the string after the colon as an argument to the game command. May be specified more than once. Escape commas and backslashes with a backslash. |
| `nowritewatch` | `PROTON_NO_WRITE_WATCH` | Disable support for memory write watches in ntdll. This is a very dangerous hack and should only be applied if you have verified that the game can operate without write watches. This improves performance for some very specific games (e.g. CoreRT-based games). |
| `nosteamffmpeg` | `PROTON_NO_STEAM_FFMPEG` | Ignore ffmpeg that ships with Steam. Some videos may not play. |
| `seccomp` | `PROTON_USE_SECCOMP` | **Note: Obsoleted in Proton 5.13.** In older versions, enable seccomp-bpf filter to emulate native syscalls, required for some DRM protections to work. |
| `d9vk` | `PROTON_USE_D9VK` | **Note: Obsoleted in Proton 5.0.** In older versions, use Vulkan-based DXVK instead of OpenGL-based wined3d for d3d9. |
| Compat config string | Environment Variable | Description |
| :-------------------- | :----------------------------- | :----------- |
| | <tt>PROTON_LOG</tt> | Convenience method for dumping a useful debug log to `$HOME/steam-$APPID.log`. For more thorough logging, use `user_settings.py`. |
| | <tt>PROTON_DUMP_DEBUG_COMMANDS</tt> | When running a game, Proton will write some useful debug scripts for that game into `$PROTON_DEBUG_DIR/proton_$USER/`. |
| | <tt>PROTON_DEBUG_DIR</tt> | Root directory for the Proton debug scripts, `/tmp` by default. |
| <tt>wined3d</tt> | <tt>PROTON_USE_WINED3D</tt> | Use OpenGL-based wined3d instead of Vulkan-based DXVK for d3d11 and d3d10. This used to be called `PROTON_USE_WINED3D11`, which is now an alias for this same option. |
| <tt>nod3d11</tt> | <tt>PROTON_NO_D3D11</tt> | Disable <tt>d3d11.dll</tt>, for d3d11 games which can fall back to and run better with d3d9. |
| <tt>nod3d10</tt> | <tt>PROTON_NO_D3D10</tt> | Disable <tt>d3d10.dll</tt> and <tt>dxgi.dll</tt>, for d3d10 games which can fall back to and run better with d3d9. |
| <tt>noesync</tt> | <tt>PROTON_NO_ESYNC</tt> | Do not use eventfd-based in-process synchronization primitives. |
| <tt>forcelgadd</tt> | <tt>PROTON_FORCE_LARGE_ADDRESS_AWARE</tt> | Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. |
| <tt>oldglstr</tt> | <tt>PROTON_OLD_GL_STRING</tt> | Set some driver overrides to limit the length of the GL extension string, for old games that crash on very long extension strings. |
<!-- Target: GitHub Flavor Markdown. To test locally: pandoc -f markdown_github -t html README.md -->

@ -1 +0,0 @@
Subproject commit 6cae8216a6ea19ff3f237af01e54378c1ff81fcd

64
Vagrantfile vendored Normal file
View File

@ -0,0 +1,64 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrant file for setting up a build environment for Proton.
Vagrant.configure(2) do |config|
config.vm.box = "generic/debian9"
config.vm.provider "virtualbox" do |v|
v.cpus = `nproc`.to_i
# meminfo shows KB and we need to convert to MB
v.memory = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024 / 2
end
#set up shared and rsynced folders
config.vm.synced_folder "./vagrant_share/", "/vagrant/", id: "share", create: true
config.vm.synced_folder ".", "/home/vagrant/proton", id: "proton", type: "rsync", rsync__exclude: ["/output/", "vagrant_share"], rsync__args: ["--verbose", "--archive", "-z", "--links", "--update"]
#this is where the VM is initialized on first setup
config.vm.provision "shell", privileged: "true", inline: <<-SHELL
#install docker and steam-runtime dependencies
dpkg --add-architecture i386
apt-get update
apt-get install -y apt-transport-https ca-certificates curl gnupg2 software-properties-common
#add winehq repo
curl -fsSL https://dl.winehq.org/wine-builds/winehq.key | apt-key add -
echo 'deb http://dl.winehq.org/wine-builds/debian stretch main' > /etc/apt/sources.list.d/winehq.list
#add docker repo
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian stretch stable"
#add backports
echo 'deb http://ftp.debian.org/debian stretch-backports main' > /etc/apt/sources.list.d/backports.list
#install host build-time dependencies
apt-get update
apt-get install -y gpgv2 gnupg2 g++ g++-6-multilib mingw-w64 git docker-ce fontforge-nox python-debian
apt-get -y -t stretch-backports install meson
#winehq-devel is installed to pull in dependencies to run Wine
apt-get install -y --install-recommends winehq-devel
#remove system Wine installation to ensure no accidental leakage
apt-get remove -y winehq-devel
#configure posix mingw-w64 alternative for DXVK
update-alternatives --set x86_64-w64-mingw32-gcc `which x86_64-w64-mingw32-gcc-posix`
update-alternatives --set x86_64-w64-mingw32-g++ `which x86_64-w64-mingw32-g++-posix`
update-alternatives --set i686-w64-mingw32-gcc `which i686-w64-mingw32-gcc-posix`
update-alternatives --set i686-w64-mingw32-g++ `which i686-w64-mingw32-g++-posix`
#allow vagrant user to run docker
adduser vagrant docker
SHELL
config.vm.provision "shell", privileged: "true", inline: <<-SHELL
# unprivileged shell still runs as root for some reason
# the script below will set up the steam-runtime docker containers
sudo -u vagrant /home/vagrant/proton/vagrant-user-setup.sh
SHELL
end

@ -1 +0,0 @@
Subproject commit 8c1c27d5a9b9de8a17f500053bd08c7ca6bba19c

@ -1 +0,0 @@
Subproject commit 538b2676eaac29565e4f1034a6f8a59ce158213d

1096
build/makefile_base.mak Normal file

File diff suppressed because it is too large Load Diff

1
cmake Submodule

@ -0,0 +1 @@
Subproject commit c4ab098097f4fe1bc85ee29c6de390dff435f63f

View File

@ -19,9 +19,9 @@ if [[ $(tput colors 2>/dev/null || echo 0) -gt 0 ]]; then
COLOR_CLEAR=$'\e[0m'
fi
sh_quote() {
sh_quote() {
local quoted
quoted="$(printf '%q ' "$@")"; [[ $# -eq 0 ]] || echo "${quoted:0:-1}";
quoted="$(printf '%q ' "$@")"; [[ $# -eq 0 ]] || echo "${quoted:0:-1}";
}
err() { echo >&2 "${COLOR_ERR}!!${COLOR_CLEAR} $*"; }
stat() { echo >&2 "${COLOR_STAT}::${COLOR_CLEAR} $*"; }
@ -31,50 +31,6 @@ die() { err "$@"; exit 1; }
finish() { stat "$@"; exit 0; }
cmd() { showcmd "$@"; "$@"; }
#
# Dependency Checks
#
MISSING_DEPENDENCIES=0
dependency_command() {
local COMMAND=$1
shift
if ! command -v "$COMMAND" &> /dev/null; then
err "Couldn't find command '$COMMAND'. Please install ${@:-$COMMAND}."
MISSING_DEPENDENCIES=1
fi
}
CONTAINER_MOUNT_OPTS=""
check_container_engine() {
stat "Trying $1."
if ! cmd $1 run --rm $2; then
info "$1 is unable to run the container."
return 1
fi
touch permission_check
local inner_uid="$($1 run -v "$(pwd):/test$CONTAINER_MOUNT_OPTS" \
--rm $2 \
stat --format "%u" /test/permission_check 2>&1)"
rm permission_check
if [[ $inner_uid == *"Permission denied"* ]]; then
err "The container cannot access files. Are you using SELinux?"
die "Please read README.md and check your $1 setup works."
elif [ "$inner_uid" -eq 0 ]; then
# namespace maps the user as root or the build is performed as host's root
ROOTLESS_CONTAINER=1
elif [ "$inner_uid" -eq "$(id -u)" ]; then
ROOTLESS_CONTAINER=0
else
err "File owner's UID doesn't map to 0 or $(id -u) in the container."
die "Don't know how to map permissions. Please check your $1 setup."
fi
}
#
# Configure
#
@ -82,6 +38,23 @@ check_container_engine() {
THIS_COMMAND="$0 $*" # For printing, not evaling
MAKEFILE="./Makefile"
function check_steamrt_image() {
local type="$1"
local name="$2"
# nil nil -> no container
[[ -n $type || -n $name ]] || return 0;
# Otherwise both needed
[[ -n $type && -n $name ]] || die "Steam Runtime SDK option must be of form type:image"
# Type known?
[[ $type = docker ]] || die "Only supported Steam Runtime type is currently docker"
# Name must be alphanumericish for dumping into makefile and sanity.
[[ $name =~ ^[a-zA-Z0-9_.-]+$ ]] || die "Runtime image name should be alphanumeric ($name)"
}
# This is not rigorous. Do not use this for untrusted input. Do not. If you need a version of
# this for untrusted input, rethink the path that got you here.
function escape_for_make() {
@ -94,21 +67,18 @@ function escape_for_make() {
}
function configure() {
local steamrt_image="$arg_protonsdk_image"
local steamrt64_type="${1%:*}"
local steamrt64_name="${1#*:}"
local steamrt32_type="${2%:*}"
local steamrt32_name="${2#*:}"
local steamrt_path="${3}"
check_steamrt_image "$steamrt64_type" "$steamrt64_name"
check_steamrt_image "$steamrt32_type" "$steamrt32_name"
local srcdir
srcdir="$(dirname "$0")"
if [[ "$srcdir" = "." ]]; then
err "Cannot do a top level in-tree build."
die "Create a subdirectory in build/ or outside of the tree and run configure.sh from there."
fi
# nothing specified, getting the default value from the Makefile to test the
# container engine
if [[ -z $steamrt_image ]]; then
steamrt_image="$(sed -n 's/STEAMRT_IMAGE ?= //p' $SRCDIR/Makefile.in)"
fi
# Build name
local build_name="$arg_build_name"
if [[ -n $build_name ]]; then
@ -118,31 +88,6 @@ function configure() {
info "No build name specified, using default: $build_name"
fi
dependency_command make "GNU Make"
if [ "$MISSING_DEPENDENCIES" -ne 0 ]; then
die "Missing dependencies, cannot continue."
fi
if [[ -n "$arg_relabel_volumes" ]]; then
CONTAINER_MOUNT_OPTS=:Z
fi
if [[ -n "$arg_container_engine" ]]; then
check_container_engine "$arg_container_engine" "$steamrt_image" || die "Specified container engine \"$arg_container_engine\" doesn't work"
else
stat "Trying to find usable container engine."
if check_container_engine docker "$steamrt_image"; then
arg_container_engine="docker"
elif check_container_engine podman "$steamrt_image"; then
arg_container_engine="podman"
else
die "${arg_container_engine:-Container engine discovery} has failed. Please fix your setup."
fi
fi
stat "Using $arg_container_engine."
## Write out config
# Don't die after this point or we'll have rather unhelpfully deleted the Makefile
[[ ! -e "$MAKEFILE" ]] || rm "$MAKEFILE"
@ -154,29 +99,21 @@ function configure() {
echo "SRCDIR := $(escape_for_make "$srcdir")"
echo "BUILD_NAME := $(escape_for_make "$build_name")"
# SteamRT was specified, baking it into the Makefile
if [[ -n $arg_protonsdk_image ]]; then
echo "STEAMRT_IMAGE := $(escape_for_make "$arg_protonsdk_image")"
# ffmpeg?
if [[ -n $arg_ffmpeg ]]; then
echo "WITH_FFMPEG := 1"
fi
echo "ROOTLESS_CONTAINER := $ROOTLESS_CONTAINER"
echo "CONTAINER_ENGINE := $arg_container_engine"
if [[ -n "$arg_docker_opts" ]]; then
echo "DOCKER_OPTS := $arg_docker_opts"
fi
if [[ -n "$CONTAINER_MOUNT_OPTS" ]]; then
echo "CONTAINER_MOUNT_OPTS := $CONTAINER_MOUNT_OPTS"
fi
if [[ -n "$arg_enable_ccache" ]]; then
echo "ENABLE_CCACHE := 1"
fi
if [[ -n "$arg_enable_bear" ]]; then
echo "ENABLE_BEAR := 1"
fi
# SteamRT
echo "STEAMRT64_MODE := $(escape_for_make "$steamrt64_type")"
echo "STEAMRT64_IMAGE := $(escape_for_make "$steamrt64_name")"
echo "STEAMRT32_MODE := $(escape_for_make "$steamrt32_type")"
echo "STEAMRT32_IMAGE := $(escape_for_make "$steamrt32_name")"
echo "STEAMRT_PATH := $(escape_for_make "$steamrt_path")"
# Include base
echo ""
echo "include \$(SRCDIR)/Makefile.in"
echo "include \$(SRCDIR)/build/makefile_base.mak"
} >> "$MAKEFILE"
stat "Created $MAKEFILE, now run make to build."
@ -187,13 +124,11 @@ function configure() {
# Parse arguments
#
arg_protonsdk_image=""
arg_steamrt32=""
arg_steamrt64=""
arg_no_steamrt=""
arg_ffmpeg=""
arg_build_name=""
arg_container_engine=""
arg_docker_opts=""
arg_relabel_volumes=""
arg_enable_ccache=""
arg_enable_bear=""
arg_help=""
invalid_args=""
function parse_args() {
@ -230,21 +165,19 @@ function parse_args() {
elif [[ $arg = --build-name ]]; then
arg_build_name="$val"
val_used=1
elif [[ $arg = --container-engine ]]; then
arg_container_engine="$val"
elif [[ $arg = --with-ffmpeg ]]; then
arg_ffmpeg=1
elif [[ $arg = --steam-runtime32 ]]; then
val_used=1
elif [[ $arg = --docker-opts ]]; then
arg_docker_opts="$val"
arg_steamrt32="$val"
elif [[ $arg = --steam-runtime64 ]]; then
val_used=1
elif [[ $arg = --relabel-volumes ]]; then
arg_relabel_volumes="1"
elif [[ $arg = --enable-ccache ]]; then
arg_enable_ccache="1"
elif [[ $arg = --enable-bear ]]; then
arg_enable_bear="1"
elif [[ $arg = --proton-sdk-image ]]; then
arg_steamrt64="$val"
elif [[ $arg = --steam-runtime ]]; then
val_used=1
arg_protonsdk_image="$val"
arg_steamrt="$val"
elif [[ $arg = --no-steam-runtime ]]; then
arg_no_steamrt=1
else
err "Unrecognized option $arg"
return 1
@ -279,7 +212,7 @@ function parse_args() {
}
usage() {
"$1" "Usage: $0 { --proton-sdk-image=<image> }"
"$1" "Usage: $0 { --no-steam-runtime | --steam-runtime32=<image> --steam-runtime64=<image> --steam-runtime=<path> }"
"$1" " Generate a Makefile for building Proton. May be run from another directory to create"
"$1" " out-of-tree build directories (e.g. mkdir mybuild && cd mybuild && ../configure.sh)"
"$1" ""
@ -288,29 +221,38 @@ usage() {
"$1" ""
"$1" " --build-name=<name> Set the name of the build that displays when used in Steam"
"$1" ""
"$1" " --container-engine=<engine> Which Docker-compatible container engine to use,"
"$1" " e.g. podman. Tries to do autodiscovery when not specified."
"$1" ""
"$1" " --docker-opts='<options>' Extra options to pass to Docker when invoking the runtime."
"$1" ""
"$1" " --relabel-volumes Bind-mounted volumes will be relabeled. Use with caution."
"$1" ""
"$1" " --enable-ccache Mount \$CCACHE_DIR or \$HOME/.ccache inside of the container and use ccache for the build."
"$1" ""
"$1" " --enable-bear Invokes make via bear creating compile_commands.json."
"$1" " --with-ffmpeg Build ffmpeg for WMA audio support"
"$1" ""
"$1" " Steam Runtime"
"$1" " Proton builds that are to be installed & run under the steam client must be built with"
"$1" " the Steam Runtime SDK to ensure compatibility. See README.md for more information."
"$1" ""
"$1" " --proton-sdk-image=<image> Automatically invoke the Steam Runtime SDK in <image>"
"$1" " for build steps that must be run in an SDK"
"$1" " environment. See README.md for instructions to"
"$1" " create this image."
"$1" " --steam-runtime64=docker:<image> Automatically invoke the Steam Runtime SDK in <image>"
"$1" " for build steps that must be run in an SDK"
"$1" " environment. See README.md for instructions to"
"$1" " create this image."
"$1" ""
"$1" " --steam-runtime32=docker:<image> The 32-bit docker image to use for steps that require"
"$1" " a 32-bit environment. See --steam-runtime64."
"$1" ""
"$1" " --steam-runtime=<path> Path to the runtime built for the host (i.e. the output"
"$1" " directory given to steam-runtime/build-runtime.py). Should"
"$1" " contain run.sh."
"$1" ""
"$1" " --no-steam-runtime Do not automatically invoke any runtime SDK as part of the build."
"$1" " Build steps may still be manually run in a runtime environment."
exit 1;
}
[[ $# -gt 0 ]] || usage info
parse_args "$@" || usage err
[[ -z $arg_help ]] || usage info
configure
# Sanity check arguments
if [[ -n $arg_no_steamrt && (-n $arg_steamrt32 || -n $arg_steamrt64 || -n $arg_steamrt) ]]; then
die "Cannot specify a Steam Runtime SDK as well as --no-steam-runtime"
elif [[ -z $arg_no_steamrt && ( -z $arg_steamrt32 || -z $arg_steamrt64 || -z $arg_steamrt ) ]]; then
die "Must specify either --no-steam-runtime or all of --steam-runtime32, --steam-runtime64, and --steam-runtime"
fi
configure "$arg_steamrt64" "$arg_steamrt32" "$arg_steamrt"

View File

@ -0,0 +1,150 @@
#ifndef __GNUTLS_ABSTRACT_H
#define __GNUTLS_ABSTRACT_H
#include <stdarg.h>
#include <gnutls26/gnutls.h>
#include <gnutls26/x509.h>
#include <gnutls26/pkcs11.h>
#include <gnutls26/openpgp.h>
/* Public key operations */
struct gnutls_pubkey_st;
typedef struct gnutls_pubkey_st *gnutls_pubkey_t;
struct gnutls_privkey_st;
typedef struct gnutls_privkey_st *gnutls_privkey_t;
int gnutls_pubkey_init (gnutls_pubkey_t * key);
void gnutls_pubkey_deinit (gnutls_pubkey_t key);
int gnutls_pubkey_get_pk_algorithm (gnutls_pubkey_t key, unsigned int *bits);
int gnutls_pubkey_import_x509 (gnutls_pubkey_t key, gnutls_x509_crt_t crt,
unsigned int flags);
int gnutls_pubkey_import_pkcs11 (gnutls_pubkey_t pkey,
gnutls_pkcs11_obj_t crt, unsigned int flags);
int gnutls_pubkey_import_openpgp (gnutls_pubkey_t pkey,
gnutls_openpgp_crt_t crt,
unsigned int flags);
int
gnutls_pubkey_import_privkey (gnutls_pubkey_t key, gnutls_privkey_t pkey,
unsigned int usage, unsigned int flags);
int gnutls_pubkey_get_preferred_hash_algorithm (gnutls_pubkey_t key,
gnutls_digest_algorithm_t *
hash, unsigned int *mand);
int gnutls_pubkey_get_pk_rsa_raw (gnutls_pubkey_t key,
gnutls_datum_t * m, gnutls_datum_t * e);
int gnutls_pubkey_get_pk_dsa_raw (gnutls_pubkey_t key,
gnutls_datum_t * p, gnutls_datum_t * q,
gnutls_datum_t * g, gnutls_datum_t * y);
int gnutls_pubkey_export (gnutls_pubkey_t key,
gnutls_x509_crt_fmt_t format,
void *output_data, size_t * output_data_size);
int gnutls_pubkey_get_key_id (gnutls_pubkey_t key, unsigned int flags,
unsigned char *output_data,
size_t * output_data_size);
int gnutls_pubkey_get_key_usage (gnutls_pubkey_t key, unsigned int *usage);
int gnutls_pubkey_set_key_usage (gnutls_pubkey_t key, unsigned int usage);
int gnutls_pubkey_import (gnutls_pubkey_t key,
const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format);
int gnutls_pubkey_import_pkcs11_url (gnutls_pubkey_t key, const char *url,
unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
int gnutls_pubkey_import_dsa_raw (gnutls_pubkey_t key,
const gnutls_datum_t * p,
const gnutls_datum_t * q,
const gnutls_datum_t * g,
const gnutls_datum_t * y);
int gnutls_pubkey_import_rsa_raw (gnutls_pubkey_t key,
const gnutls_datum_t * m,
const gnutls_datum_t * e);
int gnutls_x509_crt_set_pubkey (gnutls_x509_crt_t crt, gnutls_pubkey_t key);
int gnutls_x509_crq_set_pubkey (gnutls_x509_crq_t crq, gnutls_pubkey_t key);
int
gnutls_pubkey_verify_hash (gnutls_pubkey_t key, unsigned int flags,
const gnutls_datum_t * hash,
const gnutls_datum_t * signature);
int
gnutls_pubkey_get_verify_algorithm (gnutls_pubkey_t key,
const gnutls_datum_t * signature,
gnutls_digest_algorithm_t * hash);
int gnutls_pubkey_verify_data (gnutls_pubkey_t pubkey,
unsigned int flags,
const gnutls_datum_t * data,
const gnutls_datum_t * signature);
/* Private key operations */
int gnutls_privkey_init (gnutls_privkey_t * key);
void gnutls_privkey_deinit (gnutls_privkey_t key);
int gnutls_privkey_get_pk_algorithm (gnutls_privkey_t key,
unsigned int *bits);
int
gnutls_privkey_get_preferred_hash_algorithm (gnutls_privkey_t key,
gnutls_digest_algorithm_t *
hash, unsigned int *mand);
gnutls_privkey_type_t gnutls_privkey_get_type (gnutls_privkey_t key);
#define GNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE (1<<0)
#define GNUTLS_PRIVKEY_IMPORT_COPY (1<<1)
int gnutls_privkey_import_pkcs11 (gnutls_privkey_t pkey,
gnutls_pkcs11_privkey_t key,
unsigned int flags);
int gnutls_privkey_import_x509 (gnutls_privkey_t pkey,
gnutls_x509_privkey_t key,
unsigned int flags);
int gnutls_privkey_import_openpgp (gnutls_privkey_t pkey,
gnutls_openpgp_privkey_t key,
unsigned int flags);
int gnutls_privkey_sign_data (gnutls_privkey_t signer,
gnutls_digest_algorithm_t hash,
unsigned int flags,
const gnutls_datum_t * data,
gnutls_datum_t * signature);
int gnutls_privkey_sign_hash (gnutls_privkey_t signer,
gnutls_digest_algorithm_t hash_algo,
unsigned int flags,
const gnutls_datum_t * hash_data,
gnutls_datum_t * signature);
int gnutls_privkey_decrypt_data (gnutls_privkey_t key,
unsigned int flags,
const gnutls_datum_t * ciphertext,
gnutls_datum_t * plaintext);
int gnutls_x509_crt_privkey_sign (gnutls_x509_crt_t crt,
gnutls_x509_crt_t issuer,
gnutls_privkey_t issuer_key,
gnutls_digest_algorithm_t dig,
unsigned int flags);
int gnutls_x509_crl_privkey_sign (gnutls_x509_crl_t crl,
gnutls_x509_crt_t issuer,
gnutls_privkey_t issuer_key,
gnutls_digest_algorithm_t dig,
unsigned int flags);
int gnutls_x509_crq_privkey_sign (gnutls_x509_crq_t crq,
gnutls_privkey_t key,
gnutls_digest_algorithm_t dig,
unsigned int flags);
#endif

View File

@ -0,0 +1,359 @@
/* Typedefs for more compatibility with older GnuTLS. */
#ifndef _GNUTLS_COMPAT_H
#define _GNUTLS_COMPAT_H
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __GNUC__
#define _GNUTLS_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#if !defined GNUTLS_INTERNAL_BUILD
#if _GNUTLS_GCC_VERSION >= 30100
#define _GNUTLS_GCC_ATTR_DEPRECATED __attribute__ ((__deprecated__))
#endif
#endif
#endif /* __GNUC__ */
#ifndef _GNUTLS_GCC_ATTR_DEPRECATED
#define _GNUTLS_GCC_ATTR_DEPRECATED
#endif
#define gnutls_cipher_algorithm gnutls_cipher_algorithm_t
#define gnutls_kx_algorithm gnutls_kx_algorithm_t
#define gnutls_paramsype gnutls_paramsype_t
#define gnutls_mac_algorithm gnutls_mac_algorithm_t
#define gnutls_digest_algorithm gnutls_digest_algorithm_t
#define gnutls_compression_method gnutls_compression_method_t
#define gnutls_connection_end gnutls_connection_end_t
#define gnutls_credentialsype gnutls_credentialsype_t
#define gnutls_certificateype gnutls_certificateype_t
#define gnutls_x509_crt_fmt gnutls_x509_crt_fmt_t
#define gnutls_openpgp_key_fmt gnutls_openpgp_key_fmt_t
#define gnutls_pk_algorithm gnutls_pk_algorithm_t
#define gnutls_sign_algorithm gnutls_sign_algorithm_t
#define gnutls_server_name gnutls_server_nameype_t
#define gnutls_protocol gnutls_protocol_version_t
#define gnutls_close_request gnutls_close_request_t
#define gnutls_openpgp_key_status gnutls_openpgp_key_status_t
#define gnutls_certificate_request gnutls_certificate_request_t
#define gnutls_certificate_status gnutls_certificate_status_t
#define gnutls_session gnutls_session_t
#define gnutls_alert_level gnutls_alert_level_t
#define gnutls_alert_description gnutls_alert_description_t
#define gnutls_x509_subject_alt_name gnutls_x509_subject_alt_name_t
#define gnutls_openpgp_key gnutls_openpgp_key_t
#define gnutls_openpgp_privkey gnutls_openpgp_privkey_t
#define gnutls_openpgp_keyring gnutls_openpgp_keyring_t
#define gnutls_x509_crt gnutls_x509_crt_t
#define gnutls_x509_privkey gnutls_x509_privkey_t
#define gnutls_x509_crl gnutls_x509_crl_t
#define gnutls_pkcs7 gnutls_pkcs7_t
#define gnutls_x509_crq gnutls_x509_crq_t
#define gnutls_pkcs_encrypt_flags gnutls_pkcs_encrypt_flags_t
#define gnutls_pkcs12_bag_type gnutls_pkcs12_bag_type_t
#define gnutls_pkcs12_bag gnutls_pkcs12_bag_t
#define gnutls_pkcs12 gnutls_pkcs12_t
#define gnutls_certificate_credentials gnutls_certificate_credentials_t
#define gnutls_anon_server_credentials gnutls_anon_server_credentials_t
#define gnutls_anon_client_credentials gnutls_anon_client_credentials_t
#define gnutls_srp_client_credentials gnutls_srp_client_credentials_t
#define gnutls_srp_server_credentials gnutls_srp_server_credentials_t
#define gnutls_dh_params gnutls_dh_params_t
#define gnutls_rsa_params gnutls_rsa_params_t
#define gnutls_params_type gnutls_params_type_t
#define gnutls_credentials_type gnutls_credentials_type_t
#define gnutls_certificate_type gnutls_certificate_type_t
#define gnutls_datum gnutls_datum_t
#define gnutls_transport_ptr gnutls_transport_ptr_t
/* Old SRP alerts removed in 2.1.x because the TLS-SRP RFC was
modified to use the PSK alert. */
#define GNUTLS_A_MISSING_SRP_USERNAME GNUTLS_A_UNKNOWN_PSK_IDENTITY
#define GNUTLS_A_UNKNOWN_SRP_USERNAME GNUTLS_A_UNKNOWN_PSK_IDENTITY
/* OpenPGP stuff renamed in 2.1.x. */
#define gnutls_openpgp_key_fmt_t gnutls_openpgp_crt_fmt_t
#define GNUTLS_OPENPGP_KEY GNUTLS_OPENPGP_CERT
#define GNUTLS_OPENPGP_KEY_FINGERPRINT GNUTLS_OPENPGP_CERT_FINGERPRINT
#define gnutls_openpgp_send_key gnutls_openpgp_send_cert
#define gnutls_openpgp_key_status_t gnutls_openpgp_crt_status_t
#define gnutls_openpgp_key_t gnutls_openpgp_crt_t
#define gnutls_openpgp_key_init gnutls_openpgp_crt_init
#define gnutls_openpgp_key_deinit gnutls_openpgp_crt_deinit
#define gnutls_openpgp_key_import gnutls_openpgp_crt_import
#define gnutls_openpgp_key_export gnutls_openpgp_crt_export
#define gnutls_openpgp_key_get_key_usage gnutls_openpgp_crt_get_key_usage
#define gnutls_openpgp_key_get_fingerprint gnutls_openpgp_crt_get_fingerprint
#define gnutls_openpgp_key_get_pk_algorithm gnutls_openpgp_crt_get_pk_algorithm
#define gnutls_openpgp_key_get_name gnutls_openpgp_crt_get_name
#define gnutls_openpgp_key_get_version gnutls_openpgp_crt_get_version
#define gnutls_openpgp_key_get_creation_time gnutls_openpgp_crt_get_creation_time
#define gnutls_openpgp_key_get_expiration_time gnutls_openpgp_crt_get_expiration_time
#define gnutls_openpgp_key_get_id gnutls_openpgp_crt_get_id
#define gnutls_openpgp_key_check_hostname gnutls_openpgp_crt_check_hostname
/* OpenPGP stuff renamed in 2.3.x. */
#define gnutls_openpgp_crt_get_id gnutls_openpgp_crt_get_key_id
/* New better names renamed in 2.3.x, add these for backwards
compatibility with old poor names.*/
#define GNUTLS_X509_CRT_FULL GNUTLS_CRT_PRINT_FULL
#define GNUTLS_X509_CRT_ONELINE GNUTLS_CRT_PRINT_ONELINE
#define GNUTLS_X509_CRT_UNSIGNED_FULL GNUTLS_CRT_PRINT_UNSIGNED_FULL
/* These old #define's violate the gnutls_* namespace. */
#define TLS_MASTER_SIZE GNUTLS_MASTER_SIZE
#define TLS_RANDOM_SIZE GNUTLS_RANDOM_SIZE
/* Namespace problems. */
#define LIBGNUTLS_VERSION GNUTLS_VERSION
#define LIBGNUTLS_VERSION_MAJOR GNUTLS_VERSION_MAJOR
#define LIBGNUTLS_VERSION_MINOR GNUTLS_VERSION_MINOR
#define LIBGNUTLS_VERSION_PATCH GNUTLS_VERSION_PATCH
#define LIBGNUTLS_VERSION_NUMBER GNUTLS_VERSION_NUMBER
#define LIBGNUTLS_EXTRA_VERSION GNUTLS_VERSION
/* The gnutls_retr_st was deprecated by gnutls_certificate_retrieve_function()
* and gnutls_retr2_st.
*/
typedef struct gnutls_retr_st
{
gnutls_certificate_type_t type;
union
{
gnutls_x509_crt_t *x509;
gnutls_openpgp_crt_t pgp;
} cert;
unsigned int ncerts; /* one for pgp keys */
union
{
gnutls_x509_privkey_t x509;
gnutls_openpgp_privkey_t pgp;
} key;
unsigned int deinit_all; /* if non zero all keys will be deinited */
} gnutls_retr_st;
typedef int gnutls_certificate_client_retrieve_function (gnutls_session_t,
const
gnutls_datum_t *
req_ca_rdn,
int nreqs,
const
gnutls_pk_algorithm_t
* pk_algos,
int
pk_algos_length,
gnutls_retr_st *);
typedef int gnutls_certificate_server_retrieve_function (gnutls_session_t,
gnutls_retr_st *);
void gnutls_certificate_client_set_retrieve_function
(gnutls_certificate_credentials_t cred,
gnutls_certificate_client_retrieve_function *
func) _GNUTLS_GCC_ATTR_DEPRECATED;
void
gnutls_certificate_server_set_retrieve_function
(gnutls_certificate_credentials_t cred,
gnutls_certificate_server_retrieve_function *
func) _GNUTLS_GCC_ATTR_DEPRECATED;
/* External signing callback. No longer supported because it
* was deprecated by the PKCS #11 API. */
typedef int (*gnutls_sign_func) (gnutls_session_t session,
void *userdata,
gnutls_certificate_type_t cert_type,
const gnutls_datum_t * cert,
const gnutls_datum_t * hash,
gnutls_datum_t * signature);
void
gnutls_sign_callback_set (gnutls_session_t session,
gnutls_sign_func sign_func, void *userdata)
_GNUTLS_GCC_ATTR_DEPRECATED;
gnutls_sign_func
gnutls_sign_callback_get (gnutls_session_t session, void **userdata)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* Extension API is no longer exported because a lot of internal
* structures are used. Currently it works due to a compatibility
* layer, but will be removed in later versions.
*/
int gnutls_ext_register (int type,
const char *name,
gnutls_ext_parse_type_t parse_type,
gnutls_ext_recv_func recv_func,
gnutls_ext_send_func send_func)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* We no longer support the finished callback. Use
* gnutls_session_channel_binding for similar functionality.
*/
typedef void (*gnutls_finished_callback_func) (gnutls_session_t session,
const void *finished,
size_t len);
void gnutls_session_set_finished_function (gnutls_session_t session,
gnutls_finished_callback_func
func)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* returns security values.
* Do not use them unless you know what you're doing. Those are dangerous since
* they depend on a particular TLS version number
*/
#define GNUTLS_MASTER_SIZE 48
#define GNUTLS_RANDOM_SIZE 32
const void *gnutls_session_get_server_random (gnutls_session_t session)
_GNUTLS_GCC_ATTR_DEPRECATED;
const void *gnutls_session_get_client_random (gnutls_session_t session)
_GNUTLS_GCC_ATTR_DEPRECATED;
const void *gnutls_session_get_master_secret (gnutls_session_t session)
_GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_psk_netconf_derive_key (const char *password,
const char *psk_identity,
const char *psk_identity_hint,
gnutls_datum_t *
output_key)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* This is a very dangerous and error-prone function.
* Use gnutls_privkey_sign_hash() instead.
*/
int gnutls_x509_privkey_sign_hash (gnutls_x509_privkey_t key,
const gnutls_datum_t * hash,
gnutls_datum_t * signature)
_GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_openpgp_privkey_sign_hash (gnutls_openpgp_privkey_t key,
const gnutls_datum_t * hash,
gnutls_datum_t * signature)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* Deprecated because verify_* functions are moved to public
* keys. Check abstract.h for similar functionality.
*/
int gnutls_x509_privkey_verify_data (gnutls_x509_privkey_t key,
unsigned int flags,
const gnutls_datum_t * data,
const gnutls_datum_t * signature)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* we support the gnutls_privkey_sign_data() instead.
*/
int gnutls_x509_privkey_sign_data (gnutls_x509_privkey_t key,
gnutls_digest_algorithm_t digest,
unsigned int flags,
const gnutls_datum_t * data,
void *signature,
size_t * signature_size)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* gnutls_pubkey_verify_data() */
int gnutls_x509_crt_verify_data (gnutls_x509_crt_t crt,
unsigned int flags,
const gnutls_datum_t * data,
const gnutls_datum_t * signature)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* gnutls_pubkey_verify_hash() */
int gnutls_x509_crt_verify_hash (gnutls_x509_crt_t crt,
unsigned int flags,
const gnutls_datum_t * hash,
const gnutls_datum_t * signature)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* gnutls_pubkey_get_verify_algorithm() */
int gnutls_x509_crt_get_verify_algorithm (gnutls_x509_crt_t crt,
const gnutls_datum_t * signature,
gnutls_digest_algorithm_t * hash)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* gnutls_pubkey_get_preferred_hash_algorithm() */
int gnutls_x509_crt_get_preferred_hash_algorithm (gnutls_x509_crt_t crt,
gnutls_digest_algorithm_t
* hash,
unsigned int *mand)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* gnutls_x509_crq_privkey_sign() */
int gnutls_x509_crq_sign2 (gnutls_x509_crq_t crq,
gnutls_x509_privkey_t key,
gnutls_digest_algorithm_t dig,
unsigned int flags)
_GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_x509_crq_sign (gnutls_x509_crq_t crq, gnutls_x509_privkey_t key)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* gnutls_x509_crl_privkey_sign */
int gnutls_x509_crl_sign (gnutls_x509_crl_t crl,
gnutls_x509_crt_t issuer,
gnutls_x509_privkey_t issuer_key)
_GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_x509_crl_sign2 (gnutls_x509_crl_t crl,
gnutls_x509_crt_t issuer,
gnutls_x509_privkey_t issuer_key,
gnutls_digest_algorithm_t dig,
unsigned int flags)
_GNUTLS_GCC_ATTR_DEPRECATED;
void gnutls_certificate_get_x509_cas (gnutls_certificate_credentials_t sc,
gnutls_x509_crt_t ** x509_ca_list,
unsigned int *ncas)
_GNUTLS_GCC_ATTR_DEPRECATED;
void gnutls_certificate_get_x509_crls (gnutls_certificate_credentials_t sc,
gnutls_x509_crl_t ** x509_crl_list,
unsigned int *ncrls)
_GNUTLS_GCC_ATTR_DEPRECATED;
void
gnutls_certificate_get_openpgp_keyring (gnutls_certificate_credentials_t
sc,
gnutls_openpgp_keyring_t *
keyring)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* this is obsolete (?). */
int gnutls_certificate_verify_peers (gnutls_session_t session)
_GNUTLS_GCC_ATTR_DEPRECATED;
/* functions to set priority of cipher suites
*/
int gnutls_cipher_set_priority (gnutls_session_t session, const int *list)
_GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_mac_set_priority (gnutls_session_t session, const int *list)
_GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_compression_set_priority (gnutls_session_t session,
const int *list)
_GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_kx_set_priority (gnutls_session_t session, const int *list)
_GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_protocol_set_priority (gnutls_session_t session,
const int *list)
_GNUTLS_GCC_ATTR_DEPRECATED;
int gnutls_certificate_type_set_priority (gnutls_session_t session,
const int *list)
_GNUTLS_GCC_ATTR_DEPRECATED;
void gnutls_transport_set_lowat (gnutls_session_t session, int num) _GNUTLS_GCC_ATTR_DEPRECATED;
void gnutls_transport_set_global_errno (int err) _GNUTLS_GCC_ATTR_DEPRECATED;
#ifdef __cplusplus
}
#endif
#endif /* _GNUTLS_COMPAT_H */

View File

@ -0,0 +1,378 @@
/*
* Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
*
* Author: Nikos Mavrogiannopoulos
*
* This file is part of GnuTLS.
*
* The GnuTLS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA
*
*/
#ifndef GNUTLS_CRYPTO_H
#define GNUTLS_CRYPTO_H
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct cipher_hd_st *gnutls_cipher_hd_t;
int gnutls_cipher_init (gnutls_cipher_hd_t * handle,
gnutls_cipher_algorithm_t cipher,
const gnutls_datum_t * key,
const gnutls_datum_t * iv);
int gnutls_cipher_encrypt (const gnutls_cipher_hd_t handle,
void *text, size_t textlen);
int gnutls_cipher_decrypt (const gnutls_cipher_hd_t handle,
void *ciphertext, size_t ciphertextlen);
int gnutls_cipher_decrypt2 (gnutls_cipher_hd_t handle,
const void *ciphertext, size_t ciphertextlen,
void *text, size_t textlen);
int gnutls_cipher_encrypt2 (gnutls_cipher_hd_t handle, void *text,
size_t textlen, void *ciphertext,
size_t ciphertextlen);
void gnutls_cipher_deinit (gnutls_cipher_hd_t handle);
int gnutls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm);
typedef struct hash_hd_st *gnutls_hash_hd_t;
typedef struct hmac_hd_st *gnutls_hmac_hd_t;
int gnutls_hmac_init (gnutls_hmac_hd_t * dig,
gnutls_digest_algorithm_t algorithm, const void *key,
size_t keylen);
int gnutls_hmac (gnutls_hmac_hd_t handle, const void *text, size_t textlen);
void gnutls_hmac_output (gnutls_hmac_hd_t handle, void *digest);
void gnutls_hmac_deinit (gnutls_hmac_hd_t handle, void *digest);
int gnutls_hmac_get_len (gnutls_mac_algorithm_t algorithm);
int gnutls_hmac_fast (gnutls_mac_algorithm_t algorithm, const void *key,
size_t keylen, const void *text, size_t textlen,
void *digest);
int gnutls_hash_init (gnutls_hash_hd_t * dig,
gnutls_digest_algorithm_t algorithm);
int gnutls_hash (gnutls_hash_hd_t handle, const void *text, size_t textlen);
void gnutls_hash_output (gnutls_hash_hd_t handle, void *digest);
void gnutls_hash_deinit (gnutls_hash_hd_t handle, void *digest);
int gnutls_hash_get_len (gnutls_digest_algorithm_t algorithm);
int gnutls_hash_fast (gnutls_digest_algorithm_t algorithm,
const void *text, size_t textlen, void *digest);
/* register ciphers */
#define GNUTLS_CRYPTO_API_VERSION 0x03
#define gnutls_crypto_single_cipher_st gnutls_crypto_cipher_st
#define gnutls_crypto_single_mac_st gnutls_crypto_mac_st
#define gnutls_crypto_single_digest_st gnutls_crypto_digest_st
typedef struct
{
int (*init) (gnutls_cipher_algorithm_t, void **ctx);
int (*setkey) (void *ctx, const void *key, size_t keysize);
int (*setiv) (void *ctx, const void *iv, size_t ivsize);
int (*encrypt) (void *ctx, const void *plain, size_t plainsize,
void *encr, size_t encrsize);
int (*decrypt) (void *ctx, const void *encr, size_t encrsize,
void *plain, size_t plainsize);
void (*deinit) (void *ctx);
} gnutls_crypto_cipher_st;
typedef struct
{
int (*init) (gnutls_mac_algorithm_t, void **ctx);
int (*setkey) (void *ctx, const void *key, size_t keysize);
int (*hash) (void *ctx, const void *text, size_t textsize);
int (*output) (void *src_ctx, void *digest, size_t digestsize);
void (*deinit) (void *ctx);
} gnutls_crypto_mac_st;
typedef struct
{
int (*init) (gnutls_mac_algorithm_t, void **ctx);
int (*hash) (void *ctx, const void *text, size_t textsize);
int (*copy) (void **dst_ctx, void *src_ctx);
int (*output) (void *src_ctx, void *digest, size_t digestsize);
void (*deinit) (void *ctx);
} gnutls_crypto_digest_st;
/**
* gnutls_rnd_level_t:
* @GNUTLS_RND_NONCE: Non-predictable random number. Fatal in parts
* of session if broken, i.e., vulnerable to statistical analysis.
* @GNUTLS_RND_RANDOM: Pseudo-random cryptographic random number.
* Fatal in session if broken.
* @GNUTLS_RND_KEY: Fatal in many sessions if broken.
*
* Enumeration of random quality levels.
*/
typedef enum gnutls_rnd_level
{
GNUTLS_RND_NONCE = 0,
GNUTLS_RND_RANDOM = 1,
GNUTLS_RND_KEY = 2
} gnutls_rnd_level_t;
int gnutls_rnd (gnutls_rnd_level_t level, void *data, size_t len);
/**
* gnutls_pk_flag_t:
* @GNUTLS_PK_FLAG_NONE: No flag.
*
* Enumeration of public-key flag.
*/
typedef enum
{
GNUTLS_PK_FLAG_NONE = 0
} gnutls_pk_flag_t;
typedef struct gnutls_crypto_rnd
{
int (*init) (void **ctx);
int (*rnd) (void *ctx, int level, void *data, size_t datasize);
void (*deinit) (void *ctx);
} gnutls_crypto_rnd_st;
typedef void *bigint_t;
/**
* gnutls_bigint_format_t:
* @GNUTLS_MPI_FORMAT_USG: Raw unsigned integer format.
* @GNUTLS_MPI_FORMAT_STD: Raw signed integer format, always a leading
* zero when positive.
* @GNUTLS_MPI_FORMAT_PGP: The pgp integer format.
*
* Enumeration of different bignum integer encoding formats.
*/
typedef enum
{
/* raw unsigned integer format */
GNUTLS_MPI_FORMAT_USG = 0,
/* raw signed integer format - always a leading zero when positive */
GNUTLS_MPI_FORMAT_STD = 1,
/* the pgp integer format */
GNUTLS_MPI_FORMAT_PGP = 2
} gnutls_bigint_format_t;
typedef struct
{
bigint_t g; /* group generator */
bigint_t p; /* prime */
} gnutls_group_st;
/* Multi precision integer arithmetic */
typedef struct gnutls_crypto_bigint
{
bigint_t (*bigint_new) (int nbits);
void (*bigint_release) (bigint_t n);
/* 0 for equality, > 0 for m1>m2, < 0 for m1<m2 */
int (*bigint_cmp) (const bigint_t m1, const bigint_t m2);
/* as bigint_cmp */
int (*bigint_cmp_ui) (const bigint_t m1, unsigned long m2);
/* ret = a % b */
bigint_t (*bigint_mod) (const bigint_t a, const bigint_t b);
/* a = b -> ret == a */
bigint_t (*bigint_set) (bigint_t a, const bigint_t b);
/* a = b -> ret == a */
bigint_t (*bigint_set_ui) (bigint_t a, unsigned long b);
unsigned int (*bigint_get_nbits) (const bigint_t a);
/* w = b ^ e mod m */
bigint_t (*bigint_powm) (bigint_t w, const bigint_t b,
const bigint_t e, const bigint_t m);
/* w = a + b mod m */
bigint_t (*bigint_addm) (bigint_t w, const bigint_t a,
const bigint_t b, const bigint_t m);
/* w = a - b mod m */
bigint_t (*bigint_subm) (bigint_t w, const bigint_t a, const bigint_t b,
const bigint_t m);
/* w = a * b mod m */
bigint_t (*bigint_mulm) (bigint_t w, const bigint_t a, const bigint_t b,
const bigint_t m);
/* w = a + b */ bigint_t (*bigint_add) (bigint_t w, const bigint_t a,
const bigint_t b);
/* w = a - b */ bigint_t (*bigint_sub) (bigint_t w, const bigint_t a,
const bigint_t b);
/* w = a * b */
bigint_t (*bigint_mul) (bigint_t w, const bigint_t a, const bigint_t b);
/* w = a + b */
bigint_t (*bigint_add_ui) (bigint_t w, const bigint_t a,
unsigned long b);
/* w = a - b */
bigint_t (*bigint_sub_ui) (bigint_t w, const bigint_t a,
unsigned long b);
/* w = a * b */
bigint_t (*bigint_mul_ui) (bigint_t w, const bigint_t a,
unsigned long b);
/* q = a / b */
bigint_t (*bigint_div) (bigint_t q, const bigint_t a, const bigint_t b);
/* 0 if prime */
int (*bigint_prime_check) (const bigint_t pp);
int (*bigint_generate_group) (gnutls_group_st * gg, unsigned int bits);
/* reads an bigint from a buffer */
/* stores an bigint into the buffer. returns
* GNUTLS_E_SHORT_MEMORY_BUFFER if buf_size is not sufficient to
* store this integer, and updates the buf_size;
*/
bigint_t (*bigint_scan) (const void *buf, size_t buf_size,
gnutls_bigint_format_t format);
int (*bigint_print) (const bigint_t a, void *buf, size_t * buf_size,
gnutls_bigint_format_t format);
} gnutls_crypto_bigint_st;
#define GNUTLS_MAX_PK_PARAMS 16
typedef struct
{
bigint_t params[GNUTLS_MAX_PK_PARAMS];
unsigned int params_nr; /* the number of parameters */
unsigned int flags;
} gnutls_pk_params_st;
void gnutls_pk_params_release (gnutls_pk_params_st * p);
void gnutls_pk_params_init (gnutls_pk_params_st * p);
/* params are:
* RSA:
* [0] is modulus
* [1] is public exponent
* [2] is private exponent (private key only)
* [3] is prime1 (p) (private key only)
* [4] is prime2 (q) (private key only)
* [5] is coefficient (u == inverse of p mod q) (private key only)
* [6] e1 == d mod (p-1)
* [7] e2 == d mod (q-1)
*
* note that for libgcrypt that does not use the inverse of q mod p,
* we need to perform conversions using fixup_params().
*
* DSA:
* [0] is p
* [1] is q
* [2] is g
* [3] is y (public key)
* [4] is x (private key only)
*/
/**
* gnutls_direction_t:
* @GNUTLS_IMPORT: Import direction.
* @GNUTLS_EXPORT: Export direction.
*
* Enumeration of different directions.
*/
typedef enum
{
GNUTLS_IMPORT = 0,
GNUTLS_EXPORT = 1
} gnutls_direction_t;
/* Public key algorithms */
typedef struct gnutls_crypto_pk
{
/* The params structure should contain the private or public key
* parameters, depending on the operation */
int (*encrypt) (gnutls_pk_algorithm_t, gnutls_datum_t * ciphertext,
const gnutls_datum_t * plaintext,
const gnutls_pk_params_st * pub);
int (*decrypt) (gnutls_pk_algorithm_t, gnutls_datum_t * plaintext,
const gnutls_datum_t * ciphertext,
const gnutls_pk_params_st * priv);
int (*sign) (gnutls_pk_algorithm_t, gnutls_datum_t * signature,
const gnutls_datum_t * data,
const gnutls_pk_params_st * priv);
int (*verify) (gnutls_pk_algorithm_t, const gnutls_datum_t * data,
const gnutls_datum_t * signature,
const gnutls_pk_params_st * pub);
int (*generate) (gnutls_pk_algorithm_t, unsigned int nbits,
gnutls_pk_params_st *);
/* this function should convert params to ones suitable
* for the above functions
*/
int (*pk_fixup_private_params) (gnutls_pk_algorithm_t, gnutls_direction_t,
gnutls_pk_params_st *);
} gnutls_crypto_pk_st;
/* priority: infinity for backend algorithms, 90 for kernel
algorithms, lowest wins
*/
#define gnutls_crypto_single_cipher_register(algo, prio, st) \
gnutls_crypto_single_cipher_register2 (algo, prio, \
GNUTLS_CRYPTO_API_VERSION, st)
#define gnutls_crypto_single_mac_register(algo, prio, st) \
gnutls_crypto_single_mac_register2 (algo, prio, \
GNUTLS_CRYPTO_API_VERSION, st)
#define gnutls_crypto_single_digest_register(algo, prio, st) \
gnutls_crypto_single_digest_register2(algo, prio, \
GNUTLS_CRYPTO_API_VERSION, st)
int gnutls_crypto_single_cipher_register2 (gnutls_cipher_algorithm_t
algorithm, int priority,
int version,
const
gnutls_crypto_single_cipher_st *
s);
int gnutls_crypto_single_mac_register2 (gnutls_mac_algorithm_t algorithm,
int priority, int version,
const gnutls_crypto_single_mac_st *
s);
int gnutls_crypto_single_digest_register2 (gnutls_digest_algorithm_t
algorithm, int priority,
int version,
const
gnutls_crypto_single_digest_st *
s);
#define gnutls_crypto_cipher_register(prio, st) \
gnutls_crypto_cipher_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
#define gnutls_crypto_mac_register(prio, st) \
gnutls_crypto_mac_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
#define gnutls_crypto_digest_register(prio, st) \
gnutls_crypto_digest_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
int gnutls_crypto_cipher_register2 (int priority, int version,
const gnutls_crypto_cipher_st * s);
int gnutls_crypto_mac_register2 (int priority, int version,
const gnutls_crypto_mac_st * s);
int gnutls_crypto_digest_register2 (int priority, int version,
const gnutls_crypto_digest_st * s);
#define gnutls_crypto_rnd_register(prio, st) \
gnutls_crypto_rnd_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
#define gnutls_crypto_pk_register(prio, st) \
gnutls_crypto_pk_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
#define gnutls_crypto_bigint_register(prio, st) \
gnutls_crypto_bigint_register2 (prio, GNUTLS_CRYPTO_API_VERSION, st)
int gnutls_crypto_rnd_register2 (int priority, int version,
const gnutls_crypto_rnd_st * s);
int gnutls_crypto_pk_register2 (int priority, int version,
const gnutls_crypto_pk_st * s);
int gnutls_crypto_bigint_register2 (int priority, int version,
const gnutls_crypto_bigint_st * s);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,365 @@
/*
* Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
* Software Foundation, Inc.
*
* Author: Nikos Mavrogiannopoulos
*
* This file is part of GnuTLS.
*
* The GnuTLS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
*/
/* This file contains the types and prototypes for the OpenPGP
* key and private key parsing functions.
*/
#ifndef GNUTLS_OPENPGP_H
#define GNUTLS_OPENPGP_H
#include <gnutls26/gnutls.h>
#ifdef __cplusplus
extern "C"
{
#endif
/* Openpgp certificate stuff
*/
/**
* gnutls_openpgp_crt_fmt_t:
* @GNUTLS_OPENPGP_FMT_RAW: OpenPGP certificate in raw format.
* @GNUTLS_OPENPGP_FMT_BASE64: OpenPGP certificate in base64 format.
*
* Enumeration of different OpenPGP key formats.
*/
typedef enum gnutls_openpgp_crt_fmt
{
GNUTLS_OPENPGP_FMT_RAW,
GNUTLS_OPENPGP_FMT_BASE64
} gnutls_openpgp_crt_fmt_t;
#define GNUTLS_OPENPGP_KEYID_SIZE 8
typedef unsigned char gnutls_openpgp_keyid_t[GNUTLS_OPENPGP_KEYID_SIZE];
/* gnutls_openpgp_cert_t should be defined in gnutls.h
*/
/* initializes the memory for gnutls_openpgp_crt_t struct */
int gnutls_openpgp_crt_init (gnutls_openpgp_crt_t * key);
/* frees all memory */
void gnutls_openpgp_crt_deinit (gnutls_openpgp_crt_t key);
int gnutls_openpgp_crt_import (gnutls_openpgp_crt_t key,
const gnutls_datum_t * data,
gnutls_openpgp_crt_fmt_t format);
int gnutls_openpgp_crt_export (gnutls_openpgp_crt_t key,
gnutls_openpgp_crt_fmt_t format,
void *output_data,
size_t * output_data_size);
int gnutls_openpgp_crt_print (gnutls_openpgp_crt_t cert,
gnutls_certificate_print_formats_t format,
gnutls_datum_t * out);
/* The key_usage flags are defined in gnutls.h. They are
* the GNUTLS_KEY_* definitions.
*/
int gnutls_openpgp_crt_get_key_usage (gnutls_openpgp_crt_t key,
unsigned int *key_usage);
int gnutls_openpgp_crt_get_fingerprint (gnutls_openpgp_crt_t key, void *fpr,
size_t * fprlen);
int gnutls_openpgp_crt_get_subkey_fingerprint (gnutls_openpgp_crt_t key,
unsigned int idx,
void *fpr, size_t * fprlen);
int gnutls_openpgp_crt_get_name (gnutls_openpgp_crt_t key,
int idx, char *buf, size_t * sizeof_buf);
gnutls_pk_algorithm_t
gnutls_openpgp_crt_get_pk_algorithm (gnutls_openpgp_crt_t key,
unsigned int *bits);
int gnutls_openpgp_crt_get_version (gnutls_openpgp_crt_t key);
time_t gnutls_openpgp_crt_get_creation_time (gnutls_openpgp_crt_t key);
time_t gnutls_openpgp_crt_get_expiration_time (gnutls_openpgp_crt_t key);
int gnutls_openpgp_crt_get_key_id (gnutls_openpgp_crt_t key,
gnutls_openpgp_keyid_t keyid);
int gnutls_openpgp_crt_check_hostname (gnutls_openpgp_crt_t key,
const char *hostname);
int gnutls_openpgp_crt_get_revoked_status (gnutls_openpgp_crt_t key);
int gnutls_openpgp_crt_get_subkey_count (gnutls_openpgp_crt_t key);
int gnutls_openpgp_crt_get_subkey_idx (gnutls_openpgp_crt_t key,
const gnutls_openpgp_keyid_t keyid);
int gnutls_openpgp_crt_get_subkey_revoked_status (gnutls_openpgp_crt_t key,
unsigned int idx);
gnutls_pk_algorithm_t
gnutls_openpgp_crt_get_subkey_pk_algorithm (gnutls_openpgp_crt_t key,
unsigned int idx,
unsigned int *bits);
time_t gnutls_openpgp_crt_get_subkey_creation_time (gnutls_openpgp_crt_t
key, unsigned int idx);
time_t gnutls_openpgp_crt_get_subkey_expiration_time (gnutls_openpgp_crt_t
key,
unsigned int idx);
int gnutls_openpgp_crt_get_subkey_id (gnutls_openpgp_crt_t key,
unsigned int idx,
gnutls_openpgp_keyid_t keyid);
int gnutls_openpgp_crt_get_subkey_usage (gnutls_openpgp_crt_t key,
unsigned int idx,
unsigned int *key_usage);
int gnutls_openpgp_crt_get_subkey_pk_dsa_raw (gnutls_openpgp_crt_t crt,
unsigned int idx,
gnutls_datum_t * p,
gnutls_datum_t * q,
gnutls_datum_t * g,
gnutls_datum_t * y);
int gnutls_openpgp_crt_get_subkey_pk_rsa_raw (gnutls_openpgp_crt_t crt,
unsigned int idx,
gnutls_datum_t * m,
gnutls_datum_t * e);
int gnutls_openpgp_crt_get_pk_dsa_raw (gnutls_openpgp_crt_t crt,
gnutls_datum_t * p,
gnutls_datum_t * q,
gnutls_datum_t * g,
gnutls_datum_t * y);
int gnutls_openpgp_crt_get_pk_rsa_raw (gnutls_openpgp_crt_t crt,
gnutls_datum_t * m,
gnutls_datum_t * e);
int gnutls_openpgp_crt_get_preferred_key_id (gnutls_openpgp_crt_t key,
gnutls_openpgp_keyid_t keyid);
int
gnutls_openpgp_crt_set_preferred_key_id (gnutls_openpgp_crt_t key,
const gnutls_openpgp_keyid_t
keyid);
/* privkey stuff.
*/
int gnutls_openpgp_privkey_init (gnutls_openpgp_privkey_t * key);
void gnutls_openpgp_privkey_deinit (gnutls_openpgp_privkey_t key);
gnutls_pk_algorithm_t
gnutls_openpgp_privkey_get_pk_algorithm (gnutls_openpgp_privkey_t key,
unsigned int *bits);
gnutls_sec_param_t
gnutls_openpgp_privkey_sec_param (gnutls_openpgp_privkey_t key);
int gnutls_openpgp_privkey_import (gnutls_openpgp_privkey_t key,
const gnutls_datum_t * data,
gnutls_openpgp_crt_fmt_t format,
const char *password,
unsigned int flags);
int gnutls_openpgp_privkey_get_fingerprint (gnutls_openpgp_privkey_t key,
void *fpr, size_t * fprlen);
int gnutls_openpgp_privkey_get_subkey_fingerprint (gnutls_openpgp_privkey_t
key, unsigned int idx,
void *fpr,
size_t * fprlen);
int gnutls_openpgp_privkey_get_key_id (gnutls_openpgp_privkey_t key,
gnutls_openpgp_keyid_t keyid);
int gnutls_openpgp_privkey_get_subkey_count (gnutls_openpgp_privkey_t key);
int gnutls_openpgp_privkey_get_subkey_idx (gnutls_openpgp_privkey_t key,
const gnutls_openpgp_keyid_t
keyid);
int
gnutls_openpgp_privkey_get_subkey_revoked_status (gnutls_openpgp_privkey_t
key, unsigned int idx);
int gnutls_openpgp_privkey_get_revoked_status (gnutls_openpgp_privkey_t
key);
gnutls_pk_algorithm_t
gnutls_openpgp_privkey_get_subkey_pk_algorithm (gnutls_openpgp_privkey_t
key, unsigned int idx,
unsigned int *bits);
time_t
gnutls_openpgp_privkey_get_subkey_expiration_time
(gnutls_openpgp_privkey_t key, unsigned int idx);
int gnutls_openpgp_privkey_get_subkey_id (gnutls_openpgp_privkey_t key,
unsigned int idx,
gnutls_openpgp_keyid_t keyid);
time_t
gnutls_openpgp_privkey_get_subkey_creation_time (gnutls_openpgp_privkey_t
key, unsigned int idx);
int
gnutls_openpgp_privkey_export_subkey_dsa_raw (gnutls_openpgp_privkey_t
pkey, unsigned int idx,
gnutls_datum_t * p,
gnutls_datum_t * q,
gnutls_datum_t * g,
gnutls_datum_t * y,
gnutls_datum_t * x);
int gnutls_openpgp_privkey_export_subkey_rsa_raw (gnutls_openpgp_privkey_t
pkey, unsigned int idx,
gnutls_datum_t * m,
gnutls_datum_t * e,
gnutls_datum_t * d,
gnutls_datum_t * p,
gnutls_datum_t * q,
gnutls_datum_t * u);
int gnutls_openpgp_privkey_export_dsa_raw (gnutls_openpgp_privkey_t pkey,
gnutls_datum_t * p,
gnutls_datum_t * q,
gnutls_datum_t * g,
gnutls_datum_t * y,
gnutls_datum_t * x);
int gnutls_openpgp_privkey_export_rsa_raw (gnutls_openpgp_privkey_t pkey,
gnutls_datum_t * m,
gnutls_datum_t * e,
gnutls_datum_t * d,
gnutls_datum_t * p,
gnutls_datum_t * q,
gnutls_datum_t * u);
int gnutls_openpgp_privkey_export (gnutls_openpgp_privkey_t key,
gnutls_openpgp_crt_fmt_t format,
const char *password,
unsigned int flags,
void *output_data,
size_t * output_data_size);
int
gnutls_openpgp_privkey_set_preferred_key_id (gnutls_openpgp_privkey_t key,
const gnutls_openpgp_keyid_t
keyid);
int gnutls_openpgp_privkey_get_preferred_key_id (gnutls_openpgp_privkey_t
key,
gnutls_openpgp_keyid_t
keyid);
int gnutls_openpgp_crt_get_auth_subkey (gnutls_openpgp_crt_t crt,
gnutls_openpgp_keyid_t keyid,
unsigned int flag);
/* Keyring stuff.
*/
int gnutls_openpgp_keyring_init (gnutls_openpgp_keyring_t * keyring);
void gnutls_openpgp_keyring_deinit (gnutls_openpgp_keyring_t keyring);
int gnutls_openpgp_keyring_import (gnutls_openpgp_keyring_t keyring,
const gnutls_datum_t * data,
gnutls_openpgp_crt_fmt_t format);
int gnutls_openpgp_keyring_check_id (gnutls_openpgp_keyring_t ring,
const gnutls_openpgp_keyid_t keyid,
unsigned int flags);
int gnutls_openpgp_crt_verify_ring (gnutls_openpgp_crt_t key,
gnutls_openpgp_keyring_t keyring,
unsigned int flags, unsigned int *verify
/* the output of the verification */ );
int gnutls_openpgp_crt_verify_self (gnutls_openpgp_crt_t key,
unsigned int flags,
unsigned int *verify);
int gnutls_openpgp_keyring_get_crt (gnutls_openpgp_keyring_t ring,
unsigned int idx,
gnutls_openpgp_crt_t * cert);
int gnutls_openpgp_keyring_get_crt_count (gnutls_openpgp_keyring_t ring);
/**
* gnutls_openpgp_recv_key_func:
* @session: a TLS session
* @keyfpr: key fingerprint
* @keyfpr_length: length of key fingerprint
* @key: output key.
*
* A callback of this type is used to retrieve OpenPGP keys. Only
* useful on the server, and will only be used if the peer send a key
* fingerprint instead of a full key. See also
* gnutls_openpgp_set_recv_key_function().
*
* Returns: On success, %GNUTLS_E_SUCCESS (zero) is returned,
* otherwise an error code is returned.
*/
typedef int (*gnutls_openpgp_recv_key_func) (gnutls_session_t session,
const unsigned char *keyfpr,
unsigned int keyfpr_length,
gnutls_datum_t * key);
void
gnutls_openpgp_set_recv_key_function (gnutls_session_t session,
gnutls_openpgp_recv_key_func func);
/* certificate authentication stuff.
*/
int gnutls_certificate_set_openpgp_key (gnutls_certificate_credentials_t
res, gnutls_openpgp_crt_t key,
gnutls_openpgp_privkey_t pkey);
int
gnutls_certificate_set_openpgp_key_file (gnutls_certificate_credentials_t
res, const char *certfile,
const char *keyfile,
gnutls_openpgp_crt_fmt_t format);
int gnutls_certificate_set_openpgp_key_mem (gnutls_certificate_credentials_t
res,
const gnutls_datum_t * cert,
const gnutls_datum_t * key,
gnutls_openpgp_crt_fmt_t
format);
int
gnutls_certificate_set_openpgp_key_file2 (gnutls_certificate_credentials_t
res, const char *certfile,
const char *keyfile,
const char *subkey_id,
gnutls_openpgp_crt_fmt_t
format);
int
gnutls_certificate_set_openpgp_key_mem2 (gnutls_certificate_credentials_t
res, const gnutls_datum_t * cert,
const gnutls_datum_t * key,
const char *subkey_id,
gnutls_openpgp_crt_fmt_t format);
int
gnutls_certificate_set_openpgp_keyring_mem
(gnutls_certificate_credentials_t c, const unsigned char *data,
size_t dlen, gnutls_openpgp_crt_fmt_t format);
int
gnutls_certificate_set_openpgp_keyring_file
(gnutls_certificate_credentials_t c, const char *file,
gnutls_openpgp_crt_fmt_t format);
#ifdef __cplusplus
}
#endif
#endif /* GNUTLS_OPENPGP_H */

View File

@ -0,0 +1,304 @@
#ifndef __GNUTLS_PKCS11_H
#define __GNUTLS_PKCS11_H
#include <stdarg.h>
#include <gnutls26/gnutls.h>
#include <gnutls26/x509.h>
#define GNUTLS_PKCS11_MAX_PIN_LEN 32
/* Token callback function. The callback will be used to
* ask the user to re-enter the token with given null terminated
* label. Callback should return zero if token has been inserted
* by user and a negative error code otherwise. It might be called
* multiple times if the token is not detected and the retry counter
* will be increased.
*/
typedef int (*gnutls_pkcs11_token_callback_t) (void *const global_data,
const char *const label,
const unsigned retry);
/**
* gnutls_pkcs11_pin_flag_t:
* @GNUTLS_PKCS11_PIN_USER: The PIN for the user.
* @GNUTLS_PKCS11_PIN_SO: The PIN for the security officer.
* @GNUTLS_PKCS11_PIN_CONTEXT_SPECIFIC: The PIN is for a specific action and key like signing.
* @GNUTLS_PKCS11_PIN_FINAL_TRY: This is the final try before blocking.
* @GNUTLS_PKCS11_PIN_COUNT_LOW: Few tries remain before token blocks.
* @GNUTLS_PKCS11_PIN_WRONG: Last given PIN was not correct.
*
* Enumeration of different PIN flags.
*/
typedef enum
{
GNUTLS_PKCS11_PIN_USER = (1 << 0),
GNUTLS_PKCS11_PIN_SO = (1 << 1),
GNUTLS_PKCS11_PIN_FINAL_TRY = (1 << 2),
GNUTLS_PKCS11_PIN_COUNT_LOW = (1 << 3),
GNUTLS_PKCS11_PIN_CONTEXT_SPECIFIC = (1 << 4),
GNUTLS_PKCS11_PIN_WRONG = (1 << 5),
} gnutls_pkcs11_pin_flag_t;
/**
* gnutls_pkcs11_pin_callback_t:
* @userdata: user-controlled data from gnutls_pkcs11_set_pin_function().
* @attempt: pin-attempt counter, initially 0.
* @token_url: PKCS11 URL.
* @token_label: label of PKCS11 token.
* @flags: a #gnutls_pkcs11_pin_flag_t flag.
* @pin: buffer to hold PIN, of size @pin_max.
* @pin_max: size of @pin buffer.
*
* Callback function type for PKCS#11 PIN entry. It is set by
* gnutls_pkcs11_set_pin_function().
*
* The callback should provides the PIN code to unlock the token with
* label @token_label, specified by the URL @token_url.
*
* The PIN code, as a NUL-terminated ASCII string, should be copied
* into the @pin buffer (of maximum size @pin_max), and return 0 to
* indicate success. Alternatively, the callback may return a
* negative gnutls error code to indicate failure and cancel PIN entry
* (in which case, the contents of the @pin parameter are ignored).
*
* When a PIN is required, the callback will be invoked repeatedly
* (and indefinitely) until either the returned PIN code is correct,
* the callback returns failure, or the token refuses login (e.g. when
* the token is locked due to too many incorrect PINs!). For the
* first such invocation, the @attempt counter will have value zero;
* it will increase by one for each subsequent attempt.
*
* Returns: %GNUTLS_E_SUCCESS (0) on success or a negative error code on error.
*
* Since: 2.12.0
**/
typedef int (*gnutls_pkcs11_pin_callback_t) (void *userdata, int attempt,
const char *token_url,
const char *token_label,
unsigned int flags
/*gnutls_pkcs11_pin_flag_t */ ,
char *pin, size_t pin_max);
struct gnutls_pkcs11_obj_st;
typedef struct gnutls_pkcs11_obj_st *gnutls_pkcs11_obj_t;
#define GNUTLS_PKCS11_FLAG_MANUAL 0 /* Manual loading of libraries */
#define GNUTLS_PKCS11_FLAG_AUTO 1 /* Automatically load libraries by reading /etc/gnutls/pkcs11.conf */
/* pkcs11.conf format:
* load = /lib/xxx-pkcs11.so
* load = /lib/yyy-pkcs11.so
*/
int gnutls_pkcs11_init (unsigned int flags, const char *deprecated_config_file);
void gnutls_pkcs11_deinit (void);
void gnutls_pkcs11_set_token_function (gnutls_pkcs11_token_callback_t fn,
void *userdata);
void gnutls_pkcs11_set_pin_function (gnutls_pkcs11_pin_callback_t fn,
void *userdata);
int gnutls_pkcs11_add_provider (const char *name, const char *params);
int gnutls_pkcs11_obj_init (gnutls_pkcs11_obj_t * obj);
#define GNUTLS_PKCS11_OBJ_FLAG_LOGIN (1<<0) /* force login in the token for the operation */
#define GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED (1<<1) /* object marked as trusted */
#define GNUTLS_PKCS11_OBJ_FLAG_MARK_SENSITIVE (1<<2) /* object marked as sensitive (unexportable) */
#define GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO (1<<3) /* force login as a security officer in the token for the operation */
/**
* gnutls_pkcs11_url_type_t:
* @GNUTLS_PKCS11_URL_GENERIC: A generic-purpose URL.
* @GNUTLS_PKCS11_URL_LIB: A URL that specifies the library used as well.
* @GNUTLS_PKCS11_URL_LIB_VERSION: A URL that specifies the library and its version.
*
* Enumeration of different URL extraction flags.
*/
typedef enum
{
GNUTLS_PKCS11_URL_GENERIC, /* URL specifies the object on token level */
GNUTLS_PKCS11_URL_LIB, /* URL specifies the object on module level */
GNUTLS_PKCS11_URL_LIB_VERSION /* URL specifies the object on module and version level */
} gnutls_pkcs11_url_type_t;
int gnutls_pkcs11_obj_import_url (gnutls_pkcs11_obj_t, const char *url,
unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
int gnutls_pkcs11_obj_export_url (gnutls_pkcs11_obj_t obj,
gnutls_pkcs11_url_type_t detailed,
char **url);
void gnutls_pkcs11_obj_deinit (gnutls_pkcs11_obj_t obj);
int gnutls_pkcs11_obj_export (gnutls_pkcs11_obj_t obj,
void *output_data, size_t * output_data_size);
int gnutls_pkcs11_copy_x509_crt (const char *token_url, gnutls_x509_crt_t crt,
const char *label, unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
int gnutls_pkcs11_copy_x509_privkey (const char *token_url, gnutls_x509_privkey_t key,
const char *label, unsigned int key_usage /*GNUTLS_KEY_* */, unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
int gnutls_pkcs11_delete_url (const char *object_url, unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
int gnutls_pkcs11_copy_secret_key (const char *token_url,
gnutls_datum_t * key, const char *label,
unsigned int key_usage /* GNUTLS_KEY_* */ ,
unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
/**
* gnutls_pkcs11_obj_info_t:
* @GNUTLS_PKCS11_OBJ_ID_HEX: The object ID in hex.
* @GNUTLS_PKCS11_OBJ_LABEL: The object label.
* @GNUTLS_PKCS11_OBJ_TOKEN_LABEL: The token's label.
* @GNUTLS_PKCS11_OBJ_TOKEN_SERIAL: The token's serial number.
* @GNUTLS_PKCS11_OBJ_TOKEN_MANUFACTURER: The token's manufacturer.
* @GNUTLS_PKCS11_OBJ_TOKEN_MODEL: The token's model.
* @GNUTLS_PKCS11_OBJ_ID: The object ID.
* @GNUTLS_PKCS11_OBJ_LIBRARY_VERSION: The library's used to access the object version.
* @GNUTLS_PKCS11_OBJ_LIBRARY_DESCRIPTION: The library's used to access the object description (name).
* @GNUTLS_PKCS11_OBJ_LIBRARY_MANUFACTURER: The library's used to access the object manufacturer name.
*
* Enumeration of several object information types.
*/
typedef enum
{
GNUTLS_PKCS11_OBJ_ID_HEX = 1,
GNUTLS_PKCS11_OBJ_LABEL,
GNUTLS_PKCS11_OBJ_TOKEN_LABEL,
GNUTLS_PKCS11_OBJ_TOKEN_SERIAL,
GNUTLS_PKCS11_OBJ_TOKEN_MANUFACTURER,
GNUTLS_PKCS11_OBJ_TOKEN_MODEL,
GNUTLS_PKCS11_OBJ_ID,
/* the pkcs11 provider library info */
GNUTLS_PKCS11_OBJ_LIBRARY_VERSION,
GNUTLS_PKCS11_OBJ_LIBRARY_DESCRIPTION,
GNUTLS_PKCS11_OBJ_LIBRARY_MANUFACTURER
} gnutls_pkcs11_obj_info_t;
int gnutls_pkcs11_obj_get_info (gnutls_pkcs11_obj_t crt,
gnutls_pkcs11_obj_info_t itype, void *output,
size_t * output_size);
/**
* gnutls_pkcs11_obj_attr_t:
* @GNUTLS_PKCS11_OBJ_ATTR_CRT_ALL: Specify all certificates.
* @GNUTLS_PKCS11_OBJ_ATTR_CRT_TRUSTED: Specify all certificates marked as trusted.
* @GNUTLS_PKCS11_OBJ_ATTR_CRT_WITH_PRIVKEY: Specify all certificates with a corresponding private key.
* @GNUTLS_PKCS11_OBJ_ATTR_PUBKEY: Specify all public keys.
* @GNUTLS_PKCS11_OBJ_ATTR_PRIVKEY: Specify all private keys.
* @GNUTLS_PKCS11_OBJ_ATTR_ALL: Specify all objects.
*
* Enumeration of several attributes for object enumeration.
*/
typedef enum
{
GNUTLS_PKCS11_OBJ_ATTR_CRT_ALL = 1, /* all certificates */
GNUTLS_PKCS11_OBJ_ATTR_CRT_TRUSTED, /* certificates marked as trusted */
GNUTLS_PKCS11_OBJ_ATTR_CRT_WITH_PRIVKEY, /* certificates with corresponding private key */
GNUTLS_PKCS11_OBJ_ATTR_PUBKEY, /* public keys */
GNUTLS_PKCS11_OBJ_ATTR_PRIVKEY, /* private keys */
GNUTLS_PKCS11_OBJ_ATTR_ALL /* everything! */
} gnutls_pkcs11_obj_attr_t;
/**
* gnutls_pkcs11_token_info_t:
* @GNUTLS_PKCS11_TOKEN_LABEL: The token's label
* @GNUTLS_PKCS11_TOKEN_SERIAL: The token's serial number
* @GNUTLS_PKCS11_TOKEN_MANUFACTURER: The token's manufacturer
* @GNUTLS_PKCS11_TOKEN_MODEL: The token's model
*
* Enumeration of types for retrieving token information.
*/
typedef enum
{
GNUTLS_PKCS11_TOKEN_LABEL,
GNUTLS_PKCS11_TOKEN_SERIAL,
GNUTLS_PKCS11_TOKEN_MANUFACTURER,
GNUTLS_PKCS11_TOKEN_MODEL
} gnutls_pkcs11_token_info_t;
/**
* gnutls_pkcs11_obj_type_t:
* @GNUTLS_PKCS11_OBJ_UNKNOWN: Unknown PKCS11 object.
* @GNUTLS_PKCS11_OBJ_X509_CRT: X.509 certificate.
* @GNUTLS_PKCS11_OBJ_PUBKEY: Public key.
* @GNUTLS_PKCS11_OBJ_PRIVKEY: Private key.
* @GNUTLS_PKCS11_OBJ_SECRET_KEY: Secret key.
* @GNUTLS_PKCS11_OBJ_DATA: Data object.
*
* Enumeration of object types.
*/
typedef enum
{
GNUTLS_PKCS11_OBJ_UNKNOWN,
GNUTLS_PKCS11_OBJ_X509_CRT,
GNUTLS_PKCS11_OBJ_PUBKEY,
GNUTLS_PKCS11_OBJ_PRIVKEY,
GNUTLS_PKCS11_OBJ_SECRET_KEY,
GNUTLS_PKCS11_OBJ_DATA
} gnutls_pkcs11_obj_type_t;
int
gnutls_pkcs11_token_init (const char *token_url,
const char *so_pin, const char *label);
int
gnutls_pkcs11_token_get_mechanism (const char *url, int idx,
unsigned long *mechanism);
int gnutls_pkcs11_token_set_pin (const char *token_url, const char *oldpin, const char *newpin, unsigned int flags /*gnutls_pkcs11_pin_flag_t */
);
int gnutls_pkcs11_token_get_url (unsigned int seq,
gnutls_pkcs11_url_type_t detailed,
char **url);
int gnutls_pkcs11_token_get_info (const char *url, gnutls_pkcs11_token_info_t ttype,
void *output, size_t * output_size);
#define GNUTLS_PKCS11_TOKEN_HW 1
int gnutls_pkcs11_token_get_flags (const char *url, unsigned int *flags);
int gnutls_pkcs11_obj_list_import_url (gnutls_pkcs11_obj_t * p_list,
unsigned int *const n_list,
const char *url,
gnutls_pkcs11_obj_attr_t attrs,
unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
int gnutls_x509_crt_import_pkcs11 (gnutls_x509_crt_t crt,
gnutls_pkcs11_obj_t pkcs11_crt);
int gnutls_x509_crt_import_pkcs11_url (gnutls_x509_crt_t crt, const char *url,
unsigned int flags
/* GNUTLS_PKCS11_OBJ_FLAG_* */ );
gnutls_pkcs11_obj_type_t gnutls_pkcs11_obj_get_type (gnutls_pkcs11_obj_t
certificate);
const char *gnutls_pkcs11_type_get_name (gnutls_pkcs11_obj_type_t);
int gnutls_x509_crt_list_import_pkcs11 (gnutls_x509_crt_t * certs, unsigned int cert_max,
gnutls_pkcs11_obj_t * const objs, unsigned int flags /* must be zero */);
/* private key functions...*/
int gnutls_pkcs11_privkey_init (gnutls_pkcs11_privkey_t * key);
void gnutls_pkcs11_privkey_deinit (gnutls_pkcs11_privkey_t key);
int gnutls_pkcs11_privkey_get_pk_algorithm (gnutls_pkcs11_privkey_t key,
unsigned int *bits);
int gnutls_pkcs11_privkey_get_info (gnutls_pkcs11_privkey_t pkey,
gnutls_pkcs11_obj_info_t itype,
void *output, size_t * output_size);
int gnutls_pkcs11_privkey_import_url (gnutls_pkcs11_privkey_t pkey,
const char *url, unsigned int flags);
int gnutls_pkcs11_privkey_export_url (gnutls_pkcs11_privkey_t key,
gnutls_pkcs11_url_type_t detailed,
char **url);
/** @} */
#endif

View File

@ -0,0 +1,123 @@
/*
* Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software
* Foundation, Inc.
*
* Author: Nikos Mavrogiannopoulos
*
* This file is part of GnuTLS.
*
* The GnuTLS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
*/
#ifndef GNUTLS_PKCS12_H
#define GNUTLS_PKCS12_H
#include <gnutls26/x509.h>
#ifdef __cplusplus
extern "C"
{
#endif
/* PKCS12 structures handling
*/
struct gnutls_pkcs12_int;
typedef struct gnutls_pkcs12_int *gnutls_pkcs12_t;
struct gnutls_pkcs12_bag_int;
typedef struct gnutls_pkcs12_bag_int *gnutls_pkcs12_bag_t;
int gnutls_pkcs12_init (gnutls_pkcs12_t * pkcs12);
void gnutls_pkcs12_deinit (gnutls_pkcs12_t pkcs12);
int gnutls_pkcs12_import (gnutls_pkcs12_t pkcs12,
const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format, unsigned int flags);
int gnutls_pkcs12_export (gnutls_pkcs12_t pkcs12,
gnutls_x509_crt_fmt_t format,
void *output_data, size_t * output_data_size);
int gnutls_pkcs12_get_bag (gnutls_pkcs12_t pkcs12,
int indx, gnutls_pkcs12_bag_t bag);
int gnutls_pkcs12_set_bag (gnutls_pkcs12_t pkcs12, gnutls_pkcs12_bag_t bag);
int gnutls_pkcs12_generate_mac (gnutls_pkcs12_t pkcs12, const char *pass);
int gnutls_pkcs12_verify_mac (gnutls_pkcs12_t pkcs12, const char *pass);
int gnutls_pkcs12_bag_decrypt (gnutls_pkcs12_bag_t bag, const char *pass);
int gnutls_pkcs12_bag_encrypt (gnutls_pkcs12_bag_t bag, const char *pass,
unsigned int flags);
/**
* gnutls_pkcs12_bag_type_t:
* @GNUTLS_BAG_EMPTY: Empty PKCS-12 bag.
* @GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: PKCS-12 bag with PKCS-8 encrypted key.
* @GNUTLS_BAG_PKCS8_KEY: PKCS-12 bag with PKCS-8 key.
* @GNUTLS_BAG_CERTIFICATE: PKCS-12 bag with certificate.
* @GNUTLS_BAG_CRL: PKCS-12 bag with CRL.
* @GNUTLS_BAG_SECRET: PKCS-12 bag with secret PKCS-9 keys.
* @GNUTLS_BAG_ENCRYPTED: Encrypted PKCS-12 bag.
* @GNUTLS_BAG_UNKNOWN: Unknown PKCS-12 bag.
*
* Enumeration of different PKCS 12 bag types.
*/
typedef enum gnutls_pkcs12_bag_type_t
{
GNUTLS_BAG_EMPTY = 0,
GNUTLS_BAG_PKCS8_ENCRYPTED_KEY = 1,
GNUTLS_BAG_PKCS8_KEY = 2,
GNUTLS_BAG_CERTIFICATE = 3,
GNUTLS_BAG_CRL = 4,
GNUTLS_BAG_SECRET = 5, /* Secret data. Underspecified in pkcs-12,
* gnutls extension. We use the PKCS-9
* random nonce ID 1.2.840.113549.1.9.25.3
* to store randomly generated keys.
*/
GNUTLS_BAG_ENCRYPTED = 10,
GNUTLS_BAG_UNKNOWN = 20
} gnutls_pkcs12_bag_type_t;
gnutls_pkcs12_bag_type_t
gnutls_pkcs12_bag_get_type (gnutls_pkcs12_bag_t bag, int indx);
int gnutls_pkcs12_bag_get_data (gnutls_pkcs12_bag_t bag, int indx,
gnutls_datum_t * data);
int gnutls_pkcs12_bag_set_data (gnutls_pkcs12_bag_t bag,
gnutls_pkcs12_bag_type_t type,
const gnutls_datum_t * data);
int gnutls_pkcs12_bag_set_crl (gnutls_pkcs12_bag_t bag,
gnutls_x509_crl_t crl);
int gnutls_pkcs12_bag_set_crt (gnutls_pkcs12_bag_t bag,
gnutls_x509_crt_t crt);
int gnutls_pkcs12_bag_init (gnutls_pkcs12_bag_t * bag);
void gnutls_pkcs12_bag_deinit (gnutls_pkcs12_bag_t bag);
int gnutls_pkcs12_bag_get_count (gnutls_pkcs12_bag_t bag);
int gnutls_pkcs12_bag_get_key_id (gnutls_pkcs12_bag_t bag, int indx,
gnutls_datum_t * id);
int gnutls_pkcs12_bag_set_key_id (gnutls_pkcs12_bag_t bag, int indx,
const gnutls_datum_t * id);
int gnutls_pkcs12_bag_get_friendly_name (gnutls_pkcs12_bag_t bag, int indx,
char **name);
int gnutls_pkcs12_bag_set_friendly_name (gnutls_pkcs12_bag_t bag, int indx,
const char *name);
#ifdef __cplusplus
}
#endif
#endif /* GNUTLS_PKCS12_H */

View File

@ -0,0 +1,827 @@
/*
* Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software
* Foundation, Inc.
*
* Author: Nikos Mavrogiannopoulos
*
* This file is part of GnuTLS.
*
* The GnuTLS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
* USA
*
*/
/* This file contains the types and prototypes for the X.509
* certificate and CRL handling functions.
*/
#ifndef GNUTLS_X509_H
#define GNUTLS_X509_H
#include <gnutls26/gnutls.h>
#ifdef __cplusplus
extern "C"
{
#endif
/* Some OIDs usually found in Distinguished names, or
* in Subject Directory Attribute extensions.
*/
#define GNUTLS_OID_X520_COUNTRY_NAME "2.5.4.6"
#define GNUTLS_OID_X520_ORGANIZATION_NAME "2.5.4.10"
#define GNUTLS_OID_X520_ORGANIZATIONAL_UNIT_NAME "2.5.4.11"
#define GNUTLS_OID_X520_COMMON_NAME "2.5.4.3"
#define GNUTLS_OID_X520_LOCALITY_NAME "2.5.4.7"
#define GNUTLS_OID_X520_STATE_OR_PROVINCE_NAME "2.5.4.8"
#define GNUTLS_OID_X520_INITIALS "2.5.4.43"
#define GNUTLS_OID_X520_GENERATION_QUALIFIER "2.5.4.44"
#define GNUTLS_OID_X520_SURNAME "2.5.4.4"
#define GNUTLS_OID_X520_GIVEN_NAME "2.5.4.42"
#define GNUTLS_OID_X520_TITLE "2.5.4.12"
#define GNUTLS_OID_X520_DN_QUALIFIER "2.5.4.46"
#define GNUTLS_OID_X520_PSEUDONYM "2.5.4.65"
#define GNUTLS_OID_X520_POSTALCODE "2.5.4.17"
#define GNUTLS_OID_X520_NAME "2.5.4.41"
#define GNUTLS_OID_LDAP_DC "0.9.2342.19200300.100.1.25"
#define GNUTLS_OID_LDAP_UID "0.9.2342.19200300.100.1.1"
/* The following should not be included in DN.
*/
#define GNUTLS_OID_PKCS9_EMAIL "1.2.840.113549.1.9.1"
#define GNUTLS_OID_PKIX_DATE_OF_BIRTH "1.3.6.1.5.5.7.9.1"
#define GNUTLS_OID_PKIX_PLACE_OF_BIRTH "1.3.6.1.5.5.7.9.2"
#define GNUTLS_OID_PKIX_GENDER "1.3.6.1.5.5.7.9.3"
#define GNUTLS_OID_PKIX_COUNTRY_OF_CITIZENSHIP "1.3.6.1.5.5.7.9.4"
#define GNUTLS_OID_PKIX_COUNTRY_OF_RESIDENCE "1.3.6.1.5.5.7.9.5"
/* Key purpose Object Identifiers.
*/
#define GNUTLS_KP_TLS_WWW_SERVER "1.3.6.1.5.5.7.3.1"
#define GNUTLS_KP_TLS_WWW_CLIENT "1.3.6.1.5.5.7.3.2"
#define GNUTLS_KP_CODE_SIGNING "1.3.6.1.5.5.7.3.3"
#define GNUTLS_KP_EMAIL_PROTECTION "1.3.6.1.5.5.7.3.4"
#define GNUTLS_KP_TIME_STAMPING "1.3.6.1.5.5.7.3.8"
#define GNUTLS_KP_OCSP_SIGNING "1.3.6.1.5.5.7.3.9"
#define GNUTLS_KP_IPSEC_IKE "1.3.6.1.5.5.7.3.17"
#define GNUTLS_KP_ANY "2.5.29.37.0"
#define GNUTLS_FSAN_SET 0
#define GNUTLS_FSAN_APPEND 1
/* Certificate handling functions.
*/
/**
* gnutls_certificate_import_flags:
* @GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED: Fail if the
* certificates in the buffer are more than the space allocated for
* certificates. The error code will be %GNUTLS_E_SHORT_MEMORY_BUFFER.
* @GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED: Fail if the certificates
* in the buffer are not ordered starting from subject to issuer.
* The error code will be %GNUTLS_E_CERTIFICATE_LIST_UNSORTED.
*
* Enumeration of different certificate import flags.
*/
typedef enum gnutls_certificate_import_flags
{
GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED = 1,
GNUTLS_X509_CRT_LIST_FAIL_IF_UNSORTED = 2
} gnutls_certificate_import_flags;
int gnutls_x509_crt_init (gnutls_x509_crt_t * cert);
void gnutls_x509_crt_deinit (gnutls_x509_crt_t cert);
int gnutls_x509_crt_import (gnutls_x509_crt_t cert,
const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format);
int gnutls_x509_crt_list_import (gnutls_x509_crt_t * certs,
unsigned int *cert_max,
const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format,
unsigned int flags);
int gnutls_x509_crt_export (gnutls_x509_crt_t cert,
gnutls_x509_crt_fmt_t format,
void *output_data, size_t * output_data_size);
int gnutls_x509_crt_get_issuer_dn (gnutls_x509_crt_t cert, char *buf,
size_t * sizeof_buf);
int gnutls_x509_crt_get_issuer_dn_oid (gnutls_x509_crt_t cert, int indx,
void *oid, size_t * sizeof_oid);
int gnutls_x509_crt_get_issuer_dn_by_oid (gnutls_x509_crt_t cert,
const char *oid, int indx,
unsigned int raw_flag,
void *buf, size_t * sizeof_buf);
int gnutls_x509_crt_get_dn (gnutls_x509_crt_t cert, char *buf,
size_t * sizeof_buf);
int gnutls_x509_crt_get_dn_oid (gnutls_x509_crt_t cert, int indx,
void *oid, size_t * sizeof_oid);
int gnutls_x509_crt_get_dn_by_oid (gnutls_x509_crt_t cert,
const char *oid, int indx,
unsigned int raw_flag, void *buf,
size_t * sizeof_buf);
int gnutls_x509_crt_check_hostname (gnutls_x509_crt_t cert,
const char *hostname);
int gnutls_x509_crt_get_signature_algorithm (gnutls_x509_crt_t cert);
int gnutls_x509_crt_get_signature (gnutls_x509_crt_t cert,
char *sig, size_t * sizeof_sig);
int gnutls_x509_crt_get_version (gnutls_x509_crt_t cert);
int gnutls_x509_crt_get_key_id (gnutls_x509_crt_t crt,
unsigned int flags,
unsigned char *output_data,
size_t * output_data_size);
int gnutls_x509_crt_set_authority_key_id (gnutls_x509_crt_t cert,
const void *id, size_t id_size);
int gnutls_x509_crt_get_authority_key_id (gnutls_x509_crt_t cert,
void *ret, size_t * ret_size,
unsigned int *critical);
int gnutls_x509_crt_get_subject_key_id (gnutls_x509_crt_t cert,
void *ret, size_t * ret_size,
unsigned int *critical);
int gnutls_x509_crt_get_subject_unique_id (gnutls_x509_crt_t crt, char *buf,
size_t * sizeof_buf);
int gnutls_x509_crt_get_issuer_unique_id (gnutls_x509_crt_t crt, char *buf,
size_t * sizeof_buf);
#define GNUTLS_CRL_REASON_UNUSED 128
#define GNUTLS_CRL_REASON_KEY_COMPROMISE 64
#define GNUTLS_CRL_REASON_CA_COMPROMISE 32
#define GNUTLS_CRL_REASON_AFFILIATION_CHANGED 16
#define GNUTLS_CRL_REASON_SUPERSEDED 8
#define GNUTLS_CRL_REASON_SUPERSEEDED GNUTLS_CRL_REASON_SUPERSEDED
#define GNUTLS_CRL_REASON_CESSATION_OF_OPERATION 4
#define GNUTLS_CRL_REASON_CERTIFICATE_HOLD 2
#define GNUTLS_CRL_REASON_PRIVILEGE_WITHDRAWN 1
#define GNUTLS_CRL_REASON_AA_COMPROMISE 32768
int gnutls_x509_crt_get_crl_dist_points (gnutls_x509_crt_t cert,
unsigned int seq, void *ret,
size_t * ret_size,
unsigned int *reason_flags,
unsigned int *critical);
int gnutls_x509_crt_set_crl_dist_points2 (gnutls_x509_crt_t crt,
gnutls_x509_subject_alt_name_t
type, const void *data,
unsigned int data_size,
unsigned int reason_flags);
int gnutls_x509_crt_set_crl_dist_points (gnutls_x509_crt_t crt,
gnutls_x509_subject_alt_name_t
type, const void *data_string,
unsigned int reason_flags);
int gnutls_x509_crt_cpy_crl_dist_points (gnutls_x509_crt_t dst,
gnutls_x509_crt_t src);
time_t gnutls_x509_crt_get_activation_time (gnutls_x509_crt_t cert);
time_t gnutls_x509_crt_get_expiration_time (gnutls_x509_crt_t cert);
int gnutls_x509_crt_get_serial (gnutls_x509_crt_t cert, void *result,
size_t * result_size);
int gnutls_x509_crt_get_pk_algorithm (gnutls_x509_crt_t cert,
unsigned int *bits);
int gnutls_x509_crt_get_pk_rsa_raw (gnutls_x509_crt_t crt,
gnutls_datum_t * m, gnutls_datum_t * e);
int gnutls_x509_crt_get_pk_dsa_raw (gnutls_x509_crt_t crt,
gnutls_datum_t * p,
gnutls_datum_t * q,
gnutls_datum_t * g, gnutls_datum_t * y);
int gnutls_x509_crt_get_subject_alt_name (gnutls_x509_crt_t cert,
unsigned int seq, void *ret,
size_t * ret_size,
unsigned int *critical);
int gnutls_x509_crt_get_subject_alt_name2 (gnutls_x509_crt_t cert,
unsigned int seq, void *ret,
size_t * ret_size,
unsigned int *ret_type,
unsigned int *critical);
int gnutls_x509_crt_get_subject_alt_othername_oid (gnutls_x509_crt_t cert,
unsigned int seq,
void *ret,
size_t * ret_size);
int gnutls_x509_crt_get_issuer_alt_name (gnutls_x509_crt_t cert,
unsigned int seq, void *ret,
size_t * ret_size,
unsigned int *critical);
int gnutls_x509_crt_get_issuer_alt_name2 (gnutls_x509_crt_t cert,
unsigned int seq, void *ret,
size_t * ret_size,
unsigned int *ret_type,
unsigned int *critical);
int gnutls_x509_crt_get_issuer_alt_othername_oid (gnutls_x509_crt_t cert,
unsigned int seq,
void *ret,
size_t * ret_size);
int gnutls_x509_crt_get_ca_status (gnutls_x509_crt_t cert,
unsigned int *critical);
int gnutls_x509_crt_get_basic_constraints (gnutls_x509_crt_t cert,
unsigned int *critical,
int *ca, int *pathlen);
/* The key_usage flags are defined in gnutls.h. They are the
* GNUTLS_KEY_* definitions.
*/
int gnutls_x509_crt_get_key_usage (gnutls_x509_crt_t cert,
unsigned int *key_usage,
unsigned int *critical);
int gnutls_x509_crt_set_key_usage (gnutls_x509_crt_t crt,
unsigned int usage);
int gnutls_x509_crt_get_proxy (gnutls_x509_crt_t cert,
unsigned int *critical,
int *pathlen,
char **policyLanguage,
char **policy, size_t * sizeof_policy);
int gnutls_x509_dn_oid_known (const char *oid);
/* Read extensions by OID. */
int gnutls_x509_crt_get_extension_oid (gnutls_x509_crt_t cert, int indx,
void *oid, size_t * sizeof_oid);
int gnutls_x509_crt_get_extension_by_oid (gnutls_x509_crt_t cert,
const char *oid, int indx,
void *buf,
size_t * sizeof_buf,
unsigned int *critical);
/* Read extensions by sequence number. */
int gnutls_x509_crt_get_extension_info (gnutls_x509_crt_t cert, int indx,
void *oid, size_t * sizeof_oid,
int *critical);
int gnutls_x509_crt_get_extension_data (gnutls_x509_crt_t cert, int indx,
void *data, size_t * sizeof_data);
int gnutls_x509_crt_set_extension_by_oid (gnutls_x509_crt_t crt,
const char *oid,
const void *buf,
size_t sizeof_buf,
unsigned int critical);
/* X.509 Certificate writing.
*/
int gnutls_x509_crt_set_dn_by_oid (gnutls_x509_crt_t crt,
const char *oid,
unsigned int raw_flag,
const void *name,
unsigned int sizeof_name);
int gnutls_x509_crt_set_issuer_dn_by_oid (gnutls_x509_crt_t crt,
const char *oid,
unsigned int raw_flag,
const void *name,
unsigned int sizeof_name);
int gnutls_x509_crt_set_version (gnutls_x509_crt_t crt,
unsigned int version);
int gnutls_x509_crt_set_key (gnutls_x509_crt_t crt,
gnutls_x509_privkey_t key);
int gnutls_x509_crt_set_ca_status (gnutls_x509_crt_t crt, unsigned int ca);
int gnutls_x509_crt_set_basic_constraints (gnutls_x509_crt_t crt,
unsigned int ca,
int pathLenConstraint);
int gnutls_x509_crt_set_subject_alternative_name (gnutls_x509_crt_t crt,
gnutls_x509_subject_alt_name_t
type,
const char *data_string);
int gnutls_x509_crt_set_subject_alt_name (gnutls_x509_crt_t crt,
gnutls_x509_subject_alt_name_t
type, const void *data,
unsigned int data_size,
unsigned int flags);
int gnutls_x509_crt_sign (gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer,
gnutls_x509_privkey_t issuer_key);
int gnutls_x509_crt_sign2 (gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer,
gnutls_x509_privkey_t issuer_key,
gnutls_digest_algorithm_t dig,
unsigned int flags);
int gnutls_x509_crt_set_activation_time (gnutls_x509_crt_t cert,
time_t act_time);
int gnutls_x509_crt_set_expiration_time (gnutls_x509_crt_t cert,
time_t exp_time);
int gnutls_x509_crt_set_serial (gnutls_x509_crt_t cert, const void *serial,
size_t serial_size);
int gnutls_x509_crt_set_subject_key_id (gnutls_x509_crt_t cert,
const void *id, size_t id_size);
int gnutls_x509_crt_set_proxy_dn (gnutls_x509_crt_t crt,
gnutls_x509_crt_t eecrt,
unsigned int raw_flag,
const void *name,
unsigned int sizeof_name);
int gnutls_x509_crt_set_proxy (gnutls_x509_crt_t crt,
int pathLenConstraint,
const char *policyLanguage,
const char *policy, size_t sizeof_policy);
int gnutls_x509_crt_print (gnutls_x509_crt_t cert,
gnutls_certificate_print_formats_t format,
gnutls_datum_t * out);
int gnutls_x509_crl_print (gnutls_x509_crl_t crl,
gnutls_certificate_print_formats_t format,
gnutls_datum_t * out);
/* Access to internal Certificate fields.
*/
int gnutls_x509_crt_get_raw_issuer_dn (gnutls_x509_crt_t cert,
gnutls_datum_t * start);
int gnutls_x509_crt_get_raw_dn (gnutls_x509_crt_t cert,
gnutls_datum_t * start);
/* RDN handling.
*/
int gnutls_x509_rdn_get (const gnutls_datum_t * idn,
char *buf, size_t * sizeof_buf);
int gnutls_x509_rdn_get_oid (const gnutls_datum_t * idn,
int indx, void *buf, size_t * sizeof_buf);
int gnutls_x509_rdn_get_by_oid (const gnutls_datum_t * idn,
const char *oid, int indx,
unsigned int raw_flag, void *buf,
size_t * sizeof_buf);
typedef void *gnutls_x509_dn_t;
typedef struct gnutls_x509_ava_st
{
gnutls_datum_t oid;
gnutls_datum_t value;
unsigned long value_tag;
} gnutls_x509_ava_st;
int gnutls_x509_crt_get_subject (gnutls_x509_crt_t cert,
gnutls_x509_dn_t * dn);
int gnutls_x509_crt_get_issuer (gnutls_x509_crt_t cert,
gnutls_x509_dn_t * dn);
int gnutls_x509_dn_get_rdn_ava (gnutls_x509_dn_t dn, int irdn,
int iava, gnutls_x509_ava_st * ava);
int gnutls_x509_dn_init (gnutls_x509_dn_t * dn);
int gnutls_x509_dn_import (gnutls_x509_dn_t dn,
const gnutls_datum_t * data);
int gnutls_x509_dn_export (gnutls_x509_dn_t dn,
gnutls_x509_crt_fmt_t format, void *output_data,
size_t * output_data_size);
void gnutls_x509_dn_deinit (gnutls_x509_dn_t dn);
/* CRL handling functions.
*/
int gnutls_x509_crl_init (gnutls_x509_crl_t * crl);
void gnutls_x509_crl_deinit (gnutls_x509_crl_t crl);
int gnutls_x509_crl_import (gnutls_x509_crl_t crl,
const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format);
int gnutls_x509_crl_export (gnutls_x509_crl_t crl,
gnutls_x509_crt_fmt_t format,
void *output_data, size_t * output_data_size);
int
gnutls_x509_crl_get_raw_issuer_dn (gnutls_x509_crl_t crl,
gnutls_datum_t * dn);
int gnutls_x509_crl_get_issuer_dn (const gnutls_x509_crl_t crl,
char *buf, size_t * sizeof_buf);
int gnutls_x509_crl_get_issuer_dn_by_oid (gnutls_x509_crl_t crl,
const char *oid, int indx,
unsigned int raw_flag,
void *buf, size_t * sizeof_buf);
int gnutls_x509_crl_get_dn_oid (gnutls_x509_crl_t crl, int indx,
void *oid, size_t * sizeof_oid);
int gnutls_x509_crl_get_signature_algorithm (gnutls_x509_crl_t crl);
int gnutls_x509_crl_get_signature (gnutls_x509_crl_t crl,
char *sig, size_t * sizeof_sig);
int gnutls_x509_crl_get_version (gnutls_x509_crl_t crl);
time_t gnutls_x509_crl_get_this_update (gnutls_x509_crl_t crl);
time_t gnutls_x509_crl_get_next_update (gnutls_x509_crl_t crl);
int gnutls_x509_crl_get_crt_count (gnutls_x509_crl_t crl);
int gnutls_x509_crl_get_crt_serial (gnutls_x509_crl_t crl, int indx,
unsigned char *serial,
size_t * serial_size, time_t * t);
#define gnutls_x509_crl_get_certificate_count gnutls_x509_crl_get_crt_count
#define gnutls_x509_crl_get_certificate gnutls_x509_crl_get_crt_serial
int gnutls_x509_crl_check_issuer (gnutls_x509_crl_t crl,
gnutls_x509_crt_t issuer);
/* CRL writing.
*/
int gnutls_x509_crl_set_version (gnutls_x509_crl_t crl,
unsigned int version);
int gnutls_x509_crl_set_this_update (gnutls_x509_crl_t crl,
time_t act_time);
int gnutls_x509_crl_set_next_update (gnutls_x509_crl_t crl,
time_t exp_time);
int gnutls_x509_crl_set_crt_serial (gnutls_x509_crl_t crl,
const void *serial,
size_t serial_size,
time_t revocation_time);
int gnutls_x509_crl_set_crt (gnutls_x509_crl_t crl,
gnutls_x509_crt_t crt, time_t revocation_time);
int gnutls_x509_crl_get_authority_key_id (gnutls_x509_crl_t crl, void *ret,
size_t * ret_size,
unsigned int *critical);
int gnutls_x509_crl_get_number (gnutls_x509_crl_t crl, void *ret,
size_t * ret_size, unsigned int *critical);
int gnutls_x509_crl_get_extension_oid (gnutls_x509_crl_t crl, int indx,
void *oid, size_t * sizeof_oid);
int gnutls_x509_crl_get_extension_info (gnutls_x509_crl_t crl, int indx,
void *oid, size_t * sizeof_oid,
int *critical);
int gnutls_x509_crl_get_extension_data (gnutls_x509_crl_t crl, int indx,
void *data, size_t * sizeof_data);
int gnutls_x509_crl_set_authority_key_id (gnutls_x509_crl_t crl,
const void *id, size_t id_size);
int gnutls_x509_crl_set_number (gnutls_x509_crl_t crl,
const void *nr, size_t nr_size);
/* PKCS7 structures handling
*/
struct gnutls_pkcs7_int;
typedef struct gnutls_pkcs7_int *gnutls_pkcs7_t;
int gnutls_pkcs7_init (gnutls_pkcs7_t * pkcs7);
void gnutls_pkcs7_deinit (gnutls_pkcs7_t pkcs7);
int gnutls_pkcs7_import (gnutls_pkcs7_t pkcs7,
const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format);
int gnutls_pkcs7_export (gnutls_pkcs7_t pkcs7,
gnutls_x509_crt_fmt_t format,
void *output_data, size_t * output_data_size);
int gnutls_pkcs7_get_crt_count (gnutls_pkcs7_t pkcs7);
int gnutls_pkcs7_get_crt_raw (gnutls_pkcs7_t pkcs7, int indx,
void *certificate, size_t * certificate_size);
int gnutls_pkcs7_set_crt_raw (gnutls_pkcs7_t pkcs7,
const gnutls_datum_t * crt);
int gnutls_pkcs7_set_crt (gnutls_pkcs7_t pkcs7, gnutls_x509_crt_t crt);
int gnutls_pkcs7_delete_crt (gnutls_pkcs7_t pkcs7, int indx);
int gnutls_pkcs7_get_crl_raw (gnutls_pkcs7_t pkcs7,
int indx, void *crl, size_t * crl_size);
int gnutls_pkcs7_get_crl_count (gnutls_pkcs7_t pkcs7);
int gnutls_pkcs7_set_crl_raw (gnutls_pkcs7_t pkcs7,
const gnutls_datum_t * crl);
int gnutls_pkcs7_set_crl (gnutls_pkcs7_t pkcs7, gnutls_x509_crl_t crl);
int gnutls_pkcs7_delete_crl (gnutls_pkcs7_t pkcs7, int indx);
/* X.509 Certificate verification functions.
*/
/**
* gnutls_certificate_verify_flags:
* @GNUTLS_VERIFY_DISABLE_CA_SIGN: If set a signer does not have to be
* a certificate authority. This flag should normaly be disabled,
* unless you know what this means.
* @GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS: If set a signer in the trusted
* list is never checked for expiration or activation.
* @GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT: Allow trusted CA
* certificates that have version 1. This is the default.
* @GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT: Do not allow trusted CA
* certificates that have version 1. This option is to be used
* to deprecate all V1 certificates.
* @GNUTLS_VERIFY_DO_NOT_ALLOW_SAME: If a certificate is not signed by
* anyone trusted but exists in the trusted CA list do not treat it
* as trusted.
* @GNUTLS_VERIFY_ALLOW_ANY_X509_V1_CA_CRT: Allow CA certificates that
* have version 1 (both root and intermediate). This might be
* dangerous since those haven't the basicConstraints
* extension. Must be used in combination with
* %GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT.
* @GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2: Allow certificates to be signed
* using the broken MD2 algorithm.
* @GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5: Allow certificates to be signed
* using the broken MD5 algorithm.
* @GNUTLS_VERIFY_DISABLE_TIME_CHECKS: Disable checking of activation
* and expiration validity periods of certificate chains. Don't set
* this unless you understand the security implications.
*
* Enumeration of different certificate verify flags.
*/
typedef enum gnutls_certificate_verify_flags
{
GNUTLS_VERIFY_DISABLE_CA_SIGN = 1,
GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT = 2,
GNUTLS_VERIFY_DO_NOT_ALLOW_SAME = 4,
GNUTLS_VERIFY_ALLOW_ANY_X509_V1_CA_CRT = 8,
GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD2 = 16,
GNUTLS_VERIFY_ALLOW_SIGN_RSA_MD5 = 32,
GNUTLS_VERIFY_DISABLE_TIME_CHECKS = 64,
GNUTLS_VERIFY_DISABLE_TRUSTED_TIME_CHECKS = 128,
GNUTLS_VERIFY_DO_NOT_ALLOW_X509_V1_CA_CRT = 256
} gnutls_certificate_verify_flags;
int gnutls_x509_crt_check_issuer (gnutls_x509_crt_t cert,
gnutls_x509_crt_t issuer);
int gnutls_x509_crt_list_verify (const gnutls_x509_crt_t * cert_list,
int cert_list_length,
const gnutls_x509_crt_t * CA_list,
int CA_list_length,
const gnutls_x509_crl_t * CRL_list,
int CRL_list_length,
unsigned int flags, unsigned int *verify);
int gnutls_x509_crt_verify (gnutls_x509_crt_t cert,
const gnutls_x509_crt_t * CA_list,
int CA_list_length, unsigned int flags,
unsigned int *verify);
int gnutls_x509_crl_verify (gnutls_x509_crl_t crl,
const gnutls_x509_crt_t * CA_list,
int CA_list_length, unsigned int flags,
unsigned int *verify);
int gnutls_x509_crt_check_revocation (gnutls_x509_crt_t cert,
const gnutls_x509_crl_t *
crl_list, int crl_list_length);
int gnutls_x509_crt_get_fingerprint (gnutls_x509_crt_t cert,
gnutls_digest_algorithm_t algo,
void *buf, size_t * sizeof_buf);
int gnutls_x509_crt_get_key_purpose_oid (gnutls_x509_crt_t cert,
int indx, void *oid,
size_t * sizeof_oid,
unsigned int *critical);
int gnutls_x509_crt_set_key_purpose_oid (gnutls_x509_crt_t cert,
const void *oid,
unsigned int critical);
/* Private key handling.
*/
/* Flags for the gnutls_x509_privkey_export_pkcs8() function.
*/
/**
* gnutls_pkcs_encrypt_flags_t:
* @GNUTLS_PKCS_PLAIN: Unencrypted private key.
* @GNUTLS_PKCS8_PLAIN: Same as %GNUTLS_PKCS_PLAIN.
* @GNUTLS_PKCS_USE_PKCS12_3DES: PKCS-12 3DES.
* @GNUTLS_PKCS8_USE_PKCS12_3DES: Same as %GNUTLS_PKCS_USE_PKCS12_3DES.
* @GNUTLS_PKCS_USE_PKCS12_ARCFOUR: PKCS-12 ARCFOUR.
* @GNUTLS_PKCS8_USE_PKCS12_ARCFOUR: Same as %GNUTLS_PKCS_USE_PKCS12_ARCFOUR.
* @GNUTLS_PKCS_USE_PKCS12_RC2_40: PKCS-12 RC2-40.
* @GNUTLS_PKCS8_USE_PKCS12_RC2_40: Same as %GNUTLS_PKCS_USE_PKCS12_RC2_40.
* @GNUTLS_PKCS_USE_PBES2_3DES: PBES2 3DES.
* @GNUTLS_PKCS_USE_PBES2_AES_128: PBES2 AES-128.
* @GNUTLS_PKCS_USE_PBES2_AES_192: PBES2 AES-192.
* @GNUTLS_PKCS_USE_PBES2_AES_256: PBES2 AES-256.
*
* Enumeration of different PKCS encryption flags.
*/
typedef enum gnutls_pkcs_encrypt_flags_t
{
GNUTLS_PKCS_PLAIN = 1,
GNUTLS_PKCS8_PLAIN = GNUTLS_PKCS_PLAIN,
GNUTLS_PKCS_USE_PKCS12_3DES = 2,
GNUTLS_PKCS8_USE_PKCS12_3DES = GNUTLS_PKCS_USE_PKCS12_3DES,
GNUTLS_PKCS_USE_PKCS12_ARCFOUR = 4,
GNUTLS_PKCS8_USE_PKCS12_ARCFOUR = GNUTLS_PKCS_USE_PKCS12_ARCFOUR,
GNUTLS_PKCS_USE_PKCS12_RC2_40 = 8,
GNUTLS_PKCS8_USE_PKCS12_RC2_40 = GNUTLS_PKCS_USE_PKCS12_RC2_40,
GNUTLS_PKCS_USE_PBES2_3DES = 16,
GNUTLS_PKCS_USE_PBES2_AES_128 = 32,
GNUTLS_PKCS_USE_PBES2_AES_192 = 64,
GNUTLS_PKCS_USE_PBES2_AES_256 = 128
} gnutls_pkcs_encrypt_flags_t;
int gnutls_x509_privkey_init (gnutls_x509_privkey_t * key);
void gnutls_x509_privkey_deinit (gnutls_x509_privkey_t key);
gnutls_sec_param_t gnutls_x509_privkey_sec_param (gnutls_x509_privkey_t
key);
int gnutls_x509_privkey_cpy (gnutls_x509_privkey_t dst,
gnutls_x509_privkey_t src);
int gnutls_x509_privkey_import (gnutls_x509_privkey_t key,
const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format);
int gnutls_x509_privkey_import_pkcs8 (gnutls_x509_privkey_t key,
const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format,
const char *password,
unsigned int flags);
int gnutls_x509_privkey_import_rsa_raw (gnutls_x509_privkey_t key,
const gnutls_datum_t * m,
const gnutls_datum_t * e,
const gnutls_datum_t * d,
const gnutls_datum_t * p,
const gnutls_datum_t * q,
const gnutls_datum_t * u);
int gnutls_x509_privkey_import_rsa_raw2 (gnutls_x509_privkey_t key,
const gnutls_datum_t * m,
const gnutls_datum_t * e,
const gnutls_datum_t * d,
const gnutls_datum_t * p,
const gnutls_datum_t * q,
const gnutls_datum_t * u,
const gnutls_datum_t * e1,
const gnutls_datum_t * e2);
int gnutls_x509_privkey_fix (gnutls_x509_privkey_t key);
int gnutls_x509_privkey_export_dsa_raw (gnutls_x509_privkey_t key,
gnutls_datum_t * p,
gnutls_datum_t * q,
gnutls_datum_t * g,
gnutls_datum_t * y,
gnutls_datum_t * x);
int gnutls_x509_privkey_import_dsa_raw (gnutls_x509_privkey_t key,
const gnutls_datum_t * p,
const gnutls_datum_t * q,
const gnutls_datum_t * g,
const gnutls_datum_t * y,
const gnutls_datum_t * x);
int gnutls_x509_privkey_get_pk_algorithm (gnutls_x509_privkey_t key);
int gnutls_x509_privkey_get_key_id (gnutls_x509_privkey_t key,
unsigned int flags,
unsigned char *output_data,
size_t * output_data_size);
int gnutls_x509_privkey_generate (gnutls_x509_privkey_t key,
gnutls_pk_algorithm_t algo,
unsigned int bits, unsigned int flags);
int gnutls_x509_privkey_export (gnutls_x509_privkey_t key,
gnutls_x509_crt_fmt_t format,
void *output_data,
size_t * output_data_size);
int gnutls_x509_privkey_export_pkcs8 (gnutls_x509_privkey_t key,
gnutls_x509_crt_fmt_t format,
const char *password,
unsigned int flags,
void *output_data,
size_t * output_data_size);
int gnutls_x509_privkey_export_rsa_raw2 (gnutls_x509_privkey_t key,
gnutls_datum_t * m,
gnutls_datum_t * e,
gnutls_datum_t * d,
gnutls_datum_t * p,
gnutls_datum_t * q,
gnutls_datum_t * u,
gnutls_datum_t * e1,
gnutls_datum_t * e2);
int gnutls_x509_privkey_export_rsa_raw (gnutls_x509_privkey_t key,
gnutls_datum_t * m,
gnutls_datum_t * e,
gnutls_datum_t * d,
gnutls_datum_t * p,
gnutls_datum_t * q,
gnutls_datum_t * u);
/* Certificate request stuff.
*/
int gnutls_x509_crq_print (gnutls_x509_crq_t crq,
gnutls_certificate_print_formats_t format,
gnutls_datum_t * out);
int gnutls_x509_crq_verify (gnutls_x509_crq_t crq, unsigned int flags);
int gnutls_x509_crq_init (gnutls_x509_crq_t * crq);
void gnutls_x509_crq_deinit (gnutls_x509_crq_t crq);
int gnutls_x509_crq_import (gnutls_x509_crq_t crq,
const gnutls_datum_t * data,
gnutls_x509_crt_fmt_t format);
int gnutls_x509_crq_get_dn (gnutls_x509_crq_t crq, char *buf,
size_t * sizeof_buf);
int gnutls_x509_crq_get_dn_oid (gnutls_x509_crq_t crq, int indx,
void *oid, size_t * sizeof_oid);
int gnutls_x509_crq_get_dn_by_oid (gnutls_x509_crq_t crq,
const char *oid, int indx,
unsigned int raw_flag, void *buf,
size_t * sizeof_buf);
int gnutls_x509_crq_set_dn_by_oid (gnutls_x509_crq_t crq,
const char *oid,
unsigned int raw_flag,
const void *data,
unsigned int sizeof_data);
int gnutls_x509_crq_set_version (gnutls_x509_crq_t crq,
unsigned int version);
int gnutls_x509_crq_get_version (gnutls_x509_crq_t crq);
int gnutls_x509_crq_set_key (gnutls_x509_crq_t crq,
gnutls_x509_privkey_t key);
int gnutls_x509_crq_set_challenge_password (gnutls_x509_crq_t crq,
const char *pass);
int gnutls_x509_crq_get_challenge_password (gnutls_x509_crq_t crq,
char *pass,
size_t * sizeof_pass);
int gnutls_x509_crq_set_attribute_by_oid (gnutls_x509_crq_t crq,
const char *oid, void *buf,
size_t sizeof_buf);
int gnutls_x509_crq_get_attribute_by_oid (gnutls_x509_crq_t crq,
const char *oid, int indx,
void *buf, size_t * sizeof_buf);
int gnutls_x509_crq_export (gnutls_x509_crq_t crq,
gnutls_x509_crt_fmt_t format,
void *output_data, size_t * output_data_size);
int gnutls_x509_crt_set_crq (gnutls_x509_crt_t crt, gnutls_x509_crq_t crq);
int gnutls_x509_crt_set_crq_extensions (gnutls_x509_crt_t crt,
gnutls_x509_crq_t crq);
int gnutls_x509_crq_set_key_rsa_raw (gnutls_x509_crq_t crq,
const gnutls_datum_t * m,
const gnutls_datum_t * e);
int gnutls_x509_crq_set_subject_alt_name (gnutls_x509_crq_t crq,
gnutls_x509_subject_alt_name_t nt,
const void *data,
unsigned int data_size,
unsigned int flags);
int gnutls_x509_crq_set_key_usage (gnutls_x509_crq_t crq,
unsigned int usage);
int gnutls_x509_crq_set_basic_constraints (gnutls_x509_crq_t crq,
unsigned int ca,
int pathLenConstraint);
int gnutls_x509_crq_set_key_purpose_oid (gnutls_x509_crq_t crq,
const void *oid,
unsigned int critical);
int gnutls_x509_crq_get_key_purpose_oid (gnutls_x509_crq_t crq, int indx,
void *oid, size_t * sizeof_oid,
unsigned int *critical);
int gnutls_x509_crq_get_extension_data (gnutls_x509_crq_t crq, int indx,
void *data, size_t * sizeof_data);
int gnutls_x509_crq_get_extension_info (gnutls_x509_crq_t crq, int indx,
void *oid, size_t * sizeof_oid,
int *critical);
int gnutls_x509_crq_get_attribute_data (gnutls_x509_crq_t crq, int indx,
void *data, size_t * sizeof_data);
int gnutls_x509_crq_get_attribute_info (gnutls_x509_crq_t crq, int indx,
void *oid, size_t * sizeof_oid);
int gnutls_x509_crq_get_pk_algorithm (gnutls_x509_crq_t crq,
unsigned int *bits);
int gnutls_x509_crq_get_key_id (gnutls_x509_crq_t crq, unsigned int flags,
unsigned char *output_data,
size_t * output_data_size);
int gnutls_x509_crq_get_key_rsa_raw (gnutls_x509_crq_t crq,
gnutls_datum_t * m,
gnutls_datum_t * e);
int gnutls_x509_crq_get_key_usage (gnutls_x509_crq_t crq,
unsigned int *key_usage,
unsigned int *critical);
int gnutls_x509_crq_get_basic_constraints (gnutls_x509_crq_t crq,
unsigned int *critical,
int *ca, int *pathlen);
int gnutls_x509_crq_get_subject_alt_name (gnutls_x509_crq_t crq,
unsigned int seq, void *ret,
size_t * ret_size,
unsigned int *ret_type,
unsigned int *critical);
int gnutls_x509_crq_get_subject_alt_othername_oid (gnutls_x509_crq_t crq,
unsigned int seq,
void *ret,
size_t * ret_size);
int gnutls_x509_crq_get_extension_by_oid (gnutls_x509_crq_t crq,
const char *oid, int indx,
void *buf, size_t * sizeof_buf,
unsigned int *critical);
#ifdef __cplusplus
}
#endif
#endif /* GNUTLS_X509_H */

1
dav1d

@ -1 +0,0 @@
Subproject commit 8a6f054ef1e0f7886bc6e53e6be97c427154fe85

View File

@ -1,143 +0,0 @@
#!/usr/bin/env python3
# usage: default_pfx.py path/to/default_pfx_dir path/to/dist
"Helper module for building the default prefix"
import os
import subprocess
import re
def file_is_wine_builtin_dll(path):
if not os.path.exists(path):
return False
try:
sfile = open(path, "rb")
sfile.seek(0x40)
tag = sfile.read(20)
return tag.startswith((b"Wine placeholder DLL", b"Wine builtin DLL"))
except IOError:
return False
def little_endian_bytes_to_uint(b):
result = 0
multiplier = 1
for i in b:
result += i * multiplier
multiplier <<= 8
return result
def dll_bitness(path):
if not os.path.exists(path):
return 0
try:
sfile = open(path, "rb")
sfile.seek(0x3c)
ntheader_ofs = little_endian_bytes_to_uint(sfile.read(4))
sfile.seek(0x18 + ntheader_ofs)
magic = sfile.read(2)
if magic == bytes((11, 1)):
return 32
if magic == bytes((11, 2)):
return 64
return 0
except IOError:
return 0
def make_relative_symlink(target, linkname):
target = os.path.abspath(target)
linkname = os.path.abspath(linkname)
rel = os.path.relpath(target, os.path.dirname(linkname))
os.symlink(rel, linkname)
def setup_dll_symlinks(default_pfx_dir, dist_dir):
skip_dlls = [ 'amd_ags_x64.dll' ]
for walk_dir, dirs, files in os.walk(default_pfx_dir):
for file_ in files:
filename = os.path.join(walk_dir, file_)
if file_ in skip_dlls:
continue
if os.path.isfile(filename) and file_is_wine_builtin_dll(filename):
bitness = dll_bitness(filename)
if bitness == 32:
libdir = os.path.join(dist_dir, 'lib/wine/i386-windows')
elif bitness == 64:
libdir = os.path.join(dist_dir, 'lib64/wine/x86_64-windows')
else:
continue
if os.path.exists(os.path.join(libdir, file_)):
target = os.path.join(libdir, file_)
else:
continue
os.unlink(filename)
make_relative_symlink(target, filename)
KEY_RE = re.compile(r'\[(.+)\] ([0-9]+)')
VALUE_RE = re.compile(r'"(.*)"="(.+)"')
def filter_registry(filename):
"""Remove registry values that contain a fully qualified path
inside some well-known registry keys. These paths are devised on
the build machine and it makes no sense to distribute them. Plus,
they are known to cause bugs."""
FILTER_KEYS = [
r'Software\\Microsoft\\Windows\\CurrentVersion\\Fonts',
r'Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts',
r'Software\\Wine\\Fonts\\External Fonts',
]
filtering = False
with open(filename) as fin:
with open(filename + '.tmp', 'w') as fout:
for line in fin:
line = line.strip()
match = KEY_RE.match(line)
if match is not None:
fout.write(line + '\n')
filtering = match.group(1) in FILTER_KEYS
continue
match = VALUE_RE.match(line)
if match is not None:
if not filtering or match.group(2)[1:2] != ':':
fout.write(line + '\n')
continue
fout.write(line + '\n')
os.rename(filename + '.tmp', filename)
#steampipe can't handle filenames with colons, so we remove them here
#and restore them in the proton script
def fixup_drive_links(default_pfx_dir):
for walk_dir, dirs, files in os.walk(os.path.join(default_pfx_dir, "dosdevices")):
for dir_ in dirs:
if ":" in dir_:
os.remove(os.path.join(walk_dir, dir_))
def make_default_pfx(default_pfx_dir, dist_dir):
local_env = dict(os.environ)
ld_path = dist_dir + "/lib64:" + dist_dir + "/lib"
local_env["LD_LIBRARY_PATH"] = ld_path
local_env["WINEPREFIX"] = default_pfx_dir
local_env["WINEDEBUG"] = "-all"
runtime_args = []
subprocess.run(runtime_args + ["/bin/bash", "-c",
os.path.join(dist_dir, 'bin', 'wine') + " wineboot && " +
os.path.join(dist_dir, 'bin', 'wineserver') + " -w"],
env=local_env, check=True)
setup_dll_symlinks(default_pfx_dir, dist_dir)
fixup_drive_links(default_pfx_dir)
filter_registry(os.path.join(default_pfx_dir, 'user.reg'))
filter_registry(os.path.join(default_pfx_dir, 'system.reg'))
if __name__ == '__main__':
import sys
make_default_pfx(sys.argv[1], sys.argv[2])

View File

@ -1,4 +1,4 @@
Copyright (c) 2018-2022, Valve Corporation
Copyright (c) 2018, Valve Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@ -28,440 +28,48 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Browse the source code for more information
https://github.com/ValveSoftware/Proton
https://github.com/ValveSoftware/Proton/
---- ---- ---- ----
This software contains a modified version of Wine licensed under the LGPL 2.1. Wine is
This software contains Wine licensed under the LGPL 2.1. Wine is
Copyright (c) 1993-2022 the Wine project authors
Copyright (c) 1993-2018 the Wine project authors
Visit Wine at
Browse the source code for more information
https://winehq.org
View our modifications at
https://github.com/ValveSoftware/wine
https://github.com/ValveSoftware/wine/
---- ---- ---- ----
This software contains a modified version of DXVK licensed under the zlib/libpng license. DXVK is
This software contains DXVK licensed under the zlib/libpng license. DXVK is
Copyright (c) 2017-2022 Philip Rebohle
Copyright (c) 2019-2022 Joshua Ashton
Copyright (c) 2017 Philip Rebohle
Visit DXVK at
https://github.com/doitsujin/dxvk
View our modifications at
https://github.com/ValveSoftware/dxvk
---- ---- ---- ----
This software contains vkd3d-proton licensed under the LGPL 2.1. vkd3d-proton is
Copyright 2016-2022 the vkd3d-proton project authors
Visit vkd3d-proton at
https://github.com/HansKristian-Work/vkd3d-proton
---- ---- ---- ----
This software contains FAudio licensed under the zlib license. FAudio is
Copyright (c) 2011-2022 Ethan Lee, Luigi Auriemma, and the MonoGame Team
Visit FAudio at
https://github.com/FNA-XNA/FAudio
---- ---- ---- ----
This software contains gstreamer, gst-plugins-base, and gst-plugins-good licensed under the LGPL 2.
Visit gstreamer at
https://gstreamer.freedesktop.org/
---- ---- ---- ----
This software contains some Liberation Fonts licensed under the SIL Open Font License, available at LICENSE.OFL. These fonts are
Copyright (c) 2010 Google Corporation
Copyright (c) 2012 Red Hat, Inc.
Visit Liberation Fonts at
https://github.com/liberationfonts/liberation-fonts
---- ---- ---- ----
This software contains Source Han Sans licensed under the SIL Open Font License, available at LICENSE.OFL. This font is
Copyright 2014-2021 Adobe (http://www.adobe.com/)
Visit Source Han Sans at
https://github.com/adobe-fonts/source-han-sans
---- ---- ---- ----
This software contains Ume fonts distributed under the following license:
These fonts are free software. Unlimited permission is granted to
use, copy, and distribute it, with or without modification, either
commercially and noncommercially. THESE FONTS ARE PROVIDED "AS
IS" WITHOUT WARRANTY.
Visit Ume fonts home page at
https://osdn.net/projects/ume-font/
---- ---- ---- ----
This software contains some fonts from the Google Noto collection, licensed under the SIL Open Font License, available at LICENSE.OFL. They are
Copyright 2015 Google Inc.
Visit the Google Noto fonts collection at
https://www.google.com/get/noto/
---- ---- ---- ----
This software contains wine-mono, parts of which are included under a variety of licenses.
Parts of Mono (mono/) are variously licensed under the GPL, LGPL, and MIT X11 licenses. All parts are available as LGPL or MIT X11 except for the following:
* The ICSharpCode.SharpZipLib library is available as GPL with an exception (see mono/mcs/class/ICSharpCode.SharpZipLib/README).
* mcs/jay is BSD-licensed.
The Visual Basic class libraries (mono-basic/) are MIT X11. The compiler is LGPL v2.
FNA is a mix of MSPL and MIT. It has the following library dependencies:
* FAudio, MojoShader, Theorafile, SDL2, SDL_image_compact, and SDL2-CS are zlib-licensed. SDL2-CS is built into FNA.dll.
* FNA.NetStub is MSPL.
The winforms and wpf libraries are MIT.
wine-mono itself is included under the MIT license. wine-mono is
Copyright (c) 2012 Vincent Povirk for CodeWeavers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Visit wine-mono at
https://github.com/madewokherd/wine-mono
View wine-mono's complete license at
https://github.com/madewokherd/wine-mono/blob/master/COPYING
---- ---- ---- ----
This software contains wine-gecko, parts of which are included under a variety of licenses.
wine-gecko itself is included under the Mozilla Public License 2.0.
wine-gecko is available in Source Code form at
https://sourceforge.net/p/wine/wine-gecko
---- ---- ---- ----
This software contains orc. Orc is
Copyright 2002 - 2009 David A. Schleef <ds@schleef.org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
The source code implementing the Mersenne Twister algorithm is
subject to the following license:
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of its contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Visit orc at
https://gitlab.freedesktop.org/gstreamer/orc
---- ---- ---- ----
This software contains the following Rust libraries under the MIT license:
gstreamer-rs <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs>
gst-plugins-rs <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs>
array-init <https://github.com/Manishearth/array-init/>
Copyright (c) 2017-2020 The array-init developers
bitflags <https://github.com/bitflags/bitflags>
num-integer <https://github.com/rust-num/num-integer>
num-rational <https://github.com/rust-num/num-rational>
num-traits <https://github.com/rust-num/num-traits>
Copyright (c) 2014 The Rust Project Developers
cfg-if <https://github.com/alexcrichton/cfg-if>
proc-macro2 <https://github.com/dtolnay/proc-macro2>
toml <https://github.com/alexcrichton/toml-rs>
Copyright (c) 2014 Alex Crichton
crc32fast <https://github.com/srijs/rust-crc32fast>
Copyright (c) 2018 Sam Rijs, Alex Crichton and contributors
dav1d-rs <https://github.com/rust-av/dav1d-rs>
Copyright (c) 2018 Luca Barbato
futures-channel <https://github.com/rust-lang/futures-rs>
futures-core <https://github.com/rust-lang/futures-rs>
futures-executor <https://github.com/rust-lang/futures-rs>
futures-task <https://github.com/rust-lang/futures-rs>
futures-util <https://github.com/rust-lang/futures-rs>
Copyright (c) 2016 Alex Crichton
Copyright (c) 2017 The Tokio Authors
heck <https://github.com/withoutboats/heck>
unicode-segmentation <https://github.com/unicode-rs/unicode-segmentation>
unicode-xid <https://github.com/unicode-rs/unicode-xid>
Copyright (c) 2015 The Rust Project Developers
libc <https://github.com/rust-lang/libc>
Copyright (c) 2014-2020 The Rust Project Developers
muldiv <https://github.com/sdroege/rust-muldiv>
Copyright (c) 2017 Sebastian Dröge <sebastian@centricular.com>
murmur3 <https://github.com/stusmall/murmur3>
Copyright (c) 2016 Stu Small
pin-utils <https://github.com/rust-lang-nursery/pin-utils>
Copyright (c) 2018 The pin-utils authors
pretty-hex <https://github.com/wolandr/pretty-hex>
Copyright (c) 2018 Andrei Volnin
proc-macro-error <https://gitlab.com/CreepySkeleton/proc-macro-error>
proc-macro-error-attr <https://gitlab.com/CreepySkeleton/proc-macro-error>
Copyright (c) 2019-2020 CreepySkeleton
quote <https://github.com/dtolnay/quote>
Copyright (c) 2016 The Rust Project Developers
slab <https://github.com/tokio-rs/slab>
Copyright (c) 2019 Carl Lerche
smallvec <https://github.com/servo/rust-smallvec>
Copyright (c) 2018 The Servo Project Developers
anyhow <https://github.com/dtolnay/anyhow>
glib <https://github.com/gtk-rs/gtk-rs-core>
once_cell <https://github.com/matklad/once_cell>
paste <https://github.com/dtolnay/paste>
pin-project-lite <https://github.com/taiki-e/pin-project-lite>
proc-macro-crate <https://github.com/bkchr/proc-macro-crate>
serde <https://github.com/serde-rs/serde>
syn <https://github.com/dtolnay/syn>
thiserror <https://github.com/dtolnay/thiserror>
thiserror-impl <https://github.com/dtolnay/thiserror>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
https://github.com/doitsujin/dxvk/
---- ---- ---- ----
Parts of this software are based on the OpenVR SDK, which is
Copyright (c) 2015, Valve Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Visit OpenVR at
https://github.com/ValveSoftware/openvr
https://github.com/ValveSoftware/openvr/
---- ---- ---- ----
This software contains openal-soft licensed under the LGPL 2.
Visit openal-soft at
https://github.com/kcat/openal-soft/
---- ---- ---- ----
Parts of this software are based on the AMD AGS library, which is
Copyright (c) 2017 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
---- ---- ---- ----
This software contains the jxrlib library, which is
Copyright (c) Microsoft Corp. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
---- ---- ---- ----
This software contains the dav1d library, which is
Copyright © 2018-2019, VideoLAN and dav1d authors
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Distribution of dav1d is also covered by the Alliance for Open Media Patent License 1.0, available at PATENTS.AV1.

View File

@ -1,228 +0,0 @@
STEAMRT_VERSION = 0.20230905.59202
STEAMRT_URLBASE = registry.gitlab.steamos.cloud
PROTONSDK_URLBASE = $(STEAMRT_URLBASE)/proton/sniper/sdk
PROTONSDK_VERSION = $(STEAMRT_VERSION)-0-dev
# this is just for building toolchain, as we do static builds it should
# not have any impact on the end result, but changing it will invalidate
# docker caches, so we need something that don't change much
BASE_IMAGE = $(STEAMRT_URLBASE)/steamrt/sniper/sdk:0.20221017.1
BINUTILS_VERSION = 2.40
GCC_VERSION = 10.3.0
MINGW_VERSION = 9.0.0
RUST_VERSION = 1.68.0
NINJA_VERSION = 1.11.1
SOURCES_URLBASE = https://repo.steampowered.com/proton-sdk
BINUTILS_URLBASE = $(SOURCES_URLBASE)
GCC_URLBASE = $(SOURCES_URLBASE)
MINGW_URLBASE = $(SOURCES_URLBASE)
RUST_URLBASE = $(SOURCES_URLBASE)
NINJA_URLBASE = $(SOURCES_URLBASE)
BINUTILS_SOURCE = binutils-$(BINUTILS_VERSION).tar.xz
GCC_SOURCE = gcc-$(GCC_VERSION).tar.xz
MINGW_SOURCE = mingw-w64-v$(MINGW_VERSION).tar.bz2
RUST_SOURCE_x86_64 = rust-$(RUST_VERSION)-x86_64-unknown-linux-gnu.tar.gz
RUST_SOURCE_i686 = rust-$(RUST_VERSION)-i686-unknown-linux-gnu.tar.gz
NINJA_SOURCE = ninja-build_$(NINJA_VERSION).orig.tar.gz
BINUTILS_SHA256 = 0f8a4c272d7f17f369ded10a4aca28b8e304828e95526da482b0ccc4dfc9d8e1
GCC_SHA256 = 64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344
MINGW_SHA256 = 1929b94b402f5ff4d7d37a9fe88daa9cc55515a6134805c104d1794ae22a4181
RUST_SHA256_x86_64 = 7be1acdac656d0b0b7e909e5c0d4ddf61c755c203ec26ebafbd306322335b361
RUST_SHA256_i686 = dc931adeb2943dcadfbd29546481f0296fcb97a511421053ecae6586a85869b1
NINJA_SHA256 = 31747ae633213f1eda3842686f83c2aa1412e0f5691d1c14dbbcc67fe7400cea
DOCKER = docker
%.Dockerfile: %.Dockerfile.in Makefile
sed -re 's!@PROTONSDK_URLBASE@!$(PROTONSDK_URLBASE)!g' \
-re 's!@BASE_IMAGE@!$(BASE_IMAGE)!g' \
-re 's!@BINUTILS_VERSION@!$(BINUTILS_VERSION)!g' \
-re 's!@BINUTILS_URLBASE@!$(BINUTILS_URLBASE)!g' \
-re 's!@BINUTILS_SOURCE@!$(BINUTILS_SOURCE)!g' \
-re 's!@BINUTILS_SHA256@!$(BINUTILS_SHA256)!g' \
-re 's!@GCC_VERSION@!$(GCC_VERSION)!g' \
-re 's!@GCC_URLBASE@!$(GCC_URLBASE)!g' \
-re 's!@GCC_SOURCE@!$(GCC_SOURCE)!g' \
-re 's!@GCC_SHA256@!$(GCC_SHA256)!g' \
-re 's!@MINGW_VERSION@!$(MINGW_VERSION)!g' \
-re 's!@MINGW_URLBASE@!$(MINGW_URLBASE)!g' \
-re 's!@MINGW_SOURCE@!$(MINGW_SOURCE)!g' \
-re 's!@MINGW_SHA256@!$(MINGW_SHA256)!g' \
-re 's!@RUST_VERSION@!$(RUST_VERSION)!g' \
-re 's!@RUST_URLBASE@!$(RUST_URLBASE)!g' \
-re 's!@RUST_SOURCE_x86_64@!$(RUST_SOURCE_x86_64)!g' \
-re 's!@RUST_SOURCE_i686@!$(RUST_SOURCE_i686)!g' \
-re 's!@RUST_SHA256_x86_64@!$(RUST_SHA256_x86_64)!g' \
-re 's!@RUST_SHA256_i686@!$(RUST_SHA256_i686)!g' \
-re 's!@NINJA_VERSION@!$(NINJA_VERSION)!g' \
-re 's!@NINJA_URLBASE@!$(NINJA_URLBASE)!g' \
-re 's!@NINJA_SOURCE@!$(NINJA_SOURCE)!g' \
-re 's!@NINJA_SHA256@!$(NINJA_SHA256)!g' \
-re 's!@J@!$(shell nproc)!g' \
$< >$@
%-i686.Dockerfile.in: %.Dockerfile.in
sed -re 's!@ARCH@!i686!g' \
-re 's!@ARCH_FLAGS@!$(ARCH_FLAGS)!g' \
$< >$@
%-x86_64.Dockerfile.in: %.Dockerfile.in
sed -re 's!@ARCH@!x86_64!g' \
-re 's!@ARCH_FLAGS@!$(ARCH_FLAGS)!g' \
$< >$@
%-linux-gnu.Dockerfile.in: %.Dockerfile.in
sed -re 's!@TARGET@!linux-gnu!g' \
-re 's!@ARCH_FLAGS@!$(ARCH_FLAGS)!g' \
-re 's!@TARGET_FLAGS@!$(TARGET_FLAGS)!g' \
$< >$@
%-w64-mingw32.Dockerfile.in: %.Dockerfile.in
sed -re 's!@TARGET@!w64-mingw32!g' \
-re 's!@ARCH_FLAGS@!$(ARCH_FLAGS)!g' \
-re 's!@TARGET_FLAGS@!$(TARGET_FLAGS)!g' \
$< >$@
define create-build-base-rules
.PHONY: build-base-$(1)
all build-base: build-base-$(1)
build-base-$(1): build-base-$(1).Dockerfile
$(DOCKER) build -f $$< \
--cache-from=$(PROTONSDK_URLBASE)/build-base-$(1) \
-t $(PROTONSDK_URLBASE)/build-base-$(1):latest \
context
pull::
-$(DOCKER) pull $(PROTONSDK_URLBASE)/build-base-$(1):latest
push::
$(DOCKER) push $(PROTONSDK_URLBASE)/build-base-$(1):latest
endef
$(eval $(call create-build-base-rules,i686))
$(eval $(call create-build-base-rules,x86_64))
define create-binutils-rules
.PHONY: binutils-$(1)-$(2)
all binutils: binutils-$(1)-$(2)
binutils-$(1)-$(2): binutils-$(1)-$(2).Dockerfile | build-base
$(DOCKER) build -f $$< \
--cache-from=$(PROTONSDK_URLBASE)/binutils-$(1)-$(2) \
-t $(PROTONSDK_URLBASE)/binutils-$(1)-$(2):$(BINUTILS_VERSION) \
-t $(PROTONSDK_URLBASE)/binutils-$(1)-$(2):latest \
context
pull::
-$(DOCKER) pull $(PROTONSDK_URLBASE)/binutils-$(1)-$(2):$(BINUTILS_VERSION)
push::
$(DOCKER) push $(PROTONSDK_URLBASE)/binutils-$(1)-$(2):$(BINUTILS_VERSION)
$(DOCKER) push $(PROTONSDK_URLBASE)/binutils-$(1)-$(2):latest
endef
$(eval $(call create-binutils-rules,i686,w64-mingw32))
$(eval $(call create-binutils-rules,i686,linux-gnu))
$(eval $(call create-binutils-rules,x86_64,w64-mingw32))
$(eval $(call create-binutils-rules,x86_64,linux-gnu))
MINGW_ARCH_FLAGS_crt-x86_64 = --disable-lib32 CFLAGS="-mcmodel=small"
MINGW_ARCH_FLAGS_crt-i686 = --disable-lib64
MINGW_ARCH_FLAGS_pthread-x86_64 = CFLAGS="-mcmodel=small"
MINGW_ARCH_FLAGS_pthread-i686 =
define create-mingw-rules
.PHONY: mingw-$(2)-$(1)
all mingw: mingw-$(2)-$(1)
mingw-$(2)-$(1): ARCH_FLAGS = $(MINGW_ARCH_FLAGS_$(2)-$(1))
mingw-$(2)-$(1): mingw-$(2)-$(1).Dockerfile | binutils
$(DOCKER) build -f $$< \
--cache-from=$(PROTONSDK_URLBASE)/mingw-$(2)-$(1) \
-t $(PROTONSDK_URLBASE)/mingw-$(2)-$(1):$(MINGW_VERSION) \
-t $(PROTONSDK_URLBASE)/mingw-$(2)-$(1):latest \
context
pull::
-$(DOCKER) pull $(PROTONSDK_URLBASE)/mingw-$(2)-$(1):$(MINGW_VERSION)
push::
$(DOCKER) push $(PROTONSDK_URLBASE)/mingw-$(2)-$(1):$(MINGW_VERSION)
$(DOCKER) push $(PROTONSDK_URLBASE)/mingw-$(2)-$(1):latest
endef
$(eval $(call create-mingw-rules,i686,headers))
$(eval $(call create-mingw-rules,i686,gcc))
$(eval $(call create-mingw-rules,i686,crt))
$(eval $(call create-mingw-rules,i686,pthreads))
$(eval $(call create-mingw-rules,i686,widl))
$(eval $(call create-mingw-rules,x86_64,headers))
$(eval $(call create-mingw-rules,x86_64,gcc))
$(eval $(call create-mingw-rules,x86_64,crt))
$(eval $(call create-mingw-rules,x86_64,pthreads))
$(eval $(call create-mingw-rules,x86_64,widl))
GCC_ARCH_FLAGS_x86_64 = CFLAGS_FOR_TARGET="-mcmodel=small" CXXFLAGS_FOR_TARGET="-mcmodel=small"
GCC_ARCH_FLAGS_i686 =
GCC_TARGET_FLAGS_w64-mingw32 = --disable-shared
GCC_TARGET_FLAGS_linux-gnu =
define create-gcc-rules
.PHONY: gcc-$(1)-$(2)
all gcc: gcc-$(1)-$(2)
gcc-$(1)-$(2): ARCH_FLAGS = $(GCC_ARCH_FLAGS_$(1))
gcc-$(1)-$(2): TARGET_FLAGS = $(GCC_TARGET_FLAGS_$(2))
gcc-$(1)-$(2): gcc-$(1)-$(2).Dockerfile | mingw
$(DOCKER) build -f $$< \
--cache-from=$(PROTONSDK_URLBASE)/gcc-$(1)-$(2) \
-t $(PROTONSDK_URLBASE)/gcc-$(1)-$(2):$(GCC_VERSION) \
-t $(PROTONSDK_URLBASE)/gcc-$(1)-$(2):latest \
context
pull::
-$(DOCKER) pull $(PROTONSDK_URLBASE)/gcc-$(1)-$(2):$(GCC_VERSION)
push::
$(DOCKER) push $(PROTONSDK_URLBASE)/gcc-$(1)-$(2):$(GCC_VERSION)
$(DOCKER) push $(PROTONSDK_URLBASE)/gcc-$(1)-$(2):latest
endef
$(eval $(call create-gcc-rules,i686,linux-gnu))
$(eval $(call create-gcc-rules,x86_64,linux-gnu))
$(eval $(call create-gcc-rules,i686,w64-mingw32))
$(eval $(call create-gcc-rules,x86_64,w64-mingw32))
define create-proton-rules
.PHONY: proton
all: proton
proton: BASE_IMAGE = $(STEAMRT_URLBASE)/steamrt/sniper/sdk:$(STEAMRT_VERSION)
proton: proton.Dockerfile | gcc
$(DOCKER) build -f $$< \
--cache-from=$(PROTONSDK_URLBASE) \
-t $(PROTONSDK_URLBASE):$(PROTONSDK_VERSION) \
-t $(PROTONSDK_URLBASE):latest \
context
pull::
-$(DOCKER) pull $(PROTONSDK_URLBASE):$(PROTONSDK_VERSION)
push::
$(DOCKER) push $(PROTONSDK_URLBASE):$(PROTONSDK_VERSION)
$(DOCKER) push $(PROTONSDK_URLBASE):latest
endef
$(eval $(call create-proton-rules))
sources::
rm -f $(BINUTILS_SOURCE)
rm -f $(MINGW_SOURCE)
rm -f $(GCC_SOURCE)
rm -f $(RUST_SOURCE_x86_64)
rm -f $(RUST_SOURCE_i686)
rm -f $(NINJA_SOURCE)
wget $(BINUTILS_URLBASE)/$(BINUTILS_SOURCE)
wget $(MINGW_URLBASE)/$(MINGW_SOURCE)
wget $(GCC_URLBASE)/$(GCC_SOURCE)
wget $(RUST_URLBASE)/$(RUST_SOURCE_x86_64)
wget $(RUST_URLBASE)/$(RUST_SOURCE_i686)
wget $(NINJA_URLBASE)/$(NINJA_SOURCE)
echo $(BINUTILS_SHA256) $(BINUTILS_SOURCE) | sha256sum -c -
echo $(MINGW_SHA256) $(MINGW_SOURCE) | sha256sum -c -
echo $(GCC_SHA256) $(GCC_SOURCE) | sha256sum -c -
echo $(RUST_SHA256_x86_64) $(RUST_SOURCE_x86_64) | sha256sum -c -
echo $(RUST_SHA256_i686) $(RUST_SOURCE_i686) | sha256sum -c -
echo $(NINJA_SHA256) $(NINJA_SOURCE) | sha256sum -c -

View File

@ -1,81 +0,0 @@
Proton (sniper) SDK
====================
These are the build rules that are used to create docker images to build
Proton. The automated creation of the official images lives in
<https://gitlab.steamos.cloud/proton/sniper/sdk>, but this can be
used to create local images too.
Local usage
-----------
The `protonsdk_version` make variable will override which image is used
to build Proton, but may not trigger a full rebuild, so building from
scratch may be necessary.
Building Proton with a locally build docker image, instead of using the
official images, can be done by using `protonsdk_version=local`. This
may be used for instance to test changes to the docker image recipes.
Or, it is also possible to build the docker images first by invoking
`make protonsdk` and it will tag the images with the `protonsdk_version`
variable value.
Official images
---------------
To update the official Proton SDK images:
1) Update the image build rules, `STEAMRT_VERSION` and
`PROTONSDK_VERSION` version numbers in this folder, test locally,
commit and push the changes.
2) Update `.gitlab-ci.yml` in the
[Proton SDK](https://gitlab.steamos.cloud/proton/sniper/sdk)
repository to point to the new commit, commit and push to trigger a
new build of "-dev" images.
3) Once the images are satisfying, tag the version in Proton SDK
repository and push the tag, this will trigger a new build of the
images and version them with the same tag as the Git tag.
4) Once the images have been published, update the default
`arg_protonsdk_image` version number in `configure.sh` to use the
newly built images by default.
Any change or addition to GPL-ed source first requires to update or add
the corresponding source to <https://repo.steampowered.com/proton-sdk>.
The `SOURCES_URLBASE` variable must be used to download the sources
from there, and its sha256 must be added to validate the sources in the
same way the existing code does.
Technical details
-----------------
The images are built incrementally, with intermediate images created
for each component of the toolchain, then assembled together in a single
`proton` image.
The reason behind this is to optimize the use of docker cache, so that
components that didn't change do not require to be rebuilt every time,
saving a lot of time in the build process, when only small additions are
made.
It also lets us build several components of the toolchain separately,
in parallel. This is especially the case when building the images on
the <https://gitlab.steamos.cloud> CI.
Because the `ARG` parameter in Dockerfile doesn't behave nicely with
docker caches it is avoided, and `Dockerfile.in` are used with variable
replacements done using `sed`.
The <https://gitlab.steamos.cloud> CI uses Kaniko instead of Docker,
with a bit of script conversion to generate commands usable there. More
details are available in
[Proton SDK](https://gitlab.steamos.cloud/proton/sniper/sdk).
The `build-base` images are there to create a common ground to build the
other elements of the toolchain. They are based on fairly recent (more
than what `steamrt` provides), but they are only used temporarily to
build a static version of the Binutils, MinGW and GCC binaries, which
are then copied over the `steamrt` base image.

View File

@ -1,32 +0,0 @@
FROM @PROTONSDK_URLBASE@/build-base-@ARCH@:latest AS build
RUN wget -q @BINUTILS_URLBASE@/@BINUTILS_SOURCE@ \
&& echo '@BINUTILS_SHA256@ @BINUTILS_SOURCE@' | sha256sum -c - \
&& tar xf @BINUTILS_SOURCE@ -C /tmp && rm @BINUTILS_SOURCE@ \
&& cd /tmp/binutils-@BINUTILS_VERSION@ \
&& ./configure --quiet \
--prefix=/usr \
--libdir=/usr/lib \
--host=@ARCH@-linux-gnu \
--build=@ARCH@-linux-gnu \
--target=@ARCH@-@TARGET@ \
--program-prefix=@ARCH@-@TARGET@- \
--enable-gold \
--enable-ld=default \
--enable-lto \
--enable-static \
--disable-multilib \
--disable-nls \
--disable-plugins \
--disable-shared \
--disable-werror \
--with-gmp \
--with-isl \
--with-mpc \
--with-mpfr \
--with-system-zlib \
MAKEINFO=true \
&& make --quiet -j@J@ MAKEINFO=true configure-host \
&& make --quiet -j@J@ MAKEINFO=true LDFLAGS="-static" \
&& make --quiet -j@J@ MAKEINFO=true install-strip DESTDIR=/opt \
&& rm -rf /opt/usr/share/doc /opt/usr/share/info /opt/usr/share/man \
&& rm -rf /tmp/binutils-@BINUTILS_VERSION@

View File

@ -1,17 +0,0 @@
FROM @BASE_IMAGE@ AS base
RUN apt-get update && apt-get install -y \
autoconf \
bzip2 \
g++ \
gcc \
libgmp-dev \
libisl-dev \
libmpc-dev \
libmpfr-dev \
libtool \
libz-dev \
make \
wget \
xz-utils \
&& rm -rf /opt/usr/share/doc /opt/usr/share/info /opt/usr/share/man \
&& rm -rf /var/lib/apt/lists/*

File diff suppressed because it is too large Load Diff

View File

@ -1,48 +0,0 @@
FROM @PROTONSDK_URLBASE@/binutils-@ARCH@-@TARGET@:@BINUTILS_VERSION@ AS binutils
FROM @PROTONSDK_URLBASE@/mingw-headers-@ARCH@:@MINGW_VERSION@ AS mingw-headers
FROM @PROTONSDK_URLBASE@/mingw-crt-@ARCH@:@MINGW_VERSION@ AS mingw-crt
FROM @PROTONSDK_URLBASE@/mingw-pthreads-@ARCH@:@MINGW_VERSION@ AS mingw-pthreads
FROM @PROTONSDK_URLBASE@/build-base-@ARCH@:latest AS build
COPY --from=binutils /opt/usr /usr
COPY --from=mingw-headers /opt/usr /usr
COPY --from=mingw-crt /opt/usr /usr
COPY --from=mingw-pthreads /opt/usr /usr
RUN wget -q @GCC_URLBASE@/@GCC_SOURCE@ \
&& echo '@GCC_SHA256@ @GCC_SOURCE@' | sha256sum -c - \
&& tar xf @GCC_SOURCE@ -C /tmp && rm @GCC_SOURCE@ \
&& mkdir /tmp/gcc-@GCC_VERSION@/build && cd /tmp/gcc-@GCC_VERSION@/build \
&& ../configure --quiet \
--prefix=/usr \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
--host=@ARCH@-linux-gnu \
--build=@ARCH@-linux-gnu \
--target=@ARCH@-@TARGET@ \
--program-prefix=@ARCH@-@TARGET@- \
--enable-languages=c,c++,lto \
--enable-libstdcxx-time=yes \
--enable-lto \
--enable-threads=posix \
--disable-bootstrap \
--disable-checking \
--disable-multilib \
--disable-nls \
--disable-plugin \
@TARGET_FLAGS@ \
--disable-sjlj-exceptions \
--disable-werror \
--with-arch=nocona \
--with-default-libstdcxx-abi=new \
--with-dwarf2 \
--with-system-gmp \
--with-system-isl \
--with-system-mpc \
--with-system-mpfr \
--with-system-zlib \
--with-tune=core-avx2 \
@ARCH_FLAGS@ \
MAKEINFO=true \
&& make --quiet -j@J@ MAKEINFO=true CFLAGS="-static --static" LDFLAGS="-s -static --static" \
&& make --quiet -j@J@ MAKEINFO=true CFLAGS="-static --static" LDFLAGS="-s -static --static" install-strip DESTDIR=/opt \
&& rm -rf /opt/usr/share/doc /opt/usr/share/info /opt/usr/share/man \
&& rm -rf /tmp/gcc-@GCC_VERSION@

View File

@ -1,21 +0,0 @@
FROM @PROTONSDK_URLBASE@/binutils-@ARCH@-w64-mingw32:@BINUTILS_VERSION@ AS binutils
FROM @PROTONSDK_URLBASE@/mingw-headers-@ARCH@:@MINGW_VERSION@ AS mingw-headers
FROM @PROTONSDK_URLBASE@/mingw-gcc-@ARCH@:@MINGW_VERSION@ AS mingw-gcc
FROM @PROTONSDK_URLBASE@/build-base-@ARCH@:latest AS build
COPY --from=binutils /opt/usr /usr
COPY --from=mingw-headers /opt/usr /usr
COPY --from=mingw-gcc /opt/usr /usr
RUN wget -q @MINGW_URLBASE@/@MINGW_SOURCE@ \
&& echo '@MINGW_SHA256@ @MINGW_SOURCE@' | sha256sum -c - \
&& tar xf @MINGW_SOURCE@ -C /tmp && rm @MINGW_SOURCE@ \
&& cd /tmp/mingw-w64-v@MINGW_VERSION@/mingw-w64-crt \
&& ./configure --quiet \
--prefix=/usr/@ARCH@-w64-mingw32/ \
--host=@ARCH@-w64-mingw32 \
--enable-wildcard \
@ARCH_FLAGS@ \
MAKEINFO=true \
&& make --quiet -j@J@ MAKEINFO=true \
&& make --quiet -j@J@ MAKEINFO=true install-strip DESTDIR=/opt \
&& rm -rf /opt/usr/share/doc /opt/usr/share/info /opt/usr/share/man \
&& rm -rf /tmp/mingw-w64-v@MINGW_VERSION@

View File

@ -1,35 +0,0 @@
FROM @PROTONSDK_URLBASE@/binutils-@ARCH@-w64-mingw32:@BINUTILS_VERSION@ AS binutils
FROM @PROTONSDK_URLBASE@/mingw-headers-@ARCH@:@MINGW_VERSION@ AS mingw-headers
FROM @PROTONSDK_URLBASE@/build-base-@ARCH@:latest AS build
COPY --from=binutils /opt/usr /usr
COPY --from=mingw-headers /opt/usr /usr
RUN wget -q @GCC_URLBASE@/@GCC_SOURCE@ \
&& echo '@GCC_SHA256@ @GCC_SOURCE@' | sha256sum -c - \
&& tar xf @GCC_SOURCE@ -C /tmp && rm @GCC_SOURCE@ \
&& mkdir /tmp/gcc-@GCC_VERSION@/build && cd /tmp/gcc-@GCC_VERSION@/build \
&& ../configure --quiet \
--prefix=/usr \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
--host=@ARCH@-linux-gnu \
--build=@ARCH@-linux-gnu \
--target=@ARCH@-w64-mingw32 \
--program-prefix=@ARCH@-w64-mingw32- \
--enable-languages=c \
--disable-bootstrap \
--disable-checking \
--disable-multilib \
--disable-nls \
--disable-shared \
--disable-threads \
--disable-werror \
--with-system-gmp \
--with-system-isl \
--with-system-mpc \
--with-system-mpfr \
--with-system-zlib \
MAKEINFO=true \
&& make --quiet -j@J@ MAKEINFO=true CFLAGS="-static --static" LDFLAGS="-s -static --static" all-gcc \
&& make --quiet -j@J@ MAKEINFO=true CFLAGS="-static --static" LDFLAGS="-s -static --static" install-strip-gcc DESTDIR=/opt \
&& rm -rf /opt/usr/share/doc /opt/usr/share/info /opt/usr/share/man \
&& rm -rf /tmp/gcc-@GCC_VERSION@

View File

@ -1,16 +0,0 @@
FROM @PROTONSDK_URLBASE@/build-base-@ARCH@:latest AS build
RUN wget -q @MINGW_URLBASE@/@MINGW_SOURCE@ \
&& echo '@MINGW_SHA256@ @MINGW_SOURCE@' | sha256sum -c - \
&& tar xf @MINGW_SOURCE@ -C /tmp && rm @MINGW_SOURCE@ \
&& cd /tmp/mingw-w64-v@MINGW_VERSION@/mingw-w64-headers \
&& ./configure --quiet \
--prefix=/usr/@ARCH@-w64-mingw32/ \
--host=@ARCH@-w64-mingw32 \
--enable-sdk=all \
--enable-secure-api \
--enable-idl \
MAKEINFO=true \
&& make --quiet -j@J@ MAKEINFO=true \
&& make --quiet -j@J@ MAKEINFO=true install-strip DESTDIR=/opt \
&& rm -rf /opt/usr/share/doc /opt/usr/share/info /opt/usr/share/man \
&& rm -rf /tmp/mingw-w64-v@MINGW_VERSION@

View File

@ -1,23 +0,0 @@
FROM @PROTONSDK_URLBASE@/binutils-@ARCH@-w64-mingw32:@BINUTILS_VERSION@ AS binutils
FROM @PROTONSDK_URLBASE@/mingw-headers-@ARCH@:@MINGW_VERSION@ AS mingw-headers
FROM @PROTONSDK_URLBASE@/mingw-gcc-@ARCH@:@MINGW_VERSION@ AS mingw-gcc
FROM @PROTONSDK_URLBASE@/mingw-crt-@ARCH@:@MINGW_VERSION@ AS mingw-crt
FROM @PROTONSDK_URLBASE@/build-base-@ARCH@:latest AS build
COPY --from=binutils /opt/usr /usr
COPY --from=mingw-headers /opt/usr /usr
COPY --from=mingw-gcc /opt/usr /usr
COPY --from=mingw-crt /opt/usr /usr
RUN wget -q @MINGW_URLBASE@/@MINGW_SOURCE@ \
&& echo '@MINGW_SHA256@ @MINGW_SOURCE@' | sha256sum -c - \
&& tar xf @MINGW_SOURCE@ -C /tmp && rm @MINGW_SOURCE@ \
&& cd /tmp/mingw-w64-v@MINGW_VERSION@/mingw-w64-libraries/winpthreads \
&& ./configure --quiet \
--prefix=/usr/@ARCH@-w64-mingw32/ \
--host=@ARCH@-w64-mingw32 \
--disable-shared \
@ARCH_FLAGS@ \
MAKEINFO=true \
&& make --quiet -j@J@ MAKEINFO=true \
&& make --quiet -j@J@ MAKEINFO=true install-strip DESTDIR=/opt \
&& rm -rf /opt/usr/share/doc /opt/usr/share/info /opt/usr/share/man \
&& rm -rf /tmp/mingw-w64-v@MINGW_VERSION@

View File

@ -1,16 +0,0 @@
FROM @PROTONSDK_URLBASE@/build-base-@ARCH@:latest AS build
RUN wget -q @MINGW_URLBASE@/@MINGW_SOURCE@ \
&& echo '@MINGW_SHA256@ @MINGW_SOURCE@' | sha256sum -c - \
&& tar xf @MINGW_SOURCE@ -C /tmp && rm @MINGW_SOURCE@ \
&& cd /tmp/mingw-w64-v@MINGW_VERSION@/mingw-w64-tools/widl \
&& ./configure --quiet \
--prefix=/usr \
--host=@ARCH@-linux-gnu \
--build=@ARCH@-linux-gnu \
--target=@ARCH@-w64-mingw32 \
--program-prefix=@ARCH@-w64-mingw32- \
MAKEINFO=true \
&& make --quiet -j@J@ MAKEINFO=true LDFLAGS="-static" \
&& make --quiet -j@J@ MAKEINFO=true install-strip DESTDIR=/opt \
&& rm -rf /opt/usr/share/doc /opt/usr/share/info /opt/usr/share/man \
&& rm -rf /tmp/mingw-w64-v@MINGW_VERSION@

View File

@ -1,91 +0,0 @@
FROM @PROTONSDK_URLBASE@/binutils-i686-linux-gnu:@BINUTILS_VERSION@ AS binutils-linux-i686
FROM @PROTONSDK_URLBASE@/binutils-x86_64-linux-gnu:@BINUTILS_VERSION@ AS binutils-linux-x86_64
FROM @PROTONSDK_URLBASE@/binutils-i686-w64-mingw32:@BINUTILS_VERSION@ AS binutils-mingw-i686
FROM @PROTONSDK_URLBASE@/binutils-x86_64-w64-mingw32:@BINUTILS_VERSION@ AS binutils-mingw-x86_64
FROM @PROTONSDK_URLBASE@/mingw-headers-i686:@MINGW_VERSION@ AS mingw-headers-i686
FROM @PROTONSDK_URLBASE@/mingw-headers-x86_64:@MINGW_VERSION@ AS mingw-headers-x86_64
FROM @PROTONSDK_URLBASE@/mingw-crt-i686:@MINGW_VERSION@ AS mingw-crt-i686
FROM @PROTONSDK_URLBASE@/mingw-crt-x86_64:@MINGW_VERSION@ AS mingw-crt-x86_64
FROM @PROTONSDK_URLBASE@/mingw-pthreads-i686:@MINGW_VERSION@ AS mingw-pthreads-i686
FROM @PROTONSDK_URLBASE@/mingw-pthreads-x86_64:@MINGW_VERSION@ AS mingw-pthreads-x86_64
FROM @PROTONSDK_URLBASE@/mingw-widl-i686:@MINGW_VERSION@ AS mingw-widl-i686
FROM @PROTONSDK_URLBASE@/mingw-widl-x86_64:@MINGW_VERSION@ AS mingw-widl-x86_64
FROM @PROTONSDK_URLBASE@/gcc-i686-linux-gnu:@GCC_VERSION@ AS gcc-linux-i686
FROM @PROTONSDK_URLBASE@/gcc-x86_64-linux-gnu:@GCC_VERSION@ AS gcc-linux-x86_64
FROM @PROTONSDK_URLBASE@/gcc-i686-w64-mingw32:@GCC_VERSION@ AS gcc-mingw-i686
FROM @PROTONSDK_URLBASE@/gcc-x86_64-w64-mingw32:@GCC_VERSION@ AS gcc-mingw-x86_64
FROM @BASE_IMAGE@ AS base
COPY --from=binutils-linux-i686 /opt/usr /usr
COPY --from=binutils-linux-x86_64 /opt/usr /usr
COPY --from=binutils-mingw-i686 /opt/usr /usr
COPY --from=binutils-mingw-x86_64 /opt/usr /usr
COPY --from=mingw-headers-i686 /opt/usr /usr
COPY --from=mingw-headers-x86_64 /opt/usr /usr
COPY --from=mingw-crt-i686 /opt/usr /usr
COPY --from=mingw-crt-x86_64 /opt/usr /usr
COPY --from=mingw-pthreads-i686 /opt/usr /usr
COPY --from=mingw-pthreads-x86_64 /opt/usr /usr
COPY --from=mingw-widl-i686 /opt/usr /usr
COPY --from=mingw-widl-x86_64 /opt/usr /usr
COPY --from=gcc-linux-i686 /opt/usr /usr
COPY --from=gcc-linux-x86_64 /opt/usr /usr
COPY --from=gcc-mingw-i686 /opt/usr /usr
COPY --from=gcc-mingw-x86_64 /opt/usr /usr
RUN wget -q @RUST_URLBASE@/@RUST_SOURCE_x86_64@ \
&& echo '@RUST_SHA256_x86_64@ @RUST_SOURCE_x86_64@' | sha256sum -c - \
&& tar xf @RUST_SOURCE_x86_64@ -C /tmp && rm @RUST_SOURCE_x86_64@ \
&& /tmp/rust-@RUST_VERSION@-x86_64-unknown-linux-gnu/install.sh --prefix=/opt/rust \
&& rm -rf /tmp/rust-@RUST_VERSION@-x86_64-unknown-linux-gnu
RUN wget -q @RUST_URLBASE@/@RUST_SOURCE_i686@ \
&& echo '@RUST_SHA256_i686@ @RUST_SOURCE_i686@' | sha256sum -c - \
&& tar xf @RUST_SOURCE_i686@ -C /tmp && rm @RUST_SOURCE_i686@ \
&& /tmp/rust-@RUST_VERSION@-i686-unknown-linux-gnu/install.sh --prefix=/opt/rust \
--components=rust-std-i686-unknown-linux-gnu \
&& rm -rf /tmp/rust-@RUST_VERSION@-i686-unknown-linux-gnu
RUN bash -c 'ls /opt/rust/bin/* | xargs -n1 -I{} ln -sf {} /usr/bin/'
RUN bash -c 'mkdir -p /usr/lib/ccache && ls /usr/bin/{,*-}{cc,c++,gcc,g++}{,-[0-9]*} | sed -re s:/bin:/lib/ccache: | xargs -n1 ln -sf ../../bin/ccache'
ENV PATH=/usr/lib/ccache:$PATH
RUN apt-get install -y \
autoconf-archive \
fontforge \
fonttools \
libxpresent-dev \
libxpresent-dev:i386 \
libopenblas-dev \
libopenblas-dev:i386 \
python3-mako \
python3-pefile \
libcapstone-dev \
libcapstone-dev:i386 \
libutfcpp-dev \
yasm \
nasm \
&& rm -rf /opt/usr/share/doc /opt/usr/share/info /opt/usr/share/man \
&& rm -rf /var/lib/apt/lists/*
COPY ninja-jobserver-client.patch /tmp
RUN wget -q @NINJA_URLBASE@/@NINJA_SOURCE@ \
&& echo '@NINJA_SHA256@ @NINJA_SOURCE@' \
&& echo '@NINJA_SHA256@ @NINJA_SOURCE@' | sha256sum -c - \
&& tar xf @NINJA_SOURCE@ -C /tmp && rm @NINJA_SOURCE@ \
&& cd /tmp/ninja-@NINJA_VERSION@ \
&& patch -p1 < /tmp/ninja-jobserver-client.patch \
&& mkdir build \
&& cd build \
&& cmake .. \
&& make \
&& cp ninja $(which ninja) \
&& cd / \
&& rm -rf /tmp/ninja-@NINJA_VERSION@ \
&& rm -rf /tmp/ninja-jobserver-client.patch
ENTRYPOINT ["/usr/bin/tini-static", "-s", "-g", "--"]
CMD ["/bin/bash"]

View File

@ -1,115 +0,0 @@
---
How controllers work in Proton
---
There are five methods that Windows games can use to access controllers:
dinput, xinput, winmm, hid, and rawinput. Games can use any combination of all
of these APIs.
rawinput allows direct access to the gamepad hardware. The application must
know the HID protocol, and/or know the device-specific protocol for
non-standard devices like Xbox controllers.
hid is a layer above rawinput, where Windows will talk HID to the controller on
the game's behalf. This turns the raw HID protocol data into usable things like
buttons and joysticks.
dinput is a "legacy" API that allows applications to talk to any type of
joystick. On Windows, it is implemented on top of HID. Notably, dinput allows
easy access to controllers that no other API does, so it is still used by
modern games despite being "legacy."
xinput is the new API that supports only Xbox controllers. On Windows, it is
likely implemented on top of rawinput, as Xbox controllers do not behave like
standard HID devices.
winmm is the very legacy API, for when joysticks were hooked up through the
soundcard. On modern Windows, it is implemented on top of dinput.
Here is a diagram for how these APIs are mapped down to the system by Proton:
----------
| game.exe |
----------
/ | | | \
/ | | | \ application
*********/****|*|**|****\******************
| | | \ \ wine
| | | | \
------ | | ----- \
|xinput| | | |winmm| |
------ | | ----- |
| | \ | |
| | | | |
\ | ------ |
\ | |dinput| |
\ | ------ /
| | / /
| | | /
--- /
|hid| /
--- /
| /
| |
--------
|rawinput|
--------
|
-----------
|winebus.sys|
-----------
| | wine
************|******|***********************
| | linux
| ----
| |SDL2|
| ----
| | \
| | \
| | |
------ -----------
|hidraw| |input event|
------ -----------
| |
\ /
========
|hardware|
========
Some things to note:
SDL2 provides the controller mapping feature of the Steam client. If you don't
go through SDL2, then you don't get that mapping feature. Also notice that
winebus.sys must turn SDL2 events into usable winebus data (HID protocol). We
also allow direct access to hidraw devices so games which can speak HID (or
other) protocol can talk directly to those devices.
Xbox controllers do not speak real HID. Instead Windows provides a HID
compatibility layer so dinput, which is implemented on top of HID, will present
the Xbox controller to legacy games. Of course some games (Unity) have noticed
that, and talk directly to this internal HID interface, so we need to duplicate
it bit-for-bit in winebus.sys.
Some games support talking directly to certain controller types. For example,
many modern games support PlayStation 4 controllers directly and will provide
layouts and button images in-game specific to DualShock 4 controllers. For this
reason, we don't want to present every controller through xinput, which should
only present Xbox controllers.
However, we also want users to be able to use any controller, even if the game
only supports xinput. Steam provides a controller mapping feature, which is
presented as a virtual Steam Controller. We turn this virtual Steam Controller
into an xinput device. This means any controller which is mapped will appear to
the game as an xinput device, in addition to the other APIs. Controllers which
are not mapped will appear as the real controller, which the game may or may
not support.
One final snag is that many distros do not allow user access to hidraw devices.
Steam ships some udev rules to allow this for certain common controller types,
but not most. In other words, your user may not have access to the hidraw
device for your controller, especially if it is a less well-known controller.
In those cases, we access it through SDL2 via its linux js backend and try to
treat it as an Xbox controller, even if it is not mapped with the Steam client
mapping feature.

View File

@ -1,26 +0,0 @@
# ICMP ECHO requests (ping)
Some games rely on ICMP ECHO requests to detect network connectivity,
or to measure connection ping.
Proton supports sending ICMP ECHO requests using RAW sockets or DGRAM
ICMP sockets, but the former requires elevated privileges, and the
latter may also be disabled by default.
DGRAM ICMP sockets can be enabled for a given set of user groups by
running the following command, and will stay enabled until next reboot:
```
sudo sysctl -w net.ipv4.ping_group_range="<low> <high>"
```
Where <low> (resp <high>) is lower bound (resp higher) of the user
groups which will be allowed to create such sockets. It is possible to
enable them for any group by using "0 4294967295".
In order for the configuration to be persistent, it is possible to add
the following line to `/etc/sysctl.conf` (or a file in `/etc/sysctl.d`):
```
net.ipv4.ping_group_range="<low> <high>"
```

View File

@ -1,146 +0,0 @@
---
How to make Proton work with PRIME
---
# Setup
## Context
PRIME is a technology that allows one GPU to perform graphics rendering and
another GPU to display the result on the screen.
This document assumes that PRIME / GPU offloading is configured and working
for native software and will touch only on things specific to Proton.
If you need help with configuring PRIME in the first place you may find the
following resources useful:
* https://wiki.archlinux.org/index.php/PRIME
* https://wiki.debian.org/NVIDIA%20Optimus
## DirectX 9, 10, 11 and 12 (DXVK and VKD3D-Proton)
The implementations of those graphics APIs are built on top of Vulkan and
**most of the games should work out of the box.** Discrete GPUs are
prioritized (i.e. enumerated first) and games should default to them.
If you have multiple discrete GPUs or the wrong GPU is selected as the
default one and the game doesn't have the means of selecting an adapter you
can limit what gets enumerated.
In Steam, set your game's Properties -> GENERAL -> LAUNCH OPTIONS to:
DXVK_FILTER_DEVICE_NAME="GTX 1650" %command%
This should work for GeForce GTX 1650. A different name may be required for
your particular graphics card (e.g. "VEGA10" for Vega 56/64). You can use
`vulkaninfo` program (usually packaged as `vulkan-tools`) to check the names
of your GPUs.
## DirectX 8 and OpenGL
Those APIs are implemented on top of OpenGL and require a bit more
configuration.
The two most common PRIME scenarios are covered, but the content should be
enough to troubleshoot and make any other configuration work.
### AMD -> Integrated Intel (Mesa -> Mesa)
In Steam, set your game's Properties -> GENERAL -> LAUNCH OPTIONS to:
DRI_PRIME=1 %command%
### Nvidia -> Integrated Intel (Nvidia's Proprietary Driver -> Mesa)
In Steam set your game's Properties -> GENERAL -> LAUNCH OPTIONS to:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia %command%
## Vulkan
In case Vulkan games don't allow you to select a GPU or you experience
problems with graphics APIs implemented on top of Vulkan you can limit or
alter the GPU selection.
### AMD -> Integrated Intel (Mesa -> Mesa)
In Steam, set your game's Properties -> GENERAL -> LAUNCH OPTIONS to:
DRI_PRIME=1 %command%
This will cause the devices to change order, i.e. the first GPU will swap
places with another one.
You can also limit the selection using Mesa's DEVICE_SELECT Vulkan layer. To
list the GPUs:
$ MESA_VK_DEVICE_SELECT=list vulkaninfo
selectable devices:
GPU 0: 1002:67df "AMD RADV POLARIS10 (ACO)" discrete GPU 0000:01:00.0
GPU 1: 8086:412 "Intel(R) HD Graphics 4600 (HSW GT2)" integrated GPU 0000:00:02.0
Then set the launch options using one of the vendor and product ids, e.g.:
DRI_PRIME=1 MESA_VK_DEVICE_SELECT=1002:67df $command%
### Nvidia -> Integrated Intel (Nvidia's Proprietary Driver -> Mesa)
In Steam set your game's Properties -> GENERAL -> LAUNCH OPTIONS to:
__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only %command%
This will load the Optimus Vulkan layer and use it to limit the GPU selection
to NVIDIA only. Using `non_NVIDIA_only` will do the opposite.
# Troubleshooting
## Performance
Having vsync enabled in-game is known to cause problems in PRIME
configurations. If you experience poor framerates / freezes try disabling
vsync.
## Device selection
To make sure that all libraries have selected the correct GPU you can check
the logs.
In the game's properties set the following 'LAUNCH OPTIONS':
PROTON_LOG=1 WINEDEBUG=+d3d VKD3D_DEBUG=trace
After running the game, you should find a file named `steam-$APPID.log` in your
Home directory.
For wined3d/DXGI, look for:
```
trace:d3d:wined3d_adapter_init_gl_caps GL_RENDERER: "Radeon RX 580 Series (POLARIS10, DRM 3.40.0, 5.10.9-zen1-1-zen, LLVM 11.0.1)".
```
For DXVK, look for:
```
info: DXVK: v1.7.3-36-g85c70ad5
...
info: AMD RADV POLARIS10 (ACO):
info: Driver: 20.3.3
info: Vulkan: 1.2.145
```
For VKD3D-Proton, look for:
```
trace:vkd3d_trace_physical_device_properties: Device name: AMD RADV POLARIS10 (ACO).
trace:vkd3d_trace_physical_device_properties: Vendor ID: 0x1002, Device ID: 0x67df.
```
Refer to the main README and each project's own documentation for more details
on logging. Extra logging can destroy game performance. Make sure that you
clear your 'LAUNCH OPTIONS' after troubleshooting.

View File

@ -1,57 +0,0 @@
---
Rebasing Proton onto new upstream releases
---
We maintain a lot of patches on top of upstream releases. When cherry-picking
stuff from upstream into Proton, *always* use the `-x` parameter so the
original commit ID is retained in the log message. Contrarily, *never* use `-x`
when picking things that are not upstreamed. This lets us use the cherry-picked
log message as an indicator of which commits can be dropped during a rebase
because they were already upstreamed.
Here's a command which will generate the list of commits that were applied on
top of wine-4.2, which were not backported from upstream Wine:
wine$ git log --pretty=oneline --reverse --grep='cherry pick' --invert-grep wine-4.2..proton_4.2
You can then pick that list (*without* `-x`!) onto a new Wine release tag,
resolving conflicts and such as you go.
Here's a somewhat clumsy script that I think is easier to work with than git's
built-in tools:
#!/bin/bash
# Cherry-picks commits from an input file in --pretty=oneline format.
# Lines that begin with '#' are ignored.
# Aborts when a cherry-pick fails.
# Outputs the same input file on stderr, but with '#' prefixed to lines that were successfully cherry-picked.
#Usage:
# $ pick_commits to_pick 2> ~/to_pick2
# On pick failure, fix conflicts and use "git cherry-pick --continue", or
# otherwise fix up the repo as desired.
# Edit ~/to_pick2 to comment-out the commit that you fixed.
# Continue using the new file:
# $ pick_commits to_pick2 2> ~/to_pick
# Repeat, alternating between to_pick and to_pick2.
broken=0
while read -r l; do
f=$(echo -n "$l" | cut '-d ' -f1 -)
if [ $broken == 0 -a ${f:0:1} != '#' ]; then
echo "Picking $l"
git cherry-pick $f 2>&1
if [ $? -ne 0 ]; then
echo $l 1>&2
broken=1
else
echo '#'$l 1>&2
fi
else
echo $l 1>&2
fi
done < "$1"
Once your Wine rebase is done, update the prefix version in the proton Python
script, resetting the minor version back to 1.

View File

@ -1,20 +0,0 @@
# Thread priorities
Proton supports fine-grained thread priority control using `setpriority(2)` to
set thread niceness values corresponding to the game threads' Windows base
priority levels. However, most default Linux configurations don't allow
individual threads to raise their priority, so some system configuration is
likely required.
It can be configured as a privileged user by editing the
`/etc/security/limits.conf` file, or using the `/etc/security/limits.d/` conf
directory, and adding the following line at the end:
```
* hard nice -15
```
Where -15 could be any value between [-20,0] that will correspond to the
minimum niceness (the highest priority) a thread can get to. The lower the
value, the more CPU time a high priority thread will get, at the expense of
others and other processes, possibly making the system less responsive.

2
dxvk

@ -1 +1 @@
Subproject commit 1b31aa5dbca0749d0737cff02043acb061332fb6
Subproject commit c1eb78247c61af686f4e3c4159ab02d2750ebf08

@ -1 +0,0 @@
Subproject commit 0a7c48b256cafe6b3fa1db8183f089712c72e9ad

2
ffmpeg

@ -1 +1 @@
Subproject commit a77521cd5d27e955b16e8097eecefc779ffdcb6d
Subproject commit ace829cb45cff530b8a0aed6adf18f329d7a98f6

View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
@ -69,7 +71,7 @@ __all__ = [
"FileLock"
]
__version__ = "3.0.12"
__version__ = "3.0.4"
_logger = None
@ -103,29 +105,6 @@ class Timeout(TimeoutError):
# Classes
# ------------------------------------------------
# This is a helper class which is returned by :meth:`BaseFileLock.acquire`
# and wraps the lock to make sure __enter__ is not called twice when entering
# the with statement.
# If we would simply return *self*, the lock would be acquired again
# in the *__enter__* method of the BaseFileLock, but not released again
# automatically.
#
# :seealso: issue #37 (memory leak)
class _Acquire_ReturnProxy(object):
def __init__(self, lock):
self.lock = lock
return None
def __enter__(self):
return self.lock
def __exit__(self, exc_type, exc_value, traceback):
self.lock.release()
return None
class BaseFileLock(object):
"""
Implements the base class of a file lock.
@ -235,7 +214,7 @@ class BaseFileLock(object):
:arg float timeout:
The maximum time waited for the file lock.
If ``timeout < 0``, there is no timeout and this method will
If ``timeout <= 0``, there is no timeout and this method will
block until the lock could be acquired.
If ``timeout`` is None, the default :attr:`~timeout` is used.
@ -260,11 +239,12 @@ class BaseFileLock(object):
with self._thread_lock:
self._lock_counter += 1
lock_id = id(self)
lock_filename = self._lock_file
start_time = time.time()
try:
start_time = time.time()
while True:
lock_id = id(self)
lock_filename = self._lock_file
with self._thread_lock:
if not self.is_locked:
logger().debug('Attempting to acquire lock %s on %s', lock_id, lock_filename)
@ -288,7 +268,26 @@ class BaseFileLock(object):
self._lock_counter = max(0, self._lock_counter - 1)
raise
return _Acquire_ReturnProxy(lock = self)
# This class wraps the lock to make sure __enter__ is not called
# twiced when entering the with statement.
# If we would simply return *self*, the lock would be acquired again
# in the *__enter__* method of the BaseFileLock, but not released again
# automatically.
class ReturnProxy(object):
def __init__(self, lock):
self.lock = lock
return None
def __enter__(self):
return self.lock
def __exit__(self, exc_type, exc_value, traceback):
self.lock.release()
return None
return ReturnProxy(lock = self)
def release(self, force = False):
"""

@ -1 +1 @@
Subproject commit 4b0192046158094654e865245832c66d2104219e
Subproject commit 9510ebd130bcb4dfc76b053b438d8a97a3ed4600

View File

@ -1,94 +0,0 @@
Copyright 2018 The Noto Project Authors (github.com/googlei18n/noto-fonts)
This Font Software is licensed under the SIL Open Font License,
Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to
provide a free and open framework in which fonts may be shared and
improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software
components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to,
deleting, or substituting -- in part or in whole -- any of the
components of the Original Version, by changing formats or by porting
the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed,
modify, redistribute, and sell modified and unmodified copies of the
Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created using
the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,8 @@
diff --git a/LiberationMono-Regular.sfd b/LiberationMono-Regular.sfd
index 0cedbd4..13b9a63 100644
--- a/LiberationMono-Regular.sfd
+++ b/LiberationMono-Regular.sfd
@@ -3935,6 +3935,10 @@
@@ -3931,6 +3931,10 @@ ShortTable: maxp 16
3
1
EndShort
@ -8,6 +10,6 @@
+!!!!"!!**$!<E0/!"B2J!!iQ/s8E!)!"&](!"&]4s8;p*!"8i*!"8i9s8;p,!"Ao*!"Ju<s82j-
+!"Ju+!"],?s82j/!"],,!"o8Bs8)d0!"f2-!#,DFs8)cr
+EndTtf
LangName: 1033 "" "" "Regular" "Ascender - Liberation Mono" "" "Version 2.1.5" "" "Liberation is a trademark of Red Hat, Inc. registered in U.S. Patent and Trademark Office and certain other jurisdictions." "Ascender Corporation" "Steve Matteson" "Based on Cousine, which was designed by Steve Matteson as an innovative, refreshing sans serif design that is metrically compatible with Courier New+ISIA. Cousine offers improved on-screen readability characteristics and the pan-European WGL character set and solves the needs of developers looking for width-compatible fonts to address document portability across platforms." "http://www.ascendercorp.com/" "http://www.ascendercorp.com/typedesigners.html" "Licensed under the SIL Open Font License, Version 1.1" "http://scripts.sil.org/OFL"
LangName: 1033 "" "" "Regular" "Ascender - Liberation Mono" "" "Version 2.00.3" "" "Liberation is a trademark of Red Hat, Inc. registered in U.S. Patent and Trademark Office and certain other jurisdictions." "Ascender Corporation" "Steve Matteson" "Based on Cousine, which was designed by Steve Matteson as an innovative, refreshing sans serif design that is metrically compatible with Courier New+ISIA. Cousine offers improved on-screen readability characteristics and the pan-European WGL character set and solves the needs of developers looking for width-compatible fonts to address document portability across platforms." "http://www.ascendercorp.com/" "http://www.ascendercorp.com/typedesigners.html" "Licensed under the SIL Open Font License, Version 1.1" "http://scripts.sil.org/OFL"
GaspTable: 3 8 2 17 1 65535 3 0
Encoding: UnicodeBmp

View File

@ -1,5 +0,0 @@
[SourceHanSansK-Regular]
f=3,1,0x412,\B9D1\C740 \ACE0\B515
s=3,1,0x412,Regular
f=Malgun Gothic
s=Regular

View File

@ -1,5 +0,0 @@
[SourceHanSansSC-Regular]
f=3,1,0x804,\65B0\5B8B\4F53
s=3,1,0x804,\5E38\89C4
f=NSimSun
s=Regular

View File

@ -1,5 +0,0 @@
[SourceHanSansSC-Regular]
f=3,1,0x804,\5B8B\4F53
s=3,1,0x804,\5E38\89C4
f=SimSun
s=Regular

View File

@ -1,86 +0,0 @@
--- a/UmeGothic-nametable.ttx 2021-11-14 02:41:52.823198735 +0900
+++ b/UmeGothic-nametable.ttx 2021-11-14 02:44:50.269352384 +0900
@@ -5,8 +5,12 @@
<namerecord nameID="0" platformID="1" platEncID="0" langID="0x411" unicode="True">
Author: HORAI Wataru. License: This font is a free software. Unlimited permission is granted to use, copy, and distribute it, with or without modification, either commercially and noncommercially. THIS FONT IS PROVIDED "AS IS" WITHOUT WARRANTY.
</namerecord>
+ <!--
+ NameID=1 (Family)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="1" platformID="1" platEncID="0" langID="0x411" unicode="True">
- Ume Gothic
+ MS Gothic
</namerecord>
<namerecord nameID="2" platformID="1" platEncID="0" langID="0x411" unicode="True">
Regular
@@ -14,8 +18,12 @@
<namerecord nameID="3" platformID="1" platEncID="0" langID="0x411" unicode="True">
Ume Gothic
</namerecord>
+ <!--
+ NameID=4 (Full)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="4" platformID="1" platEncID="0" langID="0x411" unicode="True">
- Ume Gothic
+ MS Gothic
</namerecord>
<namerecord nameID="5" platformID="1" platEncID="0" langID="0x411" unicode="True">
Look update time of this file.
@@ -29,8 +37,12 @@
<namerecord nameID="0" platformID="3" platEncID="1" langID="0x409">
Author: HORAI Wataru. License: This font is a free software. Unlimited permission is granted to use, copy, and distribute it, with or without modification, either commercially and noncommercially. THIS FONT IS PROVIDED "AS IS" WITHOUT WARRANTY.
</namerecord>
+ <!--
+ NameID=1 (Family)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
- Ume Gothic
+ MS Gothic
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
Regular
@@ -38,8 +50,12 @@
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
Ume Gothic
</namerecord>
+ <!--
+ NameID=4 (Full)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
- Ume Gothic
+ MS Gothic
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
Look update time of this file.
@@ -53,8 +69,12 @@
<namerecord nameID="0" platformID="3" platEncID="1" langID="0x411">
作者: 蓬莱和多流. ライセンス: このフォントはフリー(自由な)ソフトウエアです。あらゆる改変の有無に関わらず、また商業的な利用であっても、自由に利用、複製、再配布することができますが、全て無保証とさせていただきます。
</namerecord>
+ <!--
+ NameID=1 (Family)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x411">
- 梅ゴシック
+ ゴシック
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x411">
Regular
@@ -62,8 +82,12 @@
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x411">
梅ゴシック
</namerecord>
+ <!--
+ NameID=4 (Full)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x411">
- 梅ゴシック
+ ゴシック
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x411">
Look update time of this file.

View File

@ -1,86 +0,0 @@
--- a/UmePGothic-nametable.ttx 2021-11-14 02:41:46.983127001 +0900
+++ b/UmePGothic-nametable.ttx 2021-11-14 02:44:42.413257975 +0900
@@ -5,8 +5,12 @@
<namerecord nameID="0" platformID="1" platEncID="0" langID="0x411" unicode="True">
Author: HORAI Wataru. License: This font is a free software. Unlimited permission is granted to use, copy, and distribute it, with or without modification, either commercially and noncommercially. THIS FONT IS PROVIDED "AS IS" WITHOUT WARRANTY.
</namerecord>
+ <!--
+ NameID=1 (Family)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="1" platformID="1" platEncID="0" langID="0x411" unicode="True">
- Ume P Gothic
+ MS PGothic
</namerecord>
<namerecord nameID="2" platformID="1" platEncID="0" langID="0x411" unicode="True">
Regular
@@ -14,8 +18,12 @@
<namerecord nameID="3" platformID="1" platEncID="0" langID="0x411" unicode="True">
Ume P Gothic
</namerecord>
+ <!--
+ NameID=4 (Full)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="4" platformID="1" platEncID="0" langID="0x411" unicode="True">
- Ume P Gothic
+ MS PGothic
</namerecord>
<namerecord nameID="5" platformID="1" platEncID="0" langID="0x411" unicode="True">
Look update time of this file.
@@ -29,8 +37,12 @@
<namerecord nameID="0" platformID="3" platEncID="1" langID="0x409">
Author: HORAI Wataru. License: This font is a free software. Unlimited permission is granted to use, copy, and distribute it, with or without modification, either commercially and noncommercially. THIS FONT IS PROVIDED "AS IS" WITHOUT WARRANTY.
</namerecord>
+ <!--
+ NameID=1 (Family)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
- Ume P Gothic
+ MS PGothic
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
Regular
@@ -38,8 +50,12 @@
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
Ume P Gothic
</namerecord>
+ <!--
+ NameID=4 (Full)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
- Ume P Gothic
+ MS PGothic
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
Look update time of this file.
@@ -53,8 +69,12 @@
<namerecord nameID="0" platformID="3" platEncID="1" langID="0x411">
作者: 蓬莱和多流. ライセンス: このフォントはフリー(自由な)ソフトウエアです。あらゆる改変の有無に関わらず、また商業的な利用であっても、自由に利用、複製、再配布することができますが、全て無保証とさせていただきます。
</namerecord>
+ <!--
+ NameID=1 (Family)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x411">
- 梅Pゴシック
+ Pゴシック
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x411">
Regular
@@ -62,8 +82,12 @@
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x411">
梅Pゴシック
</namerecord>
+ <!--
+ NameID=4 (Full)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x411">
- 梅Pゴシック
+ Pゴシック
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x411">
Look update time of this file.

View File

@ -1,86 +0,0 @@
--- a/UmeUIGothic-nametable.ttx 2021-11-14 02:41:57.955261726 +0900
+++ b/UmeUIGothic-nametable.ttx 2021-11-14 02:44:57.653441054 +0900
@@ -5,8 +5,12 @@
<namerecord nameID="0" platformID="1" platEncID="0" langID="0x411" unicode="True">
Author: HORAI Wataru. License: This font is a free software. Unlimited permission is granted to use, copy, and distribute it, with or without modification, either commercially and noncommercially. THIS FONT IS PROVIDED "AS IS" WITHOUT WARRANTY.
</namerecord>
+ <!--
+ NameID=1 (Family)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="1" platformID="1" platEncID="0" langID="0x411" unicode="True">
- Ume UI Gothic
+ MS UI Gothic
</namerecord>
<namerecord nameID="2" platformID="1" platEncID="0" langID="0x411" unicode="True">
Regular
@@ -14,8 +18,12 @@
<namerecord nameID="3" platformID="1" platEncID="0" langID="0x411" unicode="True">
Ume UI Gothic
</namerecord>
++ <!--
++ NameID=4 (Full)
++ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
++ -->
<namerecord nameID="4" platformID="1" platEncID="0" langID="0x411" unicode="True">
- Ume UI Gothic
+ MS UI Gothic
</namerecord>
<namerecord nameID="5" platformID="1" platEncID="0" langID="0x411" unicode="True">
Look update time of this file.
@@ -29,8 +37,12 @@
<namerecord nameID="0" platformID="3" platEncID="1" langID="0x409">
Author: HORAI Wataru. License: This font is a free software. Unlimited permission is granted to use, copy, and distribute it, with or without modification, either commercially and noncommercially. THIS FONT IS PROVIDED "AS IS" WITHOUT WARRANTY.
</namerecord>
+ <!--
+ NameID=1 (Family)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
- Ume UI Gothic
+ MS UI Gothic
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
Regular
@@ -38,8 +50,12 @@
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
Ume UI Gothic
</namerecord>
+ <!--
+ NameID=4 (Full)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
- Ume UI Gothic
+ MS UI Gothic
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
Look update time of this file.
@@ -53,8 +69,12 @@
<namerecord nameID="0" platformID="3" platEncID="1" langID="0x411">
作者: 蓬莱和多流. ライセンス: このフォントはフリー(自由な)ソフトウエアです。あらゆる改変の有無に関わらず、また商業的な利用であっても、自由に利用、複製、再配布することができますが、全て無保証とさせていただきます。
</namerecord>
+ <!--
+ NameID=1 (Family)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x411">
- 梅UIゴシック
+ MS UI Gothic
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x411">
Regular
@@ -62,8 +82,12 @@
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x411">
梅UIゴシック
</namerecord>
+ <!--
+ NameID=4 (Full)
+ https://adobe-type-tools.github.io/font-tech-notes/pdfs/5149.OTFname_Tutorial.pdf
+ -->
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x411">
- 梅UIゴシック
+ MS UI Gothic
</namerecord>
<namerecord nameID="5" platformID="3" platEncID="1" langID="0x411">
Look update time of this file.

View File

@ -1,5 +0,0 @@
[SourceHanSansSC-Regular]
f=3,1,0x804,\5FAE\8F6F\96C5\9ED1
s=3,1,0x804,Regular
f=Microsoft YaHei
s=Regular

View File

@ -1,140 +0,0 @@
0020-007E
00A0-0377
037A-037F
0384-038A
038C
038E-03A1
03A3-052F
0531-0556
0559-055F
0561-0587
0589-058A
058D-058F
0591-05C7
05D0-05EA
05F0-05F4
0600-061C
061E-06FF
0750-077F
08A0-08B4
08B6-08BD
08D4-08FF
1D00-1DCA
1DFE-1F15
1F18-1F1D
1F20-1F45
1F48-1F4D
1F50-1F57
1F59
1F5B
1F5D
1F5F-1F7D
1F80-1FB4
1FB6-1FC4
1FC6-1FD3
1FD6-1FDB
1FDD-1FEF
1FF2-1FF4
1FF6-1FFE
2000-200F
2012-2022
2026
202A-2030
2032-2034
2039-203A
203C-203E
2044
205E
206A-2070
2074-2079
207F
2090-2094
20A0-20BF
20F0
2105
2113
2116-2117
2122
2126
212E
214D-214E
2153-2154
215B-215E
2184
2190-2195
21A8
2202
2206
220F
2211-2212
2215
2219-221A
221E-221F
2229
222B
2248
2260-2261
2264-2265
2302
2310
2320-2321
2500
2502
250C
2510
2514
2518
251C
2524
252C
2534
253C
2550-256C
2580
2584
2588
258C
2590-2593
25A0-25A1
25AA-25AC
25B2
25BA
25BC
25C4
25CA-25CC
25CF
25D8-25D9
25E6
263A-263C
2640
2642
2660
2663
2665-2666
266A-266B
266F
2C60-2C7F
2E17
A717-A7AE
A7B0-A7B7
A7F7-A7FF
AB30-AB65
FB00-FB06
FB13-FB17
FB1D-FB36
FB38-FB3C
FB3E
FB40-FB41
FB43-FB44
FB46-FBC1
FBD3-FBFF
FC5E-FC63
FCF2-FCF4
FD3C-FD3F
FDF2
FDF4
FDFA-FDFD
FE20-FE23
FE70-FE74
FE76-FEFC
FFFC

View File

@ -1,123 +0,0 @@
0020-007E
00A0-0377
037A-037F
0384-038A
038C
038E-03A1
03A3-052F
0531-0556
0559-055F
0561-0587
0589-058A
058D-058F
0591-05C7
05D0-05EA
05F0-05F4
0600-061C
061E-06FF
0750-077F
0783
08A0-08B4
08B6-08BD
08D4-08FF
09F2-09F3
0AF1
0BF9
0E01-0E3A
0E3F-0E5B
10A0-10C5
10C7
10CD
10D0-10FF
17DB
1D00-1DCA
1DFE-1F15
1F18-1F1D
1F20-1F45
1F48-1F4D
1F50-1F57
1F59
1F5B
1F5D
1F5F-1F7D
1F80-1FB4
1FB6-1FC4
1FC6-1FD3
1FD6-1FDB
1FDD-1FEF
1FF2-1FF4
1FF6-1FFE
2000-2064
2066-2071
2074-208E
2090-209C
20A0-20BF
20E3
20F0
2105
2113
2116-2117
2122
2126
212E
2133
214D-214E
2150-218B
2190-2195
21A8
2202
2206
220F
2211-2212
2215
2219-221A
221E-221F
2229
222B
2248
2260-2261
2264-2265
2302
2310
2320-2321
2500
2502
250C
25A1
25AA-25AB
25CA
25CC
25CF
25E6
266F
2C60-2C7F
2D00-2D25
2D27
2D2D
2DE0-2DFF
2E17
A640-A69F
A717-A7AD
A7B0-A7B7
A7F7-A7FF
AB30-AB65
FB00-FB06
FB13-FB17
FB1D-FB36
FB38-FB3C
FB3E
FB40-FB41
FB43-FB44
FB46-FBC1
FBD3-FBFF
FC5E-FC63
FCF2-FCF4
FD3C-FD3F
FDF2
FDF4
FDFA-FDFD
FE20-FE23
FE70-FE74
FE76-FEFC
FEFF
FFFC-FFFD

View File

@ -1,166 +0,0 @@
000D
0020-007E
00A0-00FF
0131
0152-0153
0160-0161
0178
017D-017E
0192
02BC
02C6-02C7
02D8
02DA
02DC
03BC
0900-0983
0985-098C
098F-0990
0993-09A8
09AA-09B0
09B2
09B6-09B9
09BC-09C4
09C7-09C8
09CB-09CE
09D7
09DC-09DD
09DF-09E3
09E6-09FE
0A01-0A03
0A05-0A0A
0A0F-0A10
0A13-0A28
0A2A-0A30
0A32-0A33
0A35-0A36
0A38-0A39
0A3C
0A3E-0A42
0A47-0A48
0A4B-0A4D
0A51
0A59-0A5C
0A5E
0A66-0A76
0A81-0A83
0A85-0A8D
0A8F-0A91
0A93-0AA8
0AAA-0AB0
0AB2-0AB3
0AB5-0AB9
0ABC-0AC5
0AC7-0AC9
0ACB-0ACD
0AD0
0AE0-0AE3
0AE6-0AF1
0AF9-0AFF
0B01-0B03
0B05-0B0C
0B0F-0B10
0B13-0B28
0B2A-0B30
0B32-0B33
0B35-0B39
0B3C-0B44
0B47-0B48
0B4B-0B4D
0B56-0B57
0B5C-0B5D
0B5F-0B63
0B66-0B77
0B82-0B83
0B85-0B8A
0B8E-0B90
0B92-0B95
0B99-0B9A
0B9C
0B9E-0B9F
0BA3-0BA4
0BA8-0BAA
0BAE-0BB9
0BBE-0BC2
0BC6-0BC8
0BCA-0BCD
0BD0
0BD7
0BE6-0BFA
0C00-0C0C
0C0E-0C10
0C12-0C28
0C2A-0C39
0C3D-0C44
0C46-0C48
0C4A-0C4D
0C55-0C56
0C58-0C5A
0C60-0C63
0C66-0C6F
0C78-0C8C
0C8E-0C90
0C92-0CA8
0CAA-0CB3
0CB5-0CB9
0CBC-0CC4
0CC6-0CC8
0CCA-0CCD
0CD5-0CD6
0CDE
0CE0-0CE3
0CE6-0CEF
0CF1-0CF2
0D00-0D03
0D05-0D0C
0D0E-0D10
0D12-0D44
0D46-0D48
0D4A-0D4F
0D54-0D63
0D66-0D7F
0D82-0D83
0D85-0D96
0D9A-0DB1
0DB3-0DBB
0DBD
0DC0-0DC6
0DCA
0DCF-0DD4
0DD6
0DD8-0DDF
0DE6-0DEF
0DF2-0DF4
0FD5-0FD8
1C50-1C7F
1CD0-1CF9
200B-200D
2010
2013-2014
2018-201A
201C-201E
2020-2022
2026
2030
2039-203A
2044
20A8
20AC
20B9
2122
2212
2215
2219
2236
25CC
25CF
262C
A830-A839
A8E0-A8FF
ABC0-ABED
ABF0-ABF9
110D0-110E8
110F0-110F9
11100-11134
11136-11146
111E1-111F4

View File

@ -1,7 +1,7 @@
if ($argc != 6)
Error ("Expected arguments - FileName, PSName, FamilyName, FaceName, OutFileName")
if ($argc != 5)
Error ("Expected arguments - FileName, PSName, FamilyName, FaceName")
endif
Open($1)
SetFontNames($argv[2], $argv[3], $argv[4])
Generate($5)
Generate($1:r + ".ttf")

View File

@ -1,290 +0,0 @@
#!/usr/bin/env python3
# This script was created by Giovanni Mascellani for CodeWeavers
# Based on merge_noto.py and merge_fonts.py from the nototools
# (https://github.com/googlefonts/nototools), with the following
# copyright notice:
# Copyright 2014-2017 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# The font name changing logic is taken from
# https://github.com/chrissimpkins/fontname.py/blob/master/fontname.py,
# with the following copyright notice:
# Copyright 2019 Christopher Simpkins
# MIT License
# The font subsetting logic is taken from
# https://github.com/fonttools/fonttools/blob/main/Lib/fontTools/subset/__init__.py
# with the following copyright notice:
# Copyright 2013 Google, Inc. All Rights Reserved.
# Google Author(s): Behdad Esfahbod
# The whole fonttools repository is distributed under the MIT license.
"""Merges a number of Noto fonts and then sets a given name to the
result.
"""
import sys
import tempfile
import os
from fontTools import merge
from fontTools import ttLib
from fontTools import subset
from fontTools.ttLib.tables import otTables
def read_line_metrics(font):
metrics = {
"ascent": font["hhea"].ascent,
"descent": font["hhea"].descent,
"usWinAscent": font["OS/2"].usWinAscent,
"usWinDescent": font["OS/2"].usWinDescent,
"sTypoAscender": font["OS/2"].sTypoAscender,
"sTypoDescender": font["OS/2"].sTypoDescender,
"sxHeight": font["OS/2"].sxHeight,
"sCapHeight": font["OS/2"].sCapHeight,
"sTypoLineGap": font["OS/2"].sTypoLineGap,
}
return metrics
def set_line_metrics(font, metrics):
font["hhea"].ascent = metrics["ascent"]
font["hhea"].descent = metrics["descent"]
font["OS/2"].usWinAscent = metrics["usWinAscent"]
font["OS/2"].usWinDescent = metrics["usWinDescent"]
font["OS/2"].sTypoAscender = metrics["sTypoAscender"]
font["OS/2"].sTypoDescender = metrics["sTypoDescender"]
font["OS/2"].sxHeight = metrics["sxHeight"]
font["OS/2"].sCapHeight = metrics["sCapHeight"]
font["OS/2"].sTypoLineGap = metrics["sTypoLineGap"]
def has_gsub_table(fontfile):
font = ttLib.TTFont(fontfile)
return "GSUB" in font
SCRIPT_TO_OPENTYPE_SCRIPT_TAG = {
# Retrieved from Opentype 1.9 delta specs. Prerelease scripttags used out of necessity. https://docs.microsoft.com/en-us/typography/opentype/spec/scripttags
"Carian": "cari",
"CypriotSyllabary": "cprt",
"CyproMinoan": "cpmn",
"Deseret": "dsrt",
"Glagolitic": "glag",
"EgyptianHieroglyphs": "egyp",
"ImperialAramaic": "armi",
"LinearA": "lina",
"LinearB": "linb",
"Lisu": "lisu",
"Lycian": "lyci",
"Lydian": "lydi",
"Ogham": "ogam",
"OldItalic": "ital",
"OldPersian": "xpeo",
"OldSouthArabian": "sarb",
"OldTurkic": "orkh",
"OldSogdian": "sogo",
"OldNorthArabian": "narb",
"OldHungarian": "hung",
"Osmanya": "osma",
"Phoenician": "phnx",
"SumeroAkkadianCuneiform": "xsux",
"Ugaritic": "ugar",
"OlChiki": "olck",
"TaiLe": "tale",
"Cuneiform": "xsux",
"Cypriot": "cprt",
"Runic": "runr",
"Shavian": "shaw",
"Vai": "vai ",
"Yi": "yi ",
"AnatolianHieroglyphs": "hluw",
"Bamum": "bamu",
"ByzantineMusic": "byzm",
"Gothic": "goth",
"ImperialAramaic": "armi",
"InscriptionalPahlavi": "phli",
"InscriptionalParthian": "prti",
"Khojki": "khoj",
"MathematicalAlphanumericSymbols": "math",
"MeroiticCursive": "merc",
"MeroiticHieroglyphs": "mero",
"MusicalSymbols": "musc",
"Palmyrene": "palm",
"Rejang": "rjng",
"Samaritan": "samr",
"Carian": "cari",
"Ahom": "ahom",
"Adlam": "adlm",
"Dogra": "dogr",
"Lisu": "lisu",
"Mandaean": "mand",
"Manichaean": "mani",
"Tifinagh": "tfng",
"Wancho": "wcho",
"Yezidi": "yezi",
"Cherokee": "cher",
"Chorasmian": "chrs",
"PahawhHmong": "hmng",
"Phagspa": "phag",
"Sundanese": "sund",
"WarangCiti": "wara",
"SylotiNagri": "sylo",
"PsalterPahlavi": "phlp",
"CaucasianAlbanian": "aghb",
"Medefaidrin": "medf",
"MeiteiMayek": "mtei",
"MendeKikakui": "mend",
"Mro": "mroo",
"Multani": "mult",
"Nabataean": "nbat",
"Nandinagari": "nand",
"Newa": "newa",
"NewTaiLue": "talu",
"Nushu": "nshu",
"NyiakengPuachueHmong": "hmnp",
"OldPermic": "perm",
"SoraSompeng": "sora",
"Soyombo": "soyo",
"SylotiNagri": "sylo",
"Tagbanwa": "tagb",
"Tagalog": "tglg",
"Takri": "takr",
"TaiTham": "lana",
"TaiViet": "tavt",
"Tangut": "tang",
"Thaana": "thaa",
"UgariticCuneiform": "ugar",
"ZanabazarSquare": "zanb",
"SignWriting": "sgnw",
"OldUyghur": "ougr",
"Tangsa": "tnsa",
"Toto": "toto",
"Vithkuqi": "vith",
"Duployan": "dupl",
"Hatran": "hatr",
# These last two would only merge using the long script name including the 'NotoSerif' part
"NotoSerifYezidi": "yezi",
"NotoSerifNyiakengPuachueHmong": "hmnp",
}
def get_opentype_script_tag(fontfile):
fontfile = os.path.basename(fontfile)
if fontfile.startswith("NotoSans"):
fontfile = fontfile[8:]
fontfile = fontfile[: fontfile.index("-")]
return SCRIPT_TO_OPENTYPE_SCRIPT_TAG[fontfile]
def add_gsub_to_font(fontfile):
"""Adds an empty GSUB table to a font."""
font = ttLib.TTFont(fontfile)
gsub_table = ttLib.getTableClass("GSUB")("GSUB")
gsub_table.table = otTables.GSUB()
gsub_table.table.Version = 1.0
gsub_table.table.ScriptList = otTables.ScriptList()
gsub_table.table.ScriptCount = 1
gsub_table.table.LookupList = otTables.LookupList()
gsub_table.table.LookupList.LookupCount = 0
gsub_table.table.LookupList.Lookup = []
gsub_table.table.FeatureList = otTables.FeatureList()
gsub_table.table.FeatureList.FeatureCount = 0
gsub_table.table.LookupList.FeatureRecord = []
script_record = otTables.ScriptRecord()
script_record.ScriptTag = get_opentype_script_tag(fontfile)
script_record.Script = otTables.Script()
script_record.Script.LangSysCount = 0
script_record.Script.LangSysRecord = []
default_lang_sys = otTables.DefaultLangSys()
default_lang_sys.FeatureIndex = []
default_lang_sys.FeatureCount = 0
default_lang_sys.LookupOrder = None
default_lang_sys.ReqFeatureIndex = 65535
script_record.Script.DefaultLangSys = default_lang_sys
gsub_table.table.ScriptList.ScriptRecord = [script_record]
font["GSUB"] = gsub_table
target_file = tempfile.gettempdir() + "/" + os.path.basename(fontfile)
font.save(target_file)
return target_file
def parse_unicodes(s):
import re
s = re.sub(r"0[xX]", " ", s)
s = re.sub(r"[<+>,;&#\\xXuU\n ]", " ", s)
l = []
for item in s.split():
fields = item.split("-")
if len(fields) == 1:
l.append(int(item, 16))
else:
start, end = fields
l.extend(range(int(start, 16), int(end, 16) + 1))
return l
def main():
output_filename = sys.argv[-1]
ranges_filename = sys.argv[-2]
weight = sys.argv[-3]
font_name = sys.argv[-4]
ps_name = sys.argv[-5]
input_filenames = sys.argv[1:-5]
# Add a GSUB table to the fonts that do not have one, otherwise
# the merger will complain
for index, filename in enumerate(input_filenames):
if not has_gsub_table(filename):
input_filenames[index] = add_gsub_to_font(filename)
merger = merge.Merger()
font = merger.merge(input_filenames)
# Use the line metrics defined by the first font, which is
# supposed to be the basic NotoSans
metrics = read_line_metrics(ttLib.TTFont(input_filenames[0]))
set_line_metrics(font, metrics)
# Select the subset we care about
options = subset.Options(ignore_missing_unicodes=False)
subsetter = subset.Subsetter(options)
unicodes = []
with open(ranges_filename) as ranges:
for line in ranges:
unicodes.extend(parse_unicodes(line.split("#")[0]))
if len(unicodes) != 0:
subsetter.populate(unicodes=unicodes)
subsetter.subset(font)
# Rename the result
for record in font['name'].names:
if record.nameID == 1:
record.string = font_name
elif record.nameID == 4:
record.string = "{} {}".format(font_name, weight)
elif record.nameID == 6:
record.string = "{}-{}".format(ps_name, weight.replace(' ', ''))
font.save(output_filename)
if __name__ == '__main__':
main()

View File

@ -1,96 +0,0 @@
Copyright 2014-2019 Adobe (http://www.adobe.com/), with Reserved Font
Name 'Source'. Source is a trademark of Adobe in the United States
and/or other countries.
This Font Software is licensed under the SIL Open Font License,
Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to
provide a free and open framework in which fonts may be shared and
improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software
components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to,
deleting, or substituting -- in part or in whole -- any of the
components of the Original Version, by changing formats or by porting
the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed,
modify, redistribute, and sell modified and unmodified copies of the
Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created using
the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

Some files were not shown because too many files have changed in this diff Show More