mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-15 05:22:53 +08:00
Format code, update to Qt 6.7.0 & attend issue #189
This commit is contained in:
parent
d4f7fbc0e3
commit
2684acaec5
@ -1,39 +1,24 @@
|
||||
# Copyright (C) 2016 Olivier Goffart <ogoffart@woboq.com>
|
||||
#
|
||||
# You may use this file under the terms of the 3-clause BSD license.
|
||||
# See the file LICENSE from this package for details.
|
||||
|
||||
# This is the clang-format configuration style to be used by Qt,
|
||||
# based on the rules from https://wiki.qt.io/Qt_Coding_Style and
|
||||
# https://wiki.qt.io/Coding_Conventions
|
||||
|
||||
---
|
||||
# Webkit style was loosely based on the Qt style
|
||||
BasedOnStyle: WebKit
|
||||
|
||||
BasedOnStyle: LLVM
|
||||
Standard: Cpp11
|
||||
|
||||
# Leave the line breaks up to the user.
|
||||
# Note that this may be changed at some point in the future.
|
||||
ColumnLimit: 0
|
||||
# How much weight do extra characters after the line length limit have.
|
||||
# PenaltyExcessCharacter: 4
|
||||
|
||||
# Disable reflow of qdoc comments: indentation rules are different.
|
||||
# Translation comments are also excluded.
|
||||
CommentPragmas: "^!|^:"
|
||||
|
||||
# We want a space between the type and the star for pointer types.
|
||||
PointerBindsToType: false
|
||||
|
||||
# We use template< without space.
|
||||
SpaceAfterTemplateKeyword: false
|
||||
|
||||
# We want to break before the operators, but not before a '='.
|
||||
BreakBeforeBinaryOperators: All
|
||||
|
||||
# Braces are usually attached, but not after functions or class declarations.
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
ConstructorInitializerIndentWidth: 2
|
||||
NamespaceIndentation: None
|
||||
AlignAfterOpenBracket: true
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
SortIncludes: false
|
||||
IndentCaseLabels: true
|
||||
IndentPPDirectives: AfterHash
|
||||
AccessModifierOffset: -2
|
||||
IndentWidth: 2
|
||||
ColumnLimit: 80
|
||||
|
||||
BraceWrapping:
|
||||
AfterClass: true
|
||||
AfterControlStatement: true
|
||||
@ -47,48 +32,7 @@ BraceWrapping:
|
||||
BeforeElse: true
|
||||
IndentBraces: false
|
||||
|
||||
BreakBeforeTernaryOperators: true
|
||||
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
|
||||
# Indent initializers by 3 spaces
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
|
||||
# No indentation for namespaces.
|
||||
NamespaceIndentation: None
|
||||
|
||||
# Horizontally align arguments after an open bracket.
|
||||
# The coding style does not specify the following, but this is what gives
|
||||
# results closest to the existing code.
|
||||
AlignAfterOpenBracket: true
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
|
||||
# Ideally we should also allow less short function in a single line, but
|
||||
# clang-format does not handle that.
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
|
||||
# The coding style specifies some include order categories, but also tells to
|
||||
# separate categories with an empty line. It does not specify the order within
|
||||
# the categories. Since the SortInclude feature of clang-format does not
|
||||
# re-order includes separated by empty lines, the feature is not used.
|
||||
SortIncludes: false
|
||||
|
||||
# macros for which the opening brace stays attached.
|
||||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH, forever, Q_FOREVER, QBENCHMARK, QBENCHMARK_ONCE ]
|
||||
|
||||
IndentCaseLabels: true
|
||||
|
||||
IndentPPDirectives: AfterHash
|
||||
|
||||
AlignAfterOpenBracket: Align
|
||||
|
||||
AccessModifierOffset: -4
|
||||
|
||||
IndentWidth: 4
|
||||
|
||||
#StatementMacros ['Q_OBJECT', 'Q_UNUSED']
|
||||
|
||||
ColumnLimit: 90
|
||||
|
||||
|
||||
|
||||
|
56
.clang-tidy
Normal file
56
.clang-tidy
Normal file
@ -0,0 +1,56 @@
|
||||
---
|
||||
Checks: '*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-modernize-use-trailing-return-type,-llvm-*,-llvmlibc-*'
|
||||
CheckOptions: [{ key: misc-non-private-member-variables-in-classes, value: IgnoreClassesWithAllMemberVariablesBeingPublic }]
|
||||
WarningsAsErrors: '*'
|
||||
HeaderFilterRegex: ''
|
||||
FormatStyle: none
|
||||
|
||||
CheckOptions:
|
||||
- key: readability-identifier-naming.ClassCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.ClassMemberCase
|
||||
value: lower_case
|
||||
- key: readability-identifier-naming.ConstexprVariableCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.ConstexprVariablePrefix
|
||||
value: k
|
||||
- key: readability-identifier-naming.EnumCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.EnumConstantCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.EnumConstantPrefix
|
||||
value: k
|
||||
- key: readability-identifier-naming.FunctionCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.GlobalConstantCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.GlobalConstantPrefix
|
||||
value: k
|
||||
- key: readability-identifier-naming.StaticConstantCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.StaticConstantPrefix
|
||||
value: k
|
||||
- key: readability-identifier-naming.StaticVariableCase
|
||||
value: lower_case
|
||||
- key: readability-identifier-naming.MacroDefinitionCase
|
||||
value: UPPER_CASE
|
||||
- key: readability-identifier-naming.MacroDefinitionIgnoredRegexp
|
||||
value: '^[A-Z]+(_[A-Z]+)*_$'
|
||||
- key: readability-identifier-naming.MemberCase
|
||||
value: lower_case
|
||||
- key: readability-identifier-naming.PrivateMemberSuffix
|
||||
value: _
|
||||
- key: readability-identifier-naming.PublicMemberSuffix
|
||||
value: ''
|
||||
- key: readability-identifier-naming.NamespaceCase
|
||||
value: lower_case
|
||||
- key: readability-identifier-naming.ParameterCase
|
||||
value: lower_case
|
||||
- key: readability-identifier-naming.TypeAliasCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.TypedefCase
|
||||
value: CamelCase
|
||||
- key: readability-identifier-naming.VariableCase
|
||||
value: lower_case
|
||||
- key: readability-identifier-naming.IgnoreMainLikeFunctions
|
||||
value: 1
|
73
.github/workflows/deploy.yml
vendored
73
.github/workflows/deploy.yml
vendored
@ -1,6 +1,6 @@
|
||||
#--------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Workflow configuration
|
||||
#--------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
name: Deploy
|
||||
on:
|
||||
@ -12,9 +12,9 @@ on:
|
||||
paths-ignore: # File-patterns to ignore
|
||||
- '**.md' # Ignore changes to *.md files
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Define application name & version
|
||||
#--------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
env:
|
||||
VERSION: "2.0.0"
|
||||
@ -26,14 +26,14 @@ env:
|
||||
QML_DIR_WIN: "assets\\qml"
|
||||
PUBLISHER: "Alex Spataru"
|
||||
REPO_DIR: "/home/runner/work/Serial-Studio"
|
||||
QT_VERSION: 6.6.2
|
||||
QT_MODULES: qtserialport qtconnectivity qt5compat qtpositioning qtlocation
|
||||
QT_VERSION: 6.7.0
|
||||
QT_MODULES: qtserialport qtconnectivity qtpositioning qtlocation
|
||||
QMAKE: qmake6
|
||||
CORES: 16
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Workflow jobs (GNU/Linux, macOS & Windows)
|
||||
#--------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
jobs:
|
||||
#
|
||||
@ -60,7 +60,10 @@ jobs:
|
||||
- name: '⚙️ Install dependencies'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libgl1-mesa-dev libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libzstd-dev libxcb-image0-dev libxcb-util0-dev libxcb-cursor-dev
|
||||
sudo apt-get install libgl1-mesa-dev libxkbcommon-x11-0 libxcb-icccm4 \
|
||||
libxcb-image0 libxcb-keysyms1 libxcb-render-util0 \
|
||||
libxcb-xinerama0 libzstd-dev libxcb-image0-dev \
|
||||
libxcb-util0-dev libxcb-cursor-dev
|
||||
|
||||
- name: '🚧 Compile application'
|
||||
run: |
|
||||
@ -109,24 +112,58 @@ jobs:
|
||||
version: ${{env.QT_VERSION}}
|
||||
modules: ${{env.QT_MODULES}}
|
||||
cache: true
|
||||
arch: clang_64
|
||||
install-deps: 'true'
|
||||
|
||||
- name: '⚙️ Install Node'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: '🚧 Compile application'
|
||||
run: |
|
||||
${{env.QMAKE}} ${{env.QMAKE_PROJECT}} CONFIG+=release PREFIX=/usr
|
||||
${{env.QMAKE}} ${{env.QMAKE_PROJECT}} CONFIG+=release
|
||||
make -j${{env.CORES}}
|
||||
|
||||
- name: '📦 Package application (macdeployqt and zipfile)'
|
||||
- name: '📦 Package application'
|
||||
run: |
|
||||
macdeployqt ${{env.EXECUTABLE}}.app -qmldir="${{env.QML_DIR_NIX}}"
|
||||
mv "${{env.EXECUTABLE}}.app" "${{env.APPLICATION}}.app"
|
||||
ditto -c -k --sequesterRsrc --keepParent "${{env.APPLICATION}}.app" ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
|
||||
|
||||
- name: '📤 Upload artifact: ZIP'
|
||||
uses: actions/upload-artifact@v2
|
||||
- name: '🪪 Import Code Signing Certificate'
|
||||
uses: apple-actions/import-codesign-certs@v2
|
||||
with:
|
||||
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
|
||||
path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
|
||||
p12-file-base64: ${{secrets.CERTIFICATES_P12}}
|
||||
p12-password: ${{secrets.CERTIFICATES_P12_PASSWORD}}
|
||||
|
||||
- name: '✍🏻 Sign Application'
|
||||
run: codesign --force --deep --options runtime --sign "${{secrets.DEVELOPER_ID}}" "${{env.APPLICATION}}.app"
|
||||
|
||||
- name: '💽 Create nice DMG'
|
||||
run: |
|
||||
npm install --global create-dmg
|
||||
rm LICENSE.md
|
||||
create-dmg "${{env.APPLICATION}}.app" --dmg-title="${{env.APPLICATION}}"
|
||||
mv "${{env.APPLICATION}} ${{env.VERSION}}.dmg" "${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg"
|
||||
|
||||
- name: '📋 Notarize'
|
||||
uses: alex-spataru/xcode-notarize@v2
|
||||
with:
|
||||
product-path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg
|
||||
appstore-connect-username: ${{secrets.NOTARIZATION_USERNAME}}
|
||||
appstore-connect-teamid: ${{secrets.NOTARIZATION_TEAMID}}
|
||||
appstore-connect-password: ${{secrets.NOTARIZATION_PASSWORD}}
|
||||
|
||||
- name: '📌 Staple'
|
||||
uses: BoundfoxStudios/action-xcode-staple@v1
|
||||
with:
|
||||
product-path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg
|
||||
|
||||
- name: '📤 Upload artifact: DMG'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg
|
||||
path: ${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg
|
||||
|
||||
#
|
||||
# Windows build
|
||||
@ -259,7 +296,9 @@ jobs:
|
||||
name: msys2-pkgs
|
||||
path: msys2/*.zst
|
||||
|
||||
#
|
||||
# Test Windows MSYS2 packages
|
||||
#
|
||||
msys2-test:
|
||||
if: ${{false}}
|
||||
needs: msys2-makepkg
|
||||
@ -324,6 +363,6 @@ jobs:
|
||||
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
|
||||
chmod +x pyuploadtool-x86_64.AppImage
|
||||
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-Linux.AppImage
|
||||
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.zip
|
||||
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-macOS.dmg
|
||||
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.exe
|
||||
./pyuploadtool-x86_64.AppImage **/${{env.EXECUTABLE}}-${{env.VERSION}}-Windows.zip
|
||||
|
12
.gitignore
vendored
12
.gitignore
vendored
@ -4,8 +4,11 @@
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# SciTools understand
|
||||
Serial-Studio.und
|
||||
# Build & IDEs
|
||||
*.kdev*
|
||||
build/*
|
||||
*.vscode
|
||||
*.layout
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
@ -31,3 +34,8 @@ Temporary Items
|
||||
|
||||
# Qt project file
|
||||
*.pro.user
|
||||
*.user
|
||||
|
||||
# Clion
|
||||
.idea/*
|
||||
cmake-build-*
|
||||
|
@ -20,9 +20,9 @@
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Make options
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
UI_DIR = uic
|
||||
MOC_DIR = moc
|
||||
@ -33,15 +33,15 @@ isEmpty(PREFIX) {
|
||||
PREFIX = /usr
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Qt configuration
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
TEMPLATE = app # Project template
|
||||
TARGET = serial-studio # Set default target name
|
||||
CONFIG += qtquickcompiler # Pre-compile QML interface
|
||||
CONFIG += utf8_source # Source code encoding
|
||||
QTPLUGIN += qsvg # Fixes issues with windeployqt
|
||||
TEMPLATE = app
|
||||
TARGET = serial-studio
|
||||
CONFIG += qtquickcompiler
|
||||
CONFIG += utf8_source
|
||||
QTPLUGIN += qsvg
|
||||
|
||||
QT += xml
|
||||
QT += svg
|
||||
@ -56,15 +56,9 @@ QT += printsupport
|
||||
|
||||
QT += quickcontrols2
|
||||
|
||||
equals(QT_MAJOR_VERSION, 6) {
|
||||
QT += core5compat
|
||||
}
|
||||
|
||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00
|
||||
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Compiler options
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
CONFIG += c++11
|
||||
CONFIG += silent
|
||||
@ -79,68 +73,64 @@ CONFIG(release, debug|release) {
|
||||
}
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Serial Studio compile-time settings
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
DEFINES += SERIAL_STUDIO_INCLUDE_MOC
|
||||
|
||||
#DEFINES += DISABLE_QSU # If enabled, QSimpleUpdater shall not be used by the app.
|
||||
#DEFINES += DISABLE_QS # If enabled, QSimpleUpdater shall not be used by the app
|
||||
# This is the default behaviour for MinGW.
|
||||
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Libraries
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include(libs/Libraries.pri)
|
||||
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Assets
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
include(assets/Assets.pri)
|
||||
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Deploy options
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
win32* {
|
||||
TARGET = SerialStudio # Change target name
|
||||
RC_FILE = deploy/windows/resources/info.rc # Set applicaiton icon
|
||||
OTHER_FILES += deploy/windows/nsis/setup.nsi # Setup script
|
||||
TARGET = SerialStudio
|
||||
RC_FILE = deploy/windows/resources/info.rc
|
||||
OTHER_FILES += deploy/windows/nsis/setup.nsi
|
||||
}
|
||||
|
||||
macx* {
|
||||
TARGET = SerialStudio # Change target name
|
||||
ICON = deploy/macOS/icon.icns # icon file
|
||||
RC_FILE = deploy/macOS/icon.icns # icon file
|
||||
QMAKE_INFO_PLIST = deploy/macOS/info.plist # Add info.plist file
|
||||
CONFIG += sdk_no_version_check # Avoid warnings with Big Sur
|
||||
TARGET = SerialStudio
|
||||
ICON = deploy/macOS/icon.icns
|
||||
RC_FILE = deploy/macOS/icon.icns
|
||||
QMAKE_INFO_PLIST = deploy/macOS/info.plist
|
||||
CONFIG += sdk_no_version_check
|
||||
}
|
||||
|
||||
linux:!android {
|
||||
PKGCONFIG += libssl # Add OpenSSL library
|
||||
target.path = $$PREFIX/bin # Set binary installation path
|
||||
icon.path = $$PREFIX/share/pixmaps # icon instalation path
|
||||
desktop.path = $$PREFIX/share/applications # *.desktop instalation path
|
||||
icon.files += deploy/linux/serial-studio.png # Add application icon
|
||||
desktop.files += deploy/linux/serial-studio.desktop # Add *.desktop file
|
||||
copyright.files += deploy/linux/copyright # Libc6 file for linuxdeployqt
|
||||
copyright.path = $$PREFIX/share/doc/libc6 # libc6 copyright path
|
||||
INSTALLS += target copyright desktop icon # make install targets
|
||||
PKGCONFIG += libssl
|
||||
target.path = $$PREFIX/bin
|
||||
icon.path = $$PREFIX/share/pixmaps
|
||||
desktop.path = $$PREFIX/share/applications
|
||||
icon.files += deploy/linux/serial-studio.png
|
||||
desktop.files += deploy/linux/serial-studio.desktop
|
||||
INSTALLS += target copyright desktop icon
|
||||
}
|
||||
|
||||
mingw {
|
||||
target.path = $$PREFIX/bin
|
||||
license.path = $$PREFIX/share/licenses/$$TARGET # Set license install path
|
||||
license.files += LICENSE.md # Add LICENSE.md file
|
||||
INSTALLS += target license # Install target+licence (MSYS2)
|
||||
DEFINES += DISABLE_QSU # Disable QSimpleUpdater (MSYS2)
|
||||
license.path = $$PREFIX/share/licenses/$$TARGET
|
||||
license.files += LICENSE.md
|
||||
INSTALLS += target license
|
||||
DEFINES += DISABLE_QSU
|
||||
}
|
||||
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Import source code
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
INCLUDEPATH += src
|
||||
|
||||
@ -161,7 +151,6 @@ HEADERS += \
|
||||
src/JSON/Generator.h \
|
||||
src/JSON/Group.h \
|
||||
src/MQTT/Client.h \
|
||||
src/Misc/MacExtras.h \
|
||||
src/Misc/ModuleManager.h \
|
||||
src/Misc/ThemeManager.h \
|
||||
src/Misc/TimerEvents.h \
|
||||
@ -205,7 +194,6 @@ SOURCES += \
|
||||
src/JSON/Generator.cpp \
|
||||
src/JSON/Group.cpp \
|
||||
src/MQTT/Client.cpp \
|
||||
src/Misc/MacExtras.cpp \
|
||||
src/Misc/ModuleManager.cpp \
|
||||
src/Misc/ThemeManager.cpp \
|
||||
src/Misc/TimerEvents.cpp \
|
||||
@ -236,9 +224,9 @@ SOURCES += \
|
||||
src/UI/Widgets/Terminal.cpp \
|
||||
src/main.cpp
|
||||
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Import QML source code
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
DISTFILES += \
|
||||
assets/qml/*.qml \
|
||||
@ -252,9 +240,9 @@ DISTFILES += \
|
||||
assets/qml/PlatformDependent/*.qml \
|
||||
assets/qml/Panes/SetupPanes/Devices/*.qml \
|
||||
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
# Deploy files
|
||||
#-----------------------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
OTHER_FILES += \
|
||||
deploy/linux/* \
|
||||
|
@ -57,6 +57,7 @@
|
||||
<file>icons/multiplot.svg</file>
|
||||
<file>icons/new.svg</file>
|
||||
<file>icons/open.svg</file>
|
||||
<file>icons/paste.svg</file>
|
||||
<file>icons/plot.svg</file>
|
||||
<file>icons/points.svg</file>
|
||||
<file>icons/power.svg</file>
|
||||
@ -131,6 +132,7 @@
|
||||
<file>qml/ProjectEditor/JsonDatasetDelegate.qml</file>
|
||||
<file>qml/ProjectEditor/JsonGroupDelegate.qml</file>
|
||||
<file>qml/ProjectEditor/TreeView.qml</file>
|
||||
<file>qml/Widgets/GpsMap.qml</file>
|
||||
<file>qml/Widgets/Icon.qml</file>
|
||||
<file>qml/Widgets/JSONDropArea.qml</file>
|
||||
<file>qml/Widgets/Shadow.qml</file>
|
||||
@ -144,15 +146,13 @@
|
||||
<file>qml/Windows/MQTTConfiguration.qml</file>
|
||||
<file>qml/Windows/ProjectEditor.qml</file>
|
||||
<file>qml/main.qml</file>
|
||||
<file>scripts/frame-parser.js</file>
|
||||
<file>themes/1_Flat.json</file>
|
||||
<file>themes/2_Dark.json</file>
|
||||
<file>themes/3_Classic.json</file>
|
||||
<file>themes/4_Midnight.json</file>
|
||||
<file>themes/5_Noir.json</file>
|
||||
<file>themes/6_Mathworks.json</file>
|
||||
<file>touchbar/console.png</file>
|
||||
<file>touchbar/dashboard.png</file>
|
||||
<file>touchbar/setup.png</file>
|
||||
<file>translations/de.qm</file>
|
||||
<file>translations/de.ts</file>
|
||||
<file>translations/en.qm</file>
|
||||
@ -178,8 +178,5 @@
|
||||
<file>window-border/minimize.svg</file>
|
||||
<file>window-border/restore.svg</file>
|
||||
<file>window-border/unmaximize.svg</file>
|
||||
<file>icons/paste.svg</file>
|
||||
<file>scripts/frame-parser.js</file>
|
||||
<file>qml/Widgets/GpsMap.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -74,26 +74,6 @@ 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.
|
||||
|
||||
## QMapControl
|
||||
|
||||
Copyright (C) 2007 - 2008 Kai Winter
|
||||
|
||||
This program 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 QMapControl. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact e-mail: kaiwinter@gmx.de
|
||||
Program URL : http://qmapcontrol.sourceforge.net/
|
||||
|
||||
## qtcsv
|
||||
|
||||
Copyright © 2015 Antony Cherepanov (antony.cherepanov@gmail.com)
|
||||
@ -731,13 +711,6 @@ Everyone is permitted to copy and distribute copies of this Agreement, but in or
|
||||
|
||||
This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
|
||||
|
||||
## KDMacTouchBar
|
||||
|
||||
KDMacTouchBar is Copyright (C) 2019-2021 Klaralvdalens Datakonsult AB.
|
||||
|
||||
You may use, distribute and copy KDMacTouchBar under the terms of GNU Lesser General Public License version 3, which is displayed below.
|
||||
|
||||
You may even contact us at info@kdab.com for different licensing options.
|
||||
|
||||
### GNU Lesser General Public License
|
||||
|
||||
|
@ -24,5 +24,5 @@ MCU-Projekten, lesen Sie bitte das Wiki:
|
||||
|
||||
→ https://github.com/Serial-Studio/Serial-Studio/wiki
|
||||
|
||||
Tipp: Verwenden Sie den JSON-Editor zum Erstellen und Bearbeiten von
|
||||
Tipp: Verwenden Sie den Projekt-Editor zum Erstellen und Bearbeiten von
|
||||
Serial Studio-Projektdateien.
|
||||
|
@ -22,4 +22,4 @@ the wiki:
|
||||
|
||||
→ https://github.com/Serial-Studio/Serial-Studio/wiki
|
||||
|
||||
Tip: use the JSON Editor to create and edit Serial Studio project files.
|
||||
Tip: use the Project Editor to create and edit Serial Studio project files.
|
||||
|
@ -22,4 +22,4 @@ actuales, por favor lea la wiki:
|
||||
|
||||
→ https://github.com/Serial-Studio/Serial-Studio/wiki
|
||||
|
||||
Consejo: utilice el Editor JSON para crear y editar proyectos de Serial Studio.
|
||||
Consejo: utilice el Editor de Proyectos para crear y editar proyectos de Serial Studio.
|
||||
|
@ -114,22 +114,6 @@ Control {
|
||||
Cpp_ThemeManager.customWindowDecorations = checked
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Software rendering
|
||||
//
|
||||
Label {
|
||||
text: qsTr("Software rendering") + ": "
|
||||
} Switch {
|
||||
id: _softwareRendering
|
||||
Layout.leftMargin: -app.spacing
|
||||
Layout.alignment: Qt.AlignLeft
|
||||
checked: Cpp_ModuleManager.softwareRendering
|
||||
onCheckedChanged: {
|
||||
if (checked !== Cpp_ModuleManager.softwareRendering)
|
||||
Cpp_ModuleManager.setSoftwareRenderingEnabled(checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -55,28 +55,6 @@ Control {
|
||||
property alias consoleChecked: consoleBt.checked
|
||||
property alias dashboardChecked: dashboardBt.checked
|
||||
|
||||
//
|
||||
// Connections with mac touchbar
|
||||
//
|
||||
Connections {
|
||||
target: Cpp_Misc_MacExtras
|
||||
|
||||
function onSetupClicked() {
|
||||
setupBt.clicked()
|
||||
Cpp_Misc_MacExtras.setSetupChecked(setupBt.checked)
|
||||
}
|
||||
|
||||
function onConsoleClicked() {
|
||||
consoleBt.clicked()
|
||||
Cpp_Misc_MacExtras.setConsoleChecked(consoleBt.checked)
|
||||
}
|
||||
|
||||
function onDashboardClicked() {
|
||||
dashboardBt.clicked()
|
||||
Cpp_Misc_MacExtras.setDashboardChecked(dashboardBt.checked)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Toolbar shadow
|
||||
//
|
||||
@ -139,7 +117,6 @@ Control {
|
||||
palette.buttonText: Cpp_ThemeManager.menubarText
|
||||
palette.button: Cpp_ThemeManager.toolbarGradient1
|
||||
palette.window: Cpp_ThemeManager.toolbarGradient1
|
||||
onCheckedChanged: Cpp_Misc_MacExtras.setSetupChecked(checked)
|
||||
|
||||
background: Rectangle {
|
||||
radius: 3
|
||||
@ -174,7 +151,6 @@ Control {
|
||||
palette.buttonText: Cpp_ThemeManager.menubarText
|
||||
palette.button: Cpp_ThemeManager.toolbarGradient1
|
||||
palette.window: Cpp_ThemeManager.toolbarGradient1
|
||||
onCheckedChanged: Cpp_Misc_MacExtras.setConsoleChecked(checked)
|
||||
|
||||
background: Rectangle {
|
||||
radius: 3
|
||||
@ -210,8 +186,6 @@ Control {
|
||||
palette.buttonText: Cpp_ThemeManager.menubarText
|
||||
palette.button: Cpp_ThemeManager.toolbarGradient1
|
||||
palette.window: Cpp_ThemeManager.toolbarGradient1
|
||||
onCheckedChanged: Cpp_Misc_MacExtras.setDashboardChecked(checked)
|
||||
onEnabledChanged: Cpp_Misc_MacExtras.setDashboardEnabled(enabled)
|
||||
|
||||
background: Rectangle {
|
||||
radius: 3
|
||||
|
@ -38,12 +38,12 @@ Item {
|
||||
//
|
||||
// Access to dialogs & windows
|
||||
//
|
||||
property Windows.About aboutDialog: null
|
||||
property Windows.Donate donateDialog: null
|
||||
property Windows.MainWindow mainWindow: null
|
||||
property Windows.CsvPlayer csvPlayerDialog: null
|
||||
property Windows.ProjectEditor projectEditorWindow: null
|
||||
property Windows.Acknowledgements acknowledgementsDialog: null
|
||||
property Window aboutDialog: null
|
||||
property Window donateDialog: null
|
||||
property Window mainWindow: null
|
||||
property Window csvPlayerDialog: null
|
||||
property Window projectEditorWindow: null
|
||||
property Window acknowledgementsDialog: null
|
||||
|
||||
//
|
||||
// Check for updates (non-silent mode)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.1 KiB |
@ -8,5 +8,5 @@ StartupNotify=true
|
||||
Categories=Electronics;Engineering;Science;
|
||||
Icon=serial-studio
|
||||
X-AppImage-Name=Serial Studio
|
||||
X-AppImage-Version=2.0.0
|
||||
X-AppImage-Version=2.1.0
|
||||
X-AppImage-Arch=x86_64
|
||||
|
@ -31,7 +31,7 @@ Unicode True
|
||||
!define COMPANYNAME "Alex Spataru"
|
||||
!define DESCRIPTION "Multi-purpose data visualization & processing program"
|
||||
!define VERSIONMAJOR 2
|
||||
!define VERSIONMINOR 0
|
||||
!define VERSIONMINOR 1
|
||||
!define VERSIONBUILD 0
|
||||
!define MUI_ABORTWARNING
|
||||
!define INSTALL_DIR "$PROGRAMFILES64\${APPNAME}"
|
||||
|
7
libs/KDMacTouchBar/.gitignore
vendored
7
libs/KDMacTouchBar/.gitignore
vendored
@ -1,7 +0,0 @@
|
||||
Makefile
|
||||
*.moc
|
||||
*.o
|
||||
lib
|
||||
.qmake.cache
|
||||
.qmake.stash
|
||||
.DS_Store
|
@ -1,16 +0,0 @@
|
||||
CHECKSETS qt5,c++,foss
|
||||
|
||||
#KDAB-specific checks
|
||||
EXTRA kdabcopyright,kdabcontactus
|
||||
|
||||
#additional checks
|
||||
#EXTRA defines,null
|
||||
|
||||
#exclude checks now being done by clazy or clang-tools
|
||||
EXCLUDE strings,explicit,normalize,passbyvalue,operators,nullstrcompare,nullstrassign,doublequote_chars,qobject,sigsandslots,staticobjects
|
||||
#exclude more checks
|
||||
EXCLUDE style
|
||||
|
||||
#skip the borrowed code in the cmake subdir
|
||||
SKIP /cmake/Qt5Portability.cmake
|
||||
|
@ -1,46 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "")
|
||||
set(USE_DEFAULT_INSTALL_LOCATION True)
|
||||
else()
|
||||
set(USE_DEFAULT_INSTALL_LOCATION False)
|
||||
endif()
|
||||
|
||||
project(KDMacTouchBar CXX)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
set(${PROJECT_NAME}_VERSION_MAJOR 1)
|
||||
set(${PROJECT_NAME}_VERSION_MINOR 0)
|
||||
set(${PROJECT_NAME}_VERSION_PATCH 0)
|
||||
set(${PROJECT_NAME}_VERSION ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}.${${PROJECT_NAME}_VERSION_PATCH})
|
||||
|
||||
if(CMAKE_VERSION VERSION_LESS "3.1")
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||
endif ()
|
||||
else()
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
endif()
|
||||
|
||||
if(USE_DEFAULT_INSTALL_LOCATION)
|
||||
set(CMAKE_INSTALL_PREFIX "/usr/local/KDAB/${PROJECT_NAME}-${${PROJECT_NAME}_VERSION}" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
message(STATUS "Building ${PROJECT_NAME} ${${PROJECT_NAME}_VERSION} in ${CMAKE_BUILD_TYPE} mode. Installing to ${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
find_package(Qt5Core REQUIRED)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
|
||||
set(CMAKE_AUTOMOC TRUE)
|
||||
set(QT_LIBRARIES Qt5::Widgets)
|
||||
set(QT_USE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Qt5Portability.cmake")
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/KDMacTouchBarConfig.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake")
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(examples)
|
@ -1,175 +0,0 @@
|
||||
|
||||
KDMacTouchBar is Copyright (C) 2019-2021 Klaralvdalens Datakonsult AB.
|
||||
|
||||
You may use, distribute and copy KDMacTouchBar under the terms of
|
||||
GNU Lesser General Public License version 3, which is displayed below.
|
||||
|
||||
You may even contact us at info@kdab.com for different licensing options.
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
@ -1,64 +0,0 @@
|
||||
# KDMacTouchBar
|
||||
KDAB's Qt Widget for the Mac Touch Bar
|
||||
|
||||
## Introduction
|
||||
The KDMacTouchBar class wraps the native NSTouchBar class.
|
||||
|
||||
KDMacTouchBar provides a Qt-based API for NSTouchBar. The touchbar displays
|
||||
a number of QActions. Each QAction can have a text and an icon. Alternatively,
|
||||
the QActions might be separators (with or without text) or QWidgetActions.
|
||||
|
||||
Add actions by calling addAction(). Alternatively, you can use one of the
|
||||
convenience methods like addDialogButtonBox() or addTabBar() which provide
|
||||
common use cases.
|
||||
|
||||
If an action with a associated menu is added, its menu items are added as
|
||||
sub-touchbar. Showing sub-menus of this menu is not supported, due to macOS
|
||||
system restrictions.
|
||||
|
||||
## Usage:
|
||||
```
|
||||
QMainWindow *mw = ...;
|
||||
KDMacTouchBar *touchBar = new KDMacTouchBar(mw);
|
||||
touchBar->addAction(actionNewFile);
|
||||
touchBar->addSeparator();
|
||||
touchBar->addAction(actionSaveFile);
|
||||
```
|
||||
|
||||
## Licensing:
|
||||
KD MacTouchBar is (C) 2019-2021, Klarälvdalens Datakonsult AB,
|
||||
and is available under the terms of:
|
||||
|
||||
* the LGPL (see LICENSE.LGPL.txt for details)
|
||||
* the KDAB commercial license, provided that you buy a license.
|
||||
please contact info@kdab.com if you are interested in buying commercial licenses.
|
||||
|
||||
## Get Involved:
|
||||
KDAB will happily accept external contributions; however, **all**
|
||||
contributions will require a signed Contributor License Agreement
|
||||
(see docs/KDMacTouchBar-CopyrightAssignmentForm.pdf).
|
||||
|
||||
Contact info@kdab.com for more information.
|
||||
|
||||
Please submit your contributions or issue reports from our GitHub space at
|
||||
https://github.com/KDAB/KDMacTouchBar
|
||||
|
||||
## About KDAB
|
||||
KD MacTouchBar is supported and maintained by Klarälvdalens Datakonsult AB (KDAB).
|
||||
|
||||
The KDAB Group is the global No.1 software consultancy for Qt, C++ and
|
||||
OpenGL applications across desktop, embedded and mobile platforms.
|
||||
|
||||
The KDAB Group provides consulting and mentoring for developing Qt applications
|
||||
from scratch and in porting from all popular and legacy frameworks to Qt.
|
||||
We continue to help develop parts of Qt and are one of the major contributors
|
||||
to the Qt Project. We can give advanced or standard trainings anywhere
|
||||
around the globe on Qt as well as C++, OpenGL, 3D and more.
|
||||
|
||||
Please visit https://www.kdab.com to meet the people who write code like this.
|
||||
|
||||
Stay up-to-date with KDAB product announcements:
|
||||
|
||||
* [KDAB Newsletter](https://news.kdab.com)
|
||||
* [KDAB Blogs](https://www.kdab.com/category/blogs)
|
||||
* [KDAB on Twitter](https://twitter.com/KDABQt)
|
@ -1,2 +0,0 @@
|
||||
set(KDMacTouchBar_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/../KDMacTouchBar.framework/Headers)
|
||||
set(KDMacTouchBar_LIBRARIES ${CMAKE_CURRENT_LIST_DIR}/../KDMacTouchBar.framework/Versions/Current/KDMacTouchBar)
|
@ -1,32 +0,0 @@
|
||||
|
||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||
|
||||
if(QT_USE_QTNETWORK)
|
||||
find_package(Qt5Network REQUIRED)
|
||||
list(APPEND QT_LIBRARIES Qt5::Network)
|
||||
include_directories(${Qt5Network_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(QT_USE_QTXML)
|
||||
find_package(Qt5Xml REQUIRED)
|
||||
list(APPEND QT_LIBRARIES Qt5::Xml)
|
||||
include_directories(${Qt5Xml_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
if(QT_USE_QTTEST)
|
||||
find_package(Qt5Test REQUIRED)
|
||||
list(APPEND QT_LIBRARIES Qt5::Test)
|
||||
include_directories(${Qt5Test_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
macro(qt4_wrap_ui)
|
||||
qt5_wrap_ui(${ARGN})
|
||||
endmacro()
|
||||
|
||||
macro(qt4_wrap_cpp)
|
||||
qt5_wrap_cpp(${ARGN})
|
||||
endmacro()
|
||||
|
||||
macro(qt4_add_resources)
|
||||
qt5_add_resources(${ARGN})
|
||||
endmacro()
|
Binary file not shown.
@ -1 +0,0 @@
|
||||
add_subdirectory(mactouchbar)
|
@ -1,3 +0,0 @@
|
||||
TEMPLATE=subdirs
|
||||
|
||||
SUBDIRS=mactouchbar
|
@ -1,19 +0,0 @@
|
||||
include(${QT_USE_FILE})
|
||||
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_MACOSX_RPATH 1)
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
|
||||
add_executable(mactouchbar MACOSX_BUNDLE
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
mactouchbar.qrc)
|
||||
|
||||
include_directories(../../src)
|
||||
|
||||
install(TARGETS mactouchbar
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/examples/mactouchbar")
|
||||
|
||||
target_link_libraries(mactouchbar KDMacTouchBar)
|
@ -1,12 +0,0 @@
|
||||
QT += widgets
|
||||
|
||||
HEADERS += mainwindow.h
|
||||
SOURCES += mainwindow.cpp main.cpp
|
||||
RESOURCES += mactouchbar.qrc
|
||||
|
||||
INCLUDEPATH = ../../src
|
||||
LIBS += -F../../lib -framework KDMacTouchBar
|
||||
QMAKE_LFLAGS = '-Wl,-rpath,\'$$OUT_PWD/../../lib\',-rpath,\'$$INSTALL_PREFIX/lib\''
|
||||
|
||||
target.path = "$${INSTALL_PREFIX}/examples/mactouchbar"
|
||||
INSTALLS += target
|
@ -1,5 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>qtlogo.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,38 +0,0 @@
|
||||
/****************************************************************************
|
||||
** Copyright (C) 2019-2021 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com.
|
||||
** All rights reserved.
|
||||
**
|
||||
** This file is part of the KD MacTouchBar library.
|
||||
**
|
||||
** This file may be distributed and/or modified under the terms of the
|
||||
** GNU Lesser General Public License version 3 as published by the
|
||||
** Free Software Foundation and appearing in the file LICENSE.LGPL.txt included.
|
||||
**
|
||||
** You may even contact us at info@kdab.com for different licensing options.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
** Contact info@kdab.com if any conditions of this licensing are not
|
||||
** clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
|
||||
#include "kdmactouchbar.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// enable automatic message box on touchbar
|
||||
KDMacTouchBar::setAutomaticallyCreateMessageBoxTouchBar(true);
|
||||
|
||||
MainWindow mw;
|
||||
mw.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
/****************************************************************************
|
||||
** Copyright (C) 2019-2021 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com.
|
||||
** All rights reserved.
|
||||
**
|
||||
** This file is part of the KD MacTouchBar library.
|
||||
**
|
||||
** This file may be distributed and/or modified under the terms of the
|
||||
** GNU Lesser General Public License version 3 as published by the
|
||||
** Free Software Foundation and appearing in the file LICENSE.LGPL.txt included.
|
||||
**
|
||||
** You may even contact us at info@kdab.com for different licensing options.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
** Contact info@kdab.com if any conditions of this licensing are not
|
||||
** clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QtGui/QCloseEvent>
|
||||
|
||||
#include <QtWidgets/QAction>
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QLabel>
|
||||
|
||||
#include "kdmactouchbar.h"
|
||||
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
setWindowTitle("KDMacTouchBar Example");
|
||||
resize(400, 200);
|
||||
|
||||
// attach a touchbar to this window
|
||||
KDMacTouchBar *touchBar = new KDMacTouchBar(this);
|
||||
|
||||
QIcon qtIcon(QStringLiteral(":qtlogo.png"));
|
||||
|
||||
// add item
|
||||
QAction *action = new QAction(qtIcon, tr("Qt with touchbar"));
|
||||
touchBar->addAction(action);
|
||||
connect(action, &QAction::triggered, this, &MainWindow::activated);
|
||||
|
||||
// separator
|
||||
touchBar->addSeparator();
|
||||
touchBar->addSeparator()->setText(tr("More items:"));
|
||||
|
||||
// and more items
|
||||
QAction *action1 = new QAction(tr("Item 1"));
|
||||
touchBar->addAction(action1);
|
||||
connect(action1, &QAction::triggered, this, &MainWindow::activated);
|
||||
|
||||
QAction *action2 = new QAction(tr("Item 2"));
|
||||
touchBar->addAction(action2);
|
||||
connect(action2, &QAction::triggered, this, &MainWindow::activated);
|
||||
|
||||
// make special escape button
|
||||
QAction *quit = new QAction(tr("Quit"));
|
||||
touchBar->setEscapeAction(quit);
|
||||
connect(quit, &QAction::triggered, this, &QWidget::close);
|
||||
}
|
||||
|
||||
void MainWindow::activated()
|
||||
{
|
||||
QMessageBox::information(this, tr("Activated"), tr("You activated the touchbar action!"));
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
event->setAccepted(QMessageBox::question(this, tr("Quit"), tr("Do yo really want to quit?")) == QMessageBox::Yes);
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/****************************************************************************
|
||||
** Copyright (C) 2019-2021 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com.
|
||||
** All rights reserved.
|
||||
**
|
||||
** This file is part of the KD MacTouchBar library.
|
||||
**
|
||||
** This file may be distributed and/or modified under the terms of the
|
||||
** GNU Lesser General Public License version 3 as published by the
|
||||
** Free Software Foundation and appearing in the file LICENSE.LGPL.txt included.
|
||||
**
|
||||
** You may even contact us at info@kdab.com for different licensing options.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
** Contact info@kdab.com if any conditions of this licensing are not
|
||||
** clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef EX_MAINWINDOW_H
|
||||
#define EX_MAINWINDOW_H
|
||||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow();
|
||||
|
||||
public Q_SLOTS:
|
||||
void activated();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
};
|
||||
|
||||
#endif
|
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
@ -1,8 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
features.path = $$INSTALL_PREFIX/share/mkspecs/features
|
||||
features.files = *.prf
|
||||
|
||||
INSTALLS += features
|
||||
|
||||
OTHER_FILES = *.prf
|
@ -1,4 +0,0 @@
|
||||
LIBPATH=$$clean_path($$PWD/../../../lib)
|
||||
LIBS += -F$$LIBPATH -framework KDMacTouchBar
|
||||
QMAKE_LFLAGS += '-Wl,-rpath,\'$$LIBPATH\''
|
||||
INCLUDEPATH += $$LIBPATH/KDMacTouchBar.framework/Headers
|
@ -1 +0,0 @@
|
||||
VERSION = 1.0
|
@ -1,33 +0,0 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
include(kdmactouchbar.pri)
|
||||
|
||||
DEFAULT_INSTALL_PREFIX = /usr/local/KDAB/KDMacTouchBar-$$VERSION
|
||||
|
||||
isEmpty( KDMACTOUCHBAR_INSTALL_PREFIX ): KDMACTOUCHBAR_INSTALL_PREFIX=$$PREFIX
|
||||
|
||||
isEmpty( KDMACTOUCHBAR_INSTALL_PREFIX ): KDMACTOUCHBAR_INSTALL_PREFIX=$$DEFAULT_INSTALL_PREFIX
|
||||
|
||||
# if the default was either set by configure or set by the line above:
|
||||
equals( KDMACTOUCHBAR_INSTALL_PREFIX, $$DEFAULT_INSTALL_PREFIX ){
|
||||
INSTALL_PREFIX=$$DEFAULT_INSTALL_PREFIX
|
||||
message( "No install prefix given, using default of" $$DEFAULT_INSTALL_PREFIX (use configure.sh -prefix DIR to specify))
|
||||
} else {
|
||||
INSTALL_PREFIX=$$KDMACTOUCHBAR_INSTALL_PREFIX
|
||||
}
|
||||
|
||||
# This file is in the build directory (because "somecommand >> somefile" puts it there)
|
||||
QMAKE_CACHE = "$${OUT_PWD}/.qmake.cache"
|
||||
|
||||
MESSAGE = '\\'$$LITERAL_HASH\\' KDAB qmake cache file: following lines autogenerated during qmake run'
|
||||
system('echo $${MESSAGE} > $${QMAKE_CACHE}')
|
||||
|
||||
TMP_SOURCE_DIR = $${PWD}
|
||||
TMP_BUILD_DIR = $${OUT_PWD}
|
||||
system('echo TOP_SOURCE_DIR=$${TMP_SOURCE_DIR} >> $${QMAKE_CACHE}')
|
||||
system('echo TOP_BUILD_DIR=$${TMP_BUILD_DIR} >> $${QMAKE_CACHE}')
|
||||
system('echo INSTALL_PREFIX=$$INSTALL_PREFIX >> $${QMAKE_CACHE}')
|
||||
|
||||
SUBDIRS += src examples features
|
||||
|
||||
examples.depends = src
|
@ -1,24 +0,0 @@
|
||||
include(${QT_USE_FILE})
|
||||
|
||||
set(HEADERS kdmactouchbar.h
|
||||
kdmactouchbar_global.h)
|
||||
|
||||
add_definitions(-DKDMACTOUCHBAR_BUILD_KDMACTOUCHBAR_LIB -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNING)
|
||||
|
||||
add_library(KDMacTouchBar SHARED
|
||||
kdmactouchbar.mm
|
||||
${HEADERS})
|
||||
|
||||
install(TARGETS KDMacTouchBar
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
|
||||
target_link_libraries(KDMacTouchBar ${QT_LIBRARIES} "-framework Cocoa")
|
||||
|
||||
set_target_properties(KDMacTouchBar PROPERTIES
|
||||
FRAMEWORK TRUE
|
||||
FRAMEWORK_VERSION 1
|
||||
MACOSX_FRAMEWORK_IDENTIFIER com.kdab.KDMacTouchBar
|
||||
PUBLIC_HEADER "${HEADERS}"
|
||||
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib"
|
||||
MACOSX_RPATH TRUE
|
||||
)
|
@ -1,88 +0,0 @@
|
||||
/****************************************************************************
|
||||
** Copyright (C) 2019-2021 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com.
|
||||
** All rights reserved.
|
||||
**
|
||||
** This file is part of the KD MacTouchBar library.
|
||||
**
|
||||
** This file may be distributed and/or modified under the terms of the
|
||||
** GNU Lesser General Public License version 3 as published by the
|
||||
** Free Software Foundation and appearing in the file LICENSE.LGPL.txt included.
|
||||
**
|
||||
** You may even contact us at info@kdab.com for different licensing options.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
** Contact info@kdab.com if any conditions of this licensing are not
|
||||
** clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef KDMACTOUCHBAR_H
|
||||
#define KDMACTOUCHBAR_H
|
||||
|
||||
#include "kdmactouchbar_global.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QAction>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDialogButtonBox;
|
||||
class QMessageBox;
|
||||
class QTabBar;
|
||||
|
||||
|
||||
class KDMACTOUCHBAR_EXPORT KDMacTouchBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QAction *principialAction READ principialAction WRITE setPrincipialAction)
|
||||
Q_PROPERTY(QAction *escapeAction READ escapeAction WRITE setEscapeAction)
|
||||
Q_PROPERTY(TouchButtonStyle touchButtonStyle READ touchButtonStyle WRITE setTouchButtonStyle)
|
||||
public:
|
||||
explicit KDMacTouchBar(QWidget *parent = nullptr);
|
||||
explicit KDMacTouchBar(QMessageBox *messageBox);
|
||||
~KDMacTouchBar();
|
||||
|
||||
enum TouchButtonStyle
|
||||
{
|
||||
IconOnly,
|
||||
TextOnly,
|
||||
TextBesideIcon
|
||||
};
|
||||
|
||||
static void setAutomaticallyCreateMessageBoxTouchBar(bool automatic);
|
||||
static bool isAutomacicallyCreatingMessageBoxTouchBar();
|
||||
|
||||
QAction *addSeparator();
|
||||
QAction *addTabBar(QTabBar *tabBar);
|
||||
void removeTabBar(QTabBar *tabBar);
|
||||
|
||||
QAction *addMessageBox(QMessageBox *messageBox);
|
||||
void removeMessageBox(QMessageBox *messageBox);
|
||||
|
||||
QAction *addDialogButtonBox(QDialogButtonBox *buttonBox);
|
||||
void removeDialogButtonBox(QDialogButtonBox *buttonBox);
|
||||
|
||||
void setPrincipialAction(QAction *action);
|
||||
QAction *principialAction() const;
|
||||
|
||||
void setEscapeAction(QAction *action);
|
||||
QAction *escapeAction() const;
|
||||
|
||||
void setTouchButtonStyle(TouchButtonStyle touchButtonStyle);
|
||||
TouchButtonStyle touchButtonStyle() const;
|
||||
|
||||
void clear();
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
|
||||
private:
|
||||
class Private;
|
||||
Private *const d;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
@ -1,980 +0,0 @@
|
||||
/****************************************************************************
|
||||
** Copyright (C) 2019-2021 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com.
|
||||
** All rights reserved.
|
||||
**
|
||||
** This file is part of the KD MacTouchBar library.
|
||||
**
|
||||
** This file may be distributed and/or modified under the terms of the
|
||||
** GNU Lesser General Public License version 3 as published by the
|
||||
** Free Software Foundation and appearing in the file LICENSE.LGPL.txt included.
|
||||
**
|
||||
** You may even contact us at info@kdab.com for different licensing options.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
** Contact info@kdab.com if any conditions of this licensing are not
|
||||
** clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
#include "kdmactouchbar.h"
|
||||
|
||||
#include <QActionEvent>
|
||||
#include <QApplication>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLayout>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QPainter>
|
||||
#include <QPushButton>
|
||||
#include <QProxyStyle>
|
||||
#include <QStack>
|
||||
#include <QTabBar>
|
||||
#include <QTimer>
|
||||
#include <QWidgetAction>
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0);
|
||||
#else
|
||||
// defined in gui/painting/qcoregraphics.mm
|
||||
@interface NSImage (QtExtras)
|
||||
+ (instancetype)imageFromQIcon:(const QIcon &)icon;
|
||||
@end
|
||||
static NSImage *qt_mac_create_nsimage(const QIcon &icon)
|
||||
{
|
||||
return [NSImage imageFromQIcon:icon];
|
||||
}
|
||||
#endif
|
||||
|
||||
static QString identifierForAction(QObject *action)
|
||||
{
|
||||
return QStringLiteral("0x%1 %2")
|
||||
.arg((quintptr)action, QT_POINTER_SIZE * 2, 16, QLatin1Char('0'))
|
||||
.arg(action->objectName());
|
||||
}
|
||||
|
||||
|
||||
static QString removeMnemonics(const QString &original)
|
||||
{
|
||||
QString returnText(original.size(), QChar('\0'));
|
||||
int finalDest = 0;
|
||||
int currPos = 0;
|
||||
int l = original.length();
|
||||
while (l) {
|
||||
if (original.at(currPos) == QLatin1Char('&')) {
|
||||
++currPos;
|
||||
--l;
|
||||
if (l == 0)
|
||||
break;
|
||||
} else if (original.at(currPos) == QLatin1Char('(') && l >= 4 &&
|
||||
original.at(currPos + 1) == QLatin1Char('&') &&
|
||||
original.at(currPos + 2) != QLatin1Char('&') &&
|
||||
original.at(currPos + 3) == QLatin1Char(')')) {
|
||||
/* remove mnemonics its format is "\s*(&X)" */
|
||||
int n = 0;
|
||||
while (finalDest > n && returnText.at(finalDest - n - 1).isSpace())
|
||||
++n;
|
||||
finalDest -= n;
|
||||
currPos += 4;
|
||||
l -= 4;
|
||||
continue;
|
||||
}
|
||||
returnText[finalDest] = original.at(currPos);
|
||||
++currPos;
|
||||
++finalDest;
|
||||
--l;
|
||||
}
|
||||
returnText.truncate(finalDest);
|
||||
return returnText;
|
||||
}
|
||||
|
||||
class TabBarAction : public QAction
|
||||
{
|
||||
public:
|
||||
TabBarAction(QTabBar *tabBar, QObject *parent)
|
||||
: QAction(parent)
|
||||
{
|
||||
setData(QVariant::fromValue<QObject *>(tabBar));
|
||||
connect(tabBar, &QTabBar::currentChanged, this, &TabBarAction::sendDataChanged);
|
||||
connect(tabBar, &QObject::destroyed, this, &QObject::deleteLater);
|
||||
}
|
||||
|
||||
void sendDataChanged()
|
||||
{
|
||||
QActionEvent e(QEvent::ActionChanged, this);
|
||||
for (auto w : associatedWidgets())
|
||||
QApplication::sendEvent(w, &e);
|
||||
}
|
||||
};
|
||||
|
||||
class ButtonBoxAction : public QAction
|
||||
{
|
||||
public:
|
||||
ButtonBoxAction(QDialogButtonBox *buttonBox, QObject *parent)
|
||||
: QAction(parent)
|
||||
, mButtonBox(buttonBox)
|
||||
{
|
||||
setData(QVariant::fromValue<QObject *>(buttonBox));
|
||||
|
||||
checkStandardButtonAndTexts();
|
||||
|
||||
auto timer = new QTimer(buttonBox);
|
||||
timer->start(200);
|
||||
connect(timer, &QTimer::timeout, this, &ButtonBoxAction::checkStandardButtonAndTexts);
|
||||
connect(buttonBox, &QObject::destroyed, this, &QObject::deleteLater);
|
||||
}
|
||||
|
||||
void checkStandardButtonAndTexts()
|
||||
{
|
||||
QStringList buttonTexts;
|
||||
QPushButton *defaultButton = nullptr;
|
||||
for (auto b : mButtonBox->buttons()) {
|
||||
buttonTexts.append(b->text());
|
||||
if (auto pb = qobject_cast<QPushButton *>(b))
|
||||
if (pb->isDefault())
|
||||
defaultButton = pb;
|
||||
}
|
||||
|
||||
if (buttonTexts != mButtonTexts || defaultButton != mDefaultButton) {
|
||||
sendDataChanged();
|
||||
mButtonTexts = buttonTexts;
|
||||
mDefaultButton = defaultButton;
|
||||
}
|
||||
}
|
||||
|
||||
void sendDataChanged()
|
||||
{
|
||||
QActionEvent e(QEvent::ActionChanged, this);
|
||||
for (auto w : associatedWidgets())
|
||||
QApplication::sendEvent(w, &e);
|
||||
}
|
||||
|
||||
QDialogButtonBox *mButtonBox;
|
||||
QList<QAbstractButton *> mButtons;
|
||||
QPushButton *mDefaultButton = nullptr;
|
||||
QStringList mButtonTexts;
|
||||
};
|
||||
|
||||
@interface QObjectPointer : NSObject {
|
||||
}
|
||||
@property (readonly) QObject *qobject;
|
||||
@end
|
||||
|
||||
@implementation QObjectPointer
|
||||
QObject *_qobject;
|
||||
@synthesize qobject = _qobject;
|
||||
|
||||
- (id)initWithQObject:(QObject *)aQObject
|
||||
{
|
||||
self = [super init];
|
||||
_qobject = aQObject;
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
class WidgetActionContainerWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
WidgetActionContainerWidget(QWidget *widget, NSView *view)
|
||||
: w(widget)
|
||||
, v(view)
|
||||
{
|
||||
widget->setParent(this);
|
||||
widget->move(0, 0);
|
||||
if (!widget->testAttribute(Qt::WA_Resized))
|
||||
widget->resize(widget->sizeHint()
|
||||
.boundedTo(QSize(widget->maximumWidth(), 30))
|
||||
.expandedTo(widget->minimumSize()));
|
||||
setAttribute(Qt::WA_DontShowOnScreen);
|
||||
setAttribute(Qt::WA_QuitOnClose, false);
|
||||
ensurePolished();
|
||||
setVisible(true);
|
||||
QPixmap pm(1, 1);
|
||||
render(&pm, QPoint(), QRegion(),
|
||||
widget->autoFillBackground()
|
||||
? (QWidget::DrawWindowBackground | QWidget::DrawChildren)
|
||||
: QWidget::DrawChildren);
|
||||
}
|
||||
|
||||
QSize sizeHint() const { return w->size(); }
|
||||
|
||||
void resizeEvent(QResizeEvent *event) { w->resize(event->size()); }
|
||||
|
||||
bool event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::UpdateRequest)
|
||||
[v setNeedsDisplay:YES];
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
QWidget *w;
|
||||
NSView *v;
|
||||
};
|
||||
|
||||
@interface WidgetActionView : NSView
|
||||
@property WidgetActionContainerWidget *widget;
|
||||
@property QWidget *touchTarget;
|
||||
@property QWidgetAction *action;
|
||||
@property (readonly) NSSize intrinsicContentSize;
|
||||
@end
|
||||
|
||||
@implementation WidgetActionView
|
||||
@synthesize action;
|
||||
@synthesize widget;
|
||||
@synthesize touchTarget;
|
||||
|
||||
- (NSSize)intrinsicContentSize
|
||||
{
|
||||
return NSMakeSize(widget->width(), widget->height());
|
||||
}
|
||||
|
||||
- (id)initWithWidgetAction:(QWidgetAction *)wa
|
||||
{
|
||||
self = [super init];
|
||||
action = wa;
|
||||
widget = new WidgetActionContainerWidget(action->requestWidget(nullptr), self);
|
||||
if (!widget->testAttribute(Qt::WA_Resized))
|
||||
widget->resize(widget->sizeHint()
|
||||
.boundedTo(QSize(widget->maximumWidth(), 30))
|
||||
.expandedTo(widget->minimumSize()));
|
||||
[self setNeedsDisplay:YES];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
widget->w->setParent(0);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)drawRect:(NSRect)frame
|
||||
{
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
widget->w->resize(frame.size.width, frame.size.height);
|
||||
QPixmap pm(widget->w->size() * 2);
|
||||
pm.setDevicePixelRatio(2);
|
||||
pm.fill(Qt::transparent);
|
||||
widget->w->render(&pm, QPoint(), QRegion(),
|
||||
widget->w->autoFillBackground()
|
||||
? (QWidget::DrawWindowBackground | QWidget::DrawChildren)
|
||||
: QWidget::DrawChildren);
|
||||
CGImageRef cgImage = pm.toImage().toCGImage();
|
||||
NSImage *image = [[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize];
|
||||
[image drawInRect:frame];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
- (void)touchesBeganWithEvent:(NSEvent *)event
|
||||
{
|
||||
NSTouch *touch = [[event touchesMatchingPhase:NSTouchPhaseBegan inView:self] anyObject];
|
||||
const QPoint point = QPointF::fromCGPoint([touch locationInView:self]).toPoint();
|
||||
touchTarget = widget->childAt(point);
|
||||
if (touchTarget == nullptr)
|
||||
touchTarget = widget;
|
||||
QMouseEvent e(QEvent::MouseButtonPress, touchTarget->mapFrom(widget, point), Qt::LeftButton,
|
||||
Qt::LeftButton, Qt::NoModifier);
|
||||
qApp->sendEvent(touchTarget, &e);
|
||||
}
|
||||
- (void)touchesMovedWithEvent:(NSEvent *)event
|
||||
{
|
||||
NSTouch *touch = [[event touchesMatchingPhase:NSTouchPhaseMoved inView:self] anyObject];
|
||||
const QPoint point = QPointF::fromCGPoint([touch locationInView:self]).toPoint();
|
||||
QMouseEvent e(QEvent::MouseButtonPress, touchTarget->mapFrom(widget, point), Qt::LeftButton,
|
||||
Qt::LeftButton, Qt::NoModifier);
|
||||
qApp->sendEvent(touchTarget, &e);
|
||||
}
|
||||
- (void)touchesEndedWithEvent:(NSEvent *)event
|
||||
{
|
||||
NSTouch *touch = [[event touchesMatchingPhase:NSTouchPhaseEnded inView:self] anyObject];
|
||||
const QPoint point = QPointF::fromCGPoint([touch locationInView:self]).toPoint();
|
||||
QMouseEvent e(QEvent::MouseButtonRelease, touchTarget->mapFrom(widget, point), Qt::LeftButton,
|
||||
Qt::LeftButton, Qt::NoModifier);
|
||||
qApp->sendEvent(touchTarget, &e);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface DynamicTouchBarProviderDelegate : NSResponder <NSTouchBarDelegate>
|
||||
@property (strong) NSMutableDictionary *items;
|
||||
@end
|
||||
|
||||
@implementation DynamicTouchBarProviderDelegate
|
||||
@synthesize items;
|
||||
|
||||
- (id)initWithItems:(NSMutableDictionary *)i
|
||||
{
|
||||
self = [super init];
|
||||
self.items = i;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar
|
||||
makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier
|
||||
{
|
||||
Q_UNUSED(touchBar);
|
||||
|
||||
if ([self.items objectForKey:identifier] != nil)
|
||||
return [self.items objectForKey:identifier];
|
||||
|
||||
return nil;
|
||||
}
|
||||
@end
|
||||
|
||||
@interface DynamicTouchBarProvider
|
||||
: NSResponder <NSTouchBarProvider, NSApplicationDelegate, NSWindowDelegate>
|
||||
@property (strong) NSMutableDictionary *items;
|
||||
@property (strong) NSMutableDictionary *commands;
|
||||
@property (strong) NSObject *qtDelegate;
|
||||
@property (strong, readonly) NSTouchBar *touchBar;
|
||||
@property (strong) DynamicTouchBarProviderDelegate *delegate;
|
||||
@property KDMacTouchBar *qMacTouchBar;
|
||||
@property QStack<NSPopoverTouchBarItem *> openedPopOvers;
|
||||
@end
|
||||
|
||||
@implementation DynamicTouchBarProvider
|
||||
@synthesize items;
|
||||
@synthesize commands;
|
||||
@synthesize touchBar;
|
||||
@synthesize delegate;
|
||||
@synthesize qMacTouchBar;
|
||||
@synthesize openedPopOvers;
|
||||
|
||||
- (id)initWithKDMacTouchBar:(KDMacTouchBar *)bar
|
||||
{
|
||||
self = [super init];
|
||||
items = [[NSMutableDictionary alloc] init];
|
||||
commands = [[NSMutableDictionary alloc] init];
|
||||
qMacTouchBar = bar;
|
||||
delegate = [[DynamicTouchBarProviderDelegate alloc] initWithItems:items];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)addItem:(QAction *)action
|
||||
{
|
||||
// Create custom button item
|
||||
NSString *identifier = identifierForAction(action).toNSString();
|
||||
NSTouchBarItem *item = nil;
|
||||
NSView *view = nil;
|
||||
|
||||
if (auto wa = qobject_cast<QWidgetAction *>(action)) {
|
||||
NSPopoverTouchBarItem *i =
|
||||
[[[NSPopoverTouchBarItem alloc] initWithIdentifier:identifier] autorelease];
|
||||
item = i;
|
||||
view = [[WidgetActionView alloc] initWithWidgetAction:wa];
|
||||
i.collapsedRepresentation = view;
|
||||
} else if (auto tb = qobject_cast<QTabBar *>(action->data().value<QObject *>())) {
|
||||
NSCustomTouchBarItem *i =
|
||||
[[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier] autorelease];
|
||||
item = i;
|
||||
NSMutableArray *labels = [[NSMutableArray alloc] init];
|
||||
view =
|
||||
[[NSSegmentedControl segmentedControlWithLabels:labels
|
||||
trackingMode:NSSegmentSwitchTrackingSelectOne
|
||||
target:self
|
||||
action:@selector(tabBarAction:)] autorelease];
|
||||
i.view = view;
|
||||
} else if (auto bb = qobject_cast<QDialogButtonBox *>(action->data().value<QObject *>())) {
|
||||
NSMutableArray *buttonItems = [[NSMutableArray alloc] init];
|
||||
|
||||
for (int i = 0; i < bb->layout()->count(); ++i) {
|
||||
auto layoutItem = bb->layout()->itemAt(i);
|
||||
if (auto b = qobject_cast<QPushButton *>(layoutItem->widget())) {
|
||||
auto buttonIdentifier = identifierForAction(b).toNSString();
|
||||
NSCustomTouchBarItem *buttonItem = nil;
|
||||
NSButton *button = nil;
|
||||
if ([[items allKeys] containsObject:buttonIdentifier]) {
|
||||
buttonItem = [items objectForKey:buttonIdentifier];
|
||||
button = buttonItem.view;
|
||||
} else {
|
||||
buttonItem = [[NSCustomTouchBarItem alloc] initWithIdentifier:buttonIdentifier];
|
||||
button = [NSButton buttonWithTitle:removeMnemonics(b->text()).toNSString()
|
||||
target:self
|
||||
action:@selector(buttonAction:)];
|
||||
}
|
||||
if (b->isDefault())
|
||||
[button setKeyEquivalent:@"\r"];
|
||||
button.title = removeMnemonics(b->text()).toNSString();
|
||||
buttonItem.view = button;
|
||||
[buttonItems addObject:buttonItem];
|
||||
[commands setObject:[[QObjectPointer alloc] initWithQObject:b]
|
||||
forKey:[NSValue valueWithPointer:button]];
|
||||
[items setObject:buttonItem forKey:buttonIdentifier];
|
||||
}
|
||||
}
|
||||
|
||||
item = [[NSGroupTouchBarItem groupItemWithIdentifier:identifier items:buttonItems]
|
||||
autorelease];
|
||||
} else if (action->isSeparator()) {
|
||||
NSPopoverTouchBarItem *i =
|
||||
[[[NSPopoverTouchBarItem alloc] initWithIdentifier:identifier] autorelease];
|
||||
item = i;
|
||||
view = [NSTextField labelWithString:action->text().toNSString()];
|
||||
i.collapsedRepresentation = view;
|
||||
} else {
|
||||
NSPopoverTouchBarItem *i =
|
||||
[[[NSPopoverTouchBarItem alloc] initWithIdentifier:identifier] autorelease];
|
||||
item = i;
|
||||
view = [[NSButton buttonWithTitle:removeMnemonics(action->text()).toNSString()
|
||||
target:self
|
||||
action:@selector(itemAction:)] autorelease];
|
||||
i.collapsedRepresentation = view;
|
||||
}
|
||||
|
||||
if (view)
|
||||
[view retain];
|
||||
[item retain];
|
||||
|
||||
[items setObject:item forKey:identifier];
|
||||
[commands setObject:[[QObjectPointer alloc] initWithQObject:action]
|
||||
forKey:[NSValue valueWithPointer:view]];
|
||||
|
||||
if (!qobject_cast<QDialogButtonBox *>(action->data().value<QObject *>()))
|
||||
[self changeItem:action];
|
||||
else
|
||||
[self makeTouchBar];
|
||||
}
|
||||
|
||||
- (void)changeItem:(QAction *)action
|
||||
{
|
||||
NSString *identifier = identifierForAction(action).toNSString();
|
||||
|
||||
if (auto wa = qobject_cast<QWidgetAction *>(action)) {
|
||||
|
||||
} else if (auto tb = qobject_cast<QTabBar *>(action->data().value<QObject *>())) {
|
||||
NSCustomTouchBarItem *item = [items objectForKey:identifier];
|
||||
NSSegmentedControl *control = item.view;
|
||||
control.segmentCount = tb->count();
|
||||
for (int i = 0; i < tb->count(); ++i) {
|
||||
[control setLabel:tb->tabText(i).toNSString() forSegment:i];
|
||||
}
|
||||
control.selectedSegment = tb->currentIndex();
|
||||
} else if (auto bb = qobject_cast<QDialogButtonBox *>(action->data().value<QObject *>())) {
|
||||
// unfortunately we cannot modify a NSGroupTouchBarItem, so we
|
||||
// have to recreate it from scratch :-(
|
||||
int index = qMacTouchBar->actions().indexOf(action);
|
||||
if (index == qMacTouchBar->actions().count() - 1) {
|
||||
qMacTouchBar->removeAction(action);
|
||||
qMacTouchBar->addAction(action);
|
||||
} else {
|
||||
QAction *before = qMacTouchBar->actions().at(index + 1);
|
||||
qMacTouchBar->removeAction(action);
|
||||
qMacTouchBar->insertAction(before, action);
|
||||
}
|
||||
} else if (action->isSeparator()) {
|
||||
NSPopoverTouchBarItem *item = [items objectForKey:identifier];
|
||||
NSTextField *field = item.collapsedRepresentation;
|
||||
field.stringValue = action->text().toNSString();
|
||||
} else {
|
||||
NSPopoverTouchBarItem *item = [items objectForKey:identifier];
|
||||
NSButton *button = item.collapsedRepresentation;
|
||||
button.imagePosition = NSImageLeft;
|
||||
button.enabled = action->isEnabled();
|
||||
button.buttonType =
|
||||
action->isCheckable() ? NSButtonTypePushOnPushOff : NSButtonTypeAccelerator;
|
||||
button.bordered = action->isSeparator() && !action->text().isEmpty() ? NO : YES;
|
||||
button.highlighted = !button.bordered;
|
||||
button.state = action->isChecked();
|
||||
button.hidden = !action->isVisible();
|
||||
button.image = qt_mac_create_nsimage(action->icon());
|
||||
button.title = removeMnemonics(action->text()).toNSString();
|
||||
switch (qMacTouchBar->touchButtonStyle())
|
||||
{
|
||||
case KDMacTouchBar::IconOnly:
|
||||
button.imagePosition = NSImageOnly;
|
||||
break;
|
||||
case KDMacTouchBar::TextOnly:
|
||||
button.imagePosition = NSNoImage;
|
||||
break;
|
||||
case KDMacTouchBar::TextBesideIcon:
|
||||
button.imagePosition = NSImageLeft;
|
||||
break;
|
||||
}
|
||||
item.showsCloseButton = action->menu() != nullptr;
|
||||
if (action->menu()) {
|
||||
item.popoverTouchBar = [[NSTouchBar alloc] init];
|
||||
item.popoverTouchBar.delegate = delegate;
|
||||
// Add ordered items array
|
||||
NSMutableArray *array = [[NSMutableArray alloc] init];
|
||||
for (auto action : action->menu()->actions()) {
|
||||
if (action->isVisible()) {
|
||||
[self addItem:action];
|
||||
if (action->isSeparator() && action->text().isEmpty())
|
||||
[array addObject:NSTouchBarItemIdentifierFixedSpaceLarge];
|
||||
else
|
||||
[array addObject:identifierForAction(action).toNSString()];
|
||||
}
|
||||
}
|
||||
item.popoverTouchBar.defaultItemIdentifiers = array;
|
||||
}
|
||||
}
|
||||
|
||||
[self makeTouchBar];
|
||||
}
|
||||
|
||||
- (void)removeItem:(QAction *)action
|
||||
{
|
||||
NSString *identifier = identifierForAction(action).toNSString();
|
||||
NSPopoverTouchBarItem *item = [items objectForKey:identifier];
|
||||
if (item == nil)
|
||||
return;
|
||||
QObjectPointer *command = [commands objectForKey:[NSValue valueWithPointer:item.view]];
|
||||
[commands removeObjectForKey:[NSValue valueWithPointer:item.view]];
|
||||
[items removeObjectForKey:identifier];
|
||||
[command release];
|
||||
|
||||
[self makeTouchBar];
|
||||
}
|
||||
|
||||
- (void)buttonAction:(id)sender
|
||||
{
|
||||
QObjectPointer *qobjectPointer =
|
||||
(QObjectPointer *)[commands objectForKey:[NSValue valueWithPointer:sender]];
|
||||
// Missing entry in commands dict. Should not really happen, but does
|
||||
if (!qobjectPointer)
|
||||
return;
|
||||
|
||||
QPushButton *button = qobject_cast<QPushButton *>(qobjectPointer.qobject);
|
||||
if (!button)
|
||||
return;
|
||||
|
||||
button->click();
|
||||
}
|
||||
|
||||
- (void)tabBarAction:(id)sender
|
||||
{
|
||||
QObjectPointer *qobjectPointer =
|
||||
(QObjectPointer *)[commands objectForKey:[NSValue valueWithPointer:sender]];
|
||||
// Missing entry in commands dict. Should not really happen, but does
|
||||
if (!qobjectPointer)
|
||||
return;
|
||||
|
||||
// Check for deleted QObject
|
||||
if (!qobjectPointer.qobject)
|
||||
return;
|
||||
|
||||
QAction *action = static_cast<QAction *>(qobjectPointer.qobject);
|
||||
if (!action)
|
||||
return;
|
||||
QTabBar *tabBar = qobject_cast<QTabBar *>(action->data().value<QObject *>());
|
||||
if (!tabBar)
|
||||
return;
|
||||
|
||||
NSString *identifier = identifierForAction(action).toNSString();
|
||||
NSCustomTouchBarItem *item = [items objectForKey:identifier];
|
||||
NSSegmentedControl *control = item.view;
|
||||
|
||||
tabBar->setCurrentIndex(control.selectedSegment);
|
||||
}
|
||||
|
||||
- (void)itemAction:(id)sender
|
||||
{
|
||||
QObjectPointer *qobjectPointer =
|
||||
(QObjectPointer *)[commands objectForKey:[NSValue valueWithPointer:sender]];
|
||||
// Missing entry in commands dict. Should not really happen, but does
|
||||
if (!qobjectPointer)
|
||||
return;
|
||||
|
||||
// Check for deleted QObject
|
||||
if (!qobjectPointer.qobject)
|
||||
return;
|
||||
|
||||
QAction *action = static_cast<QAction *>(qobjectPointer.qobject);
|
||||
if (!action || action->isSeparator())
|
||||
return;
|
||||
if (!action->isEnabled())
|
||||
return;
|
||||
action->activate(QAction::Trigger);
|
||||
|
||||
if (action->menu()) {
|
||||
NSString *identifier = identifierForAction(action).toNSString();
|
||||
NSPopoverTouchBarItem *item = [items objectForKey:identifier];
|
||||
[item showPopover:item];
|
||||
openedPopOvers.push(item);
|
||||
} else {
|
||||
while (!openedPopOvers.isEmpty()) {
|
||||
auto poppedItem = openedPopOvers.pop();
|
||||
[poppedItem dismissPopover:poppedItem];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)clearItems
|
||||
{
|
||||
[items removeAllObjects];
|
||||
[commands removeAllObjects];
|
||||
}
|
||||
|
||||
- (NSTouchBar *)makeTouchBar
|
||||
{
|
||||
// Create the touch bar with this instance as its delegate
|
||||
if (touchBar == nil) {
|
||||
touchBar = [[NSTouchBar alloc] init];
|
||||
touchBar.delegate = delegate;
|
||||
}
|
||||
|
||||
// Add ordered items array
|
||||
NSMutableArray *array = [[NSMutableArray alloc] init];
|
||||
for (auto action : qMacTouchBar->actions()) {
|
||||
if (action->isVisible()) {
|
||||
if (action->isSeparator() && action->text().isEmpty())
|
||||
[array addObject:NSTouchBarItemIdentifierFixedSpaceLarge];
|
||||
else
|
||||
[array addObject:identifierForAction(action).toNSString()];
|
||||
}
|
||||
}
|
||||
touchBar.defaultItemIdentifiers = array;
|
||||
|
||||
return touchBar;
|
||||
}
|
||||
|
||||
- (void)installAsDelegateForWindow:(NSWindow *)window
|
||||
{
|
||||
_qtDelegate = window.delegate; // Save current delegate for forwarding
|
||||
window.delegate = self;
|
||||
}
|
||||
|
||||
- (void)installAsDelegateForApplication:(NSApplication *)application
|
||||
{
|
||||
_qtDelegate = application.delegate; // Save current delegate for forwarding
|
||||
application.delegate = self;
|
||||
}
|
||||
|
||||
- (BOOL)respondsToSelector:(SEL)aSelector
|
||||
{
|
||||
// We want to forward to the qt delegate. Respond to selectors it
|
||||
// responds to in addition to selectors this instance resonds to.
|
||||
return [_qtDelegate respondsToSelector:aSelector] || [super respondsToSelector:aSelector];
|
||||
}
|
||||
|
||||
- (void)forwardInvocation:(NSInvocation *)anInvocation
|
||||
{
|
||||
// Forward to the existing delegate. This function is only called for selectors
|
||||
// this instance does not responds to, which means that the qt delegate
|
||||
// must respond to it (due to the respondsToSelector implementation above).
|
||||
[anInvocation invokeWithTarget:_qtDelegate];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
class KDMacTouchBar::Private
|
||||
{
|
||||
public:
|
||||
DynamicTouchBarProvider *touchBarProvider = nil;
|
||||
QAction *principialAction = nullptr;
|
||||
QAction *escapeAction = nullptr;
|
||||
KDMacTouchBar::TouchButtonStyle touchButtonStyle = TextBesideIcon;
|
||||
|
||||
static bool automaticallyCreateMessageBoxTouchBar;
|
||||
};
|
||||
|
||||
bool KDMacTouchBar::Private::automaticallyCreateMessageBoxTouchBar = false;
|
||||
|
||||
class AutomaticMessageBoxTouchBarStyle : public QProxyStyle
|
||||
{
|
||||
public:
|
||||
using QProxyStyle::QProxyStyle;
|
||||
|
||||
void polish(QWidget *w) override
|
||||
{
|
||||
if (auto mb = qobject_cast<QMessageBox *>(w)) {
|
||||
if (KDMacTouchBar::isAutomacicallyCreatingMessageBoxTouchBar())
|
||||
new KDMacTouchBar(mb);
|
||||
}
|
||||
QProxyStyle::polish(w);
|
||||
}
|
||||
};
|
||||
|
||||
/*!
|
||||
\class KDMacTouchBar
|
||||
\brief The KDMacTouchBar class wraps the native NSTouchBar class.
|
||||
|
||||
KDMacTouchBar provides a Qt-based API for NSTouchBar. The touchbar displays
|
||||
a number of QActions. Each QAction can have a text and an icon. Alternatively,
|
||||
the QActions might be separators (with or without text) or QWidgetActions.
|
||||
|
||||
Add actions by calling addAction(). Alternatively, you can use one of the
|
||||
convenience methods like addDialogButtonBox() or addTabBar() which provide
|
||||
common use cases.
|
||||
|
||||
If an action with a associated menu is added, its menu items are added as
|
||||
sub-touchbar. Showing sub-menus of this menu is not supported, due to macOS
|
||||
system restrictions.
|
||||
|
||||
Usage: (QtWidgets)
|
||||
\code
|
||||
QMainWindow *mw = ...;
|
||||
KDMacTouchBar *touchBar = new KDMacTouchBar(mw);
|
||||
touchBar->addAction(actionNewFile);
|
||||
touchBar->addSeparator();
|
||||
touchBar->addAction(actionSaveFile);
|
||||
\endcode
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum KDMacTouchBar::TouchButtonStyle
|
||||
\value IconOnly Only display the icon.
|
||||
\value TextOnly Only display the text.
|
||||
\value TextBesideIcon The text appears beside the icon.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs a KDMacTouchBar for the window of \a parent. If \a parent is
|
||||
nullptr, the KDMacTouchBar is shown as soon as this QApplication has focus,
|
||||
if no other window with an own KDMacTouchBar has focus.
|
||||
*/
|
||||
KDMacTouchBar::KDMacTouchBar(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, d(new Private)
|
||||
{
|
||||
d->touchBarProvider = [[DynamicTouchBarProvider alloc] initWithKDMacTouchBar:this];
|
||||
if (parent) {
|
||||
NSView *view = reinterpret_cast<NSView *>(parent->window()->winId());
|
||||
[d->touchBarProvider installAsDelegateForWindow:[view window]];
|
||||
} else {
|
||||
[d->touchBarProvider installAsDelegateForApplication:[NSApplication sharedApplication]];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a KDMacTouchBar containing the QDialogButtonBox from inside of
|
||||
\a messageBox.
|
||||
*/
|
||||
KDMacTouchBar::KDMacTouchBar(QMessageBox *messageBox)
|
||||
: QWidget( messageBox)
|
||||
, d(new Private)
|
||||
{
|
||||
d->touchBarProvider = [[DynamicTouchBarProvider alloc] initWithKDMacTouchBar:this];
|
||||
NSView *view = reinterpret_cast<NSView *>(messageBox->window()->winId());
|
||||
[d->touchBarProvider installAsDelegateForWindow:[view window]];
|
||||
setPrincipialAction(addMessageBox(messageBox));
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroys the touch bar.
|
||||
*/
|
||||
KDMacTouchBar::~KDMacTouchBar()
|
||||
{
|
||||
[d->touchBarProvider release];
|
||||
delete d;
|
||||
}
|
||||
|
||||
/*!
|
||||
This static convenience method controls, whether KDMacTouchBar will
|
||||
automatically create a touchbar for QMessageBox instances. The
|
||||
created touchbar contains the buttons of the message box.
|
||||
This enables to use the static QMessageBox method and still having
|
||||
a touchbar for them.
|
||||
|
||||
\note When you enable this setting for the first time, KDMacTouchBar will
|
||||
install a QProxyStyle into the QApplication object to be able to create
|
||||
the KDMacTouchBar in its polish method. The installed QProxyStyle will
|
||||
use the existing application style as base style.
|
||||
*/
|
||||
void KDMacTouchBar::setAutomaticallyCreateMessageBoxTouchBar(bool automatic)
|
||||
{
|
||||
static AutomaticMessageBoxTouchBarStyle *touchStyle = nullptr;
|
||||
if (automatic && !touchStyle) {
|
||||
qApp->setStyle(touchStyle = new AutomaticMessageBoxTouchBarStyle(qApp->style()));
|
||||
}
|
||||
Private::automaticallyCreateMessageBoxTouchBar = automatic;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns whether KDMacTouchBar automatically creates a touchbar for
|
||||
QMessageBox instances.
|
||||
*/
|
||||
bool KDMacTouchBar::isAutomacicallyCreatingMessageBoxTouchBar()
|
||||
{
|
||||
return Private::automaticallyCreateMessageBoxTouchBar;
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds a separator item to the end of the touch bar.
|
||||
*/
|
||||
QAction *KDMacTouchBar::addSeparator()
|
||||
{
|
||||
auto action = new QAction(this);
|
||||
action->setSeparator(true);
|
||||
addAction(action);
|
||||
return action;
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
bool KDMacTouchBar::event(QEvent *event)
|
||||
{
|
||||
switch (event->type()) {
|
||||
case QEvent::ActionAdded:
|
||||
[d->touchBarProvider addItem:static_cast<QActionEvent *>(event)->action()];
|
||||
break;
|
||||
case QEvent::ActionChanged:
|
||||
[d->touchBarProvider changeItem:static_cast<QActionEvent *>(event)->action()];
|
||||
break;
|
||||
case QEvent::ActionRemoved:
|
||||
[d->touchBarProvider removeItem:static_cast<QActionEvent *>(event)->action()];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds a button group controlling a \a tabBar item to the end of the touch bar.
|
||||
*/
|
||||
QAction *KDMacTouchBar::addTabBar(QTabBar *tabBar)
|
||||
{
|
||||
auto a = new TabBarAction(tabBar, this);
|
||||
addAction(a);
|
||||
return a;
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes \a tabBar from the touch bar.
|
||||
*/
|
||||
void KDMacTouchBar::removeTabBar(QTabBar *tabBar)
|
||||
{
|
||||
for (auto a : actions()) {
|
||||
if (a->data().value<QObject *>() == tabBar) {
|
||||
removeAction(a);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds the QDialogButtonBox of \a messageBox to the end of the touch bar.
|
||||
*/
|
||||
QAction *KDMacTouchBar::addMessageBox(QMessageBox *messageBox)
|
||||
{
|
||||
return addDialogButtonBox(messageBox->findChild<QDialogButtonBox *>(QStringLiteral("qt_msgbox_buttonbox")));
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes the QDialogButtonBox of \a messageBox from the touch bar.
|
||||
*/
|
||||
void KDMacTouchBar::removeMessageBox(QMessageBox *messageBox)
|
||||
{
|
||||
return removeDialogButtonBox(messageBox->findChild<QDialogButtonBox *>(QStringLiteral("qt_msgbox_buttonbox")));
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds a button group controlling \a buttonBox to the end of the touch bar.
|
||||
*/
|
||||
QAction *KDMacTouchBar::addDialogButtonBox(QDialogButtonBox *buttonBox)
|
||||
{
|
||||
auto a = new ButtonBoxAction(buttonBox, this);
|
||||
addAction(a);
|
||||
return a;
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes the \a buttonBox from the touch bar.
|
||||
*/
|
||||
void KDMacTouchBar::removeDialogButtonBox(QDialogButtonBox *buttonBox)
|
||||
{
|
||||
for (auto a : actions()) {
|
||||
if (a->data().value<QObject *>() == buttonBox) {
|
||||
removeAction(a);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\property KDMacTouchBar::principialAction
|
||||
\brief the principial action of the touch bar
|
||||
|
||||
The principial action of the touch bar is the QAction you want the system
|
||||
to center in the touch bar.
|
||||
|
||||
You need to add the action to the touch bar before you can set it as principial
|
||||
action.
|
||||
*/
|
||||
void KDMacTouchBar::setPrincipialAction(QAction *action)
|
||||
{
|
||||
d->principialAction = action;
|
||||
d->touchBarProvider.touchBar.principalItemIdentifier = action ? identifierForAction(action).toNSString() : nil;
|
||||
}
|
||||
|
||||
QAction *KDMacTouchBar::principialAction() const
|
||||
{
|
||||
return d->principialAction;
|
||||
}
|
||||
|
||||
/*!
|
||||
\property KDMacTouchBar::escapeAction
|
||||
\brief the action used as system escape key action
|
||||
|
||||
By setting a QAction as escapeAction, it is possible to replace the system
|
||||
escape key with a random action.
|
||||
|
||||
You don't need to add the action to the touch bar before you can set it as
|
||||
escape action.
|
||||
*/
|
||||
void KDMacTouchBar::setEscapeAction(QAction *action)
|
||||
{
|
||||
if (d->escapeAction == action)
|
||||
return;
|
||||
if (d->escapeAction)
|
||||
[d->touchBarProvider removeItem:d->escapeAction];
|
||||
d->escapeAction = action;
|
||||
if (d->escapeAction) {
|
||||
[d->touchBarProvider addItem:d->escapeAction];
|
||||
d->touchBarProvider.touchBar.escapeKeyReplacementItemIdentifier =
|
||||
identifierForAction(action).toNSString();
|
||||
} else
|
||||
d->touchBarProvider.touchBar.escapeKeyReplacementItemIdentifier = nil;
|
||||
}
|
||||
|
||||
QAction *KDMacTouchBar::escapeAction() const
|
||||
{
|
||||
return d->escapeAction;
|
||||
}
|
||||
|
||||
/*!
|
||||
\property KDMacTouchBar::touchButtonStyle
|
||||
This property holds the style of touch bar buttons.
|
||||
|
||||
This property defines the style of all touch buttons that are added as QActions.
|
||||
Added tab widgets, dialog button boxes, message boxes or QWidgetActions won't
|
||||
follow this style.
|
||||
|
||||
The default is KDMacTouchBar::TextBesideIcon
|
||||
*/
|
||||
void KDMacTouchBar::setTouchButtonStyle(TouchButtonStyle touchButtonStyle)
|
||||
{
|
||||
if (d->touchButtonStyle == touchButtonStyle)
|
||||
return;
|
||||
|
||||
d->touchButtonStyle = touchButtonStyle;
|
||||
|
||||
for (auto* action : actions())
|
||||
[d->touchBarProvider changeItem:action];
|
||||
if (d->escapeAction)
|
||||
[d->touchBarProvider changeItem:d->escapeAction];
|
||||
}
|
||||
|
||||
KDMacTouchBar::TouchButtonStyle KDMacTouchBar::touchButtonStyle() const
|
||||
{
|
||||
return d->touchButtonStyle;
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes all actions from the touch bar. Removes even the escapeAction.
|
||||
The principialAction is cleared.
|
||||
*/
|
||||
void KDMacTouchBar::clear()
|
||||
{
|
||||
setEscapeAction(nullptr);
|
||||
setPrincipialAction(nullptr);
|
||||
for (auto* action : actions())
|
||||
removeAction(action);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
@ -1,33 +0,0 @@
|
||||
/****************************************************************************
|
||||
** Copyright (C) 2019-2021 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com.
|
||||
** All rights reserved.
|
||||
**
|
||||
** This file is part of the KD MacTouchBar library.
|
||||
**
|
||||
** This file may be distributed and/or modified under the terms of the
|
||||
** GNU Lesser General Public License version 3 as published by the
|
||||
** Free Software Foundation and appearing in the file LICENSE.LGPL.txt included.
|
||||
**
|
||||
** You may even contact us at info@kdab.com for different licensing options.
|
||||
**
|
||||
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
**
|
||||
** Contact info@kdab.com if any conditions of this licensing are not
|
||||
** clear to you.
|
||||
**
|
||||
**********************************************************************/
|
||||
#ifndef KDMACTOUCHBAR_GLOBAL_H
|
||||
#define KDMACTOUCHBAR_GLOBAL_H
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
#ifdef KDMACTOUCHBAR_BUILD_KDMACTOUCHBAR_LIB
|
||||
# define KDMACTOUCHBAR_EXPORT Q_DECL_EXPORT
|
||||
#elif defined(KDMACTOUCHBAR_BUILD_KDMACTOUCHBAR_SRC)
|
||||
# define KDMACTOUCHBAR_EXPORT
|
||||
#else
|
||||
# define KDMACTOUCHBAR_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif /* KDMACTOUCHBAR_GLOBAL_H */
|
@ -1,28 +0,0 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = KDMacTouchBar
|
||||
QT += widgets
|
||||
|
||||
include($${TOP_SOURCE_DIR}/kdmactouchbar.pri)
|
||||
|
||||
CONFIG += lib_bundle
|
||||
|
||||
DESTDIR = ../lib
|
||||
|
||||
SOURCES = kdmactouchbar.mm
|
||||
|
||||
HEADERS = kdmactouchbar.h kdmactouchbar_global.h
|
||||
|
||||
LIBS += -framework Cocoa
|
||||
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/
|
||||
|
||||
DEFINES += KDMACTOUCHBAR_BUILD_KDMACTOUCHBAR_LIB QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNING
|
||||
|
||||
target.path = "$${INSTALL_PREFIX}/lib"
|
||||
|
||||
INSTALLS += target
|
||||
|
||||
FRAMEWORK_HEADERS.version = Versions
|
||||
FRAMEWORK_HEADERS.files = $$HEADERS
|
||||
FRAMEWORK_HEADERS.path = Headers
|
||||
QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS
|
||||
QMAKE_TARGET_BUNDLE_PREFIX = "com.kdab"
|
11
libs/Libraries.pri
vendored
11
libs/Libraries.pri
vendored
@ -49,14 +49,3 @@ include($$PWD/OpenSSL/OpenSSL.pri)
|
||||
include($$PWD/QRealFourier/QRealFourier.pri)
|
||||
include($$PWD/QSimpleUpdater/QSimpleUpdater.pri)
|
||||
include($$PWD/QSourceHighlite/QSourceHighlite.pri)
|
||||
|
||||
macx* {
|
||||
DEFINES += KDMACTOUCHBAR_BUILD_KDMACTOUCHBAR_SRC
|
||||
LIBS += -framework Cocoa
|
||||
INCLUDEPATH += $$PWD/KDMacTouchBar/src
|
||||
SOURCES += \
|
||||
$$PWD/KDMacTouchBar/src/kdmactouchbar.mm
|
||||
HEADERS += \
|
||||
$$PWD/KDMacTouchBar/src/kdmactouchbar.h \
|
||||
$$PWD/KDMacTouchBar/src/kdmactouchbar_global.h
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -16,33 +16,44 @@
|
||||
#ifdef VPAES_ASM
|
||||
int vpaes_set_encrypt_key(const unsigned char *userKey, int bits, AES_KEY *key);
|
||||
int vpaes_set_decrypt_key(const unsigned char *userKey, int bits, AES_KEY *key);
|
||||
void vpaes_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
|
||||
void vpaes_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
|
||||
void vpaes_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t length,
|
||||
const AES_KEY *key, unsigned char *ivec, int enc);
|
||||
void vpaes_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
void vpaes_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
void vpaes_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key, unsigned char *ivec,
|
||||
int enc);
|
||||
#endif /* VPAES_ASM */
|
||||
|
||||
#ifdef BSAES_ASM
|
||||
void ossl_bsaes_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t length,
|
||||
const AES_KEY *key, unsigned char ivec[16], int enc);
|
||||
void ossl_bsaes_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const AES_KEY *key, const unsigned char ivec[16]);
|
||||
void ossl_bsaes_xts_encrypt(const unsigned char *inp, unsigned char *out, size_t len,
|
||||
const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16]);
|
||||
void ossl_bsaes_xts_decrypt(const unsigned char *inp, unsigned char *out, size_t len,
|
||||
const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16]);
|
||||
void ossl_bsaes_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char ivec[16], int enc);
|
||||
void ossl_bsaes_ctr32_encrypt_blocks(const unsigned char *in,
|
||||
unsigned char *out, size_t len,
|
||||
const AES_KEY *key,
|
||||
const unsigned char ivec[16]);
|
||||
void ossl_bsaes_xts_encrypt(const unsigned char *inp, unsigned char *out,
|
||||
size_t len, const AES_KEY *key1,
|
||||
const AES_KEY *key2, const unsigned char iv[16]);
|
||||
void ossl_bsaes_xts_decrypt(const unsigned char *inp, unsigned char *out,
|
||||
size_t len, const AES_KEY *key1,
|
||||
const AES_KEY *key2, const unsigned char iv[16]);
|
||||
#endif /* BSAES_ASM */
|
||||
|
||||
#ifdef AES_CTR_ASM
|
||||
void AES_ctr32_encrypt(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const AES_KEY *key, const unsigned char ivec[AES_BLOCK_SIZE]);
|
||||
void AES_ctr32_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const AES_KEY *key,
|
||||
const unsigned char ivec[AES_BLOCK_SIZE]);
|
||||
#endif /* AES_CTR_ASM */
|
||||
|
||||
#ifdef AES_XTS_ASM
|
||||
void AES_xts_encrypt(const unsigned char *inp, unsigned char *out, size_t len, const AES_KEY *key1,
|
||||
const AES_KEY *key2, const unsigned char iv[16]);
|
||||
void AES_xts_decrypt(const unsigned char *inp, unsigned char *out, size_t len, const AES_KEY *key1,
|
||||
const AES_KEY *key2, const unsigned char iv[16]);
|
||||
void AES_xts_encrypt(const unsigned char *inp, unsigned char *out, size_t len,
|
||||
const AES_KEY *key1, const AES_KEY *key2,
|
||||
const unsigned char iv[16]);
|
||||
void AES_xts_decrypt(const unsigned char *inp, unsigned char *out, size_t len,
|
||||
const AES_KEY *key1, const AES_KEY *key2,
|
||||
const unsigned char iv[16]);
|
||||
#endif /* AES_XTS_ASM */
|
||||
|
||||
#if defined(OPENSSL_CPUID_OBJ)
|
||||
@ -64,10 +75,12 @@ void AES_xts_decrypt(const unsigned char *inp, unsigned char *out, size_t len, c
|
||||
# define PPC_AES_GCM_CAPABLE (OPENSSL_ppccap_P & PPC_MADD300)
|
||||
# define AES_GCM_ENC_BYTES 128
|
||||
# define AES_GCM_DEC_BYTES 128
|
||||
size_t ppc_aes_gcm_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key,
|
||||
unsigned char ivec[16], u64 *Xi);
|
||||
size_t ppc_aes_gcm_decrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key,
|
||||
unsigned char ivec[16], u64 *Xi);
|
||||
size_t ppc_aes_gcm_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key, unsigned char ivec[16],
|
||||
u64 *Xi);
|
||||
size_t ppc_aes_gcm_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key, unsigned char ivec[16],
|
||||
u64 *Xi);
|
||||
# define AES_GCM_ASM_PPC(gctx) \
|
||||
((gctx)->ctr == aes_p8_ctr32_encrypt_blocks \
|
||||
&& (gctx)->gcm.funcs.ghash == gcm_ghash_p8)
|
||||
@ -106,46 +119,66 @@ void gcm_ghash_p8(u64 Xi[2], const u128 Htable[16], const u8 *inp, size_t len);
|
||||
# define AES_GCM_ASM(gctx) \
|
||||
((gctx)->ctr == aes_v8_ctr32_encrypt_blocks \
|
||||
&& (gctx)->gcm.funcs.ghash == gcm_ghash_v8)
|
||||
size_t aes_gcm_enc_128_kernel(const uint8_t *plaintext, uint64_t plaintext_length,
|
||||
uint8_t *ciphertext, uint64_t *Xi, unsigned char ivec[16],
|
||||
size_t aes_gcm_enc_128_kernel(const uint8_t *plaintext,
|
||||
uint64_t plaintext_length, uint8_t *ciphertext,
|
||||
uint64_t *Xi, unsigned char ivec[16],
|
||||
const void *key);
|
||||
size_t aes_gcm_enc_192_kernel(const uint8_t *plaintext, uint64_t plaintext_length,
|
||||
uint8_t *ciphertext, uint64_t *Xi, unsigned char ivec[16],
|
||||
size_t aes_gcm_enc_192_kernel(const uint8_t *plaintext,
|
||||
uint64_t plaintext_length, uint8_t *ciphertext,
|
||||
uint64_t *Xi, unsigned char ivec[16],
|
||||
const void *key);
|
||||
size_t aes_gcm_enc_256_kernel(const uint8_t *plaintext, uint64_t plaintext_length,
|
||||
uint8_t *ciphertext, uint64_t *Xi, unsigned char ivec[16],
|
||||
size_t aes_gcm_enc_256_kernel(const uint8_t *plaintext,
|
||||
uint64_t plaintext_length, uint8_t *ciphertext,
|
||||
uint64_t *Xi, unsigned char ivec[16],
|
||||
const void *key);
|
||||
size_t aes_gcm_dec_128_kernel(const uint8_t *ciphertext, uint64_t plaintext_length,
|
||||
uint8_t *plaintext, uint64_t *Xi, unsigned char ivec[16],
|
||||
size_t aes_gcm_dec_128_kernel(const uint8_t *ciphertext,
|
||||
uint64_t plaintext_length, uint8_t *plaintext,
|
||||
uint64_t *Xi, unsigned char ivec[16],
|
||||
const void *key);
|
||||
size_t aes_gcm_dec_192_kernel(const uint8_t *ciphertext, uint64_t plaintext_length,
|
||||
uint8_t *plaintext, uint64_t *Xi, unsigned char ivec[16],
|
||||
size_t aes_gcm_dec_192_kernel(const uint8_t *ciphertext,
|
||||
uint64_t plaintext_length, uint8_t *plaintext,
|
||||
uint64_t *Xi, unsigned char ivec[16],
|
||||
const void *key);
|
||||
size_t aes_gcm_dec_256_kernel(const uint8_t *ciphertext, uint64_t plaintext_length,
|
||||
uint8_t *plaintext, uint64_t *Xi, unsigned char ivec[16],
|
||||
size_t aes_gcm_dec_256_kernel(const uint8_t *ciphertext,
|
||||
uint64_t plaintext_length, uint8_t *plaintext,
|
||||
uint64_t *Xi, unsigned char ivec[16],
|
||||
const void *key);
|
||||
size_t unroll8_eor3_aes_gcm_enc_128_kernel(const uint8_t *plaintext, uint64_t plaintext_length,
|
||||
size_t unroll8_eor3_aes_gcm_enc_128_kernel(const uint8_t *plaintext,
|
||||
uint64_t plaintext_length,
|
||||
uint8_t *ciphertext, uint64_t *Xi,
|
||||
unsigned char ivec[16], const void *key);
|
||||
size_t unroll8_eor3_aes_gcm_enc_192_kernel(const uint8_t *plaintext, uint64_t plaintext_length,
|
||||
unsigned char ivec[16],
|
||||
const void *key);
|
||||
size_t unroll8_eor3_aes_gcm_enc_192_kernel(const uint8_t *plaintext,
|
||||
uint64_t plaintext_length,
|
||||
uint8_t *ciphertext, uint64_t *Xi,
|
||||
unsigned char ivec[16], const void *key);
|
||||
size_t unroll8_eor3_aes_gcm_enc_256_kernel(const uint8_t *plaintext, uint64_t plaintext_length,
|
||||
unsigned char ivec[16],
|
||||
const void *key);
|
||||
size_t unroll8_eor3_aes_gcm_enc_256_kernel(const uint8_t *plaintext,
|
||||
uint64_t plaintext_length,
|
||||
uint8_t *ciphertext, uint64_t *Xi,
|
||||
unsigned char ivec[16], const void *key);
|
||||
size_t unroll8_eor3_aes_gcm_dec_128_kernel(const uint8_t *ciphertext, uint64_t plaintext_length,
|
||||
uint8_t *plaintext, uint64_t *Xi, unsigned char ivec[16],
|
||||
unsigned char ivec[16],
|
||||
const void *key);
|
||||
size_t unroll8_eor3_aes_gcm_dec_192_kernel(const uint8_t *ciphertext, uint64_t plaintext_length,
|
||||
uint8_t *plaintext, uint64_t *Xi, unsigned char ivec[16],
|
||||
size_t unroll8_eor3_aes_gcm_dec_128_kernel(const uint8_t *ciphertext,
|
||||
uint64_t plaintext_length,
|
||||
uint8_t *plaintext, uint64_t *Xi,
|
||||
unsigned char ivec[16],
|
||||
const void *key);
|
||||
size_t unroll8_eor3_aes_gcm_dec_256_kernel(const uint8_t *ciphertext, uint64_t plaintext_length,
|
||||
uint8_t *plaintext, uint64_t *Xi, unsigned char ivec[16],
|
||||
size_t unroll8_eor3_aes_gcm_dec_192_kernel(const uint8_t *ciphertext,
|
||||
uint64_t plaintext_length,
|
||||
uint8_t *plaintext, uint64_t *Xi,
|
||||
unsigned char ivec[16],
|
||||
const void *key);
|
||||
size_t armv8_aes_gcm_encrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const void *key, unsigned char ivec[16], u64 *Xi);
|
||||
size_t armv8_aes_gcm_decrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const void *key, unsigned char ivec[16], u64 *Xi);
|
||||
size_t unroll8_eor3_aes_gcm_dec_256_kernel(const uint8_t *ciphertext,
|
||||
uint64_t plaintext_length,
|
||||
uint8_t *plaintext, uint64_t *Xi,
|
||||
unsigned char ivec[16],
|
||||
const void *key);
|
||||
size_t armv8_aes_gcm_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16], u64 *Xi);
|
||||
size_t armv8_aes_gcm_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16], u64 *Xi);
|
||||
void gcm_ghash_v8(u64 Xi[2], const u128 Htable[16], const u8 *inp, size_t len);
|
||||
# endif
|
||||
# endif
|
||||
@ -153,7 +186,8 @@ void gcm_ghash_v8(u64 Xi[2], const u128 Htable[16], const u8 *inp, size_t len);
|
||||
#endif /* OPENSSL_CPUID_OBJ */
|
||||
|
||||
#if defined(AES_ASM) \
|
||||
&& (defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64))
|
||||
&& (defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) \
|
||||
|| defined(_M_X64))
|
||||
# define AES_CBC_HMAC_SHA_CAPABLE 1
|
||||
# define AESNI_CBC_HMAC_SHA_CAPABLE (OPENSSL_ia32cap_P[1] & (1 << (57 - 32)))
|
||||
#endif
|
||||
@ -166,8 +200,10 @@ void gcm_ghash_v8(u64 Xi[2], const u128 Htable[16], const u8 *inp, size_t len);
|
||||
#endif
|
||||
|
||||
#if defined(AES_ASM) && !defined(I386_ONLY) \
|
||||
&& (((defined(__i386) || defined(__i386__) || defined(_M_IX86)) && defined(OPENSSL_IA32_SSE2)) \
|
||||
|| defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64))
|
||||
&& (((defined(__i386) || defined(__i386__) || defined(_M_IX86)) \
|
||||
&& defined(OPENSSL_IA32_SSE2)) \
|
||||
|| defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) \
|
||||
|| defined(_M_X64))
|
||||
|
||||
/* AES-NI section */
|
||||
|
||||
@ -185,50 +221,64 @@ void gcm_ghash_v8(u64 Xi[2], const u128 Htable[16], const u8 *inp, size_t len);
|
||||
int aesni_set_encrypt_key(const unsigned char *userKey, int bits, AES_KEY *key);
|
||||
int aesni_set_decrypt_key(const unsigned char *userKey, int bits, AES_KEY *key);
|
||||
|
||||
void aesni_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
|
||||
void aesni_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
|
||||
void aesni_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
void aesni_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
|
||||
void aesni_ecb_encrypt(const unsigned char *in, unsigned char *out, size_t length,
|
||||
const AES_KEY *key, int enc);
|
||||
void aesni_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t length,
|
||||
const AES_KEY *key, unsigned char *ivec, int enc);
|
||||
void aesni_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key, int enc);
|
||||
void aesni_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key, unsigned char *ivec,
|
||||
int enc);
|
||||
# ifndef OPENSSL_NO_OCB
|
||||
void aesni_ocb_encrypt(const unsigned char *in, unsigned char *out, size_t blocks, const void *key,
|
||||
size_t start_block_num, unsigned char offset_i[16],
|
||||
const unsigned char L_[][16], unsigned char checksum[16]);
|
||||
void aesni_ocb_decrypt(const unsigned char *in, unsigned char *out, size_t blocks, const void *key,
|
||||
size_t start_block_num, unsigned char offset_i[16],
|
||||
const unsigned char L_[][16], unsigned char checksum[16]);
|
||||
void aesni_ocb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const void *key, size_t start_block_num,
|
||||
unsigned char offset_i[16], const unsigned char L_[][16],
|
||||
unsigned char checksum[16]);
|
||||
void aesni_ocb_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const void *key, size_t start_block_num,
|
||||
unsigned char offset_i[16], const unsigned char L_[][16],
|
||||
unsigned char checksum[16]);
|
||||
# endif /* OPENSSL_NO_OCB */
|
||||
|
||||
void aesni_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const void *key, const unsigned char *ivec);
|
||||
void aesni_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const void *key,
|
||||
const unsigned char *ivec);
|
||||
|
||||
void aesni_xts_encrypt(const unsigned char *in, unsigned char *out, size_t length,
|
||||
const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16]);
|
||||
void aesni_xts_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key1, const AES_KEY *key2,
|
||||
const unsigned char iv[16]);
|
||||
|
||||
void aesni_xts_decrypt(const unsigned char *in, unsigned char *out, size_t length,
|
||||
const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16]);
|
||||
void aesni_xts_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key1, const AES_KEY *key2,
|
||||
const unsigned char iv[16]);
|
||||
|
||||
void aesni_ccm64_encrypt_blocks(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const void *key, const unsigned char ivec[16],
|
||||
void aesni_ccm64_encrypt_blocks(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const void *key,
|
||||
const unsigned char ivec[16],
|
||||
unsigned char cmac[16]);
|
||||
|
||||
void aesni_ccm64_decrypt_blocks(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const void *key, const unsigned char ivec[16],
|
||||
void aesni_ccm64_decrypt_blocks(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const void *key,
|
||||
const unsigned char ivec[16],
|
||||
unsigned char cmac[16]);
|
||||
|
||||
# if defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64)
|
||||
size_t aesni_gcm_encrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key,
|
||||
unsigned char ivec[16], u64 *Xi);
|
||||
size_t aesni_gcm_decrypt(const unsigned char *in, unsigned char *out, size_t len, const void *key,
|
||||
unsigned char ivec[16], u64 *Xi);
|
||||
# if defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) \
|
||||
|| defined(_M_X64)
|
||||
size_t aesni_gcm_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key, unsigned char ivec[16],
|
||||
u64 *Xi);
|
||||
size_t aesni_gcm_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key, unsigned char ivec[16],
|
||||
u64 *Xi);
|
||||
void gcm_ghash_avx(u64 Xi[2], const u128 Htable[16], const u8 *in, size_t len);
|
||||
|
||||
# define AES_gcm_encrypt aesni_gcm_encrypt
|
||||
# define AES_gcm_decrypt aesni_gcm_decrypt
|
||||
# define AES_GCM_ASM(ctx) \
|
||||
(ctx->ctr == aesni_ctr32_encrypt_blocks && ctx->gcm.funcs.ghash == gcm_ghash_avx)
|
||||
(ctx->ctr == aesni_ctr32_encrypt_blocks \
|
||||
&& ctx->gcm.funcs.ghash == gcm_ghash_avx)
|
||||
# endif
|
||||
|
||||
#elif defined(AES_ASM) && (defined(__sparc) || defined(__sparc__))
|
||||
@ -247,8 +297,10 @@ void gcm_ghash_avx(u64 Xi[2], const u128 Htable[16], const u8 *in, size_t len);
|
||||
|
||||
void aes_t4_set_encrypt_key(const unsigned char *key, int bits, AES_KEY *ks);
|
||||
void aes_t4_set_decrypt_key(const unsigned char *key, int bits, AES_KEY *ks);
|
||||
void aes_t4_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
|
||||
void aes_t4_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
|
||||
void aes_t4_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
void aes_t4_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
/*
|
||||
* Key-length specific subroutines were chosen for following reason.
|
||||
* Each SPARC T4 core can execute up to 8 threads which share core's
|
||||
@ -260,32 +312,45 @@ void aes_t4_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *
|
||||
* acceptable, while latter means code size increase to size occupied
|
||||
* by multiple key-length specific subroutines, so why fight?
|
||||
*/
|
||||
void aes128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const AES_KEY *key, unsigned char *ivec, int /*unused*/);
|
||||
void aes128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const AES_KEY *key, unsigned char *ivec, int /*unused*/);
|
||||
void aes192_t4_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const AES_KEY *key, unsigned char *ivec, int /*unused*/);
|
||||
void aes192_t4_cbc_decrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const AES_KEY *key, unsigned char *ivec, int /*unused*/);
|
||||
void aes256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const AES_KEY *key, unsigned char *ivec, int /*unused*/);
|
||||
void aes256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const AES_KEY *key, unsigned char *ivec, int /*unused*/);
|
||||
void aes128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const AES_KEY *key, unsigned char *ivec);
|
||||
void aes192_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const AES_KEY *key, unsigned char *ivec);
|
||||
void aes256_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const AES_KEY *key, unsigned char *ivec);
|
||||
void aes128_t4_xts_encrypt(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const AES_KEY *key1, const AES_KEY *key2, const unsigned char *ivec);
|
||||
void aes128_t4_xts_decrypt(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const AES_KEY *key1, const AES_KEY *key2, const unsigned char *ivec);
|
||||
void aes256_t4_xts_encrypt(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const AES_KEY *key1, const AES_KEY *key2, const unsigned char *ivec);
|
||||
void aes256_t4_xts_decrypt(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const AES_KEY *key1, const AES_KEY *key2, const unsigned char *ivec);
|
||||
void aes128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key, unsigned char *ivec,
|
||||
int /*unused*/);
|
||||
void aes128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key, unsigned char *ivec,
|
||||
int /*unused*/);
|
||||
void aes192_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key, unsigned char *ivec,
|
||||
int /*unused*/);
|
||||
void aes192_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key, unsigned char *ivec,
|
||||
int /*unused*/);
|
||||
void aes256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key, unsigned char *ivec,
|
||||
int /*unused*/);
|
||||
void aes256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const AES_KEY *key, unsigned char *ivec,
|
||||
int /*unused*/);
|
||||
void aes128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const AES_KEY *key,
|
||||
unsigned char *ivec);
|
||||
void aes192_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const AES_KEY *key,
|
||||
unsigned char *ivec);
|
||||
void aes256_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const AES_KEY *key,
|
||||
unsigned char *ivec);
|
||||
void aes128_t4_xts_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const AES_KEY *key1,
|
||||
const AES_KEY *key2, const unsigned char *ivec);
|
||||
void aes128_t4_xts_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const AES_KEY *key1,
|
||||
const AES_KEY *key2, const unsigned char *ivec);
|
||||
void aes256_t4_xts_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const AES_KEY *key1,
|
||||
const AES_KEY *key2, const unsigned char *ivec);
|
||||
void aes256_t4_xts_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const AES_KEY *key1,
|
||||
const AES_KEY *key2, const unsigned char *ivec);
|
||||
|
||||
#elif defined(OPENSSL_CPUID_OBJ) && defined(__s390__)
|
||||
/* IBM S390X support */
|
||||
@ -295,9 +360,12 @@ void aes256_t4_xts_decrypt(const unsigned char *in, unsigned char *out, size_t b
|
||||
# define S390X_AES_FC(keylen) (S390X_AES_128 + ((((keylen) << 3) - 128) >> 6))
|
||||
|
||||
/* Most modes of operation need km for partial block processing. */
|
||||
# define S390X_aes_128_CAPABLE (OPENSSL_s390xcap_P.km[0] & S390X_CAPBIT(S390X_AES_128))
|
||||
# define S390X_aes_192_CAPABLE (OPENSSL_s390xcap_P.km[0] & S390X_CAPBIT(S390X_AES_192))
|
||||
# define S390X_aes_256_CAPABLE (OPENSSL_s390xcap_P.km[0] & S390X_CAPBIT(S390X_AES_256))
|
||||
# define S390X_aes_128_CAPABLE \
|
||||
(OPENSSL_s390xcap_P.km[0] & S390X_CAPBIT(S390X_AES_128))
|
||||
# define S390X_aes_192_CAPABLE \
|
||||
(OPENSSL_s390xcap_P.km[0] & S390X_CAPBIT(S390X_AES_192))
|
||||
# define S390X_aes_256_CAPABLE \
|
||||
(OPENSSL_s390xcap_P.km[0] & S390X_CAPBIT(S390X_AES_256))
|
||||
|
||||
# define S390X_aes_128_cbc_CAPABLE 1 /* checked by callee */
|
||||
# define S390X_aes_192_cbc_CAPABLE 1
|
||||
@ -308,21 +376,30 @@ void aes256_t4_xts_decrypt(const unsigned char *in, unsigned char *out, size_t b
|
||||
# define S390X_aes_256_ecb_CAPABLE S390X_aes_256_CAPABLE
|
||||
|
||||
# define S390X_aes_128_ofb_CAPABLE \
|
||||
(S390X_aes_128_CAPABLE && (OPENSSL_s390xcap_P.kmo[0] & S390X_CAPBIT(S390X_AES_128)))
|
||||
(S390X_aes_128_CAPABLE \
|
||||
&& (OPENSSL_s390xcap_P.kmo[0] & S390X_CAPBIT(S390X_AES_128)))
|
||||
# define S390X_aes_192_ofb_CAPABLE \
|
||||
(S390X_aes_192_CAPABLE && (OPENSSL_s390xcap_P.kmo[0] & S390X_CAPBIT(S390X_AES_192)))
|
||||
(S390X_aes_192_CAPABLE \
|
||||
&& (OPENSSL_s390xcap_P.kmo[0] & S390X_CAPBIT(S390X_AES_192)))
|
||||
# define S390X_aes_256_ofb_CAPABLE \
|
||||
(S390X_aes_256_CAPABLE && (OPENSSL_s390xcap_P.kmo[0] & S390X_CAPBIT(S390X_AES_256)))
|
||||
(S390X_aes_256_CAPABLE \
|
||||
&& (OPENSSL_s390xcap_P.kmo[0] & S390X_CAPBIT(S390X_AES_256)))
|
||||
|
||||
# define S390X_aes_128_cfb_CAPABLE \
|
||||
(S390X_aes_128_CAPABLE && (OPENSSL_s390xcap_P.kmf[0] & S390X_CAPBIT(S390X_AES_128)))
|
||||
(S390X_aes_128_CAPABLE \
|
||||
&& (OPENSSL_s390xcap_P.kmf[0] & S390X_CAPBIT(S390X_AES_128)))
|
||||
# define S390X_aes_192_cfb_CAPABLE \
|
||||
(S390X_aes_192_CAPABLE && (OPENSSL_s390xcap_P.kmf[0] & S390X_CAPBIT(S390X_AES_192)))
|
||||
(S390X_aes_192_CAPABLE \
|
||||
&& (OPENSSL_s390xcap_P.kmf[0] & S390X_CAPBIT(S390X_AES_192)))
|
||||
# define S390X_aes_256_cfb_CAPABLE \
|
||||
(S390X_aes_256_CAPABLE && (OPENSSL_s390xcap_P.kmf[0] & S390X_CAPBIT(S390X_AES_256)))
|
||||
# define S390X_aes_128_cfb8_CAPABLE (OPENSSL_s390xcap_P.kmf[0] & S390X_CAPBIT(S390X_AES_128))
|
||||
# define S390X_aes_192_cfb8_CAPABLE (OPENSSL_s390xcap_P.kmf[0] & S390X_CAPBIT(S390X_AES_192))
|
||||
# define S390X_aes_256_cfb8_CAPABLE (OPENSSL_s390xcap_P.kmf[0] & S390X_CAPBIT(S390X_AES_256))
|
||||
(S390X_aes_256_CAPABLE \
|
||||
&& (OPENSSL_s390xcap_P.kmf[0] & S390X_CAPBIT(S390X_AES_256)))
|
||||
# define S390X_aes_128_cfb8_CAPABLE \
|
||||
(OPENSSL_s390xcap_P.kmf[0] & S390X_CAPBIT(S390X_AES_128))
|
||||
# define S390X_aes_192_cfb8_CAPABLE \
|
||||
(OPENSSL_s390xcap_P.kmf[0] & S390X_CAPBIT(S390X_AES_192))
|
||||
# define S390X_aes_256_cfb8_CAPABLE \
|
||||
(OPENSSL_s390xcap_P.kmf[0] & S390X_CAPBIT(S390X_AES_256))
|
||||
# define S390X_aes_128_cfb1_CAPABLE 0
|
||||
# define S390X_aes_192_cfb1_CAPABLE 0
|
||||
# define S390X_aes_256_cfb1_CAPABLE 0
|
||||
@ -335,18 +412,24 @@ void aes256_t4_xts_decrypt(const unsigned char *in, unsigned char *out, size_t b
|
||||
# define S390X_aes_256_xts_CAPABLE 1
|
||||
|
||||
# define S390X_aes_128_gcm_CAPABLE \
|
||||
(S390X_aes_128_CAPABLE && (OPENSSL_s390xcap_P.kma[0] & S390X_CAPBIT(S390X_AES_128)))
|
||||
(S390X_aes_128_CAPABLE \
|
||||
&& (OPENSSL_s390xcap_P.kma[0] & S390X_CAPBIT(S390X_AES_128)))
|
||||
# define S390X_aes_192_gcm_CAPABLE \
|
||||
(S390X_aes_192_CAPABLE && (OPENSSL_s390xcap_P.kma[0] & S390X_CAPBIT(S390X_AES_192)))
|
||||
(S390X_aes_192_CAPABLE \
|
||||
&& (OPENSSL_s390xcap_P.kma[0] & S390X_CAPBIT(S390X_AES_192)))
|
||||
# define S390X_aes_256_gcm_CAPABLE \
|
||||
(S390X_aes_256_CAPABLE && (OPENSSL_s390xcap_P.kma[0] & S390X_CAPBIT(S390X_AES_256)))
|
||||
(S390X_aes_256_CAPABLE \
|
||||
&& (OPENSSL_s390xcap_P.kma[0] & S390X_CAPBIT(S390X_AES_256)))
|
||||
|
||||
# define S390X_aes_128_ccm_CAPABLE \
|
||||
(S390X_aes_128_CAPABLE && (OPENSSL_s390xcap_P.kmac[0] & S390X_CAPBIT(S390X_AES_128)))
|
||||
(S390X_aes_128_CAPABLE \
|
||||
&& (OPENSSL_s390xcap_P.kmac[0] & S390X_CAPBIT(S390X_AES_128)))
|
||||
# define S390X_aes_192_ccm_CAPABLE \
|
||||
(S390X_aes_192_CAPABLE && (OPENSSL_s390xcap_P.kmac[0] & S390X_CAPBIT(S390X_AES_192)))
|
||||
(S390X_aes_192_CAPABLE \
|
||||
&& (OPENSSL_s390xcap_P.kmac[0] & S390X_CAPBIT(S390X_AES_192)))
|
||||
# define S390X_aes_256_ccm_CAPABLE \
|
||||
(S390X_aes_256_CAPABLE && (OPENSSL_s390xcap_P.kmac[0] & S390X_CAPBIT(S390X_AES_256)))
|
||||
(S390X_aes_256_CAPABLE \
|
||||
&& (OPENSSL_s390xcap_P.kmac[0] & S390X_CAPBIT(S390X_AES_256)))
|
||||
# define S390X_CCM_AAD_FLAG 0x40
|
||||
|
||||
# ifndef OPENSSL_NO_OCB
|
||||
@ -368,53 +451,73 @@ void aes256_t4_xts_decrypt(const unsigned char *in, unsigned char *out, size_t b
|
||||
# include "riscv_arch.h"
|
||||
# define RV64I_ZKND_ZKNE_CAPABLE (RISCV_HAS_ZKND() && RISCV_HAS_ZKNE())
|
||||
|
||||
int rv64i_zkne_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
|
||||
int rv64i_zknd_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
|
||||
void rv64i_zkne_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
|
||||
void rv64i_zknd_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
|
||||
int rv64i_zkne_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
int rv64i_zknd_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
void rv64i_zkne_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
void rv64i_zknd_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
#elif defined(OPENSSL_CPUID_OBJ) && defined(__riscv) && __riscv_xlen == 32
|
||||
/* RISC-V 32 support */
|
||||
# include "riscv_arch.h"
|
||||
# define RV32I_ZKND_ZKNE_CAPABLE (RISCV_HAS_ZKND() && RISCV_HAS_ZKNE())
|
||||
# define RV32I_ZBKB_ZKND_ZKNE_CAPABLE (RV32I_ZKND_ZKNE_CAPABLE && RISCV_HAS_ZBKB())
|
||||
# define RV32I_ZBKB_ZKND_ZKNE_CAPABLE \
|
||||
(RV32I_ZKND_ZKNE_CAPABLE && RISCV_HAS_ZBKB())
|
||||
|
||||
int rv32i_zkne_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
|
||||
/* set_decrypt_key needs both zknd and zkne */
|
||||
int rv32i_zknd_zkne_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
|
||||
int rv32i_zbkb_zkne_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
|
||||
int rv32i_zbkb_zknd_zkne_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
int rv32i_zkne_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
void rv32i_zkne_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
|
||||
void rv32i_zknd_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
|
||||
/* set_decrypt_key needs both zknd and zkne */
|
||||
int rv32i_zknd_zkne_set_decrypt_key(const unsigned char *userKey,
|
||||
const int bits, AES_KEY *key);
|
||||
int rv32i_zbkb_zkne_set_encrypt_key(const unsigned char *userKey,
|
||||
const int bits, AES_KEY *key);
|
||||
int rv32i_zbkb_zknd_zkne_set_decrypt_key(const unsigned char *userKey,
|
||||
const int bits, AES_KEY *key);
|
||||
void rv32i_zkne_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
void rv32i_zknd_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
#endif
|
||||
|
||||
#if defined(HWAES_CAPABLE)
|
||||
int HWAES_set_encrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
|
||||
int HWAES_set_decrypt_key(const unsigned char *userKey, const int bits, AES_KEY *key);
|
||||
void HWAES_encrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
|
||||
void HWAES_decrypt(const unsigned char *in, unsigned char *out, const AES_KEY *key);
|
||||
void HWAES_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t length,
|
||||
const AES_KEY *key, unsigned char *ivec, const int enc);
|
||||
void HWAES_ecb_encrypt(const unsigned char *in, unsigned char *out, size_t length,
|
||||
const AES_KEY *key, const int enc);
|
||||
void HWAES_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const void *key, const unsigned char ivec[16]);
|
||||
int HWAES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
int HWAES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
void HWAES_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
void HWAES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
void HWAES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key, unsigned char *ivec,
|
||||
const int enc);
|
||||
void HWAES_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key, const int enc);
|
||||
void HWAES_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
const unsigned char ivec[16]);
|
||||
void HWAES_xts_encrypt(const unsigned char *inp, unsigned char *out, size_t len,
|
||||
const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16]);
|
||||
const AES_KEY *key1, const AES_KEY *key2,
|
||||
const unsigned char iv[16]);
|
||||
void HWAES_xts_decrypt(const unsigned char *inp, unsigned char *out, size_t len,
|
||||
const AES_KEY *key1, const AES_KEY *key2, const unsigned char iv[16]);
|
||||
const AES_KEY *key1, const AES_KEY *key2,
|
||||
const unsigned char iv[16]);
|
||||
# ifndef OPENSSL_NO_OCB
|
||||
# ifdef HWAES_ocb_encrypt
|
||||
void HWAES_ocb_encrypt(const unsigned char *in, unsigned char *out, size_t blocks, const void *key,
|
||||
size_t start_block_num, unsigned char offset_i[16],
|
||||
const unsigned char L_[][16], unsigned char checksum[16]);
|
||||
void HWAES_ocb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const void *key, size_t start_block_num,
|
||||
unsigned char offset_i[16], const unsigned char L_[][16],
|
||||
unsigned char checksum[16]);
|
||||
# else
|
||||
# define HWAES_ocb_encrypt ((ocb128_f)NULL)
|
||||
# endif
|
||||
# ifdef HWAES_ocb_decrypt
|
||||
void HWAES_ocb_decrypt(const unsigned char *in, unsigned char *out, size_t blocks, const void *key,
|
||||
size_t start_block_num, unsigned char offset_i[16],
|
||||
const unsigned char L_[][16], unsigned char checksum[16]);
|
||||
void HWAES_ocb_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const void *key, size_t start_block_num,
|
||||
unsigned char offset_i[16], const unsigned char L_[][16],
|
||||
unsigned char checksum[16]);
|
||||
# else
|
||||
# define HWAES_ocb_decrypt ((ocb128_f)NULL)
|
||||
# endif
|
||||
|
@ -8,7 +8,8 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* Copyright (c) 2017 National Security Research Institute. All rights reserved. */
|
||||
/* Copyright (c) 2017 National Security Research Institute. All rights
|
||||
* reserved. */
|
||||
|
||||
#ifndef OSSL_CRYPTO_ARIA_H
|
||||
#define OSSL_CRYPTO_ARIA_H
|
||||
@ -41,9 +42,12 @@ struct aria_key_st
|
||||
};
|
||||
typedef struct aria_key_st ARIA_KEY;
|
||||
|
||||
int ossl_aria_set_encrypt_key(const unsigned char *userKey, const int bits, ARIA_KEY *key);
|
||||
int ossl_aria_set_decrypt_key(const unsigned char *userKey, const int bits, ARIA_KEY *key);
|
||||
int ossl_aria_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
ARIA_KEY *key);
|
||||
int ossl_aria_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
ARIA_KEY *key);
|
||||
|
||||
void ossl_aria_encrypt(const unsigned char *in, unsigned char *out, const ARIA_KEY *key);
|
||||
void ossl_aria_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const ARIA_KEY *key);
|
||||
|
||||
#endif
|
||||
|
@ -33,7 +33,8 @@ struct evp_pkey_asn1_method_st
|
||||
int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx);
|
||||
int (*priv_decode)(EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf);
|
||||
int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);
|
||||
int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx);
|
||||
int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
|
||||
ASN1_PCTX *pctx);
|
||||
int (*pkey_size)(const EVP_PKEY *pk);
|
||||
int (*pkey_bits)(const EVP_PKEY *pk);
|
||||
int (*pkey_security_bits)(const EVP_PKEY *pk);
|
||||
@ -42,20 +43,24 @@ struct evp_pkey_asn1_method_st
|
||||
int (*param_missing)(const EVP_PKEY *pk);
|
||||
int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from);
|
||||
int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
|
||||
int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx);
|
||||
int (*sig_print)(BIO *out, const X509_ALGOR *sigalg, const ASN1_STRING *sig, int indent,
|
||||
int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
|
||||
ASN1_PCTX *pctx);
|
||||
int (*sig_print)(BIO *out, const X509_ALGOR *sigalg, const ASN1_STRING *sig,
|
||||
int indent, ASN1_PCTX *pctx);
|
||||
void (*pkey_free)(EVP_PKEY *pkey);
|
||||
int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2);
|
||||
/* Legacy functions for old PEM */
|
||||
int (*old_priv_decode)(EVP_PKEY *pkey, const unsigned char **pder, int derlen);
|
||||
int (*old_priv_decode)(EVP_PKEY *pkey, const unsigned char **pder,
|
||||
int derlen);
|
||||
int (*old_priv_encode)(const EVP_PKEY *pkey, unsigned char **pder);
|
||||
/* Custom ASN1 signature verification */
|
||||
int (*item_verify)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, const void *data, const X509_ALGOR *a,
|
||||
const ASN1_BIT_STRING *sig, EVP_PKEY *pkey);
|
||||
int (*item_sign)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, const void *data, X509_ALGOR *alg1,
|
||||
X509_ALGOR *alg2, ASN1_BIT_STRING *sig);
|
||||
int (*siginf_set)(X509_SIG_INFO *siginf, const X509_ALGOR *alg, const ASN1_STRING *sig);
|
||||
int (*item_verify)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, const void *data,
|
||||
const X509_ALGOR *a, const ASN1_BIT_STRING *sig,
|
||||
EVP_PKEY *pkey);
|
||||
int (*item_sign)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, const void *data,
|
||||
X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig);
|
||||
int (*siginf_set)(X509_SIG_INFO *siginf, const X509_ALGOR *alg,
|
||||
const ASN1_STRING *sig);
|
||||
/* Check */
|
||||
int (*pkey_check)(const EVP_PKEY *pk);
|
||||
int (*pkey_public_check)(const EVP_PKEY *pk);
|
||||
@ -68,13 +73,14 @@ struct evp_pkey_asn1_method_st
|
||||
|
||||
/* Exports and imports to / from providers */
|
||||
size_t (*dirty_cnt)(const EVP_PKEY *pk);
|
||||
int (*export_to)(const EVP_PKEY *pk, void *to_keydata, OSSL_FUNC_keymgmt_import_fn *importer,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int (*export_to)(const EVP_PKEY *pk, void *to_keydata,
|
||||
OSSL_FUNC_keymgmt_import_fn *importer, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
OSSL_CALLBACK *import_from;
|
||||
int (*copy)(EVP_PKEY *to, EVP_PKEY *from);
|
||||
|
||||
int (*priv_decode_ex)(EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
int (*priv_decode_ex)(EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
} /* EVP_PKEY_ASN1_METHOD */;
|
||||
|
||||
DEFINE_STACK_OF_CONST(EVP_PKEY_ASN1_METHOD)
|
||||
@ -122,9 +128,10 @@ struct asn1_pctx_st
|
||||
|
||||
/* ASN1 type functions */
|
||||
|
||||
int ossl_asn1_type_set_octetstring_int(ASN1_TYPE *a, long num, unsigned char *data, int len);
|
||||
int ossl_asn1_type_get_octetstring_int(const ASN1_TYPE *a, long *num, unsigned char *data,
|
||||
int max_len);
|
||||
int ossl_asn1_type_set_octetstring_int(ASN1_TYPE *a, long num,
|
||||
unsigned char *data, int len);
|
||||
int ossl_asn1_type_get_octetstring_int(const ASN1_TYPE *a, long *num,
|
||||
unsigned char *data, int max_len);
|
||||
|
||||
int ossl_x509_algor_new_from_md(X509_ALGOR **palg, const EVP_MD *md);
|
||||
const EVP_MD *ossl_x509_algor_get_md(X509_ALGOR *alg);
|
||||
@ -132,8 +139,9 @@ X509_ALGOR *ossl_x509_algor_mgf1_decode(X509_ALGOR *alg);
|
||||
int ossl_x509_algor_md_to_mgf1(X509_ALGOR **palg, const EVP_MD *mgf1md);
|
||||
int ossl_asn1_time_print_ex(BIO *bp, const ASN1_TIME *tm, unsigned long flags);
|
||||
|
||||
EVP_PKEY *ossl_d2i_PrivateKey_legacy(int keytype, EVP_PKEY **a, const unsigned char **pp,
|
||||
long length, OSSL_LIB_CTX *libctx, const char *propq);
|
||||
EVP_PKEY *ossl_d2i_PrivateKey_legacy(int keytype, EVP_PKEY **a,
|
||||
const unsigned char **pp, long length,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
X509_ALGOR *ossl_X509_ALGOR_from_nid(int nid, int ptype, void *pval);
|
||||
|
||||
time_t ossl_asn1_string_to_time_t(const char *asn1_string);
|
||||
|
@ -18,6 +18,7 @@ int ossl_encode_der_integer(WPACKET *pkt, const BIGNUM *n);
|
||||
int ossl_encode_der_dsa_sig(WPACKET *pkt, const BIGNUM *r, const BIGNUM *s);
|
||||
int ossl_decode_der_length(PACKET *pkt, PACKET *subpkt);
|
||||
int ossl_decode_der_integer(PACKET *pkt, BIGNUM *n);
|
||||
size_t ossl_decode_der_dsa_sig(BIGNUM *r, BIGNUM *s, const unsigned char **ppin, size_t len);
|
||||
size_t ossl_decode_der_dsa_sig(BIGNUM *r, BIGNUM *s, const unsigned char **ppin,
|
||||
size_t len);
|
||||
|
||||
#endif
|
||||
|
@ -71,35 +71,44 @@ int bn_set_words(BIGNUM *a, const BN_ULONG *words, int num_words);
|
||||
* is constant-time by itself. They all have pre-conditions, consult source
|
||||
* code...
|
||||
*/
|
||||
int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_MONT_CTX *mont,
|
||||
int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
BN_MONT_CTX *mont, BN_CTX *ctx);
|
||||
int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||
BN_CTX *ctx);
|
||||
int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, BN_CTX *ctx);
|
||||
int bn_from_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, BN_CTX *ctx);
|
||||
int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);
|
||||
int bn_mod_sub_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);
|
||||
int bn_from_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
|
||||
BN_CTX *ctx);
|
||||
int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const BIGNUM *m);
|
||||
int bn_mod_sub_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
|
||||
const BIGNUM *m);
|
||||
int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
|
||||
int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx);
|
||||
int bn_lshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n);
|
||||
int bn_rshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n);
|
||||
int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
|
||||
int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
|
||||
BN_CTX *ctx);
|
||||
|
||||
#define BN_PRIMETEST_COMPOSITE 0
|
||||
#define BN_PRIMETEST_COMPOSITE_WITH_FACTOR 1
|
||||
#define BN_PRIMETEST_COMPOSITE_NOT_POWER_OF_PRIME 2
|
||||
#define BN_PRIMETEST_PROBABLY_PRIME 3
|
||||
|
||||
int ossl_bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx, BN_GENCB *cb,
|
||||
int enhanced, int *status);
|
||||
int ossl_bn_check_generated_prime(const BIGNUM *w, int checks, BN_CTX *ctx, BN_GENCB *cb);
|
||||
int ossl_bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx,
|
||||
BN_GENCB *cb, int enhanced, int *status);
|
||||
int ossl_bn_check_generated_prime(const BIGNUM *w, int checks, BN_CTX *ctx,
|
||||
BN_GENCB *cb);
|
||||
|
||||
const BIGNUM *ossl_bn_get0_small_factors(void);
|
||||
|
||||
int ossl_bn_rsa_fips186_4_gen_prob_primes(BIGNUM *p, BIGNUM *Xpout, BIGNUM *p1, BIGNUM *p2,
|
||||
const BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2,
|
||||
int nlen, const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb);
|
||||
int ossl_bn_rsa_fips186_4_gen_prob_primes(BIGNUM *p, BIGNUM *Xpout, BIGNUM *p1,
|
||||
BIGNUM *p2, const BIGNUM *Xp,
|
||||
const BIGNUM *Xp1, const BIGNUM *Xp2,
|
||||
int nlen, const BIGNUM *e,
|
||||
BN_CTX *ctx, BN_GENCB *cb);
|
||||
|
||||
int ossl_bn_rsa_fips186_4_derive_prime(BIGNUM *Y, BIGNUM *X, const BIGNUM *Xin, const BIGNUM *r1,
|
||||
const BIGNUM *r2, int nlen, const BIGNUM *e, BN_CTX *ctx,
|
||||
int ossl_bn_rsa_fips186_4_derive_prime(BIGNUM *Y, BIGNUM *X, const BIGNUM *Xin,
|
||||
const BIGNUM *r1, const BIGNUM *r2,
|
||||
int nlen, const BIGNUM *e, BN_CTX *ctx,
|
||||
BN_GENCB *cb);
|
||||
|
||||
OSSL_LIB_CTX *ossl_bn_get_libctx(BN_CTX *ctx);
|
||||
|
@ -32,8 +32,8 @@ void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp, size_t len,
|
||||
* that below macro is sufficient.
|
||||
*/
|
||||
#define CHACHA_U8TOU32(p) \
|
||||
(((unsigned int)(p)[0]) | ((unsigned int)(p)[1] << 8) | ((unsigned int)(p)[2] << 16) \
|
||||
| ((unsigned int)(p)[3] << 24))
|
||||
(((unsigned int)(p)[0]) | ((unsigned int)(p)[1] << 8) \
|
||||
| ((unsigned int)(p)[2] << 16) | ((unsigned int)(p)[3] << 24))
|
||||
|
||||
#define CHACHA_KEY_SIZE 32
|
||||
#define CHACHA_CTR_SIZE 16
|
||||
|
@ -21,21 +21,29 @@
|
||||
# include <openssl/camellia.h>
|
||||
|
||||
void cmll_t4_set_key(const unsigned char *key, int bits, CAMELLIA_KEY *ks);
|
||||
void cmll_t4_encrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key);
|
||||
void cmll_t4_decrypt(const unsigned char *in, unsigned char *out, const CAMELLIA_KEY *key);
|
||||
void cmll_t4_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAMELLIA_KEY *key);
|
||||
void cmll_t4_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAMELLIA_KEY *key);
|
||||
|
||||
void cmll128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const CAMELLIA_KEY *key, unsigned char *ivec, int /*unused*/);
|
||||
void cmll128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const CAMELLIA_KEY *key, unsigned char *ivec, int /*unused*/);
|
||||
void cmll256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const CAMELLIA_KEY *key, unsigned char *ivec, int /*unused*/);
|
||||
void cmll256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const CAMELLIA_KEY *key, unsigned char *ivec, int /*unused*/);
|
||||
void cmll128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const CAMELLIA_KEY *key, unsigned char *ivec);
|
||||
void cmll256_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out, size_t blocks,
|
||||
const CAMELLIA_KEY *key, unsigned char *ivec);
|
||||
void cmll128_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void cmll128_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void cmll256_t4_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void cmll256_t4_cbc_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, int /*unused*/);
|
||||
void cmll128_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec);
|
||||
void cmll256_t4_ctr32_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec);
|
||||
# endif /* OPENSSL_NO_CAMELLIA */
|
||||
|
||||
#endif /* CMLL_ASM && sparc */
|
||||
|
@ -16,7 +16,8 @@
|
||||
|
||||
/* This file is not scanned by mkdef.pl, whereas cryptlib.h is */
|
||||
|
||||
int ossl_init_thread_start(const void *index, void *arg, OSSL_thread_stop_handler_fn handfn);
|
||||
int ossl_init_thread_start(const void *index, void *arg,
|
||||
OSSL_thread_stop_handler_fn handfn);
|
||||
int ossl_init_thread_deregister(void *index);
|
||||
int ossl_init_thread(void);
|
||||
void ossl_cleanup_thread(void);
|
||||
@ -32,6 +33,7 @@ void ossl_ctx_thread_stop(OSSL_LIB_CTX *ctx);
|
||||
void ossl_trace_cleanup(void);
|
||||
void ossl_malloc_setup_failures(void);
|
||||
|
||||
int ossl_crypto_alloc_ex_data_intern(int class_index, void *obj, CRYPTO_EX_DATA *ad, int idx);
|
||||
int ossl_crypto_alloc_ex_data_intern(int class_index, void *obj,
|
||||
CRYPTO_EX_DATA *ad, int idx);
|
||||
|
||||
#endif /* OSSL_CRYPTO_CRYPTLIB_H */
|
||||
|
@ -19,14 +19,18 @@
|
||||
* except read a DER blob and pass it on as a provider object abstraction
|
||||
* (provider-object(7)).
|
||||
*/
|
||||
void *ossl_decoder_from_algorithm(int id, const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov);
|
||||
void *ossl_decoder_from_algorithm(int id, const OSSL_ALGORITHM *algodef,
|
||||
OSSL_PROVIDER *prov);
|
||||
|
||||
OSSL_DECODER_INSTANCE *ossl_decoder_instance_new(OSSL_DECODER *decoder, void *decoderctx);
|
||||
OSSL_DECODER_INSTANCE *ossl_decoder_instance_new(OSSL_DECODER *decoder,
|
||||
void *decoderctx);
|
||||
void ossl_decoder_instance_free(OSSL_DECODER_INSTANCE *decoder_inst);
|
||||
int ossl_decoder_ctx_add_decoder_inst(OSSL_DECODER_CTX *ctx, OSSL_DECODER_INSTANCE *di);
|
||||
int ossl_decoder_ctx_add_decoder_inst(OSSL_DECODER_CTX *ctx,
|
||||
OSSL_DECODER_INSTANCE *di);
|
||||
|
||||
int ossl_decoder_ctx_setup_for_pkey(OSSL_DECODER_CTX *ctx, EVP_PKEY **pkey, const char *keytype,
|
||||
OSSL_LIB_CTX *libctx, const char *propquery);
|
||||
int ossl_decoder_ctx_setup_for_pkey(OSSL_DECODER_CTX *ctx, EVP_PKEY **pkey,
|
||||
const char *keytype, OSSL_LIB_CTX *libctx,
|
||||
const char *propquery);
|
||||
|
||||
int ossl_decoder_get_number(const OSSL_DECODER *encoder);
|
||||
int ossl_decoder_store_cache_flush(OSSL_LIB_CTX *libctx);
|
||||
|
@ -20,14 +20,14 @@
|
||||
# define SPARC_DES_CAPABLE (OPENSSL_sparcv9cap_P[1] & CFR_DES)
|
||||
# include <openssl/des.h>
|
||||
void des_t4_key_expand(const void *key, DES_key_schedule *ks);
|
||||
void des_t4_ede3_cbc_encrypt(const void *inp, void *out, size_t len, const DES_key_schedule ks[3],
|
||||
unsigned char iv[8]);
|
||||
void des_t4_ede3_cbc_decrypt(const void *inp, void *out, size_t len, const DES_key_schedule ks[3],
|
||||
unsigned char iv[8]);
|
||||
void des_t4_cbc_encrypt(const void *inp, void *out, size_t len, const DES_key_schedule *ks,
|
||||
unsigned char iv[8]);
|
||||
void des_t4_cbc_decrypt(const void *inp, void *out, size_t len, const DES_key_schedule *ks,
|
||||
unsigned char iv[8]);
|
||||
void des_t4_ede3_cbc_encrypt(const void *inp, void *out, size_t len,
|
||||
const DES_key_schedule ks[3], unsigned char iv[8]);
|
||||
void des_t4_ede3_cbc_decrypt(const void *inp, void *out, size_t len,
|
||||
const DES_key_schedule ks[3], unsigned char iv[8]);
|
||||
void des_t4_cbc_encrypt(const void *inp, void *out, size_t len,
|
||||
const DES_key_schedule *ks, unsigned char iv[8]);
|
||||
void des_t4_cbc_decrypt(const void *inp, void *out, size_t len,
|
||||
const DES_key_schedule *ks, unsigned char iv[8]);
|
||||
# endif /* OPENSSL_NO_DES */
|
||||
|
||||
#endif /* DES_ASM && sparc */
|
||||
|
@ -19,8 +19,10 @@
|
||||
DH *ossl_dh_new_by_nid_ex(OSSL_LIB_CTX *libctx, int nid);
|
||||
DH *ossl_dh_new_ex(OSSL_LIB_CTX *libctx);
|
||||
void ossl_dh_set0_libctx(DH *d, OSSL_LIB_CTX *libctx);
|
||||
int ossl_dh_generate_ffc_parameters(DH *dh, int type, int pbits, int qbits, BN_GENCB *cb);
|
||||
int ossl_dh_generate_public_key(BN_CTX *ctx, const DH *dh, const BIGNUM *priv_key, BIGNUM *pub_key);
|
||||
int ossl_dh_generate_ffc_parameters(DH *dh, int type, int pbits, int qbits,
|
||||
BN_GENCB *cb);
|
||||
int ossl_dh_generate_public_key(BN_CTX *ctx, const DH *dh,
|
||||
const BIGNUM *priv_key, BIGNUM *pub_key);
|
||||
int ossl_dh_get_named_group_uid_from_size(int pbits);
|
||||
const char *ossl_dh_gen_type_id2name(int id);
|
||||
int ossl_dh_gen_type_name2id(const char *name, int type);
|
||||
@ -30,25 +32,31 @@ int ossl_dh_is_named_safe_prime_group(const DH *dh);
|
||||
FFC_PARAMS *ossl_dh_get0_params(DH *dh);
|
||||
int ossl_dh_get0_nid(const DH *dh);
|
||||
int ossl_dh_params_fromdata(DH *dh, const OSSL_PARAM params[]);
|
||||
int ossl_dh_key_fromdata(DH *dh, const OSSL_PARAM params[], int include_private);
|
||||
int ossl_dh_key_fromdata(DH *dh, const OSSL_PARAM params[],
|
||||
int include_private);
|
||||
int ossl_dh_params_todata(DH *dh, OSSL_PARAM_BLD *bld, OSSL_PARAM params[]);
|
||||
int ossl_dh_key_todata(DH *dh, OSSL_PARAM_BLD *bld, OSSL_PARAM params[], int include_private);
|
||||
DH *ossl_dh_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
int ossl_dh_key_todata(DH *dh, OSSL_PARAM_BLD *bld, OSSL_PARAM params[],
|
||||
int include_private);
|
||||
DH *ossl_dh_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh);
|
||||
|
||||
int ossl_dh_check_pub_key_partial(const DH *dh, const BIGNUM *pub_key, int *ret);
|
||||
int ossl_dh_check_pub_key_partial(const DH *dh, const BIGNUM *pub_key,
|
||||
int *ret);
|
||||
int ossl_dh_check_priv_key(const DH *dh, const BIGNUM *priv_key, int *ret);
|
||||
int ossl_dh_check_pairwise(const DH *dh);
|
||||
|
||||
const DH_METHOD *ossl_dh_get_method(const DH *dh);
|
||||
|
||||
int ossl_dh_buf2key(DH *key, const unsigned char *buf, size_t len);
|
||||
size_t ossl_dh_key2buf(const DH *dh, unsigned char **pbuf, size_t size, int alloc);
|
||||
size_t ossl_dh_key2buf(const DH *dh, unsigned char **pbuf, size_t size,
|
||||
int alloc);
|
||||
|
||||
int ossl_dh_kdf_X9_42_asn1(unsigned char *out, size_t outlen, const unsigned char *Z, size_t Zlen,
|
||||
const char *cek_alg, const unsigned char *ukm, size_t ukmlen,
|
||||
const EVP_MD *md, OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_dh_kdf_X9_42_asn1(unsigned char *out, size_t outlen,
|
||||
const unsigned char *Z, size_t Zlen,
|
||||
const char *cek_alg, const unsigned char *ukm,
|
||||
size_t ukmlen, const EVP_MD *md,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_dh_is_foreign(const DH *dh);
|
||||
DH *ossl_dh_dup(const DH *dh, int selection);
|
||||
|
||||
|
@ -22,23 +22,27 @@
|
||||
DSA *ossl_dsa_new(OSSL_LIB_CTX *libctx);
|
||||
void ossl_dsa_set0_libctx(DSA *d, OSSL_LIB_CTX *libctx);
|
||||
|
||||
int ossl_dsa_generate_ffc_parameters(DSA *dsa, int type, int pbits, int qbits, BN_GENCB *cb);
|
||||
int ossl_dsa_generate_ffc_parameters(DSA *dsa, int type, int pbits, int qbits,
|
||||
BN_GENCB *cb);
|
||||
|
||||
int ossl_dsa_sign_int(int type, const unsigned char *dgst, int dlen, unsigned char *sig,
|
||||
unsigned int *siglen, DSA *dsa, unsigned int nonce_type,
|
||||
const char *digestname, OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_dsa_sign_int(int type, const unsigned char *dgst, int dlen,
|
||||
unsigned char *sig, unsigned int *siglen, DSA *dsa,
|
||||
unsigned int nonce_type, const char *digestname,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
FFC_PARAMS *ossl_dsa_get0_params(DSA *dsa);
|
||||
int ossl_dsa_ffc_params_fromdata(DSA *dsa, const OSSL_PARAM params[]);
|
||||
int ossl_dsa_key_fromdata(DSA *dsa, const OSSL_PARAM params[], int include_private);
|
||||
DSA *ossl_dsa_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
int ossl_dsa_key_fromdata(DSA *dsa, const OSSL_PARAM params[],
|
||||
int include_private);
|
||||
DSA *ossl_dsa_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
int ossl_dsa_generate_public_key(BN_CTX *ctx, const DSA *dsa, const BIGNUM *priv_key,
|
||||
BIGNUM *pub_key);
|
||||
int ossl_dsa_generate_public_key(BN_CTX *ctx, const DSA *dsa,
|
||||
const BIGNUM *priv_key, BIGNUM *pub_key);
|
||||
int ossl_dsa_check_params(const DSA *dsa, int checktype, int *ret);
|
||||
int ossl_dsa_check_pub_key(const DSA *dsa, const BIGNUM *pub_key, int *ret);
|
||||
int ossl_dsa_check_pub_key_partial(const DSA *dsa, const BIGNUM *pub_key, int *ret);
|
||||
int ossl_dsa_check_pub_key_partial(const DSA *dsa, const BIGNUM *pub_key,
|
||||
int *ret);
|
||||
int ossl_dsa_check_priv_key(const DSA *dsa, const BIGNUM *priv_key, int *ret);
|
||||
int ossl_dsa_check_pairwise(const DSA *dsa);
|
||||
int ossl_dsa_is_foreign(const DSA *dsa);
|
||||
|
@ -47,15 +47,17 @@ int evp_pkey_ctx_set_ec_param_enc_prov(EVP_PKEY_CTX *ctx, int param_enc);
|
||||
* reduction round on the input can be omitted by the underlying
|
||||
* implementations for better SCA properties on regular input values).
|
||||
*/
|
||||
__owur int ossl_ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res, const BIGNUM *x,
|
||||
BN_CTX *ctx);
|
||||
__owur int ossl_ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
|
||||
const BIGNUM *x, BN_CTX *ctx);
|
||||
|
||||
/*-
|
||||
* ECDH Key Derivation Function as defined in ANSI X9.63
|
||||
*/
|
||||
int ossl_ecdh_kdf_X9_63(unsigned char *out, size_t outlen, const unsigned char *Z, size_t Zlen,
|
||||
const unsigned char *sinfo, size_t sinfolen, const EVP_MD *md,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_ecdh_kdf_X9_63(unsigned char *out, size_t outlen,
|
||||
const unsigned char *Z, size_t Zlen,
|
||||
const unsigned char *sinfo, size_t sinfolen,
|
||||
const EVP_MD *md, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
|
||||
int ossl_ec_key_public_check(const EC_KEY *eckey, BN_CTX *ctx);
|
||||
int ossl_ec_key_public_check_quick(const EC_KEY *eckey, BN_CTX *ctx);
|
||||
@ -66,20 +68,23 @@ const char *ossl_ec_key_get0_propq(const EC_KEY *eckey);
|
||||
void ossl_ec_key_set0_libctx(EC_KEY *key, OSSL_LIB_CTX *libctx);
|
||||
|
||||
/* Backend support */
|
||||
int ossl_ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl, OSSL_PARAM params[],
|
||||
OSSL_LIB_CTX *libctx, const char *propq, BN_CTX *bnctx,
|
||||
int ossl_ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl,
|
||||
OSSL_PARAM params[], OSSL_LIB_CTX *libctx,
|
||||
const char *propq, BN_CTX *bnctx,
|
||||
unsigned char **genbuf);
|
||||
int ossl_ec_group_fromdata(EC_KEY *ec, const OSSL_PARAM params[]);
|
||||
int ossl_ec_group_set_params(EC_GROUP *group, const OSSL_PARAM params[]);
|
||||
int ossl_ec_key_fromdata(EC_KEY *ecx, const OSSL_PARAM params[], int include_private);
|
||||
int ossl_ec_key_fromdata(EC_KEY *ecx, const OSSL_PARAM params[],
|
||||
int include_private);
|
||||
int ossl_ec_key_otherparams_fromdata(EC_KEY *ec, const OSSL_PARAM params[]);
|
||||
int ossl_ec_key_is_foreign(const EC_KEY *ec);
|
||||
EC_KEY *ossl_ec_key_dup(const EC_KEY *key, int selection);
|
||||
int ossl_x509_algor_is_sm2(const X509_ALGOR *palg);
|
||||
EC_KEY *ossl_ec_key_param_from_x509_algor(const X509_ALGOR *palg, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
EC_KEY *ossl_ec_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, OSSL_LIB_CTX *libctx,
|
||||
EC_KEY *ossl_ec_key_param_from_x509_algor(const X509_ALGOR *palg,
|
||||
OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
EC_KEY *ossl_ec_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
int ossl_ec_set_ecdh_cofactor_mode(EC_KEY *ec, int mode);
|
||||
int ossl_ec_encoding_name2id(const char *name);
|
||||
@ -90,9 +95,12 @@ char *ossl_ec_pt_format_id2name(int id);
|
||||
|
||||
char *ossl_ec_check_group_type_id2name(int flags);
|
||||
int ossl_ec_set_check_group_type_from_name(EC_KEY *ec, const char *name);
|
||||
int ossl_ec_generate_key_dhkem(EC_KEY *eckey, const unsigned char *ikm, size_t ikmlen);
|
||||
int ossl_ecdsa_deterministic_sign(const unsigned char *dgst, int dlen, unsigned char *sig,
|
||||
unsigned int *siglen, EC_KEY *eckey, unsigned int nonce_type,
|
||||
const char *digestname, OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_ec_generate_key_dhkem(EC_KEY *eckey, const unsigned char *ikm,
|
||||
size_t ikmlen);
|
||||
int ossl_ecdsa_deterministic_sign(const unsigned char *dgst, int dlen,
|
||||
unsigned char *sig, unsigned int *siglen,
|
||||
EC_KEY *eckey, unsigned int nonce_type,
|
||||
const char *digestname, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
#endif /* OPENSSL_NO_EC */
|
||||
#endif
|
||||
|
@ -59,7 +59,8 @@ typedef enum
|
||||
? EVP_PKEY_X25519 \
|
||||
: ((type) == ECX_KEY_TYPE_X448 \
|
||||
? EVP_PKEY_X448 \
|
||||
: ((type) == ECX_KEY_TYPE_ED25519 ? EVP_PKEY_ED25519 : EVP_PKEY_ED448)))
|
||||
: ((type) == ECX_KEY_TYPE_ED25519 ? EVP_PKEY_ED25519 \
|
||||
: EVP_PKEY_ED448)))
|
||||
|
||||
struct ecx_key_st
|
||||
{
|
||||
@ -75,41 +76,53 @@ struct ecx_key_st
|
||||
};
|
||||
|
||||
size_t ossl_ecx_key_length(ECX_KEY_TYPE type);
|
||||
ECX_KEY *ossl_ecx_key_new(OSSL_LIB_CTX *libctx, ECX_KEY_TYPE type, int haspubkey,
|
||||
const char *propq);
|
||||
ECX_KEY *ossl_ecx_key_new(OSSL_LIB_CTX *libctx, ECX_KEY_TYPE type,
|
||||
int haspubkey, const char *propq);
|
||||
void ossl_ecx_key_set0_libctx(ECX_KEY *key, OSSL_LIB_CTX *libctx);
|
||||
unsigned char *ossl_ecx_key_allocate_privkey(ECX_KEY *key);
|
||||
void ossl_ecx_key_free(ECX_KEY *key);
|
||||
int ossl_ecx_key_up_ref(ECX_KEY *key);
|
||||
ECX_KEY *ossl_ecx_key_dup(const ECX_KEY *key, int selection);
|
||||
int ossl_ecx_compute_key(ECX_KEY *peer, ECX_KEY *priv, size_t keylen, unsigned char *secret,
|
||||
size_t *secretlen, size_t outlen);
|
||||
int ossl_ecx_compute_key(ECX_KEY *peer, ECX_KEY *priv, size_t keylen,
|
||||
unsigned char *secret, size_t *secretlen,
|
||||
size_t outlen);
|
||||
|
||||
int ossl_x25519(uint8_t out_shared_key[32], const uint8_t private_key[32],
|
||||
const uint8_t peer_public_value[32]);
|
||||
void ossl_x25519_public_from_private(uint8_t out_public_value[32], const uint8_t private_key[32]);
|
||||
void ossl_x25519_public_from_private(uint8_t out_public_value[32],
|
||||
const uint8_t private_key[32]);
|
||||
|
||||
int ossl_ed25519_public_from_private(OSSL_LIB_CTX *ctx, uint8_t out_public_key[32],
|
||||
const uint8_t private_key[32], const char *propq);
|
||||
int ossl_ed25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len,
|
||||
const uint8_t public_key[32], const uint8_t private_key[32],
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_ed25519_verify(const uint8_t *message, size_t message_len, const uint8_t signature[64],
|
||||
const uint8_t public_key[32], OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_ed25519_public_from_private(OSSL_LIB_CTX *ctx,
|
||||
uint8_t out_public_key[32],
|
||||
const uint8_t private_key[32],
|
||||
const char *propq);
|
||||
int ossl_ed25519_sign(uint8_t *out_sig, const uint8_t *message,
|
||||
size_t message_len, const uint8_t public_key[32],
|
||||
const uint8_t private_key[32], OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
int ossl_ed25519_verify(const uint8_t *message, size_t message_len,
|
||||
const uint8_t signature[64],
|
||||
const uint8_t public_key[32], OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
|
||||
int ossl_ed448_public_from_private(OSSL_LIB_CTX *ctx, uint8_t out_public_key[57],
|
||||
const uint8_t private_key[57], const char *propq);
|
||||
int ossl_ed448_sign(OSSL_LIB_CTX *ctx, uint8_t *out_sig, const uint8_t *message, size_t message_len,
|
||||
const uint8_t public_key[57], const uint8_t private_key[57],
|
||||
const uint8_t *context, size_t context_len, const char *propq);
|
||||
int ossl_ed448_public_from_private(OSSL_LIB_CTX *ctx,
|
||||
uint8_t out_public_key[57],
|
||||
const uint8_t private_key[57],
|
||||
const char *propq);
|
||||
int ossl_ed448_sign(OSSL_LIB_CTX *ctx, uint8_t *out_sig, const uint8_t *message,
|
||||
size_t message_len, const uint8_t public_key[57],
|
||||
const uint8_t private_key[57], const uint8_t *context,
|
||||
size_t context_len, const char *propq);
|
||||
|
||||
int ossl_ed448_verify(OSSL_LIB_CTX *ctx, const uint8_t *message, size_t message_len,
|
||||
const uint8_t signature[114], const uint8_t public_key[57],
|
||||
const uint8_t *context, size_t context_len, const char *propq);
|
||||
int ossl_ed448_verify(OSSL_LIB_CTX *ctx, const uint8_t *message,
|
||||
size_t message_len, const uint8_t signature[114],
|
||||
const uint8_t public_key[57], const uint8_t *context,
|
||||
size_t context_len, const char *propq);
|
||||
|
||||
int ossl_x448(uint8_t out_shared_key[56], const uint8_t private_key[56],
|
||||
const uint8_t peer_public_value[56]);
|
||||
void ossl_x448_public_from_private(uint8_t out_public_value[56], const uint8_t private_key[56]);
|
||||
void ossl_x448_public_from_private(uint8_t out_public_value[56],
|
||||
const uint8_t private_key[56]);
|
||||
|
||||
/* Backend support */
|
||||
typedef enum
|
||||
@ -119,13 +132,15 @@ typedef enum
|
||||
KEY_OP_KEYGEN
|
||||
} ecx_key_op_t;
|
||||
|
||||
ECX_KEY *ossl_ecx_key_op(const X509_ALGOR *palg, const unsigned char *p, int plen, int pkey_id,
|
||||
ecx_key_op_t op, OSSL_LIB_CTX *libctx, const char *propq);
|
||||
ECX_KEY *ossl_ecx_key_op(const X509_ALGOR *palg, const unsigned char *p,
|
||||
int plen, int pkey_id, ecx_key_op_t op,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
int ossl_ecx_public_from_private(ECX_KEY *key);
|
||||
int ossl_ecx_key_fromdata(ECX_KEY *ecx, const OSSL_PARAM params[], int include_private);
|
||||
ECX_KEY *ossl_ecx_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
int ossl_ecx_key_fromdata(ECX_KEY *ecx, const OSSL_PARAM params[],
|
||||
int include_private);
|
||||
ECX_KEY *ossl_ecx_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
ECX_KEY *ossl_evp_pkey_get1_X25519(EVP_PKEY *pkey);
|
||||
ECX_KEY *ossl_evp_pkey_get1_X448(EVP_PKEY *pkey);
|
||||
|
@ -150,8 +150,8 @@ struct evp_pkey_method_st
|
||||
int (*keygen_init)(EVP_PKEY_CTX *ctx);
|
||||
int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
|
||||
int (*sign_init)(EVP_PKEY_CTX *ctx);
|
||||
int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, const unsigned char *tbs,
|
||||
size_t tbslen);
|
||||
int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
|
||||
const unsigned char *tbs, size_t tbslen);
|
||||
int (*verify_init)(EVP_PKEY_CTX *ctx);
|
||||
int (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen,
|
||||
const unsigned char *tbs, size_t tbslen);
|
||||
@ -159,21 +159,23 @@ struct evp_pkey_method_st
|
||||
int (*verify_recover)(EVP_PKEY_CTX *ctx, unsigned char *rout, size_t *routlen,
|
||||
const unsigned char *sig, size_t siglen);
|
||||
int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
|
||||
int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, EVP_MD_CTX *mctx);
|
||||
int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
|
||||
EVP_MD_CTX *mctx);
|
||||
int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
|
||||
int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen, EVP_MD_CTX *mctx);
|
||||
int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen,
|
||||
EVP_MD_CTX *mctx);
|
||||
int (*encrypt_init)(EVP_PKEY_CTX *ctx);
|
||||
int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *in,
|
||||
size_t inlen);
|
||||
int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
|
||||
const unsigned char *in, size_t inlen);
|
||||
int (*decrypt_init)(EVP_PKEY_CTX *ctx);
|
||||
int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *in,
|
||||
size_t inlen);
|
||||
int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
|
||||
const unsigned char *in, size_t inlen);
|
||||
int (*derive_init)(EVP_PKEY_CTX *ctx);
|
||||
int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
|
||||
int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2);
|
||||
int (*ctrl_str)(EVP_PKEY_CTX *ctx, const char *type, const char *value);
|
||||
int (*digestsign)(EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen, const unsigned char *tbs,
|
||||
size_t tbslen);
|
||||
int (*digestsign)(EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen,
|
||||
const unsigned char *tbs, size_t tbslen);
|
||||
int (*digestverify)(EVP_MD_CTX *ctx, const unsigned char *sig, size_t siglen,
|
||||
const unsigned char *tbs, size_t tbslen);
|
||||
int (*check)(EVP_PKEY *pkey);
|
||||
@ -307,9 +309,11 @@ struct evp_cipher_st
|
||||
/* How the EVP_CIPHER was created. */
|
||||
int origin;
|
||||
/* init key */
|
||||
int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc);
|
||||
int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
|
||||
const unsigned char *iv, int enc);
|
||||
/* encrypt/decrypt data */
|
||||
int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl);
|
||||
int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
const unsigned char *in, size_t inl);
|
||||
/* cleanup ctx */
|
||||
int (*cleanup)(EVP_CIPHER_CTX *);
|
||||
/* how big ctx->cipher_data needs to be */
|
||||
@ -351,7 +355,8 @@ struct evp_cipher_st
|
||||
|
||||
/* Wrapper functions for each cipher mode */
|
||||
|
||||
#define EVP_C_DATA(kstruct, ctx) ((kstruct *)EVP_CIPHER_CTX_get_cipher_data(ctx))
|
||||
#define EVP_C_DATA(kstruct, ctx) \
|
||||
((kstruct *)EVP_CIPHER_CTX_get_cipher_data(ctx))
|
||||
|
||||
#define BLOCK_CIPHER_ecb_loop() \
|
||||
size_t i, bl; \
|
||||
@ -365,8 +370,8 @@ struct evp_cipher_st
|
||||
static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, \
|
||||
const unsigned char *in, size_t inl) \
|
||||
{ \
|
||||
BLOCK_CIPHER_ecb_loop() \
|
||||
cprefix##_ecb_encrypt(in + i, out + i, &EVP_C_DATA(kstruct, ctx)->ksched, \
|
||||
BLOCK_CIPHER_ecb_loop() cprefix##_ecb_encrypt( \
|
||||
in + i, out + i, &EVP_C_DATA(kstruct, ctx)->ksched, \
|
||||
EVP_CIPHER_CTX_is_encrypting(ctx)); \
|
||||
return 1; \
|
||||
}
|
||||
@ -381,7 +386,8 @@ struct evp_cipher_st
|
||||
{ \
|
||||
int num = EVP_CIPHER_CTX_get_num(ctx); \
|
||||
cprefix##_ofb##cbits##_encrypt(in, out, (long)EVP_MAXCHUNK, \
|
||||
&EVP_C_DATA(kstruct, ctx)->ksched, ctx->iv, &num); \
|
||||
&EVP_C_DATA(kstruct, ctx)->ksched, \
|
||||
ctx->iv, &num); \
|
||||
EVP_CIPHER_CTX_set_num(ctx, num); \
|
||||
inl -= EVP_MAXCHUNK; \
|
||||
in += EVP_MAXCHUNK; \
|
||||
@ -390,7 +396,8 @@ struct evp_cipher_st
|
||||
if (inl) \
|
||||
{ \
|
||||
int num = EVP_CIPHER_CTX_get_num(ctx); \
|
||||
cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, &EVP_C_DATA(kstruct, ctx)->ksched, \
|
||||
cprefix##_ofb##cbits##_encrypt(in, out, (long)inl, \
|
||||
&EVP_C_DATA(kstruct, ctx)->ksched, \
|
||||
ctx->iv, &num); \
|
||||
EVP_CIPHER_CTX_set_num(ctx, num); \
|
||||
} \
|
||||
@ -403,20 +410,23 @@ struct evp_cipher_st
|
||||
{ \
|
||||
while (inl >= EVP_MAXCHUNK) \
|
||||
{ \
|
||||
cprefix##_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, &EVP_C_DATA(kstruct, ctx)->ksched, \
|
||||
ctx->iv, EVP_CIPHER_CTX_is_encrypting(ctx)); \
|
||||
cprefix##_cbc_encrypt(in, out, (long)EVP_MAXCHUNK, \
|
||||
&EVP_C_DATA(kstruct, ctx)->ksched, ctx->iv, \
|
||||
EVP_CIPHER_CTX_is_encrypting(ctx)); \
|
||||
inl -= EVP_MAXCHUNK; \
|
||||
in += EVP_MAXCHUNK; \
|
||||
out += EVP_MAXCHUNK; \
|
||||
} \
|
||||
if (inl) \
|
||||
cprefix##_cbc_encrypt(in, out, (long)inl, &EVP_C_DATA(kstruct, ctx)->ksched, ctx->iv, \
|
||||
cprefix##_cbc_encrypt(in, out, (long)inl, \
|
||||
&EVP_C_DATA(kstruct, ctx)->ksched, ctx->iv, \
|
||||
EVP_CIPHER_CTX_is_encrypting(ctx)); \
|
||||
return 1; \
|
||||
}
|
||||
|
||||
#define BLOCK_CIPHER_func_cfb(cname, cprefix, cbits, kstruct, ksched) \
|
||||
static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, \
|
||||
static int cname##_cfb##cbits##_cipher(EVP_CIPHER_CTX *ctx, \
|
||||
unsigned char *out, \
|
||||
const unsigned char *in, size_t inl) \
|
||||
{ \
|
||||
size_t chunk = EVP_MAXCHUNK; \
|
||||
@ -429,7 +439,9 @@ struct evp_cipher_st
|
||||
int num = EVP_CIPHER_CTX_get_num(ctx); \
|
||||
cprefix##_cfb##cbits##_encrypt( \
|
||||
in, out, \
|
||||
(long)((cbits == 1) && !EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS) \
|
||||
(long)((cbits == 1) \
|
||||
&& !EVP_CIPHER_CTX_test_flags( \
|
||||
ctx, EVP_CIPH_FLAG_LENGTH_BITS) \
|
||||
? chunk * 8 \
|
||||
: chunk), \
|
||||
&EVP_C_DATA(kstruct, ctx)->ksched, ctx->iv, &num, \
|
||||
@ -450,8 +462,9 @@ struct evp_cipher_st
|
||||
BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
|
||||
BLOCK_CIPHER_func_ofb(cname, cprefix, cbits, kstruct, ksched)
|
||||
|
||||
#define BLOCK_CIPHER_def1(cname, nmode, mode, MODE, kstruct, nid, block_size, key_len, iv_len, \
|
||||
flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
|
||||
#define BLOCK_CIPHER_def1(cname, nmode, mode, MODE, kstruct, nid, block_size, \
|
||||
key_len, iv_len, flags, init_key, cleanup, set_asn1, \
|
||||
get_asn1, ctrl) \
|
||||
static const EVP_CIPHER cname##_##mode = {nid##_##nmode, \
|
||||
block_size, \
|
||||
key_len, \
|
||||
@ -471,36 +484,45 @@ struct evp_cipher_st
|
||||
return &cname##_##mode; \
|
||||
}
|
||||
|
||||
#define BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, flags, init_key, \
|
||||
cleanup, set_asn1, get_asn1, ctrl) \
|
||||
BLOCK_CIPHER_def1(cname, cbc, cbc, CBC, kstruct, nid, block_size, key_len, iv_len, flags, \
|
||||
init_key, cleanup, set_asn1, get_asn1, ctrl)
|
||||
#define BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, \
|
||||
flags, init_key, cleanup, set_asn1, get_asn1, \
|
||||
ctrl) \
|
||||
BLOCK_CIPHER_def1(cname, cbc, cbc, CBC, kstruct, nid, block_size, key_len, \
|
||||
iv_len, flags, init_key, cleanup, set_asn1, get_asn1, \
|
||||
ctrl)
|
||||
|
||||
#define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, iv_len, cbits, flags, init_key, \
|
||||
cleanup, set_asn1, get_asn1, ctrl) \
|
||||
BLOCK_CIPHER_def1(cname, cfb##cbits, cfb##cbits, CFB, kstruct, nid, 1, key_len, iv_len, flags, \
|
||||
init_key, cleanup, set_asn1, get_asn1, ctrl)
|
||||
#define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, iv_len, cbits, \
|
||||
flags, init_key, cleanup, set_asn1, get_asn1, \
|
||||
ctrl) \
|
||||
BLOCK_CIPHER_def1(cname, cfb##cbits, cfb##cbits, CFB, kstruct, nid, 1, \
|
||||
key_len, iv_len, flags, init_key, cleanup, set_asn1, \
|
||||
get_asn1, ctrl)
|
||||
|
||||
#define BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, flags, init_key, \
|
||||
cleanup, set_asn1, get_asn1, ctrl) \
|
||||
BLOCK_CIPHER_def1(cname, ofb##cbits, ofb, OFB, kstruct, nid, 1, key_len, iv_len, flags, \
|
||||
init_key, cleanup, set_asn1, get_asn1, ctrl)
|
||||
#define BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, \
|
||||
flags, init_key, cleanup, set_asn1, get_asn1, \
|
||||
ctrl) \
|
||||
BLOCK_CIPHER_def1(cname, ofb##cbits, ofb, OFB, kstruct, nid, 1, key_len, \
|
||||
iv_len, flags, init_key, cleanup, set_asn1, get_asn1, \
|
||||
ctrl)
|
||||
|
||||
#define BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, flags, init_key, cleanup, \
|
||||
set_asn1, get_asn1, ctrl) \
|
||||
BLOCK_CIPHER_def1(cname, ecb, ecb, ECB, kstruct, nid, block_size, key_len, 0, flags, init_key, \
|
||||
cleanup, set_asn1, get_asn1, ctrl)
|
||||
|
||||
#define BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, cbits, flags, \
|
||||
#define BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, flags, \
|
||||
init_key, cleanup, set_asn1, get_asn1, ctrl) \
|
||||
BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, flags, init_key, \
|
||||
cleanup, set_asn1, get_asn1, ctrl) \
|
||||
BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, iv_len, cbits, flags, init_key, \
|
||||
cleanup, set_asn1, get_asn1, ctrl) \
|
||||
BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, flags, init_key, \
|
||||
cleanup, set_asn1, get_asn1, ctrl) \
|
||||
BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, flags, init_key, \
|
||||
cleanup, set_asn1, get_asn1, ctrl)
|
||||
BLOCK_CIPHER_def1(cname, ecb, ecb, ECB, kstruct, nid, block_size, key_len, \
|
||||
0, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
|
||||
|
||||
#define BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, \
|
||||
cbits, flags, init_key, cleanup, set_asn1, get_asn1, \
|
||||
ctrl) \
|
||||
BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, \
|
||||
flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
|
||||
BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, iv_len, cbits, flags, \
|
||||
init_key, cleanup, set_asn1, get_asn1, ctrl) \
|
||||
BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, \
|
||||
flags, init_key, cleanup, set_asn1, get_asn1, \
|
||||
ctrl) \
|
||||
BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, \
|
||||
flags, init_key, cleanup, set_asn1, \
|
||||
get_asn1, ctrl)
|
||||
|
||||
/*-
|
||||
#define BLOCK_CIPHER_defs(cname, kstruct, \
|
||||
@ -564,17 +586,21 @@ static const EVP_CIPHER cname##_ecb = {\
|
||||
const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; }
|
||||
*/
|
||||
|
||||
#define IMPLEMENT_BLOCK_CIPHER(cname, ksched, cprefix, kstruct, nid, block_size, key_len, iv_len, \
|
||||
cbits, flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
|
||||
#define IMPLEMENT_BLOCK_CIPHER(cname, ksched, cprefix, kstruct, nid, \
|
||||
block_size, key_len, iv_len, cbits, flags, \
|
||||
init_key, cleanup, set_asn1, get_asn1, ctrl) \
|
||||
BLOCK_CIPHER_all_funcs(cname, cprefix, cbits, kstruct, ksched) \
|
||||
BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, cbits, flags, \
|
||||
init_key, cleanup, set_asn1, get_asn1, ctrl)
|
||||
BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, \
|
||||
cbits, flags, init_key, cleanup, set_asn1, get_asn1, \
|
||||
ctrl)
|
||||
|
||||
#define IMPLEMENT_CFBR(cipher, cprefix, kstruct, ksched, keysize, cbits, iv_len, fl) \
|
||||
#define IMPLEMENT_CFBR(cipher, cprefix, kstruct, ksched, keysize, cbits, \
|
||||
iv_len, fl) \
|
||||
BLOCK_CIPHER_func_cfb(cipher##_##keysize, cprefix, cbits, kstruct, ksched) \
|
||||
BLOCK_CIPHER_def_cfb(cipher##_##keysize, kstruct, NID_##cipher##_##keysize, keysize / 8, \
|
||||
iv_len, cbits, (fl) | EVP_CIPH_FLAG_DEFAULT_ASN1, cipher##_init_key, \
|
||||
NULL, NULL, NULL, NULL)
|
||||
BLOCK_CIPHER_def_cfb(cipher##_##keysize, kstruct, \
|
||||
NID_##cipher##_##keysize, keysize / 8, iv_len, \
|
||||
cbits, (fl) | EVP_CIPH_FLAG_DEFAULT_ASN1, \
|
||||
cipher##_init_key, NULL, NULL, NULL, NULL)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -617,12 +643,14 @@ DEFINE_STACK_OF(OP_CACHE_ELEM)
|
||||
*
|
||||
* typed & empty:
|
||||
*
|
||||
* (type != EVP_PKEY_NONE && pkey.ptr == NULL) ## legacy (libcrypto only)
|
||||
* (type != EVP_PKEY_NONE && pkey.ptr == NULL) ## legacy (libcrypto
|
||||
* only)
|
||||
* || (keymgmt != NULL && keydata == NULL) ## provider side
|
||||
*
|
||||
* fully assigned:
|
||||
*
|
||||
* (type != EVP_PKEY_NONE && pkey.ptr != NULL) ## legacy (libcrypto only)
|
||||
* (type != EVP_PKEY_NONE && pkey.ptr != NULL) ## legacy (libcrypto
|
||||
* only)
|
||||
* || (keymgmt != NULL && keydata != NULL) ## provider side
|
||||
*
|
||||
* The easiest way to detect a legacy key is:
|
||||
@ -633,14 +661,18 @@ DEFINE_STACK_OF(OP_CACHE_ELEM)
|
||||
*
|
||||
* keymgmt != NULL
|
||||
*/
|
||||
#define evp_pkey_is_blank(pk) ((pk)->type == EVP_PKEY_NONE && (pk)->keymgmt == NULL)
|
||||
#define evp_pkey_is_typed(pk) ((pk)->type != EVP_PKEY_NONE || (pk)->keymgmt != NULL)
|
||||
#define evp_pkey_is_blank(pk) \
|
||||
((pk)->type == EVP_PKEY_NONE && (pk)->keymgmt == NULL)
|
||||
#define evp_pkey_is_typed(pk) \
|
||||
((pk)->type != EVP_PKEY_NONE || (pk)->keymgmt != NULL)
|
||||
#ifndef FIPS_MODULE
|
||||
# define evp_pkey_is_assigned(pk) ((pk)->pkey.ptr != NULL || (pk)->keydata != NULL)
|
||||
# define evp_pkey_is_assigned(pk) \
|
||||
((pk)->pkey.ptr != NULL || (pk)->keydata != NULL)
|
||||
#else
|
||||
# define evp_pkey_is_assigned(pk) ((pk)->keydata != NULL)
|
||||
#endif
|
||||
#define evp_pkey_is_legacy(pk) ((pk)->type != EVP_PKEY_NONE && (pk)->keymgmt == NULL)
|
||||
#define evp_pkey_is_legacy(pk) \
|
||||
((pk)->type != EVP_PKEY_NONE && (pk)->keymgmt == NULL)
|
||||
#define evp_pkey_is_provided(pk) ((pk)->keymgmt != NULL)
|
||||
|
||||
union legacy_pkey_st
|
||||
@ -687,7 +719,8 @@ struct evp_pkey_st
|
||||
#ifndef FIPS_MODULE
|
||||
STACK_OF(X509_ATTRIBUTE) * attributes; /* [ 0 ] */
|
||||
int save_parameters;
|
||||
unsigned int foreign : 1; /* the low-level key is using an engine or an app-method */
|
||||
unsigned int
|
||||
foreign : 1; /* the low-level key is using an engine or an app-method */
|
||||
CRYPTO_EX_DATA ex_data;
|
||||
#endif
|
||||
|
||||
@ -731,35 +764,41 @@ struct evp_pkey_st
|
||||
} /* EVP_PKEY */;
|
||||
|
||||
#define EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx) \
|
||||
((ctx)->operation == EVP_PKEY_OP_SIGN || (ctx)->operation == EVP_PKEY_OP_SIGNCTX \
|
||||
|| (ctx)->operation == EVP_PKEY_OP_VERIFY || (ctx)->operation == EVP_PKEY_OP_VERIFYCTX \
|
||||
((ctx)->operation == EVP_PKEY_OP_SIGN \
|
||||
|| (ctx)->operation == EVP_PKEY_OP_SIGNCTX \
|
||||
|| (ctx)->operation == EVP_PKEY_OP_VERIFY \
|
||||
|| (ctx)->operation == EVP_PKEY_OP_VERIFYCTX \
|
||||
|| (ctx)->operation == EVP_PKEY_OP_VERIFYRECOVER)
|
||||
|
||||
#define EVP_PKEY_CTX_IS_DERIVE_OP(ctx) ((ctx)->operation == EVP_PKEY_OP_DERIVE)
|
||||
|
||||
#define EVP_PKEY_CTX_IS_ASYM_CIPHER_OP(ctx) \
|
||||
((ctx)->operation == EVP_PKEY_OP_ENCRYPT || (ctx)->operation == EVP_PKEY_OP_DECRYPT)
|
||||
((ctx)->operation == EVP_PKEY_OP_ENCRYPT \
|
||||
|| (ctx)->operation == EVP_PKEY_OP_DECRYPT)
|
||||
|
||||
#define EVP_PKEY_CTX_IS_GEN_OP(ctx) \
|
||||
((ctx)->operation == EVP_PKEY_OP_PARAMGEN || (ctx)->operation == EVP_PKEY_OP_KEYGEN)
|
||||
((ctx)->operation == EVP_PKEY_OP_PARAMGEN \
|
||||
|| (ctx)->operation == EVP_PKEY_OP_KEYGEN)
|
||||
|
||||
#define EVP_PKEY_CTX_IS_FROMDATA_OP(ctx) ((ctx)->operation == EVP_PKEY_OP_FROMDATA)
|
||||
#define EVP_PKEY_CTX_IS_FROMDATA_OP(ctx) \
|
||||
((ctx)->operation == EVP_PKEY_OP_FROMDATA)
|
||||
|
||||
#define EVP_PKEY_CTX_IS_KEM_OP(ctx) \
|
||||
((ctx)->operation == EVP_PKEY_OP_ENCAPSULATE || (ctx)->operation == EVP_PKEY_OP_DECAPSULATE)
|
||||
((ctx)->operation == EVP_PKEY_OP_ENCAPSULATE \
|
||||
|| (ctx)->operation == EVP_PKEY_OP_DECAPSULATE)
|
||||
|
||||
void openssl_add_all_ciphers_int(void);
|
||||
void openssl_add_all_digests_int(void);
|
||||
void evp_cleanup_int(void);
|
||||
void evp_app_cleanup_int(void);
|
||||
void *evp_pkey_export_to_provider(EVP_PKEY *pk, OSSL_LIB_CTX *libctx, EVP_KEYMGMT **keymgmt,
|
||||
const char *propquery);
|
||||
void *evp_pkey_export_to_provider(EVP_PKEY *pk, OSSL_LIB_CTX *libctx,
|
||||
EVP_KEYMGMT **keymgmt, const char *propquery);
|
||||
#ifndef FIPS_MODULE
|
||||
int evp_pkey_copy_downgraded(EVP_PKEY **dest, const EVP_PKEY *src);
|
||||
void *evp_pkey_get_legacy(EVP_PKEY *pk);
|
||||
void evp_pkey_free_legacy(EVP_PKEY *x);
|
||||
EVP_PKEY *evp_pkcs82pkey_legacy(const PKCS8_PRIV_KEY_INFO *p8inf, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
EVP_PKEY *evp_pkcs82pkey_legacy(const PKCS8_PRIV_KEY_INFO *p8inf,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -777,57 +816,72 @@ struct evp_keymgmt_util_try_import_data_st
|
||||
int selection;
|
||||
};
|
||||
int evp_keymgmt_util_try_import(const OSSL_PARAM params[], void *arg);
|
||||
int evp_keymgmt_util_assign_pkey(EVP_PKEY *pkey, EVP_KEYMGMT *keymgmt, void *keydata);
|
||||
int evp_keymgmt_util_assign_pkey(EVP_PKEY *pkey, EVP_KEYMGMT *keymgmt,
|
||||
void *keydata);
|
||||
EVP_PKEY *evp_keymgmt_util_make_pkey(EVP_KEYMGMT *keymgmt, void *keydata);
|
||||
|
||||
int evp_keymgmt_util_export(const EVP_PKEY *pk, int selection, OSSL_CALLBACK *export_cb,
|
||||
void *export_cbarg);
|
||||
void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt, int selection);
|
||||
OP_CACHE_ELEM *evp_keymgmt_util_find_operation_cache(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt,
|
||||
int evp_keymgmt_util_export(const EVP_PKEY *pk, int selection,
|
||||
OSSL_CALLBACK *export_cb, void *export_cbarg);
|
||||
void *evp_keymgmt_util_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt,
|
||||
int selection);
|
||||
OP_CACHE_ELEM *evp_keymgmt_util_find_operation_cache(EVP_PKEY *pk,
|
||||
EVP_KEYMGMT *keymgmt,
|
||||
int selection);
|
||||
int evp_keymgmt_util_clear_operation_cache(EVP_PKEY *pk, int locking);
|
||||
int evp_keymgmt_util_cache_keydata(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt, void *keydata,
|
||||
int selection);
|
||||
int evp_keymgmt_util_cache_keydata(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt,
|
||||
void *keydata, int selection);
|
||||
void evp_keymgmt_util_cache_keyinfo(EVP_PKEY *pk);
|
||||
void *evp_keymgmt_util_fromdata(EVP_PKEY *target, EVP_KEYMGMT *keymgmt, int selection,
|
||||
const OSSL_PARAM params[]);
|
||||
void *evp_keymgmt_util_fromdata(EVP_PKEY *target, EVP_KEYMGMT *keymgmt,
|
||||
int selection, const OSSL_PARAM params[]);
|
||||
int evp_keymgmt_util_has(EVP_PKEY *pk, int selection);
|
||||
int evp_keymgmt_util_match(EVP_PKEY *pk1, EVP_PKEY *pk2, int selection);
|
||||
int evp_keymgmt_util_copy(EVP_PKEY *to, EVP_PKEY *from, int selection);
|
||||
void *evp_keymgmt_util_gen(EVP_PKEY *target, EVP_KEYMGMT *keymgmt, void *genctx, OSSL_CALLBACK *cb,
|
||||
void *cbarg);
|
||||
int evp_keymgmt_util_get_deflt_digest_name(EVP_KEYMGMT *keymgmt, void *keydata, char *mdname,
|
||||
size_t mdname_sz);
|
||||
const char *evp_keymgmt_util_query_operation_name(EVP_KEYMGMT *keymgmt, int op_id);
|
||||
void *evp_keymgmt_util_gen(EVP_PKEY *target, EVP_KEYMGMT *keymgmt, void *genctx,
|
||||
OSSL_CALLBACK *cb, void *cbarg);
|
||||
int evp_keymgmt_util_get_deflt_digest_name(EVP_KEYMGMT *keymgmt, void *keydata,
|
||||
char *mdname, size_t mdname_sz);
|
||||
const char *evp_keymgmt_util_query_operation_name(EVP_KEYMGMT *keymgmt,
|
||||
int op_id);
|
||||
|
||||
/*
|
||||
* KEYMGMT provider interface functions
|
||||
*/
|
||||
void *evp_keymgmt_newdata(const EVP_KEYMGMT *keymgmt);
|
||||
void evp_keymgmt_freedata(const EVP_KEYMGMT *keymgmt, void *keyddata);
|
||||
int evp_keymgmt_get_params(const EVP_KEYMGMT *keymgmt, void *keydata, OSSL_PARAM params[]);
|
||||
int evp_keymgmt_set_params(const EVP_KEYMGMT *keymgmt, void *keydata, const OSSL_PARAM params[]);
|
||||
void *evp_keymgmt_gen_init(const EVP_KEYMGMT *keymgmt, int selection, const OSSL_PARAM params[]);
|
||||
int evp_keymgmt_gen_set_template(const EVP_KEYMGMT *keymgmt, void *genctx, void *template);
|
||||
int evp_keymgmt_gen_set_params(const EVP_KEYMGMT *keymgmt, void *genctx, const OSSL_PARAM params[]);
|
||||
void *evp_keymgmt_gen(const EVP_KEYMGMT *keymgmt, void *genctx, OSSL_CALLBACK *cb, void *cbarg);
|
||||
int evp_keymgmt_get_params(const EVP_KEYMGMT *keymgmt, void *keydata,
|
||||
OSSL_PARAM params[]);
|
||||
int evp_keymgmt_set_params(const EVP_KEYMGMT *keymgmt, void *keydata,
|
||||
const OSSL_PARAM params[]);
|
||||
void *evp_keymgmt_gen_init(const EVP_KEYMGMT *keymgmt, int selection,
|
||||
const OSSL_PARAM params[]);
|
||||
int evp_keymgmt_gen_set_template(const EVP_KEYMGMT *keymgmt, void *genctx,
|
||||
void *template);
|
||||
int evp_keymgmt_gen_set_params(const EVP_KEYMGMT *keymgmt, void *genctx,
|
||||
const OSSL_PARAM params[]);
|
||||
void *evp_keymgmt_gen(const EVP_KEYMGMT *keymgmt, void *genctx,
|
||||
OSSL_CALLBACK *cb, void *cbarg);
|
||||
void evp_keymgmt_gen_cleanup(const EVP_KEYMGMT *keymgmt, void *genctx);
|
||||
|
||||
int evp_keymgmt_has_load(const EVP_KEYMGMT *keymgmt);
|
||||
void *evp_keymgmt_load(const EVP_KEYMGMT *keymgmt, const void *objref, size_t objref_sz);
|
||||
void *evp_keymgmt_load(const EVP_KEYMGMT *keymgmt, const void *objref,
|
||||
size_t objref_sz);
|
||||
|
||||
int evp_keymgmt_has(const EVP_KEYMGMT *keymgmt, void *keyddata, int selection);
|
||||
int evp_keymgmt_validate(const EVP_KEYMGMT *keymgmt, void *keydata, int selection, int checktype);
|
||||
int evp_keymgmt_match(const EVP_KEYMGMT *keymgmt, const void *keydata1, const void *keydata2,
|
||||
int selection);
|
||||
int evp_keymgmt_validate(const EVP_KEYMGMT *keymgmt, void *keydata,
|
||||
int selection, int checktype);
|
||||
int evp_keymgmt_match(const EVP_KEYMGMT *keymgmt, const void *keydata1,
|
||||
const void *keydata2, int selection);
|
||||
|
||||
int evp_keymgmt_import(const EVP_KEYMGMT *keymgmt, void *keydata, int selection,
|
||||
const OSSL_PARAM params[]);
|
||||
const OSSL_PARAM *evp_keymgmt_import_types(const EVP_KEYMGMT *keymgmt, int selection);
|
||||
const OSSL_PARAM *evp_keymgmt_import_types(const EVP_KEYMGMT *keymgmt,
|
||||
int selection);
|
||||
int evp_keymgmt_export(const EVP_KEYMGMT *keymgmt, void *keydata, int selection,
|
||||
OSSL_CALLBACK *param_cb, void *cbarg);
|
||||
const OSSL_PARAM *evp_keymgmt_export_types(const EVP_KEYMGMT *keymgmt, int selection);
|
||||
void *evp_keymgmt_dup(const EVP_KEYMGMT *keymgmt, const void *keydata_from, int selection);
|
||||
const OSSL_PARAM *evp_keymgmt_export_types(const EVP_KEYMGMT *keymgmt,
|
||||
int selection);
|
||||
void *evp_keymgmt_dup(const EVP_KEYMGMT *keymgmt, const void *keydata_from,
|
||||
int selection);
|
||||
EVP_KEYMGMT *evp_keymgmt_fetch_from_prov(OSSL_PROVIDER *prov, const char *name,
|
||||
const char *properties);
|
||||
|
||||
@ -846,12 +900,15 @@ void evp_encode_ctx_set_flags(EVP_ENCODE_CTX *ctx, unsigned int flags);
|
||||
/* Use the SRP base64 alphabet instead of the standard one */
|
||||
#define EVP_ENCODE_CTX_USE_SRP_ALPHABET 2
|
||||
|
||||
const EVP_CIPHER *evp_get_cipherbyname_ex(OSSL_LIB_CTX *libctx, const char *name);
|
||||
const EVP_CIPHER *evp_get_cipherbyname_ex(OSSL_LIB_CTX *libctx,
|
||||
const char *name);
|
||||
const EVP_MD *evp_get_digestbyname_ex(OSSL_LIB_CTX *libctx, const char *name);
|
||||
|
||||
int ossl_pkcs5_pbkdf2_hmac_ex(const char *pass, int passlen, const unsigned char *salt, int saltlen,
|
||||
int iter, const EVP_MD *digest, int keylen, unsigned char *out,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_pkcs5_pbkdf2_hmac_ex(const char *pass, int passlen,
|
||||
const unsigned char *salt, int saltlen, int iter,
|
||||
const EVP_MD *digest, int keylen,
|
||||
unsigned char *out, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
|
||||
#ifndef FIPS_MODULE
|
||||
/*
|
||||
@ -869,8 +926,8 @@ int ossl_pkcs5_pbkdf2_hmac_ex(const char *pass, int passlen, const unsigned char
|
||||
int evp_pkey_ctx_set_params_strict(EVP_PKEY_CTX *ctx, OSSL_PARAM *params);
|
||||
int evp_pkey_ctx_get_params_strict(EVP_PKEY_CTX *ctx, OSSL_PARAM *params);
|
||||
|
||||
EVP_MD_CTX *evp_md_ctx_new_ex(EVP_PKEY *pkey, const ASN1_OCTET_STRING *id, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
EVP_MD_CTX *evp_md_ctx_new_ex(EVP_PKEY *pkey, const ASN1_OCTET_STRING *id,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int evp_pkey_name2type(const char *name);
|
||||
const char *evp_pkey_type2name(int type);
|
||||
|
||||
@ -884,9 +941,10 @@ int evp_pkey_ctx_use_cached_data(EVP_PKEY_CTX *ctx);
|
||||
int evp_method_store_cache_flush(OSSL_LIB_CTX *libctx);
|
||||
int evp_method_store_remove_all_provided(const OSSL_PROVIDER *prov);
|
||||
|
||||
int evp_default_properties_enable_fips_int(OSSL_LIB_CTX *libctx, int enable, int loadconfig);
|
||||
int evp_set_default_properties_int(OSSL_LIB_CTX *libctx, const char *propq, int loadconfig,
|
||||
int mirrored);
|
||||
int evp_default_properties_enable_fips_int(OSSL_LIB_CTX *libctx, int enable,
|
||||
int loadconfig);
|
||||
int evp_set_default_properties_int(OSSL_LIB_CTX *libctx, const char *propq,
|
||||
int loadconfig, int mirrored);
|
||||
char *evp_get_global_properties_str(OSSL_LIB_CTX *libctx, int loadconfig);
|
||||
|
||||
void evp_md_ctx_clear_digest(EVP_MD_CTX *ctx, int force, int keep_digest);
|
||||
@ -900,12 +958,14 @@ int evp_md_ctx_free_algctx(EVP_MD_CTX *ctx);
|
||||
int evp_pkey_ctx_state(const EVP_PKEY_CTX *ctx);
|
||||
|
||||
/* These two must ONLY be called for provider side operations */
|
||||
int evp_pkey_ctx_ctrl_to_param(EVP_PKEY_CTX *ctx, int keytype, int optype, int cmd, int p1,
|
||||
void *p2);
|
||||
int evp_pkey_ctx_ctrl_str_to_param(EVP_PKEY_CTX *ctx, const char *name, const char *value);
|
||||
int evp_pkey_ctx_ctrl_to_param(EVP_PKEY_CTX *ctx, int keytype, int optype,
|
||||
int cmd, int p1, void *p2);
|
||||
int evp_pkey_ctx_ctrl_str_to_param(EVP_PKEY_CTX *ctx, const char *name,
|
||||
const char *value);
|
||||
|
||||
/* These two must ONLY be called for legacy operations */
|
||||
int evp_pkey_ctx_set_params_to_ctrl(EVP_PKEY_CTX *ctx, const OSSL_PARAM *params);
|
||||
int evp_pkey_ctx_set_params_to_ctrl(EVP_PKEY_CTX *ctx,
|
||||
const OSSL_PARAM *params);
|
||||
int evp_pkey_ctx_get_params_to_ctrl(EVP_PKEY_CTX *ctx, OSSL_PARAM *params);
|
||||
|
||||
/* This must ONLY be called for legacy EVP_PKEYs */
|
||||
|
@ -128,21 +128,26 @@
|
||||
#if defined(DATA_ORDER_IS_BIG_ENDIAN)
|
||||
|
||||
# define HOST_c2l(c, l) \
|
||||
(l = (((unsigned long)(*((c)++))) << 24), l |= (((unsigned long)(*((c)++))) << 16), \
|
||||
l |= (((unsigned long)(*((c)++))) << 8), l |= (((unsigned long)(*((c)++)))))
|
||||
(l = (((unsigned long)(*((c)++))) << 24), \
|
||||
l |= (((unsigned long)(*((c)++))) << 16), \
|
||||
l |= (((unsigned long)(*((c)++))) << 8), \
|
||||
l |= (((unsigned long)(*((c)++)))))
|
||||
# define HOST_l2c(l, c) \
|
||||
(*((c)++) = (unsigned char)(((l) >> 24) & 0xff), \
|
||||
*((c)++) = (unsigned char)(((l) >> 16) & 0xff), \
|
||||
*((c)++) = (unsigned char)(((l) >> 8) & 0xff), *((c)++) = (unsigned char)(((l)) & 0xff), \
|
||||
l)
|
||||
*((c)++) = (unsigned char)(((l) >> 8) & 0xff), \
|
||||
*((c)++) = (unsigned char)(((l)) & 0xff), l)
|
||||
|
||||
#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
|
||||
|
||||
# define HOST_c2l(c, l) \
|
||||
(l = (((unsigned long)(*((c)++)))), l |= (((unsigned long)(*((c)++))) << 8), \
|
||||
l |= (((unsigned long)(*((c)++))) << 16), l |= (((unsigned long)(*((c)++))) << 24))
|
||||
(l = (((unsigned long)(*((c)++)))), \
|
||||
l |= (((unsigned long)(*((c)++))) << 8), \
|
||||
l |= (((unsigned long)(*((c)++))) << 16), \
|
||||
l |= (((unsigned long)(*((c)++))) << 24))
|
||||
# define HOST_l2c(l, c) \
|
||||
(*((c)++) = (unsigned char)(((l)) & 0xff), *((c)++) = (unsigned char)(((l) >> 8) & 0xff), \
|
||||
(*((c)++) = (unsigned char)(((l)) & 0xff), \
|
||||
*((c)++) = (unsigned char)(((l) >> 8) & 0xff), \
|
||||
*((c)++) = (unsigned char)(((l) >> 16) & 0xff), \
|
||||
*((c)++) = (unsigned char)(((l) >> 24) & 0xff), l)
|
||||
|
||||
|
@ -29,14 +29,16 @@ typedef unsigned char u8;
|
||||
|
||||
#define STRICT_ALIGNMENT 1
|
||||
#ifndef PEDANTIC
|
||||
# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) \
|
||||
|| defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || defined(__aarch64__) \
|
||||
|| defined(__s390__) || defined(__s390x__)
|
||||
# if defined(__i386) || defined(__i386__) || defined(__x86_64) \
|
||||
|| defined(__x86_64__) || defined(_M_IX86) || defined(_M_AMD64) \
|
||||
|| defined(_M_X64) || defined(__aarch64__) || defined(__s390__) \
|
||||
|| defined(__s390x__)
|
||||
# undef STRICT_ALIGNMENT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(PEDANTIC) && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
|
||||
#if !defined(PEDANTIC) && !defined(OPENSSL_NO_ASM) \
|
||||
&& !defined(OPENSSL_NO_INLINE_ASM)
|
||||
# if defined(__GNUC__) && __GNUC__ >= 2
|
||||
# if defined(__x86_64) || defined(__x86_64__)
|
||||
# define BSWAP8(x) \
|
||||
@ -114,10 +116,7 @@ typedef unsigned char u8;
|
||||
# define BSWAP8(x) _byteswap_uint64((u64)(x))
|
||||
# define BSWAP4(x) _byteswap_ulong((u32)(x))
|
||||
# elif defined(_M_IX86)
|
||||
__inline u32 _bswap4(u32 val)
|
||||
{
|
||||
_asm mov eax, val _asm bswap eax
|
||||
}
|
||||
__inline u32 _bswap4(u32 val){_asm mov eax, val _asm bswap eax}
|
||||
# define BSWAP4(x) _bswap4(x)
|
||||
# endif
|
||||
# endif
|
||||
@ -126,10 +125,11 @@ __inline u32 _bswap4(u32 val)
|
||||
# define GETU32(p) BSWAP4(*(const u32 *)(p))
|
||||
# define PUTU32(p, v) *(u32 *)(p) = BSWAP4(v)
|
||||
#else
|
||||
# define GETU32(p) ((u32)(p)[0] << 24 | (u32)(p)[1] << 16 | (u32)(p)[2] << 8 | (u32)(p)[3])
|
||||
# define GETU32(p) \
|
||||
((u32)(p)[0] << 24 | (u32)(p)[1] << 16 | (u32)(p)[2] << 8 | (u32)(p)[3])
|
||||
# define PUTU32(p, v) \
|
||||
((p)[0] = (u8)((v) >> 24), (p)[1] = (u8)((v) >> 16), (p)[2] = (u8)((v) >> 8), \
|
||||
(p)[3] = (u8)(v))
|
||||
((p)[0] = (u8)((v) >> 24), (p)[1] = (u8)((v) >> 16), \
|
||||
(p)[2] = (u8)((v) >> 8), (p)[3] = (u8)(v))
|
||||
#endif
|
||||
/*- GCM definitions */ typedef struct
|
||||
{
|
||||
@ -137,7 +137,8 @@ __inline u32 _bswap4(u32 val)
|
||||
} u128;
|
||||
|
||||
typedef void (*gcm_init_fn)(u128 Htable[16], const u64 H[2]);
|
||||
typedef void (*gcm_ghash_fn)(u64 Xi[2], const u128 Htable[16], const u8 *inp, size_t len);
|
||||
typedef void (*gcm_ghash_fn)(u64 Xi[2], const u128 Htable[16], const u8 *inp,
|
||||
size_t len);
|
||||
typedef void (*gcm_gmult_fn)(u64 Xi[2], const u128 Htable[16]);
|
||||
struct gcm_funcs_st
|
||||
{
|
||||
@ -172,7 +173,8 @@ struct gcm128_context
|
||||
|
||||
/* GHASH functions */
|
||||
void ossl_gcm_init_4bit(u128 Htable[16], const u64 H[2]);
|
||||
void ossl_gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], const u8 *inp, size_t len);
|
||||
void ossl_gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16], const u8 *inp,
|
||||
size_t len);
|
||||
void ossl_gcm_gmult_4bit(u64 Xi[2], const u128 Htable[16]);
|
||||
|
||||
/*
|
||||
@ -188,8 +190,10 @@ struct xts128_context
|
||||
};
|
||||
|
||||
/* XTS mode for SM4 algorithm specified by GB/T 17964-2021 */
|
||||
int ossl_crypto_xts128gb_encrypt(const XTS128_CONTEXT *ctx, const unsigned char iv[16],
|
||||
const unsigned char *inp, unsigned char *out, size_t len, int enc);
|
||||
int ossl_crypto_xts128gb_encrypt(const XTS128_CONTEXT *ctx,
|
||||
const unsigned char iv[16],
|
||||
const unsigned char *inp, unsigned char *out,
|
||||
size_t len, int enc);
|
||||
|
||||
struct ccm128_context
|
||||
{
|
||||
@ -211,7 +215,8 @@ typedef union
|
||||
unsigned char c[16];
|
||||
} OCB_BLOCK;
|
||||
# define ocb_block16_xor(in1, in2, out) \
|
||||
((out)->a[0] = (in1)->a[0] ^ (in2)->a[0], (out)->a[1] = (in1)->a[1] ^ (in2)->a[1])
|
||||
((out)->a[0] = (in1)->a[0] ^ (in2)->a[0], \
|
||||
(out)->a[1] = (in1)->a[1] ^ (in2)->a[1])
|
||||
# if STRICT_ALIGNMENT
|
||||
# define ocb_block16_xor_misaligned(in1, in2, out) \
|
||||
ocb_block_xor((in1)->c, (in2)->c, 16, (out)->c)
|
||||
|
@ -19,16 +19,20 @@
|
||||
/* Maximum length of a blob after header */
|
||||
#define BLOB_MAX_LENGTH 102400
|
||||
|
||||
int ossl_do_blob_header(const unsigned char **in, unsigned int length, unsigned int *pmagic,
|
||||
unsigned int *pbitlen, int *pisdss, int *pispub);
|
||||
int ossl_do_blob_header(const unsigned char **in, unsigned int length,
|
||||
unsigned int *pmagic, unsigned int *pbitlen,
|
||||
int *pisdss, int *pispub);
|
||||
unsigned int ossl_blob_length(unsigned bitlen, int isdss, int ispub);
|
||||
int ossl_do_PVK_header(const unsigned char **in, unsigned int length, int skip_magic,
|
||||
unsigned int *psaltlen, unsigned int *pkeylen);
|
||||
int ossl_do_PVK_header(const unsigned char **in, unsigned int length,
|
||||
int skip_magic, unsigned int *psaltlen,
|
||||
unsigned int *pkeylen);
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
DSA *ossl_b2i_DSA_after_header(const unsigned char **in, unsigned int bitlen, int ispub);
|
||||
DSA *ossl_b2i_DSA_after_header(const unsigned char **in, unsigned int bitlen,
|
||||
int ispub);
|
||||
# endif
|
||||
RSA *ossl_b2i_RSA_after_header(const unsigned char **in, unsigned int bitlen, int ispub);
|
||||
RSA *ossl_b2i_RSA_after_header(const unsigned char **in, unsigned int bitlen,
|
||||
int ispub);
|
||||
#endif
|
||||
EVP_PKEY *ossl_b2i(const unsigned char **in, unsigned int length, int *ispub);
|
||||
EVP_PKEY *ossl_b2i_bio(BIO *in, int *ispub);
|
||||
@ -36,12 +40,12 @@ EVP_PKEY *ossl_b2i_bio(BIO *in, int *ispub);
|
||||
#ifndef OPENSSL_NO_DEPRECATED_3_0
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
DSA *b2i_DSA_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
|
||||
DSA *b2i_DSA_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
DSA *b2i_DSA_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
# endif
|
||||
RSA *b2i_RSA_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
|
||||
RSA *b2i_RSA_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
RSA *b2i_RSA_PVK_bio_ex(BIO *in, pem_password_cb *cb, void *u,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -19,9 +19,10 @@
|
||||
|
||||
typedef struct poly1305_context POLY1305;
|
||||
|
||||
typedef void (*poly1305_blocks_f)(void *ctx, const unsigned char *inp, size_t len,
|
||||
unsigned int padbit);
|
||||
typedef void (*poly1305_emit_f)(void *ctx, unsigned char mac[16], const unsigned int nonce[4]);
|
||||
typedef void (*poly1305_blocks_f)(void *ctx, const unsigned char *inp,
|
||||
size_t len, unsigned int padbit);
|
||||
typedef void (*poly1305_emit_f)(void *ctx, unsigned char mac[16],
|
||||
const unsigned int nonce[4]);
|
||||
|
||||
struct poly1305_context
|
||||
{
|
||||
|
@ -13,8 +13,8 @@
|
||||
|
||||
#include <stddef.h> /* for size_t */
|
||||
|
||||
int ossl_punycode_decode(const char *pEncoded, const size_t enc_len, unsigned int *pDecoded,
|
||||
unsigned int *pout_length);
|
||||
int ossl_punycode_decode(const char *pEncoded, const size_t enc_len,
|
||||
unsigned int *pDecoded, unsigned int *pout_length);
|
||||
|
||||
int ossl_a2ulabel(const char *in, char *out, size_t outlen);
|
||||
|
||||
|
@ -24,7 +24,8 @@
|
||||
|
||||
#if defined(__APPLE__) && !defined(OPENSSL_NO_APPLE_CRYPTO_RANDOM)
|
||||
# include <Availability.h>
|
||||
# if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) \
|
||||
# if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) \
|
||||
&& __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200) \
|
||||
|| (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) \
|
||||
&& __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000)
|
||||
# define OPENSSL_APPLE_CRYPTO_RANDOM 1
|
||||
@ -79,7 +80,8 @@
|
||||
* sockets will be tried in the order listed in case accessing the device
|
||||
* files listed in DEVRANDOM did not return enough randomness.
|
||||
*/
|
||||
# define DEVRANDOM_EGD "/var/run/egd-pool", "/dev/egd-pool", "/etc/egd-pool", "/etc/entropy"
|
||||
# define DEVRANDOM_EGD \
|
||||
"/var/run/egd-pool", "/dev/egd-pool", "/etc/egd-pool", "/etc/entropy"
|
||||
#endif
|
||||
|
||||
void ossl_rand_cleanup_int(void);
|
||||
@ -109,14 +111,16 @@ void ossl_random_add_conf_module(void);
|
||||
/*
|
||||
* Get and cleanup random seed material.
|
||||
*/
|
||||
size_t ossl_rand_get_entropy(ossl_unused const OSSL_CORE_HANDLE *handle, unsigned char **pout,
|
||||
int entropy, size_t min_len, size_t max_len);
|
||||
void ossl_rand_cleanup_entropy(ossl_unused const OSSL_CORE_HANDLE *handle, unsigned char *buf,
|
||||
size_t len);
|
||||
size_t ossl_rand_get_nonce(ossl_unused const OSSL_CORE_HANDLE *handle, unsigned char **pout,
|
||||
size_t min_len, size_t max_len, const void *salt, size_t salt_len);
|
||||
void ossl_rand_cleanup_nonce(ossl_unused const OSSL_CORE_HANDLE *handle, unsigned char *buf,
|
||||
size_t len);
|
||||
size_t ossl_rand_get_entropy(ossl_unused const OSSL_CORE_HANDLE *handle,
|
||||
unsigned char **pout, int entropy, size_t min_len,
|
||||
size_t max_len);
|
||||
void ossl_rand_cleanup_entropy(ossl_unused const OSSL_CORE_HANDLE *handle,
|
||||
unsigned char *buf, size_t len);
|
||||
size_t ossl_rand_get_nonce(ossl_unused const OSSL_CORE_HANDLE *handle,
|
||||
unsigned char **pout, size_t min_len, size_t max_len,
|
||||
const void *salt, size_t salt_len);
|
||||
void ossl_rand_cleanup_nonce(ossl_unused const OSSL_CORE_HANDLE *handle,
|
||||
unsigned char *buf, size_t len);
|
||||
|
||||
/*
|
||||
* Get seeding material from the operating system sources.
|
||||
|
@ -19,9 +19,9 @@
|
||||
*
|
||||
* The max_len value for the buffer provided to the rand_drbg_get_entropy()
|
||||
* callback is currently 2^31 bytes (2 gigabytes), if a derivation function
|
||||
* is used. Since this is much too large to be allocated, the ossl_rand_pool_new()
|
||||
* function chooses more modest values as default pool length, bounded
|
||||
* by RAND_POOL_MIN_LENGTH and RAND_POOL_MAX_LENGTH
|
||||
* is used. Since this is much too large to be allocated, the
|
||||
* ossl_rand_pool_new() function chooses more modest values as default pool
|
||||
* length, bounded by RAND_POOL_MIN_LENGTH and RAND_POOL_MAX_LENGTH
|
||||
*
|
||||
* The choice of the RAND_POOL_FACTOR is large enough such that the
|
||||
* RAND_POOL can store a random input which has a lousy entropy rate of
|
||||
@ -82,8 +82,10 @@ typedef struct rand_pool_st
|
||||
size_t entropy_requested; /* requested entropy count in bits */
|
||||
} RAND_POOL;
|
||||
|
||||
RAND_POOL *ossl_rand_pool_new(int entropy_requested, int secure, size_t min_len, size_t max_len);
|
||||
RAND_POOL *ossl_rand_pool_attach(const unsigned char *buffer, size_t len, size_t entropy);
|
||||
RAND_POOL *ossl_rand_pool_new(int entropy_requested, int secure, size_t min_len,
|
||||
size_t max_len);
|
||||
RAND_POOL *ossl_rand_pool_attach(const unsigned char *buffer, size_t len,
|
||||
size_t entropy);
|
||||
void ossl_rand_pool_free(RAND_POOL *pool);
|
||||
|
||||
const unsigned char *ossl_rand_pool_buffer(RAND_POOL *pool);
|
||||
@ -96,10 +98,12 @@ size_t ossl_rand_pool_length(RAND_POOL *pool);
|
||||
size_t ossl_rand_pool_entropy_available(RAND_POOL *pool);
|
||||
size_t ossl_rand_pool_entropy_needed(RAND_POOL *pool);
|
||||
/* |entropy_factor| expresses how many bits of data contain 1 bit of entropy */
|
||||
size_t ossl_rand_pool_bytes_needed(RAND_POOL *pool, unsigned int entropy_factor);
|
||||
size_t ossl_rand_pool_bytes_needed(RAND_POOL *pool,
|
||||
unsigned int entropy_factor);
|
||||
size_t ossl_rand_pool_bytes_remaining(RAND_POOL *pool);
|
||||
|
||||
int ossl_rand_pool_add(RAND_POOL *pool, const unsigned char *buffer, size_t len, size_t entropy);
|
||||
int ossl_rand_pool_add(RAND_POOL *pool, const unsigned char *buffer, size_t len,
|
||||
size_t entropy);
|
||||
unsigned char *ossl_rand_pool_add_begin(RAND_POOL *pool, size_t len);
|
||||
int ossl_rand_pool_add_end(RAND_POOL *pool, size_t len, size_t entropy);
|
||||
|
||||
|
@ -31,19 +31,27 @@ typedef struct rsa_pss_params_30_st
|
||||
|
||||
RSA_PSS_PARAMS_30 *ossl_rsa_get0_pss_params_30(RSA *r);
|
||||
int ossl_rsa_pss_params_30_set_defaults(RSA_PSS_PARAMS_30 *rsa_pss_params);
|
||||
int ossl_rsa_pss_params_30_copy(RSA_PSS_PARAMS_30 *to, const RSA_PSS_PARAMS_30 *from);
|
||||
int ossl_rsa_pss_params_30_is_unrestricted(const RSA_PSS_PARAMS_30 *rsa_pss_params);
|
||||
int ossl_rsa_pss_params_30_set_hashalg(RSA_PSS_PARAMS_30 *rsa_pss_params, int hashalg_nid);
|
||||
int ossl_rsa_pss_params_30_set_maskgenalg(RSA_PSS_PARAMS_30 *rsa_pss_params, int maskgenalg_nid);
|
||||
int ossl_rsa_pss_params_30_copy(RSA_PSS_PARAMS_30 *to,
|
||||
const RSA_PSS_PARAMS_30 *from);
|
||||
int ossl_rsa_pss_params_30_is_unrestricted(
|
||||
const RSA_PSS_PARAMS_30 *rsa_pss_params);
|
||||
int ossl_rsa_pss_params_30_set_hashalg(RSA_PSS_PARAMS_30 *rsa_pss_params,
|
||||
int hashalg_nid);
|
||||
int ossl_rsa_pss_params_30_set_maskgenalg(RSA_PSS_PARAMS_30 *rsa_pss_params,
|
||||
int maskgenalg_nid);
|
||||
int ossl_rsa_pss_params_30_set_maskgenhashalg(RSA_PSS_PARAMS_30 *rsa_pss_params,
|
||||
int maskgenhashalg_nid);
|
||||
int ossl_rsa_pss_params_30_set_saltlen(RSA_PSS_PARAMS_30 *rsa_pss_params, int saltlen);
|
||||
int ossl_rsa_pss_params_30_set_trailerfield(RSA_PSS_PARAMS_30 *rsa_pss_params, int trailerfield);
|
||||
int ossl_rsa_pss_params_30_set_saltlen(RSA_PSS_PARAMS_30 *rsa_pss_params,
|
||||
int saltlen);
|
||||
int ossl_rsa_pss_params_30_set_trailerfield(RSA_PSS_PARAMS_30 *rsa_pss_params,
|
||||
int trailerfield);
|
||||
int ossl_rsa_pss_params_30_hashalg(const RSA_PSS_PARAMS_30 *rsa_pss_params);
|
||||
int ossl_rsa_pss_params_30_maskgenalg(const RSA_PSS_PARAMS_30 *rsa_pss_params);
|
||||
int ossl_rsa_pss_params_30_maskgenhashalg(const RSA_PSS_PARAMS_30 *rsa_pss_params);
|
||||
int ossl_rsa_pss_params_30_maskgenhashalg(
|
||||
const RSA_PSS_PARAMS_30 *rsa_pss_params);
|
||||
int ossl_rsa_pss_params_30_saltlen(const RSA_PSS_PARAMS_30 *rsa_pss_params);
|
||||
int ossl_rsa_pss_params_30_trailerfield(const RSA_PSS_PARAMS_30 *rsa_pss_params);
|
||||
int ossl_rsa_pss_params_30_trailerfield(
|
||||
const RSA_PSS_PARAMS_30 *rsa_pss_params);
|
||||
|
||||
const char *ossl_rsa_mgf_nid2name(int mgf);
|
||||
int ossl_rsa_oaeppss_md2nid(const EVP_MD *md);
|
||||
@ -53,44 +61,56 @@ RSA *ossl_rsa_new_with_ctx(OSSL_LIB_CTX *libctx);
|
||||
OSSL_LIB_CTX *ossl_rsa_get0_libctx(RSA *r);
|
||||
void ossl_rsa_set0_libctx(RSA *r, OSSL_LIB_CTX *libctx);
|
||||
|
||||
int ossl_rsa_set0_all_params(RSA *r, const STACK_OF(BIGNUM) * primes, const STACK_OF(BIGNUM) * exps,
|
||||
int ossl_rsa_set0_all_params(RSA *r, const STACK_OF(BIGNUM) * primes,
|
||||
const STACK_OF(BIGNUM) * exps,
|
||||
const STACK_OF(BIGNUM) * coeffs);
|
||||
int ossl_rsa_get0_all_params(RSA *r, STACK_OF(BIGNUM_const) * primes, STACK_OF(BIGNUM_const) * exps,
|
||||
int ossl_rsa_get0_all_params(RSA *r, STACK_OF(BIGNUM_const) * primes,
|
||||
STACK_OF(BIGNUM_const) * exps,
|
||||
STACK_OF(BIGNUM_const) * coeffs);
|
||||
int ossl_rsa_is_foreign(const RSA *rsa);
|
||||
RSA *ossl_rsa_dup(const RSA *rsa, int selection);
|
||||
|
||||
int ossl_rsa_todata(RSA *rsa, OSSL_PARAM_BLD *bld, OSSL_PARAM params[], int include_private);
|
||||
int ossl_rsa_todata(RSA *rsa, OSSL_PARAM_BLD *bld, OSSL_PARAM params[],
|
||||
int include_private);
|
||||
int ossl_rsa_fromdata(RSA *rsa, const OSSL_PARAM params[], int include_private);
|
||||
int ossl_rsa_pss_params_30_todata(const RSA_PSS_PARAMS_30 *pss, OSSL_PARAM_BLD *bld,
|
||||
OSSL_PARAM params[]);
|
||||
int ossl_rsa_pss_params_30_fromdata(RSA_PSS_PARAMS_30 *pss_params, int *defaults_set,
|
||||
const OSSL_PARAM params[], OSSL_LIB_CTX *libctx);
|
||||
int ossl_rsa_pss_params_30_todata(const RSA_PSS_PARAMS_30 *pss,
|
||||
OSSL_PARAM_BLD *bld, OSSL_PARAM params[]);
|
||||
int ossl_rsa_pss_params_30_fromdata(RSA_PSS_PARAMS_30 *pss_params,
|
||||
int *defaults_set,
|
||||
const OSSL_PARAM params[],
|
||||
OSSL_LIB_CTX *libctx);
|
||||
int ossl_rsa_set0_pss_params(RSA *r, RSA_PSS_PARAMS *pss);
|
||||
int ossl_rsa_pss_get_param_unverified(const RSA_PSS_PARAMS *pss, const EVP_MD **pmd,
|
||||
const EVP_MD **pmgf1md, int *psaltlen, int *ptrailerField);
|
||||
int ossl_rsa_pss_get_param_unverified(const RSA_PSS_PARAMS *pss,
|
||||
const EVP_MD **pmd,
|
||||
const EVP_MD **pmgf1md, int *psaltlen,
|
||||
int *ptrailerField);
|
||||
RSA_PSS_PARAMS *ossl_rsa_pss_decode(const X509_ALGOR *alg);
|
||||
int ossl_rsa_param_decode(RSA *rsa, const X509_ALGOR *alg);
|
||||
RSA *ossl_rsa_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
RSA *ossl_rsa_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
int ossl_rsa_padding_check_PKCS1_type_2(OSSL_LIB_CTX *ctx, unsigned char *to, int tlen,
|
||||
const unsigned char *from, int flen, int num,
|
||||
unsigned char *kdk);
|
||||
int ossl_rsa_padding_check_PKCS1_type_2_TLS(OSSL_LIB_CTX *ctx, unsigned char *to, size_t tlen,
|
||||
const unsigned char *from, size_t flen,
|
||||
int client_version, int alt_version);
|
||||
int ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(OSSL_LIB_CTX *libctx, unsigned char *to, int tlen,
|
||||
int ossl_rsa_padding_check_PKCS1_type_2(OSSL_LIB_CTX *ctx, unsigned char *to,
|
||||
int tlen, const unsigned char *from,
|
||||
int flen, int num, unsigned char *kdk);
|
||||
int ossl_rsa_padding_check_PKCS1_type_2_TLS(OSSL_LIB_CTX *ctx,
|
||||
unsigned char *to, size_t tlen,
|
||||
const unsigned char *from,
|
||||
size_t flen, int client_version,
|
||||
int alt_version);
|
||||
int ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(OSSL_LIB_CTX *libctx,
|
||||
unsigned char *to, int tlen,
|
||||
const unsigned char *from, int flen,
|
||||
const unsigned char *param, int plen, const EVP_MD *md,
|
||||
const unsigned char *param,
|
||||
int plen, const EVP_MD *md,
|
||||
const EVP_MD *mgf1md);
|
||||
|
||||
int ossl_rsa_validate_public(const RSA *key);
|
||||
int ossl_rsa_validate_private(const RSA *key);
|
||||
int ossl_rsa_validate_pairwise(const RSA *key);
|
||||
|
||||
int ossl_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len, unsigned char *rm,
|
||||
size_t *prm_len, const unsigned char *sigbuf, size_t siglen, RSA *rsa);
|
||||
int ossl_rsa_verify(int dtype, const unsigned char *m, unsigned int m_len,
|
||||
unsigned char *rm, size_t *prm_len,
|
||||
const unsigned char *sigbuf, size_t siglen, RSA *rsa);
|
||||
|
||||
const unsigned char *ossl_rsa_digestinfo_encoding(int md_nid, size_t *len);
|
||||
|
||||
@ -99,8 +119,8 @@ extern const char *ossl_rsa_mp_exp_names[];
|
||||
extern const char *ossl_rsa_mp_coeff_names[];
|
||||
|
||||
ASN1_STRING *ossl_rsa_ctx_to_pss_string(EVP_PKEY_CTX *pkctx);
|
||||
int ossl_rsa_pss_to_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pkctx, const X509_ALGOR *sigalg,
|
||||
EVP_PKEY *pkey);
|
||||
int ossl_rsa_pss_to_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pkctx,
|
||||
const X509_ALGOR *sigalg, EVP_PKEY *pkey);
|
||||
|
||||
#if defined(FIPS_MODULE) && !defined(OPENSSL_NO_ACVP_TESTS)
|
||||
int ossl_rsa_acvp_test_gen_params_new(OSSL_PARAM **dst, const OSSL_PARAM src[]);
|
||||
|
@ -23,7 +23,8 @@ typedef struct siphash_st SIPHASH;
|
||||
size_t SipHash_ctx_size(void);
|
||||
size_t SipHash_hash_size(SIPHASH *ctx);
|
||||
int SipHash_set_hash_size(SIPHASH *ctx, size_t hash_size);
|
||||
int SipHash_Init(SIPHASH *ctx, const unsigned char *k, int crounds, int drounds);
|
||||
int SipHash_Init(SIPHASH *ctx, const unsigned char *k, int crounds,
|
||||
int drounds);
|
||||
void SipHash_Update(SIPHASH *ctx, const unsigned char *in, size_t inlen);
|
||||
int SipHash_Final(SIPHASH *ctx, unsigned char *out, size_t outlen);
|
||||
|
||||
|
@ -11,18 +11,21 @@
|
||||
|
||||
typedef struct siv128_context SIV128_CONTEXT;
|
||||
|
||||
SIV128_CONTEXT *ossl_siv128_new(const unsigned char *key, int klen, EVP_CIPHER *cbc,
|
||||
EVP_CIPHER *ctr, OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_siv128_init(SIV128_CONTEXT *ctx, const unsigned char *key, int klen, const EVP_CIPHER *cbc,
|
||||
const EVP_CIPHER *ctr, OSSL_LIB_CTX *libctx, const char *propq);
|
||||
SIV128_CONTEXT *ossl_siv128_new(const unsigned char *key, int klen,
|
||||
EVP_CIPHER *cbc, EVP_CIPHER *ctr,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_siv128_init(SIV128_CONTEXT *ctx, const unsigned char *key, int klen,
|
||||
const EVP_CIPHER *cbc, const EVP_CIPHER *ctr,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_siv128_copy_ctx(SIV128_CONTEXT *dest, SIV128_CONTEXT *src);
|
||||
int ossl_siv128_aad(SIV128_CONTEXT *ctx, const unsigned char *aad, size_t len);
|
||||
int ossl_siv128_encrypt(SIV128_CONTEXT *ctx, const unsigned char *in, unsigned char *out,
|
||||
size_t len);
|
||||
int ossl_siv128_decrypt(SIV128_CONTEXT *ctx, const unsigned char *in, unsigned char *out,
|
||||
size_t len);
|
||||
int ossl_siv128_encrypt(SIV128_CONTEXT *ctx, const unsigned char *in,
|
||||
unsigned char *out, size_t len);
|
||||
int ossl_siv128_decrypt(SIV128_CONTEXT *ctx, const unsigned char *in,
|
||||
unsigned char *out, size_t len);
|
||||
int ossl_siv128_finish(SIV128_CONTEXT *ctx);
|
||||
int ossl_siv128_set_tag(SIV128_CONTEXT *ctx, const unsigned char *tag, size_t len);
|
||||
int ossl_siv128_set_tag(SIV128_CONTEXT *ctx, const unsigned char *tag,
|
||||
size_t len);
|
||||
int ossl_siv128_get_tag(SIV128_CONTEXT *ctx, unsigned char *tag, size_t len);
|
||||
int ossl_siv128_cleanup(SIV128_CONTEXT *ctx);
|
||||
int ossl_siv128_speed(SIV128_CONTEXT *ctx, int arg);
|
||||
|
@ -25,44 +25,53 @@ int ossl_sm2_key_private_check(const EC_KEY *eckey);
|
||||
/* The default user id as specified in GM/T 0009-2012 */
|
||||
# define SM2_DEFAULT_USERID "1234567812345678"
|
||||
|
||||
int ossl_sm2_compute_z_digest(uint8_t *out, const EVP_MD *digest, const uint8_t *id,
|
||||
const size_t id_len, const EC_KEY *key);
|
||||
int ossl_sm2_compute_z_digest(uint8_t *out, const EVP_MD *digest,
|
||||
const uint8_t *id, const size_t id_len,
|
||||
const EC_KEY *key);
|
||||
|
||||
/*
|
||||
* SM2 signature operation. Computes Z and then signs H(Z || msg) using SM2
|
||||
*/
|
||||
ECDSA_SIG *ossl_sm2_do_sign(const EC_KEY *key, const EVP_MD *digest, const uint8_t *id,
|
||||
const size_t id_len, const uint8_t *msg, size_t msg_len);
|
||||
ECDSA_SIG *ossl_sm2_do_sign(const EC_KEY *key, const EVP_MD *digest,
|
||||
const uint8_t *id, const size_t id_len,
|
||||
const uint8_t *msg, size_t msg_len);
|
||||
|
||||
int ossl_sm2_do_verify(const EC_KEY *key, const EVP_MD *digest, const ECDSA_SIG *signature,
|
||||
const uint8_t *id, const size_t id_len, const uint8_t *msg, size_t msg_len);
|
||||
int ossl_sm2_do_verify(const EC_KEY *key, const EVP_MD *digest,
|
||||
const ECDSA_SIG *signature, const uint8_t *id,
|
||||
const size_t id_len, const uint8_t *msg, size_t msg_len);
|
||||
|
||||
/*
|
||||
* SM2 signature generation.
|
||||
*/
|
||||
int ossl_sm2_internal_sign(const unsigned char *dgst, int dgstlen, unsigned char *sig,
|
||||
unsigned int *siglen, EC_KEY *eckey);
|
||||
int ossl_sm2_internal_sign(const unsigned char *dgst, int dgstlen,
|
||||
unsigned char *sig, unsigned int *siglen,
|
||||
EC_KEY *eckey);
|
||||
|
||||
/*
|
||||
* SM2 signature verification.
|
||||
*/
|
||||
int ossl_sm2_internal_verify(const unsigned char *dgst, int dgstlen, const unsigned char *sig,
|
||||
int siglen, EC_KEY *eckey);
|
||||
int ossl_sm2_internal_verify(const unsigned char *dgst, int dgstlen,
|
||||
const unsigned char *sig, int siglen,
|
||||
EC_KEY *eckey);
|
||||
|
||||
/*
|
||||
* SM2 encryption
|
||||
*/
|
||||
int ossl_sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len,
|
||||
size_t *ct_size);
|
||||
int ossl_sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest,
|
||||
size_t msg_len, size_t *ct_size);
|
||||
|
||||
int ossl_sm2_plaintext_size(const unsigned char *ct, size_t ct_size, size_t *pt_size);
|
||||
int ossl_sm2_plaintext_size(const unsigned char *ct, size_t ct_size,
|
||||
size_t *pt_size);
|
||||
|
||||
int ossl_sm2_encrypt(const EC_KEY *key, const EVP_MD *digest, const uint8_t *msg, size_t msg_len,
|
||||
int ossl_sm2_encrypt(const EC_KEY *key, const EVP_MD *digest,
|
||||
const uint8_t *msg, size_t msg_len,
|
||||
uint8_t *ciphertext_buf, size_t *ciphertext_len);
|
||||
|
||||
int ossl_sm2_decrypt(const EC_KEY *key, const EVP_MD *digest, const uint8_t *ciphertext,
|
||||
size_t ciphertext_len, uint8_t *ptext_buf, size_t *ptext_len);
|
||||
int ossl_sm2_decrypt(const EC_KEY *key, const EVP_MD *digest,
|
||||
const uint8_t *ciphertext, size_t ciphertext_len,
|
||||
uint8_t *ptext_buf, size_t *ptext_len);
|
||||
|
||||
const unsigned char *ossl_sm2_algorithmidentifier_encoding(int md_nid, size_t *len);
|
||||
const unsigned char *ossl_sm2_algorithmidentifier_encoding(int md_nid,
|
||||
size_t *len);
|
||||
#endif /* OPENSSL_NO_SM2 */
|
||||
#endif
|
||||
|
@ -19,9 +19,12 @@ extern unsigned int OPENSSL_arm_midr;
|
||||
static inline int vpsm4_capable(void)
|
||||
{
|
||||
return (OPENSSL_armcap_P & ARMV8_CPUID)
|
||||
&& (MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_V1)
|
||||
|| MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM, ARM_CPU_PART_N1)
|
||||
|| MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, HISI_CPU_IMP, HISI_CPU_PART_KP920));
|
||||
&& (MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM,
|
||||
ARM_CPU_PART_V1)
|
||||
|| MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, ARM_CPU_IMP_ARM,
|
||||
ARM_CPU_PART_N1)
|
||||
|| MIDR_IS_CPU_MODEL(OPENSSL_arm_midr, HISI_CPU_IMP,
|
||||
HISI_CPU_PART_KP920));
|
||||
}
|
||||
# if defined(VPSM4_ASM)
|
||||
# define VPSM4_CAPABLE vpsm4_capable()
|
||||
@ -41,27 +44,35 @@ static inline int vpsm4_capable(void)
|
||||
#if defined(HWSM4_CAPABLE)
|
||||
int HWSM4_set_encrypt_key(const unsigned char *userKey, SM4_KEY *key);
|
||||
int HWSM4_set_decrypt_key(const unsigned char *userKey, SM4_KEY *key);
|
||||
void HWSM4_encrypt(const unsigned char *in, unsigned char *out, const SM4_KEY *key);
|
||||
void HWSM4_decrypt(const unsigned char *in, unsigned char *out, const SM4_KEY *key);
|
||||
void HWSM4_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t length,
|
||||
const SM4_KEY *key, unsigned char *ivec, const int enc);
|
||||
void HWSM4_ecb_encrypt(const unsigned char *in, unsigned char *out, size_t length,
|
||||
const SM4_KEY *key, const int enc);
|
||||
void HWSM4_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const void *key, const unsigned char ivec[16]);
|
||||
void HWSM4_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const SM4_KEY *key);
|
||||
void HWSM4_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const SM4_KEY *key);
|
||||
void HWSM4_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const SM4_KEY *key, unsigned char *ivec,
|
||||
const int enc);
|
||||
void HWSM4_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const SM4_KEY *key, const int enc);
|
||||
void HWSM4_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
const unsigned char ivec[16]);
|
||||
#endif /* HWSM4_CAPABLE */
|
||||
|
||||
#ifdef VPSM4_CAPABLE
|
||||
int vpsm4_set_encrypt_key(const unsigned char *userKey, SM4_KEY *key);
|
||||
int vpsm4_set_decrypt_key(const unsigned char *userKey, SM4_KEY *key);
|
||||
void vpsm4_encrypt(const unsigned char *in, unsigned char *out, const SM4_KEY *key);
|
||||
void vpsm4_decrypt(const unsigned char *in, unsigned char *out, const SM4_KEY *key);
|
||||
void vpsm4_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t length,
|
||||
const SM4_KEY *key, unsigned char *ivec, const int enc);
|
||||
void vpsm4_ecb_encrypt(const unsigned char *in, unsigned char *out, size_t length,
|
||||
const SM4_KEY *key, const int enc);
|
||||
void vpsm4_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const void *key, const unsigned char ivec[16]);
|
||||
void vpsm4_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const SM4_KEY *key);
|
||||
void vpsm4_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const SM4_KEY *key);
|
||||
void vpsm4_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const SM4_KEY *key, unsigned char *ivec,
|
||||
const int enc);
|
||||
void vpsm4_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const SM4_KEY *key, const int enc);
|
||||
void vpsm4_ctr32_encrypt_blocks(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
const unsigned char ivec[16]);
|
||||
#endif /* VPSM4_CAPABLE */
|
||||
|
||||
#endif /* OSSL_SM4_PLATFORM_H */
|
||||
|
@ -22,19 +22,23 @@ extern "C" {
|
||||
|
||||
#define DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, ctype) \
|
||||
SPARSE_ARRAY_OF(type); \
|
||||
static ossl_unused ossl_inline SPARSE_ARRAY_OF(type) * ossl_sa_##type##_new(void) \
|
||||
static ossl_unused ossl_inline SPARSE_ARRAY_OF(type) \
|
||||
* ossl_sa_##type##_new(void) \
|
||||
{ \
|
||||
return (SPARSE_ARRAY_OF(type) *)ossl_sa_new(); \
|
||||
} \
|
||||
static ossl_unused ossl_inline void ossl_sa_##type##_free(SPARSE_ARRAY_OF(type) * sa) \
|
||||
static ossl_unused ossl_inline void ossl_sa_##type##_free( \
|
||||
SPARSE_ARRAY_OF(type) * sa) \
|
||||
{ \
|
||||
ossl_sa_free((OPENSSL_SA *)sa); \
|
||||
} \
|
||||
static ossl_unused ossl_inline void ossl_sa_##type##_free_leaves(SPARSE_ARRAY_OF(type) * sa) \
|
||||
static ossl_unused ossl_inline void ossl_sa_##type##_free_leaves( \
|
||||
SPARSE_ARRAY_OF(type) * sa) \
|
||||
{ \
|
||||
ossl_sa_free_leaves((OPENSSL_SA *)sa); \
|
||||
} \
|
||||
static ossl_unused ossl_inline size_t ossl_sa_##type##_num(const SPARSE_ARRAY_OF(type) * sa) \
|
||||
static ossl_unused ossl_inline size_t ossl_sa_##type##_num( \
|
||||
const SPARSE_ARRAY_OF(type) * sa) \
|
||||
{ \
|
||||
return ossl_sa_num((OPENSSL_SA *)sa); \
|
||||
} \
|
||||
@ -44,24 +48,27 @@ extern "C" {
|
||||
ossl_sa_doall((OPENSSL_SA *)sa, (void (*)(ossl_uintmax_t, void *))leaf); \
|
||||
} \
|
||||
static ossl_unused ossl_inline void ossl_sa_##type##_doall_arg( \
|
||||
const SPARSE_ARRAY_OF(type) * sa, void (*leaf)(ossl_uintmax_t, type *, void *), void *arg) \
|
||||
const SPARSE_ARRAY_OF(type) * sa, \
|
||||
void (*leaf)(ossl_uintmax_t, type *, void *), void *arg) \
|
||||
{ \
|
||||
ossl_sa_doall_arg((OPENSSL_SA *)sa, (void (*)(ossl_uintmax_t, void *, void *))leaf, arg); \
|
||||
ossl_sa_doall_arg((OPENSSL_SA *)sa, \
|
||||
(void (*)(ossl_uintmax_t, void *, void *))leaf, arg); \
|
||||
} \
|
||||
static ossl_unused ossl_inline ctype *ossl_sa_##type##_get(const SPARSE_ARRAY_OF(type) * sa, \
|
||||
ossl_uintmax_t n) \
|
||||
static ossl_unused ossl_inline ctype *ossl_sa_##type##_get( \
|
||||
const SPARSE_ARRAY_OF(type) * sa, ossl_uintmax_t n) \
|
||||
{ \
|
||||
return (type *)ossl_sa_get((OPENSSL_SA *)sa, n); \
|
||||
} \
|
||||
static ossl_unused ossl_inline int ossl_sa_##type##_set(SPARSE_ARRAY_OF(type) * sa, \
|
||||
ossl_uintmax_t n, ctype * val) \
|
||||
static ossl_unused ossl_inline int ossl_sa_##type##_set( \
|
||||
SPARSE_ARRAY_OF(type) * sa, ossl_uintmax_t n, ctype * val) \
|
||||
{ \
|
||||
return ossl_sa_set((OPENSSL_SA *)sa, n, (void *)val); \
|
||||
} \
|
||||
SPARSE_ARRAY_OF(type)
|
||||
|
||||
#define DEFINE_SPARSE_ARRAY_OF(type) DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, type)
|
||||
#define DEFINE_SPARSE_ARRAY_OF_CONST(type) DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, const type)
|
||||
#define DEFINE_SPARSE_ARRAY_OF_CONST(type) \
|
||||
DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, const type)
|
||||
|
||||
typedef struct sparse_array_st OPENSSL_SA;
|
||||
OPENSSL_SA *ossl_sa_new(void);
|
||||
@ -69,7 +76,8 @@ void ossl_sa_free(OPENSSL_SA *sa);
|
||||
void ossl_sa_free_leaves(OPENSSL_SA *sa);
|
||||
size_t ossl_sa_num(const OPENSSL_SA *sa);
|
||||
void ossl_sa_doall(const OPENSSL_SA *sa, void (*leaf)(ossl_uintmax_t, void *));
|
||||
void ossl_sa_doall_arg(const OPENSSL_SA *sa, void (*leaf)(ossl_uintmax_t, void *, void *), void *);
|
||||
void ossl_sa_doall_arg(const OPENSSL_SA *sa,
|
||||
void (*leaf)(ossl_uintmax_t, void *, void *), void *);
|
||||
void *ossl_sa_get(const OPENSSL_SA *sa, ossl_uintmax_t n);
|
||||
int ossl_sa_set(OPENSSL_SA *sa, ossl_uintmax_t n, void *val);
|
||||
|
||||
|
@ -257,7 +257,8 @@ struct x509_store_ctx_st
|
||||
int (*check_policy)(X509_STORE_CTX *ctx);
|
||||
STACK_OF(X509) * (*lookup_certs)(X509_STORE_CTX *ctx, const X509_NAME *nm);
|
||||
/* cannot constify 'ctx' param due to lookup_certs_sk() in x509_vfy.c */
|
||||
STACK_OF(X509_CRL) * (*lookup_crls)(const X509_STORE_CTX *ctx, const X509_NAME *nm);
|
||||
STACK_OF(X509_CRL)
|
||||
* (*lookup_crls)(const X509_STORE_CTX *ctx, const X509_NAME *nm);
|
||||
int (*cleanup)(X509_STORE_CTX *ctx);
|
||||
/* The following is built up */
|
||||
/* if 0, rebuild chain */
|
||||
@ -329,12 +330,16 @@ int ossl_x509v3_cache_extensions(X509 *x);
|
||||
int ossl_x509_init_sig_info(X509 *x);
|
||||
|
||||
int ossl_x509_set0_libctx(X509 *x, OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_x509_crl_set0_libctx(X509_CRL *x, OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_x509_req_set0_libctx(X509_REQ *x, OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_asn1_item_digest_ex(const ASN1_ITEM *it, const EVP_MD *type, void *data, unsigned char *md,
|
||||
unsigned int *len, OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_x509_crl_set0_libctx(X509_CRL *x, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
int ossl_x509_req_set0_libctx(X509_REQ *x, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
int ossl_asn1_item_digest_ex(const ASN1_ITEM *it, const EVP_MD *type,
|
||||
void *data, unsigned char *md, unsigned int *len,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
int ossl_x509_add_cert_new(STACK_OF(X509) * *sk, X509 *cert, int flags);
|
||||
int ossl_x509_add_certs_new(STACK_OF(X509) * *p_sk, STACK_OF(X509) * certs, int flags);
|
||||
int ossl_x509_add_certs_new(STACK_OF(X509) * *p_sk, STACK_OF(X509) * certs,
|
||||
int flags);
|
||||
|
||||
STACK_OF(X509_ATTRIBUTE) * ossl_x509at_dup(const STACK_OF(X509_ATTRIBUTE) * x);
|
||||
|
||||
@ -356,18 +361,23 @@ DH *ossl_d2i_DHx_PUBKEY(DH **a, const unsigned char **pp, long length);
|
||||
int ossl_i2d_DHx_PUBKEY(const DH *a, unsigned char **pp);
|
||||
#endif /* OPENSSL_NO_DH */
|
||||
#ifndef OPENSSL_NO_EC
|
||||
ECX_KEY *ossl_d2i_ED25519_PUBKEY(ECX_KEY **a, const unsigned char **pp, long length);
|
||||
ECX_KEY *ossl_d2i_ED25519_PUBKEY(ECX_KEY **a, const unsigned char **pp,
|
||||
long length);
|
||||
int ossl_i2d_ED25519_PUBKEY(const ECX_KEY *a, unsigned char **pp);
|
||||
ECX_KEY *ossl_d2i_ED448_PUBKEY(ECX_KEY **a, const unsigned char **pp, long length);
|
||||
ECX_KEY *ossl_d2i_ED448_PUBKEY(ECX_KEY **a, const unsigned char **pp,
|
||||
long length);
|
||||
int ossl_i2d_ED448_PUBKEY(const ECX_KEY *a, unsigned char **pp);
|
||||
ECX_KEY *ossl_d2i_X25519_PUBKEY(ECX_KEY **a, const unsigned char **pp, long length);
|
||||
ECX_KEY *ossl_d2i_X25519_PUBKEY(ECX_KEY **a, const unsigned char **pp,
|
||||
long length);
|
||||
int ossl_i2d_X25519_PUBKEY(const ECX_KEY *a, unsigned char **pp);
|
||||
ECX_KEY *ossl_d2i_X448_PUBKEY(ECX_KEY **a, const unsigned char **pp, long length);
|
||||
ECX_KEY *ossl_d2i_X448_PUBKEY(ECX_KEY **a, const unsigned char **pp,
|
||||
long length);
|
||||
int ossl_i2d_X448_PUBKEY(const ECX_KEY *a, unsigned char **pp);
|
||||
#endif /* OPENSSL_NO_EC */
|
||||
EVP_PKEY *ossl_d2i_PUBKEY_legacy(EVP_PKEY **a, const unsigned char **pp, long length);
|
||||
EVP_PKEY *ossl_d2i_PUBKEY_legacy(EVP_PKEY **a, const unsigned char **pp,
|
||||
long length);
|
||||
int ossl_x509_check_private_key(const EVP_PKEY *k, const EVP_PKEY *pkey);
|
||||
|
||||
int x509v3_add_len_value_uchar(const char *name, const unsigned char *value, size_t vallen,
|
||||
STACK_OF(CONF_VALUE) * *extlist);
|
||||
int x509v3_add_len_value_uchar(const char *name, const unsigned char *value,
|
||||
size_t vallen, STACK_OF(CONF_VALUE) * *extlist);
|
||||
#endif /* OSSL_CRYPTO_X509_H */
|
||||
|
@ -63,15 +63,21 @@ int bread_conv(BIO *bio, char *data, size_t datal, size_t *read);
|
||||
BIO_set_flags(b, (is_tx) ? BIO_FLAGS_KTLS_TX : BIO_FLAGS_KTLS_RX)
|
||||
#define BIO_should_ktls_flag(b, is_tx) \
|
||||
BIO_test_flags(b, (is_tx) ? BIO_FLAGS_KTLS_TX : BIO_FLAGS_KTLS_RX)
|
||||
#define BIO_set_ktls_ctrl_msg_flag(b) BIO_set_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG)
|
||||
#define BIO_should_ktls_ctrl_msg_flag(b) BIO_test_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG)
|
||||
#define BIO_clear_ktls_ctrl_msg_flag(b) BIO_clear_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG)
|
||||
#define BIO_set_ktls_zerocopy_sendfile_flag(b) BIO_set_flags(b, BIO_FLAGS_KTLS_TX_ZEROCOPY_SENDFILE)
|
||||
#define BIO_set_ktls_ctrl_msg_flag(b) \
|
||||
BIO_set_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG)
|
||||
#define BIO_should_ktls_ctrl_msg_flag(b) \
|
||||
BIO_test_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG)
|
||||
#define BIO_clear_ktls_ctrl_msg_flag(b) \
|
||||
BIO_clear_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG)
|
||||
#define BIO_set_ktls_zerocopy_sendfile_flag(b) \
|
||||
BIO_set_flags(b, BIO_FLAGS_KTLS_TX_ZEROCOPY_SENDFILE)
|
||||
|
||||
#define BIO_set_ktls(b, keyblob, is_tx) BIO_ctrl(b, BIO_CTRL_SET_KTLS, is_tx, keyblob)
|
||||
#define BIO_set_ktls(b, keyblob, is_tx) \
|
||||
BIO_ctrl(b, BIO_CTRL_SET_KTLS, is_tx, keyblob)
|
||||
#define BIO_set_ktls_ctrl_msg(b, record_type) \
|
||||
BIO_ctrl(b, BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG, record_type, NULL)
|
||||
#define BIO_clear_ktls_ctrl_msg(b) BIO_ctrl(b, BIO_CTRL_CLEAR_KTLS_TX_CTRL_MSG, 0, NULL)
|
||||
#define BIO_clear_ktls_ctrl_msg(b) \
|
||||
BIO_ctrl(b, BIO_CTRL_CLEAR_KTLS_TX_CTRL_MSG, 0, NULL)
|
||||
#define BIO_set_ktls_tx_zerocopy_sendfile(b) \
|
||||
BIO_ctrl(b, BIO_CTRL_SET_KTLS_TX_ZEROCOPY_SENDFILE, 0, NULL)
|
||||
|
||||
@ -79,8 +85,10 @@ int bread_conv(BIO *bio, char *data, size_t datal, size_t *read);
|
||||
OSSL_CORE_BIO *ossl_core_bio_new_from_bio(BIO *bio);
|
||||
OSSL_CORE_BIO *ossl_core_bio_new_file(const char *filename, const char *mode);
|
||||
OSSL_CORE_BIO *ossl_core_bio_new_mem_buf(const void *buf, int len);
|
||||
int ossl_core_bio_read_ex(OSSL_CORE_BIO *cb, void *data, size_t dlen, size_t *readbytes);
|
||||
int ossl_core_bio_write_ex(OSSL_CORE_BIO *cb, const void *data, size_t dlen, size_t *written);
|
||||
int ossl_core_bio_read_ex(OSSL_CORE_BIO *cb, void *data, size_t dlen,
|
||||
size_t *readbytes);
|
||||
int ossl_core_bio_write_ex(OSSL_CORE_BIO *cb, const void *data, size_t dlen,
|
||||
size_t *written);
|
||||
int ossl_core_bio_gets(OSSL_CORE_BIO *cb, char *buf, int size);
|
||||
int ossl_core_bio_puts(OSSL_CORE_BIO *cb, const char *buf);
|
||||
long ossl_core_bio_ctrl(OSSL_CORE_BIO *cb, int cmd, long larg, void *parg);
|
||||
|
@ -21,8 +21,8 @@
|
||||
#ifdef NDEBUG
|
||||
# define ossl_assert(x) ((x) != 0)
|
||||
#else
|
||||
__owur static ossl_inline int ossl_assert_int(int expr, const char *exprstr, const char *file,
|
||||
int line)
|
||||
__owur static ossl_inline int ossl_assert_int(int expr, const char *exprstr,
|
||||
const char *file, int line)
|
||||
{
|
||||
if (!expr)
|
||||
OPENSSL_die(exprstr, file, line);
|
||||
@ -30,14 +30,16 @@ __owur static ossl_inline int ossl_assert_int(int expr, const char *exprstr, con
|
||||
return expr;
|
||||
}
|
||||
|
||||
# define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: " # x, __FILE__, __LINE__)
|
||||
# define ossl_assert(x) \
|
||||
ossl_assert_int((x) != 0, "Assertion failed: " #x, __FILE__, __LINE__)
|
||||
|
||||
#endif
|
||||
|
||||
/* Check if |pre|, which must be a string literal, is a prefix of |str| */
|
||||
#define HAS_PREFIX(str, pre) (strncmp(str, pre "", sizeof(pre) - 1) == 0)
|
||||
/* As before, and if check succeeds, advance |str| past the prefix |pre| */
|
||||
#define CHECK_AND_SKIP_PREFIX(str, pre) (HAS_PREFIX(str, pre) ? ((str) += sizeof(pre) - 1, 1) : 0)
|
||||
#define CHECK_AND_SKIP_PREFIX(str, pre) \
|
||||
(HAS_PREFIX(str, pre) ? ((str) += sizeof(pre) - 1, 1) : 0)
|
||||
/* Check if the string literal |p| is a case-insensitive prefix of |s| */
|
||||
#define HAS_CASE_PREFIX(s, p) (OPENSSL_strncasecmp(s, p "", sizeof(p) - 1) == 0)
|
||||
/* As before, and if check succeeds, advance |str| past the prefix |pre| */
|
||||
@ -47,7 +49,8 @@ __owur static ossl_inline int ossl_assert_int(int expr, const char *exprstr, con
|
||||
#define HAS_CASE_SUFFIX(str, suffix) \
|
||||
(strlen(str) < sizeof(suffix) - 1 \
|
||||
? 0 \
|
||||
: OPENSSL_strcasecmp(str + strlen(str) - sizeof(suffix) + 1, suffix "") == 0)
|
||||
: OPENSSL_strcasecmp(str + strlen(str) - sizeof(suffix) + 1, suffix "") \
|
||||
== 0)
|
||||
|
||||
/*
|
||||
* Use this inside a union with the field that needs to be aligned to a
|
||||
@ -109,8 +112,8 @@ static ossl_inline int ossl_is_absolute_path(const char *path)
|
||||
{
|
||||
#if defined __VMS
|
||||
if (strchr(path, ':') != NULL
|
||||
|| ((path[0] == '[' || path[0] == '<') && path[1] != '.' && path[1] != '-' && path[1] != ']'
|
||||
&& path[1] != '>'))
|
||||
|| ((path[0] == '[' || path[0] == '<') && path[1] != '.' && path[1] != '-'
|
||||
&& path[1] != ']' && path[1] != '>'))
|
||||
return 1;
|
||||
#elif defined _WIN32
|
||||
if (path[0] == '\\' || (path[0] != '\0' && path[1] == ':'))
|
||||
|
@ -37,16 +37,20 @@ static ossl_inline uint32_t constant_time_msb_32(uint32_t a);
|
||||
static ossl_inline uint64_t constant_time_msb_64(uint64_t a);
|
||||
|
||||
/* Returns 0xff..f if a < b and 0 otherwise. */
|
||||
static ossl_inline unsigned int constant_time_lt(unsigned int a, unsigned int b);
|
||||
static ossl_inline unsigned int constant_time_lt(unsigned int a,
|
||||
unsigned int b);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static ossl_inline unsigned char constant_time_lt_8(unsigned int a, unsigned int b);
|
||||
static ossl_inline unsigned char constant_time_lt_8(unsigned int a,
|
||||
unsigned int b);
|
||||
/* Convenience method for uint64_t. */
|
||||
static ossl_inline uint64_t constant_time_lt_64(uint64_t a, uint64_t b);
|
||||
|
||||
/* Returns 0xff..f if a >= b and 0 otherwise. */
|
||||
static ossl_inline unsigned int constant_time_ge(unsigned int a, unsigned int b);
|
||||
static ossl_inline unsigned int constant_time_ge(unsigned int a,
|
||||
unsigned int b);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static ossl_inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b);
|
||||
static ossl_inline unsigned char constant_time_ge_8(unsigned int a,
|
||||
unsigned int b);
|
||||
|
||||
/* Returns 0xff..f if a == 0 and 0 otherwise. */
|
||||
static ossl_inline unsigned int constant_time_is_zero(unsigned int a);
|
||||
@ -56,9 +60,11 @@ static ossl_inline unsigned char constant_time_is_zero_8(unsigned int a);
|
||||
static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a);
|
||||
|
||||
/* Returns 0xff..f if a == b and 0 otherwise. */
|
||||
static ossl_inline unsigned int constant_time_eq(unsigned int a, unsigned int b);
|
||||
static ossl_inline unsigned int constant_time_eq(unsigned int a,
|
||||
unsigned int b);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
static ossl_inline unsigned char constant_time_eq_8(unsigned int a, unsigned int b);
|
||||
static ossl_inline unsigned char constant_time_eq_8(unsigned int a,
|
||||
unsigned int b);
|
||||
/* Signed integers. */
|
||||
static ossl_inline unsigned int constant_time_eq_int(int a, int b);
|
||||
/* Convenience method for getting an 8-bit mask. */
|
||||
@ -71,19 +77,22 @@ static ossl_inline unsigned char constant_time_eq_int_8(int a, int b);
|
||||
* the select methods return either |a| (if |mask| is nonzero) or |b|
|
||||
* (if |mask| is zero).
|
||||
*/
|
||||
static ossl_inline unsigned int constant_time_select(unsigned int mask, unsigned int a,
|
||||
unsigned int b);
|
||||
static ossl_inline unsigned int
|
||||
constant_time_select(unsigned int mask, unsigned int a, unsigned int b);
|
||||
/* Convenience method for unsigned chars. */
|
||||
static ossl_inline unsigned char constant_time_select_8(unsigned char mask, unsigned char a,
|
||||
unsigned char b);
|
||||
static ossl_inline unsigned char
|
||||
constant_time_select_8(unsigned char mask, unsigned char a, unsigned char b);
|
||||
|
||||
/* Convenience method for uint32_t. */
|
||||
static ossl_inline uint32_t constant_time_select_32(uint32_t mask, uint32_t a, uint32_t b);
|
||||
static ossl_inline uint32_t constant_time_select_32(uint32_t mask, uint32_t a,
|
||||
uint32_t b);
|
||||
|
||||
/* Convenience method for uint64_t. */
|
||||
static ossl_inline uint64_t constant_time_select_64(uint64_t mask, uint64_t a, uint64_t b);
|
||||
static ossl_inline uint64_t constant_time_select_64(uint64_t mask, uint64_t a,
|
||||
uint64_t b);
|
||||
/* Convenience method for signed integers. */
|
||||
static ossl_inline int constant_time_select_int(unsigned int mask, int a, int b);
|
||||
static ossl_inline int constant_time_select_int(unsigned int mask, int a,
|
||||
int b);
|
||||
|
||||
static ossl_inline unsigned int constant_time_msb(unsigned int a)
|
||||
{
|
||||
@ -115,7 +124,8 @@ static ossl_inline size_t constant_time_lt_s(size_t a, size_t b)
|
||||
return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b)));
|
||||
}
|
||||
|
||||
static ossl_inline unsigned char constant_time_lt_8(unsigned int a, unsigned int b)
|
||||
static ossl_inline unsigned char constant_time_lt_8(unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
return (unsigned char)constant_time_lt(a, b);
|
||||
}
|
||||
@ -135,7 +145,8 @@ static ossl_inline size_t constant_time_ge_s(size_t a, size_t b)
|
||||
return ~constant_time_lt_s(a, b);
|
||||
}
|
||||
|
||||
static ossl_inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b)
|
||||
static ossl_inline unsigned char constant_time_ge_8(unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
return (unsigned char)constant_time_ge(a, b);
|
||||
}
|
||||
@ -180,7 +191,8 @@ static ossl_inline size_t constant_time_eq_s(size_t a, size_t b)
|
||||
return constant_time_is_zero_s(a ^ b);
|
||||
}
|
||||
|
||||
static ossl_inline unsigned char constant_time_eq_8(unsigned int a, unsigned int b)
|
||||
static ossl_inline unsigned char constant_time_eq_8(unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
return (unsigned char)constant_time_eq(a, b);
|
||||
}
|
||||
@ -254,19 +266,20 @@ static ossl_inline size_t value_barrier_s(size_t a)
|
||||
return r;
|
||||
}
|
||||
|
||||
static ossl_inline unsigned int constant_time_select(unsigned int mask, unsigned int a,
|
||||
unsigned int b)
|
||||
static ossl_inline unsigned int
|
||||
constant_time_select(unsigned int mask, unsigned int a, unsigned int b)
|
||||
{
|
||||
return (value_barrier(mask) & a) | (value_barrier(~mask) & b);
|
||||
}
|
||||
|
||||
static ossl_inline size_t constant_time_select_s(size_t mask, size_t a, size_t b)
|
||||
static ossl_inline size_t constant_time_select_s(size_t mask, size_t a,
|
||||
size_t b)
|
||||
{
|
||||
return (value_barrier_s(mask) & a) | (value_barrier_s(~mask) & b);
|
||||
}
|
||||
|
||||
static ossl_inline unsigned char constant_time_select_8(unsigned char mask, unsigned char a,
|
||||
unsigned char b)
|
||||
static ossl_inline unsigned char
|
||||
constant_time_select_8(unsigned char mask, unsigned char a, unsigned char b)
|
||||
{
|
||||
return (unsigned char)constant_time_select(mask, a, b);
|
||||
}
|
||||
@ -278,15 +291,18 @@ static ossl_inline int constant_time_select_int(unsigned int mask, int a, int b)
|
||||
|
||||
static ossl_inline int constant_time_select_int_s(size_t mask, int a, int b)
|
||||
{
|
||||
return (int)constant_time_select((unsigned)mask, (unsigned)(a), (unsigned)(b));
|
||||
return (int)constant_time_select((unsigned)mask, (unsigned)(a),
|
||||
(unsigned)(b));
|
||||
}
|
||||
|
||||
static ossl_inline uint32_t constant_time_select_32(uint32_t mask, uint32_t a, uint32_t b)
|
||||
static ossl_inline uint32_t constant_time_select_32(uint32_t mask, uint32_t a,
|
||||
uint32_t b)
|
||||
{
|
||||
return (value_barrier_32(mask) & a) | (value_barrier_32(~mask) & b);
|
||||
}
|
||||
|
||||
static ossl_inline uint64_t constant_time_select_64(uint64_t mask, uint64_t a, uint64_t b)
|
||||
static ossl_inline uint64_t constant_time_select_64(uint64_t mask, uint64_t a,
|
||||
uint64_t b)
|
||||
{
|
||||
return (value_barrier_64(mask) & a) | (value_barrier_64(~mask) & b);
|
||||
}
|
||||
@ -301,7 +317,8 @@ static ossl_inline uint64_t constant_time_select_64(uint64_t mask, uint64_t a, u
|
||||
* *b = tmp;
|
||||
* }
|
||||
*/
|
||||
static ossl_inline void constant_time_cond_swap_32(uint32_t mask, uint32_t *a, uint32_t *b)
|
||||
static ossl_inline void constant_time_cond_swap_32(uint32_t mask, uint32_t *a,
|
||||
uint32_t *b)
|
||||
{
|
||||
uint32_t xor = *a ^ *b;
|
||||
|
||||
@ -320,7 +337,8 @@ static ossl_inline void constant_time_cond_swap_32(uint32_t mask, uint32_t *a, u
|
||||
* *b = tmp;
|
||||
* }
|
||||
*/
|
||||
static ossl_inline void constant_time_cond_swap_64(uint64_t mask, uint64_t *a, uint64_t *b)
|
||||
static ossl_inline void constant_time_cond_swap_64(uint64_t mask, uint64_t *a,
|
||||
uint64_t *b)
|
||||
{
|
||||
uint64_t xor = *a ^ *b;
|
||||
|
||||
@ -341,8 +359,10 @@ static ossl_inline void constant_time_cond_swap_64(uint64_t mask, uint64_t *a, u
|
||||
* memcpy(b, tmp);
|
||||
* }
|
||||
*/
|
||||
static ossl_inline void constant_time_cond_swap_buff(unsigned char mask, unsigned char *a,
|
||||
unsigned char *b, size_t len)
|
||||
static ossl_inline void constant_time_cond_swap_buff(unsigned char mask,
|
||||
unsigned char *a,
|
||||
unsigned char *b,
|
||||
size_t len)
|
||||
{
|
||||
size_t i;
|
||||
unsigned char tmp;
|
||||
@ -361,8 +381,9 @@ static ossl_inline void constant_time_cond_swap_buff(unsigned char mask, unsigne
|
||||
* Copies row number idx into out. rowsize and numrows are not considered
|
||||
* private.
|
||||
*/
|
||||
static ossl_inline void constant_time_lookup(void *out, const void *table, size_t rowsize,
|
||||
size_t numrows, size_t idx)
|
||||
static ossl_inline void constant_time_lookup(void *out, const void *table,
|
||||
size_t rowsize, size_t numrows,
|
||||
size_t idx)
|
||||
{
|
||||
size_t i, j;
|
||||
const unsigned char *tablec = (const unsigned char *)table;
|
||||
|
@ -38,24 +38,30 @@ typedef struct ossl_method_construct_method_st
|
||||
/* Get an already existing method from a store */
|
||||
void *(*get)(void *store, const OSSL_PROVIDER **prov, void *data);
|
||||
/* Store a method in a store */
|
||||
int (*put)(void *store, void *method, const OSSL_PROVIDER *prov, const char *name,
|
||||
const char *propdef, void *data);
|
||||
int (*put)(void *store, void *method, const OSSL_PROVIDER *prov,
|
||||
const char *name, const char *propdef, void *data);
|
||||
/* Construct a new method */
|
||||
void *(*construct)(const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov, void *data);
|
||||
void *(*construct)(const OSSL_ALGORITHM *algodef, OSSL_PROVIDER *prov,
|
||||
void *data);
|
||||
/* Destruct a method */
|
||||
void (*destruct)(void *method, void *data);
|
||||
} OSSL_METHOD_CONSTRUCT_METHOD;
|
||||
|
||||
void *ossl_method_construct(OSSL_LIB_CTX *ctx, int operation_id, OSSL_PROVIDER **provider_rw,
|
||||
int force_cache, OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data);
|
||||
void *ossl_method_construct(OSSL_LIB_CTX *ctx, int operation_id,
|
||||
OSSL_PROVIDER **provider_rw, int force_cache,
|
||||
OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data);
|
||||
|
||||
void ossl_algorithm_do_all(
|
||||
OSSL_LIB_CTX *libctx, int operation_id, OSSL_PROVIDER *provider,
|
||||
int (*pre)(OSSL_PROVIDER *, int operation_id, int no_store, void *data, int *result),
|
||||
void ossl_algorithm_do_all(OSSL_LIB_CTX *libctx, int operation_id,
|
||||
OSSL_PROVIDER *provider,
|
||||
int (*pre)(OSSL_PROVIDER *, int operation_id,
|
||||
int no_store, void *data, int *result),
|
||||
int (*reserve_store)(int no_store, void *data),
|
||||
void (*fn)(OSSL_PROVIDER *provider, const OSSL_ALGORITHM *algo, int no_store, void *data),
|
||||
void (*fn)(OSSL_PROVIDER *provider,
|
||||
const OSSL_ALGORITHM *algo, int no_store,
|
||||
void *data),
|
||||
int (*unreserve_store)(void *data),
|
||||
int (*post)(OSSL_PROVIDER *, int operation_id, int no_store, void *data, int *result),
|
||||
int (*post)(OSSL_PROVIDER *, int operation_id,
|
||||
int no_store, void *data, int *result),
|
||||
void *data);
|
||||
char *ossl_algorithm_get1_first_name(const OSSL_ALGORITHM *algo);
|
||||
|
||||
|
@ -34,8 +34,9 @@ typedef struct mem_st MEM;
|
||||
DEFINE_LHASH_OF_EX(MEM);
|
||||
|
||||
void OPENSSL_cpuid_setup(void);
|
||||
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__x86_64) \
|
||||
|| defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64)
|
||||
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) \
|
||||
|| defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) \
|
||||
|| defined(_M_X64)
|
||||
extern unsigned int OPENSSL_ia32cap_P[];
|
||||
#endif
|
||||
void OPENSSL_showfatal(const char *fmta, ...);
|
||||
@ -133,9 +134,12 @@ OSSL_EX_DATA_GLOBAL *ossl_lib_ctx_get_ex_data_global(OSSL_LIB_CTX *ctx);
|
||||
const char *ossl_lib_ctx_get_descriptor(OSSL_LIB_CTX *libctx);
|
||||
|
||||
OSSL_LIB_CTX *ossl_crypto_ex_data_get_ossl_lib_ctx(const CRYPTO_EX_DATA *ad);
|
||||
int ossl_crypto_new_ex_data_ex(OSSL_LIB_CTX *ctx, int class_index, void *obj, CRYPTO_EX_DATA *ad);
|
||||
int ossl_crypto_get_ex_new_index_ex(OSSL_LIB_CTX *ctx, int class_index, long argl, void *argp,
|
||||
CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
|
||||
int ossl_crypto_new_ex_data_ex(OSSL_LIB_CTX *ctx, int class_index, void *obj,
|
||||
CRYPTO_EX_DATA *ad);
|
||||
int ossl_crypto_get_ex_new_index_ex(OSSL_LIB_CTX *ctx, int class_index,
|
||||
long argl, void *argp,
|
||||
CRYPTO_EX_new *new_func,
|
||||
CRYPTO_EX_dup *dup_func,
|
||||
CRYPTO_EX_free *free_func, int priority);
|
||||
int ossl_crypto_free_ex_index_ex(OSSL_LIB_CTX *ctx, int class_index, int idx);
|
||||
|
||||
@ -148,10 +152,11 @@ int ossl_crypto_free_ex_index_ex(OSSL_LIB_CTX *ctx, int class_index, int idx);
|
||||
const void *ossl_bsearch(const void *key, const void *base, int num, int size,
|
||||
int (*cmp)(const void *, const void *), int flags);
|
||||
|
||||
char *ossl_sk_ASN1_UTF8STRING2text(STACK_OF(ASN1_UTF8STRING) * text, const char *sep,
|
||||
size_t max_len);
|
||||
char *ossl_sk_ASN1_UTF8STRING2text(STACK_OF(ASN1_UTF8STRING) * text,
|
||||
const char *sep, size_t max_len);
|
||||
char *ossl_ipaddr_to_asc(unsigned char *p, int len);
|
||||
|
||||
char *ossl_buf2hexstr_sep(const unsigned char *buf, long buflen, char sep);
|
||||
unsigned char *ossl_hexstr2buf_sep(const char *str, long *buflen, const char sep);
|
||||
unsigned char *ossl_hexstr2buf_sep(const char *str, long *buflen,
|
||||
const char sep);
|
||||
#endif
|
||||
|
@ -79,7 +79,8 @@ struct ssl_dane_st
|
||||
unsigned long flags; /* feature bitmask */
|
||||
};
|
||||
|
||||
#define DANETLS_ENABLED(dane) ((dane) != NULL && sk_danetls_record_num((dane)->trecs) > 0)
|
||||
#define DANETLS_ENABLED(dane) \
|
||||
((dane) != NULL && sk_danetls_record_num((dane)->trecs) > 0)
|
||||
|
||||
#define DANETLS_USAGE_BIT(u) (((uint32_t)1) << u)
|
||||
|
||||
@ -98,9 +99,13 @@ struct ssl_dane_st
|
||||
#define DANETLS_HAS_TA(dane) ((dane) && ((dane)->umask & DANETLS_TA_MASK))
|
||||
#define DANETLS_HAS_EE(dane) ((dane) && ((dane)->umask & DANETLS_EE_MASK))
|
||||
|
||||
#define DANETLS_HAS_PKIX_TA(dane) ((dane) && ((dane)->umask & DANETLS_PKIX_TA_MASK))
|
||||
#define DANETLS_HAS_PKIX_EE(dane) ((dane) && ((dane)->umask & DANETLS_PKIX_EE_MASK))
|
||||
#define DANETLS_HAS_DANE_TA(dane) ((dane) && ((dane)->umask & DANETLS_DANE_TA_MASK))
|
||||
#define DANETLS_HAS_DANE_EE(dane) ((dane) && ((dane)->umask & DANETLS_DANE_EE_MASK))
|
||||
#define DANETLS_HAS_PKIX_TA(dane) \
|
||||
((dane) && ((dane)->umask & DANETLS_PKIX_TA_MASK))
|
||||
#define DANETLS_HAS_PKIX_EE(dane) \
|
||||
((dane) && ((dane)->umask & DANETLS_PKIX_EE_MASK))
|
||||
#define DANETLS_HAS_DANE_TA(dane) \
|
||||
((dane) && ((dane)->umask & DANETLS_DANE_TA_MASK))
|
||||
#define DANETLS_HAS_DANE_EE(dane) \
|
||||
((dane) && ((dane)->umask & DANETLS_DANE_EE_MASK))
|
||||
|
||||
#endif /* OSSL_INTERNAL_DANE_H */
|
||||
|
@ -73,14 +73,16 @@
|
||||
/* This can be used for all items that don't have a context */
|
||||
#define DER_NO_CONTEXT -1
|
||||
|
||||
int ossl_DER_w_precompiled(WPACKET *pkt, int tag, const unsigned char *precompiled,
|
||||
int ossl_DER_w_precompiled(WPACKET *pkt, int tag,
|
||||
const unsigned char *precompiled,
|
||||
size_t precompiled_n);
|
||||
|
||||
int ossl_DER_w_boolean(WPACKET *pkt, int tag, int b);
|
||||
int ossl_DER_w_uint32(WPACKET *pkt, int tag, uint32_t v);
|
||||
int ossl_DER_w_bn(WPACKET *pkt, int tag, const BIGNUM *v);
|
||||
int ossl_DER_w_null(WPACKET *pkt, int tag);
|
||||
int ossl_DER_w_octet_string(WPACKET *pkt, int tag, const unsigned char *data, size_t data_n);
|
||||
int ossl_DER_w_octet_string(WPACKET *pkt, int tag, const unsigned char *data,
|
||||
size_t data_n);
|
||||
int ossl_DER_w_octet_string_uint32(WPACKET *pkt, int tag, uint32_t value);
|
||||
|
||||
/*
|
||||
|
@ -13,9 +13,9 @@
|
||||
|
||||
#include <openssl/bn.h>
|
||||
|
||||
int ossl_gen_deterministic_nonce_rfc6979(BIGNUM *out, const BIGNUM *q, const BIGNUM *priv,
|
||||
const unsigned char *message, size_t message_len,
|
||||
const char *digestname, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
int ossl_gen_deterministic_nonce_rfc6979(
|
||||
BIGNUM *out, const BIGNUM *q, const BIGNUM *priv,
|
||||
const unsigned char *message, size_t message_len, const char *digestname,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
#endif /*OSSL_INTERNAL_DETERMINISTIC_NONCE_H */
|
||||
|
@ -65,7 +65,8 @@
|
||||
# define _setmode setmode
|
||||
# define _O_TEXT O_TEXT
|
||||
# define _O_BINARY O_BINARY
|
||||
# undef DEVRANDOM_EGD /* Neither MS-DOS nor FreeDOS provide 'egd' sockets. */
|
||||
# undef DEVRANDOM_EGD /* Neither MS-DOS nor FreeDOS provide 'egd' sockets. \
|
||||
*/
|
||||
# undef DEVRANDOM
|
||||
# define DEVRANDOM "/dev/urandom\x24"
|
||||
# endif /* __DJGPP__ */
|
||||
@ -138,7 +139,8 @@ static __inline unsigned int _strlen31(const char *str)
|
||||
}
|
||||
# endif
|
||||
# include <malloc.h>
|
||||
# if defined(_MSC_VER) && !defined(_WIN32_WCE) && !defined(_DLL) && defined(stdin)
|
||||
# if defined(_MSC_VER) && !defined(_WIN32_WCE) && !defined(_DLL) \
|
||||
&& defined(stdin)
|
||||
# if _MSC_VER >= 1300 && _MSC_VER < 1600
|
||||
# undef stdin
|
||||
# undef stdout
|
||||
@ -353,8 +355,9 @@ inline int nssgetpid()
|
||||
#ifndef OPENSSL_NO_SECURE_MEMORY
|
||||
/* unistd.h defines _POSIX_VERSION */
|
||||
# if (defined(OPENSSL_SYS_UNIX) \
|
||||
&& ((defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) || defined(__sun) \
|
||||
|| defined(__hpux) || defined(__sgi) || defined(__osf__))) \
|
||||
&& ((defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) \
|
||||
|| defined(__sun) || defined(__hpux) || defined(__sgi) \
|
||||
|| defined(__osf__))) \
|
||||
|| defined(_WIN32)
|
||||
/* secure memory is implemented */
|
||||
# else
|
||||
@ -375,7 +378,8 @@ inline int nssgetpid()
|
||||
# define strncasecmp_l _strnicmp_l
|
||||
# define strcasecmp _stricmp
|
||||
# define strncasecmp _strnicmp
|
||||
#elif !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L || defined(OPENSSL_SYS_TANDEM)
|
||||
#elif !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200809L \
|
||||
|| defined(OPENSSL_SYS_TANDEM)
|
||||
# ifndef OPENSSL_NO_LOCALE
|
||||
# define OPENSSL_NO_LOCALE
|
||||
# endif
|
||||
|
@ -50,35 +50,39 @@ struct ossl_event_st
|
||||
/*
|
||||
* Utility function to populate an event structure and add it to the queue
|
||||
*/
|
||||
int ossl_event_queue_add(OSSL_EVENT_QUEUE *queue, OSSL_EVENT *event, uint32_t type,
|
||||
uint32_t priority, OSSL_TIME when, void *ctx, void *payload,
|
||||
size_t payload_size);
|
||||
int ossl_event_queue_add(OSSL_EVENT_QUEUE *queue, OSSL_EVENT *event,
|
||||
uint32_t type, uint32_t priority, OSSL_TIME when,
|
||||
void *ctx, void *payload, size_t payload_size);
|
||||
|
||||
/*
|
||||
* Utility functions to extract event fields
|
||||
*/
|
||||
static ossl_unused ossl_inline uint32_t ossl_event_get_type(const OSSL_EVENT *event)
|
||||
static ossl_unused ossl_inline uint32_t
|
||||
ossl_event_get_type(const OSSL_EVENT *event)
|
||||
{
|
||||
return event->type;
|
||||
}
|
||||
|
||||
static ossl_unused ossl_inline uint32_t ossl_event_get_priority(const OSSL_EVENT *event)
|
||||
static ossl_unused ossl_inline uint32_t
|
||||
ossl_event_get_priority(const OSSL_EVENT *event)
|
||||
{
|
||||
return event->priority;
|
||||
}
|
||||
|
||||
static ossl_unused ossl_inline OSSL_TIME ossl_event_get_when(const OSSL_EVENT *event)
|
||||
static ossl_unused ossl_inline OSSL_TIME
|
||||
ossl_event_get_when(const OSSL_EVENT *event)
|
||||
{
|
||||
return event->when;
|
||||
}
|
||||
|
||||
static ossl_unused ossl_inline void *ossl_event_get0_ctx(const OSSL_EVENT *event)
|
||||
static ossl_unused ossl_inline void *
|
||||
ossl_event_get0_ctx(const OSSL_EVENT *event)
|
||||
{
|
||||
return event->ctx;
|
||||
}
|
||||
|
||||
static ossl_unused ossl_inline void *ossl_event_get0_payload(const OSSL_EVENT *event,
|
||||
size_t *length)
|
||||
static ossl_unused ossl_inline void *
|
||||
ossl_event_get0_payload(const OSSL_EVENT *event, size_t *length)
|
||||
{
|
||||
if (length != NULL)
|
||||
*length = event->payload_size;
|
||||
@ -98,8 +102,10 @@ void ossl_event_queue_free(OSSL_EVENT_QUEUE *queue);
|
||||
*
|
||||
* The function reutrns NULL on failure and the added event on success.
|
||||
*/
|
||||
OSSL_EVENT *ossl_event_queue_add_new(OSSL_EVENT_QUEUE *queue, uint32_t type, uint32_t priority,
|
||||
OSSL_TIME when, void *ctx, void *payload, size_t payload_size);
|
||||
OSSL_EVENT *ossl_event_queue_add_new(OSSL_EVENT_QUEUE *queue, uint32_t type,
|
||||
uint32_t priority, OSSL_TIME when,
|
||||
void *ctx, void *payload,
|
||||
size_t payload_size);
|
||||
|
||||
/*
|
||||
* Schedule an event into an event queue.
|
||||
@ -108,9 +114,9 @@ OSSL_EVENT *ossl_event_queue_add_new(OSSL_EVENT_QUEUE *queue, uint32_t type, uin
|
||||
*
|
||||
* The function reutrns 0 on failure and 1 on success.
|
||||
*/
|
||||
int ossl_event_queue_add(OSSL_EVENT_QUEUE *queue, OSSL_EVENT *event, uint32_t type,
|
||||
uint32_t priority, OSSL_TIME when, void *ctx, void *payload,
|
||||
size_t payload_size);
|
||||
int ossl_event_queue_add(OSSL_EVENT_QUEUE *queue, OSSL_EVENT *event,
|
||||
uint32_t type, uint32_t priority, OSSL_TIME when,
|
||||
void *ctx, void *payload, size_t payload_size);
|
||||
|
||||
/*
|
||||
* Delete an event from the queue.
|
||||
@ -142,11 +148,13 @@ OSSL_TIME ossl_event_queue_time_until_next(const OSSL_EVENT_QUEUE *queue);
|
||||
* Postpone an event to trigger at the specified time.
|
||||
* If the event has triggered, this function's behaviour is undefined.
|
||||
*/
|
||||
int ossl_event_queue_postpone_until(OSSL_EVENT_QUEUE *queue, OSSL_EVENT *event, OSSL_TIME when);
|
||||
int ossl_event_queue_postpone_until(OSSL_EVENT_QUEUE *queue, OSSL_EVENT *event,
|
||||
OSSL_TIME when);
|
||||
|
||||
/*
|
||||
* Return the next event to process.
|
||||
*/
|
||||
int ossl_event_queue_get1_next_event(OSSL_EVENT_QUEUE *queue, OSSL_EVENT **event);
|
||||
int ossl_event_queue_get1_next_event(OSSL_EVENT_QUEUE *queue,
|
||||
OSSL_EVENT **event);
|
||||
|
||||
#endif
|
||||
|
@ -42,7 +42,8 @@
|
||||
/* Validation flags */
|
||||
#define FFC_PARAM_FLAG_VALIDATE_PQ 0x01
|
||||
#define FFC_PARAM_FLAG_VALIDATE_G 0x02
|
||||
#define FFC_PARAM_FLAG_VALIDATE_PQG (FFC_PARAM_FLAG_VALIDATE_PQ | FFC_PARAM_FLAG_VALIDATE_G)
|
||||
#define FFC_PARAM_FLAG_VALIDATE_PQG \
|
||||
(FFC_PARAM_FLAG_VALIDATE_PQ | FFC_PARAM_FLAG_VALIDATE_G)
|
||||
#define FFC_PARAM_FLAG_VALIDATE_LEGACY 0x04
|
||||
|
||||
/*
|
||||
@ -118,22 +119,27 @@ typedef struct ffc_params_st
|
||||
|
||||
void ossl_ffc_params_init(FFC_PARAMS *params);
|
||||
void ossl_ffc_params_cleanup(FFC_PARAMS *params);
|
||||
void ossl_ffc_params_set0_pqg(FFC_PARAMS *params, BIGNUM *p, BIGNUM *q, BIGNUM *g);
|
||||
void ossl_ffc_params_get0_pqg(const FFC_PARAMS *params, const BIGNUM **p, const BIGNUM **q,
|
||||
const BIGNUM **g);
|
||||
void ossl_ffc_params_set0_pqg(FFC_PARAMS *params, BIGNUM *p, BIGNUM *q,
|
||||
BIGNUM *g);
|
||||
void ossl_ffc_params_get0_pqg(const FFC_PARAMS *params, const BIGNUM **p,
|
||||
const BIGNUM **q, const BIGNUM **g);
|
||||
void ossl_ffc_params_set0_j(FFC_PARAMS *d, BIGNUM *j);
|
||||
int ossl_ffc_params_set_seed(FFC_PARAMS *params, const unsigned char *seed, size_t seedlen);
|
||||
int ossl_ffc_params_set_seed(FFC_PARAMS *params, const unsigned char *seed,
|
||||
size_t seedlen);
|
||||
void ossl_ffc_params_set_gindex(FFC_PARAMS *params, int index);
|
||||
void ossl_ffc_params_set_pcounter(FFC_PARAMS *params, int index);
|
||||
void ossl_ffc_params_set_h(FFC_PARAMS *params, int index);
|
||||
void ossl_ffc_params_set_flags(FFC_PARAMS *params, unsigned int flags);
|
||||
void ossl_ffc_params_enable_flags(FFC_PARAMS *params, unsigned int flags, int enable);
|
||||
void ossl_ffc_params_enable_flags(FFC_PARAMS *params, unsigned int flags,
|
||||
int enable);
|
||||
int ossl_ffc_set_digest(FFC_PARAMS *params, const char *alg, const char *props);
|
||||
|
||||
int ossl_ffc_params_set_validate_params(FFC_PARAMS *params, const unsigned char *seed,
|
||||
int ossl_ffc_params_set_validate_params(FFC_PARAMS *params,
|
||||
const unsigned char *seed,
|
||||
size_t seedlen, int counter);
|
||||
void ossl_ffc_params_get_validate_params(const FFC_PARAMS *params, unsigned char **seed,
|
||||
size_t *seedlen, int *pcounter);
|
||||
void ossl_ffc_params_get_validate_params(const FFC_PARAMS *params,
|
||||
unsigned char **seed, size_t *seedlen,
|
||||
int *pcounter);
|
||||
|
||||
int ossl_ffc_params_copy(FFC_PARAMS *dst, const FFC_PARAMS *src);
|
||||
int ossl_ffc_params_cmp(const FFC_PARAMS *a, const FFC_PARAMS *b, int ignore_q);
|
||||
@ -142,44 +148,60 @@ int ossl_ffc_params_cmp(const FFC_PARAMS *a, const FFC_PARAMS *b, int ignore_q);
|
||||
int ossl_ffc_params_print(BIO *bp, const FFC_PARAMS *ffc, int indent);
|
||||
#endif /* FIPS_MODULE */
|
||||
|
||||
int ossl_ffc_params_FIPS186_4_generate(OSSL_LIB_CTX *libctx, FFC_PARAMS *params, int type, size_t L,
|
||||
size_t N, int *res, BN_GENCB *cb);
|
||||
int ossl_ffc_params_FIPS186_2_generate(OSSL_LIB_CTX *libctx, FFC_PARAMS *params, int type, size_t L,
|
||||
size_t N, int *res, BN_GENCB *cb);
|
||||
int ossl_ffc_params_FIPS186_4_generate(OSSL_LIB_CTX *libctx, FFC_PARAMS *params,
|
||||
int type, size_t L, size_t N, int *res,
|
||||
BN_GENCB *cb);
|
||||
int ossl_ffc_params_FIPS186_2_generate(OSSL_LIB_CTX *libctx, FFC_PARAMS *params,
|
||||
int type, size_t L, size_t N, int *res,
|
||||
BN_GENCB *cb);
|
||||
|
||||
int ossl_ffc_params_FIPS186_4_gen_verify(OSSL_LIB_CTX *libctx, FFC_PARAMS *params, int mode,
|
||||
int type, size_t L, size_t N, int *res, BN_GENCB *cb);
|
||||
int ossl_ffc_params_FIPS186_2_gen_verify(OSSL_LIB_CTX *libctx, FFC_PARAMS *params, int mode,
|
||||
int type, size_t L, size_t N, int *res, BN_GENCB *cb);
|
||||
int ossl_ffc_params_FIPS186_4_gen_verify(OSSL_LIB_CTX *libctx,
|
||||
FFC_PARAMS *params, int mode, int type,
|
||||
size_t L, size_t N, int *res,
|
||||
BN_GENCB *cb);
|
||||
int ossl_ffc_params_FIPS186_2_gen_verify(OSSL_LIB_CTX *libctx,
|
||||
FFC_PARAMS *params, int mode, int type,
|
||||
size_t L, size_t N, int *res,
|
||||
BN_GENCB *cb);
|
||||
|
||||
int ossl_ffc_params_simple_validate(OSSL_LIB_CTX *libctx, const FFC_PARAMS *params, int paramstype,
|
||||
int ossl_ffc_params_simple_validate(OSSL_LIB_CTX *libctx,
|
||||
const FFC_PARAMS *params, int paramstype,
|
||||
int *res);
|
||||
int ossl_ffc_params_full_validate(OSSL_LIB_CTX *libctx, const FFC_PARAMS *params, int paramstype,
|
||||
int ossl_ffc_params_full_validate(OSSL_LIB_CTX *libctx,
|
||||
const FFC_PARAMS *params, int paramstype,
|
||||
int *res);
|
||||
int ossl_ffc_params_FIPS186_4_validate(OSSL_LIB_CTX *libctx, const FFC_PARAMS *params, int type,
|
||||
int ossl_ffc_params_FIPS186_4_validate(OSSL_LIB_CTX *libctx,
|
||||
const FFC_PARAMS *params, int type,
|
||||
int *res, BN_GENCB *cb);
|
||||
int ossl_ffc_params_FIPS186_2_validate(OSSL_LIB_CTX *libctx, const FFC_PARAMS *params, int type,
|
||||
int ossl_ffc_params_FIPS186_2_validate(OSSL_LIB_CTX *libctx,
|
||||
const FFC_PARAMS *params, int type,
|
||||
int *res, BN_GENCB *cb);
|
||||
|
||||
int ossl_ffc_generate_private_key(BN_CTX *ctx, const FFC_PARAMS *params, int N, int s,
|
||||
BIGNUM *priv);
|
||||
int ossl_ffc_generate_private_key(BN_CTX *ctx, const FFC_PARAMS *params, int N,
|
||||
int s, BIGNUM *priv);
|
||||
|
||||
int ossl_ffc_params_validate_unverifiable_g(BN_CTX *ctx, BN_MONT_CTX *mont, const BIGNUM *p,
|
||||
const BIGNUM *q, const BIGNUM *g, BIGNUM *tmp,
|
||||
int ossl_ffc_params_validate_unverifiable_g(BN_CTX *ctx, BN_MONT_CTX *mont,
|
||||
const BIGNUM *p, const BIGNUM *q,
|
||||
const BIGNUM *g, BIGNUM *tmp,
|
||||
int *ret);
|
||||
|
||||
int ossl_ffc_validate_public_key(const FFC_PARAMS *params, const BIGNUM *pub_key, int *ret);
|
||||
int ossl_ffc_validate_public_key_partial(const FFC_PARAMS *params, const BIGNUM *pub_key, int *ret);
|
||||
int ossl_ffc_validate_private_key(const BIGNUM *upper, const BIGNUM *priv_key, int *ret);
|
||||
int ossl_ffc_validate_public_key(const FFC_PARAMS *params,
|
||||
const BIGNUM *pub_key, int *ret);
|
||||
int ossl_ffc_validate_public_key_partial(const FFC_PARAMS *params,
|
||||
const BIGNUM *pub_key, int *ret);
|
||||
int ossl_ffc_validate_private_key(const BIGNUM *upper, const BIGNUM *priv_key,
|
||||
int *ret);
|
||||
|
||||
int ossl_ffc_params_todata(const FFC_PARAMS *ffc, OSSL_PARAM_BLD *tmpl, OSSL_PARAM params[]);
|
||||
int ossl_ffc_params_todata(const FFC_PARAMS *ffc, OSSL_PARAM_BLD *tmpl,
|
||||
OSSL_PARAM params[]);
|
||||
int ossl_ffc_params_fromdata(FFC_PARAMS *ffc, const OSSL_PARAM params[]);
|
||||
|
||||
typedef struct dh_named_group_st DH_NAMED_GROUP;
|
||||
const DH_NAMED_GROUP *ossl_ffc_name_to_dh_named_group(const char *name);
|
||||
const DH_NAMED_GROUP *ossl_ffc_uid_to_dh_named_group(int uid);
|
||||
#ifndef OPENSSL_NO_DH
|
||||
const DH_NAMED_GROUP *ossl_ffc_numbers_to_dh_named_group(const BIGNUM *p, const BIGNUM *q,
|
||||
const DH_NAMED_GROUP *ossl_ffc_numbers_to_dh_named_group(const BIGNUM *p,
|
||||
const BIGNUM *q,
|
||||
const BIGNUM *g);
|
||||
#endif
|
||||
int ossl_ffc_named_group_get_uid(const DH_NAMED_GROUP *group);
|
||||
|
@ -72,24 +72,28 @@ const OSSL_HPKE_AEAD_INFO *ossl_HPKE_AEAD_INFO_find_id(uint16_t aeadid);
|
||||
const OSSL_HPKE_AEAD_INFO *ossl_HPKE_AEAD_INFO_find_random(OSSL_LIB_CTX *ctx);
|
||||
|
||||
int ossl_hpke_kdf_extract(EVP_KDF_CTX *kctx, unsigned char *prk, size_t prklen,
|
||||
const unsigned char *salt, size_t saltlen, const unsigned char *ikm,
|
||||
size_t ikmlen);
|
||||
const unsigned char *salt, size_t saltlen,
|
||||
const unsigned char *ikm, size_t ikmlen);
|
||||
|
||||
int ossl_hpke_kdf_expand(EVP_KDF_CTX *kctx, unsigned char *okm, size_t okmlen,
|
||||
const unsigned char *prk, size_t prklen, const unsigned char *info,
|
||||
size_t infolen);
|
||||
|
||||
int ossl_hpke_labeled_extract(EVP_KDF_CTX *kctx, unsigned char *prk, size_t prklen,
|
||||
const unsigned char *salt, size_t saltlen, const char *protocol_label,
|
||||
const unsigned char *suiteid, size_t suiteidlen, const char *label,
|
||||
const unsigned char *ikm, size_t ikmlen);
|
||||
int ossl_hpke_labeled_expand(EVP_KDF_CTX *kctx, unsigned char *okm, size_t okmlen,
|
||||
const unsigned char *prk, size_t prklen, const char *protocol_label,
|
||||
const unsigned char *suiteid, size_t suiteidlen, const char *label,
|
||||
const unsigned char *prk, size_t prklen,
|
||||
const unsigned char *info, size_t infolen);
|
||||
|
||||
EVP_KDF_CTX *ossl_kdf_ctx_create(const char *kdfname, const char *mdname, OSSL_LIB_CTX *libctx,
|
||||
const char *propq);
|
||||
int ossl_hpke_labeled_extract(EVP_KDF_CTX *kctx, unsigned char *prk,
|
||||
size_t prklen, const unsigned char *salt,
|
||||
size_t saltlen, const char *protocol_label,
|
||||
const unsigned char *suiteid, size_t suiteidlen,
|
||||
const char *label, const unsigned char *ikm,
|
||||
size_t ikmlen);
|
||||
int ossl_hpke_labeled_expand(EVP_KDF_CTX *kctx, unsigned char *okm,
|
||||
size_t okmlen, const unsigned char *prk,
|
||||
size_t prklen, const char *protocol_label,
|
||||
const unsigned char *suiteid, size_t suiteidlen,
|
||||
const char *label, const unsigned char *info,
|
||||
size_t infolen);
|
||||
|
||||
EVP_KDF_CTX *ossl_kdf_ctx_create(const char *kdfname, const char *mdname,
|
||||
OSSL_LIB_CTX *libctx, const char *propq);
|
||||
|
||||
int ossl_hpke_str2suite(const char *suitestr, OSSL_HPKE_SUITE *suite);
|
||||
#endif
|
||||
|
@ -70,9 +70,14 @@ static ossl_inline int ktls_enable(int fd)
|
||||
static ossl_inline int ktls_start(int fd, ktls_crypto_info_t *tls_en, int is_tx)
|
||||
{
|
||||
if (is_tx)
|
||||
return setsockopt(fd, IPPROTO_TCP, TCP_TXTLS_ENABLE, tls_en, sizeof(*tls_en)) ? 0 : 1;
|
||||
return setsockopt(fd, IPPROTO_TCP, TCP_TXTLS_ENABLE, tls_en,
|
||||
sizeof(*tls_en))
|
||||
? 0
|
||||
: 1;
|
||||
# ifndef OPENSSL_NO_KTLS_RX
|
||||
return setsockopt(fd, IPPROTO_TCP, TCP_RXTLS_ENABLE, tls_en, sizeof(*tls_en)) ? 0 : 1;
|
||||
return setsockopt(fd, IPPROTO_TCP, TCP_RXTLS_ENABLE, tls_en, sizeof(*tls_en))
|
||||
? 0
|
||||
: 1;
|
||||
# else
|
||||
return 0;
|
||||
# endif
|
||||
@ -85,8 +90,8 @@ static ossl_inline int ktls_start(int fd, ktls_crypto_info_t *tls_en, int is_tx)
|
||||
* the entire record is pushed to TCP. It is impossible to send a partial
|
||||
* record using this control message.
|
||||
*/
|
||||
static ossl_inline int ktls_send_ctrl_message(int fd, unsigned char record_type, const void *data,
|
||||
size_t length)
|
||||
static ossl_inline int ktls_send_ctrl_message(int fd, unsigned char record_type,
|
||||
const void *data, size_t length)
|
||||
{
|
||||
struct msghdr msg = {0};
|
||||
int cmsg_len = sizeof(record_type);
|
||||
@ -192,7 +197,8 @@ static ossl_inline int ktls_read_record(int fd, void *data, size_t length)
|
||||
* KTLS enables the sendfile system call to send data from a file over
|
||||
* TLS.
|
||||
*/
|
||||
static ossl_inline ossl_ssize_t ktls_sendfile(int s, int fd, off_t off, size_t size, int flags)
|
||||
static ossl_inline ossl_ssize_t ktls_sendfile(int s, int fd, off_t off,
|
||||
size_t size, int flags)
|
||||
{
|
||||
off_t sbytes = 0;
|
||||
int ret;
|
||||
@ -218,7 +224,8 @@ static ossl_inline ossl_ssize_t ktls_sendfile(int s, int fd, off_t off, size_t s
|
||||
# if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
|
||||
# define OPENSSL_NO_KTLS_ZC_TX
|
||||
# ifndef PEDANTIC
|
||||
# warning "KTLS requires Kernel Headers >= 5.19.0 for zerocopy sendfile"
|
||||
# warning \
|
||||
"KTLS requires Kernel Headers >= 5.19.0 for zerocopy sendfile"
|
||||
# warning "Skipping Compilation of KTLS zerocopy sendfile"
|
||||
# endif
|
||||
# endif
|
||||
@ -296,7 +303,8 @@ static ossl_inline int ktls_enable(int fd)
|
||||
* If successful, then data received using this socket will be decrypted,
|
||||
* authenticated and decapsulated using the crypto_info provided here.
|
||||
*/
|
||||
static ossl_inline int ktls_start(int fd, ktls_crypto_info_t *crypto_info, int is_tx)
|
||||
static ossl_inline int ktls_start(int fd, ktls_crypto_info_t *crypto_info,
|
||||
int is_tx)
|
||||
{
|
||||
return setsockopt(fd, SOL_TLS, is_tx ? TLS_TX : TLS_RX, crypto_info,
|
||||
crypto_info->tls_crypto_info_len)
|
||||
@ -309,7 +317,9 @@ static ossl_inline int ktls_enable_tx_zerocopy_sendfile(int fd)
|
||||
# ifndef OPENSSL_NO_KTLS_ZC_TX
|
||||
int enable = 1;
|
||||
|
||||
return setsockopt(fd, SOL_TLS, TLS_TX_ZEROCOPY_RO, &enable, sizeof(enable)) ? 0 : 1;
|
||||
return setsockopt(fd, SOL_TLS, TLS_TX_ZEROCOPY_RO, &enable, sizeof(enable))
|
||||
? 0
|
||||
: 1;
|
||||
# else
|
||||
return 0;
|
||||
# endif
|
||||
@ -322,8 +332,8 @@ static ossl_inline int ktls_enable_tx_zerocopy_sendfile(int fd)
|
||||
* the entire record is pushed to TCP. It is impossible to send a partial
|
||||
* record using this control message.
|
||||
*/
|
||||
static ossl_inline int ktls_send_ctrl_message(int fd, unsigned char record_type, const void *data,
|
||||
size_t length)
|
||||
static ossl_inline int ktls_send_ctrl_message(int fd, unsigned char record_type,
|
||||
const void *data, size_t length)
|
||||
{
|
||||
struct msghdr msg;
|
||||
int cmsg_len = sizeof(record_type);
|
||||
@ -357,7 +367,8 @@ static ossl_inline int ktls_send_ctrl_message(int fd, unsigned char record_type,
|
||||
* KTLS enables the sendfile system call to send data from a file over TLS.
|
||||
* @flags are ignored on Linux. (placeholder for FreeBSD sendfile)
|
||||
* */
|
||||
static ossl_inline ossl_ssize_t ktls_sendfile(int s, int fd, off_t off, size_t size, int flags)
|
||||
static ossl_inline ossl_ssize_t ktls_sendfile(int s, int fd, off_t off,
|
||||
size_t size, int flags)
|
||||
{
|
||||
return sendfile(s, fd, &off, size);
|
||||
}
|
||||
|
@ -38,7 +38,8 @@
|
||||
type *alpha, *omega; \
|
||||
size_t num_elems; \
|
||||
}; \
|
||||
static ossl_unused ossl_inline void ossl_list_##name##_init(OSSL_LIST(name) * list) \
|
||||
static ossl_unused ossl_inline void ossl_list_##name##_init(OSSL_LIST(name) \
|
||||
* list) \
|
||||
{ \
|
||||
memset(list, 0, sizeof(*list)); \
|
||||
} \
|
||||
@ -46,38 +47,44 @@
|
||||
{ \
|
||||
memset(&elem->ossl_list_##name, 0, sizeof(elem->ossl_list_##name)); \
|
||||
} \
|
||||
static ossl_unused ossl_inline int ossl_list_##name##_is_empty(const OSSL_LIST(name) * list) \
|
||||
static ossl_unused ossl_inline int ossl_list_##name##_is_empty( \
|
||||
const OSSL_LIST(name) * list) \
|
||||
{ \
|
||||
return list->num_elems == 0; \
|
||||
} \
|
||||
static ossl_unused ossl_inline size_t ossl_list_##name##_num(const OSSL_LIST(name) * list) \
|
||||
static ossl_unused ossl_inline size_t ossl_list_##name##_num( \
|
||||
const OSSL_LIST(name) * list) \
|
||||
{ \
|
||||
return list->num_elems; \
|
||||
} \
|
||||
static ossl_unused ossl_inline type *ossl_list_##name##_head(const OSSL_LIST(name) * list) \
|
||||
static ossl_unused ossl_inline type *ossl_list_##name##_head( \
|
||||
const OSSL_LIST(name) * list) \
|
||||
{ \
|
||||
assert(list->alpha == NULL || list->alpha->ossl_list_##name.list == list); \
|
||||
return list->alpha; \
|
||||
} \
|
||||
static ossl_unused ossl_inline type *ossl_list_##name##_tail(const OSSL_LIST(name) * list) \
|
||||
static ossl_unused ossl_inline type *ossl_list_##name##_tail( \
|
||||
const OSSL_LIST(name) * list) \
|
||||
{ \
|
||||
assert(list->omega == NULL || list->omega->ossl_list_##name.list == list); \
|
||||
return list->omega; \
|
||||
} \
|
||||
static ossl_unused ossl_inline type *ossl_list_##name##_next(const type *elem) \
|
||||
static ossl_unused ossl_inline type *ossl_list_##name##_next( \
|
||||
const type *elem) \
|
||||
{ \
|
||||
assert(elem->ossl_list_##name.next == NULL \
|
||||
|| elem->ossl_list_##name.next->ossl_list_##name.prev == elem); \
|
||||
return elem->ossl_list_##name.next; \
|
||||
} \
|
||||
static ossl_unused ossl_inline type *ossl_list_##name##_prev(const type *elem) \
|
||||
static ossl_unused ossl_inline type *ossl_list_##name##_prev( \
|
||||
const type *elem) \
|
||||
{ \
|
||||
assert(elem->ossl_list_##name.prev == NULL \
|
||||
|| elem->ossl_list_##name.prev->ossl_list_##name.next == elem); \
|
||||
return elem->ossl_list_##name.prev; \
|
||||
} \
|
||||
static ossl_unused ossl_inline void ossl_list_##name##_remove(OSSL_LIST(name) * list, \
|
||||
type * elem) \
|
||||
static ossl_unused ossl_inline void ossl_list_##name##_remove( \
|
||||
OSSL_LIST(name) * list, type * elem) \
|
||||
{ \
|
||||
assert(elem->ossl_list_##name.list == list); \
|
||||
OSSL_LIST_DBG(elem->ossl_list_##name.list = NULL) \
|
||||
@ -86,14 +93,16 @@
|
||||
if (list->omega == elem) \
|
||||
list->omega = elem->ossl_list_##name.prev; \
|
||||
if (elem->ossl_list_##name.prev != NULL) \
|
||||
elem->ossl_list_##name.prev->ossl_list_##name.next = elem->ossl_list_##name.next; \
|
||||
elem->ossl_list_##name.prev->ossl_list_##name.next \
|
||||
= elem->ossl_list_##name.next; \
|
||||
if (elem->ossl_list_##name.next != NULL) \
|
||||
elem->ossl_list_##name.next->ossl_list_##name.prev = elem->ossl_list_##name.prev; \
|
||||
elem->ossl_list_##name.next->ossl_list_##name.prev \
|
||||
= elem->ossl_list_##name.prev; \
|
||||
list->num_elems--; \
|
||||
memset(&elem->ossl_list_##name, 0, sizeof(elem->ossl_list_##name)); \
|
||||
} \
|
||||
static ossl_unused ossl_inline void ossl_list_##name##_insert_head(OSSL_LIST(name) * list, \
|
||||
type * elem) \
|
||||
static ossl_unused ossl_inline void ossl_list_##name##_insert_head( \
|
||||
OSSL_LIST(name) * list, type * elem) \
|
||||
{ \
|
||||
assert(elem->ossl_list_##name.list == NULL); \
|
||||
OSSL_LIST_DBG(elem->ossl_list_##name.list = list) \
|
||||
@ -106,8 +115,8 @@
|
||||
list->omega = elem; \
|
||||
list->num_elems++; \
|
||||
} \
|
||||
static ossl_unused ossl_inline void ossl_list_##name##_insert_tail(OSSL_LIST(name) * list, \
|
||||
type * elem) \
|
||||
static ossl_unused ossl_inline void ossl_list_##name##_insert_tail( \
|
||||
OSSL_LIST(name) * list, type * elem) \
|
||||
{ \
|
||||
assert(elem->ossl_list_##name.list == NULL); \
|
||||
OSSL_LIST_DBG(elem->ossl_list_##name.list = list) \
|
||||
@ -120,8 +129,8 @@
|
||||
list->alpha = elem; \
|
||||
list->num_elems++; \
|
||||
} \
|
||||
static ossl_unused ossl_inline void ossl_list_##name##_insert_before(OSSL_LIST(name) * list, \
|
||||
type * e, type * elem) \
|
||||
static ossl_unused ossl_inline void ossl_list_##name##_insert_before( \
|
||||
OSSL_LIST(name) * list, type * e, type * elem) \
|
||||
{ \
|
||||
assert(elem->ossl_list_##name.list == NULL); \
|
||||
OSSL_LIST_DBG(elem->ossl_list_##name.list = list) \
|
||||
@ -134,8 +143,8 @@
|
||||
list->alpha = elem; \
|
||||
list->num_elems++; \
|
||||
} \
|
||||
static ossl_unused ossl_inline void ossl_list_##name##_insert_after(OSSL_LIST(name) * list, \
|
||||
type * e, type * elem) \
|
||||
static ossl_unused ossl_inline void ossl_list_##name##_insert_after( \
|
||||
OSSL_LIST(name) * list, type * e, type * elem) \
|
||||
{ \
|
||||
assert(elem->ossl_list_##name.list == NULL); \
|
||||
OSSL_LIST_DBG(elem->ossl_list_##name.list = list) \
|
||||
|
@ -25,10 +25,13 @@ int ossl_namemap_add_name(OSSL_NAMEMAP *namemap, int number, const char *name);
|
||||
* number->name mapping is an iterator.
|
||||
*/
|
||||
int ossl_namemap_name2num(const OSSL_NAMEMAP *namemap, const char *name);
|
||||
int ossl_namemap_name2num_n(const OSSL_NAMEMAP *namemap, const char *name, size_t name_len);
|
||||
const char *ossl_namemap_num2name(const OSSL_NAMEMAP *namemap, int number, size_t idx);
|
||||
int ossl_namemap_name2num_n(const OSSL_NAMEMAP *namemap, const char *name,
|
||||
size_t name_len);
|
||||
const char *ossl_namemap_num2name(const OSSL_NAMEMAP *namemap, int number,
|
||||
size_t idx);
|
||||
int ossl_namemap_doall_names(const OSSL_NAMEMAP *namemap, int number,
|
||||
void (*fn)(const char *name, void *data), void *data);
|
||||
void (*fn)(const char *name, void *data),
|
||||
void *data);
|
||||
|
||||
/*
|
||||
* A utility that handles several names in a string, divided by a given
|
||||
|
@ -16,13 +16,15 @@
|
||||
#if (-1 & 3) == 0x03 /* Two's complement */
|
||||
|
||||
# define __MAXUINT__(T) ((T) - 1)
|
||||
# define __MAXINT__(T) ((T)((((T)1) << ((sizeof(T) * CHAR_BIT) - 1)) ^ __MAXUINT__(T)))
|
||||
# define __MAXINT__(T) \
|
||||
((T)((((T)1) << ((sizeof(T) * CHAR_BIT) - 1)) ^ __MAXUINT__(T)))
|
||||
# define __MININT__(T) (-__MAXINT__(T) - 1)
|
||||
|
||||
#elif (-1 & 3) == 0x02 /* One's complement */
|
||||
|
||||
# define __MAXUINT__(T) (((T) - 1) + 1)
|
||||
# define __MAXINT__(T) ((T)((((T)1) << ((sizeof(T) * CHAR_BIT) - 1)) ^ __MAXUINT__(T)))
|
||||
# define __MAXINT__(T) \
|
||||
((T)((((T)1) << ((sizeof(T) * CHAR_BIT) - 1)) ^ __MAXUINT__(T)))
|
||||
# define __MININT__(T) (-__MAXINT__(T))
|
||||
|
||||
#elif (-1 & 3) == 0x01 /* Sign/magnitude */
|
||||
@ -30,7 +32,8 @@
|
||||
# define __MAXINT__(T) \
|
||||
((T)(((((T)1) << ((sizeof(T) * CHAR_BIT) - 2)) - 1) \
|
||||
| (((T)1) << ((sizeof(T) * CHAR_BIT) - 2))))
|
||||
# define __MAXUINT__(T) ((T)(__MAXINT__(T) | (((T)1) << ((sizeof(T) * CHAR_BIT) - 1))))
|
||||
# define __MAXUINT__(T) \
|
||||
((T)(__MAXINT__(T) | (((T)1) << ((sizeof(T) * CHAR_BIT) - 1))))
|
||||
# define __MININT__(T) (-__MAXINT__(T))
|
||||
|
||||
#else
|
||||
|
@ -68,7 +68,8 @@ static ossl_inline const unsigned char *PACKET_data(const PACKET *pkt)
|
||||
* copy of the data so |buf| must be present for the whole time that the PACKET
|
||||
* is being used.
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_buf_init(PACKET *pkt, const unsigned char *buf, size_t len)
|
||||
__owur static ossl_inline int
|
||||
PACKET_buf_init(PACKET *pkt, const unsigned char *buf, size_t len)
|
||||
{
|
||||
/* Sanity check for negative values. */
|
||||
if (len > (size_t)(SIZE_MAX / 2))
|
||||
@ -91,7 +92,8 @@ static ossl_inline void PACKET_null_init(PACKET *pkt)
|
||||
* bytes read from |ptr|. Returns 0 otherwise (lengths or contents not equal).
|
||||
* If lengths are equal, performs the comparison in constant time.
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_equal(const PACKET *pkt, const void *ptr, size_t num)
|
||||
__owur static ossl_inline int PACKET_equal(const PACKET *pkt, const void *ptr,
|
||||
size_t num)
|
||||
{
|
||||
if (PACKET_remaining(pkt) != num)
|
||||
return 0;
|
||||
@ -103,7 +105,8 @@ __owur static ossl_inline int PACKET_equal(const PACKET *pkt, const void *ptr, s
|
||||
* Data is not copied: the |subpkt| packet will share its underlying buffer with
|
||||
* the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt, PACKET *subpkt, size_t len)
|
||||
__owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt,
|
||||
PACKET *subpkt, size_t len)
|
||||
{
|
||||
if (PACKET_remaining(pkt) < len)
|
||||
return 0;
|
||||
@ -116,7 +119,8 @@ __owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt, PACKET *
|
||||
* copied: the |subpkt| packet will share its underlying buffer with the
|
||||
* original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt, PACKET *subpkt, size_t len)
|
||||
__owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt, PACKET *subpkt,
|
||||
size_t len)
|
||||
{
|
||||
if (!PACKET_peek_sub_packet(pkt, subpkt, len))
|
||||
return 0;
|
||||
@ -130,7 +134,8 @@ __owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt, PACKET *subpkt,
|
||||
* Peek ahead at 2 bytes in network order from |pkt| and store the value in
|
||||
* |*data|
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_peek_net_2(const PACKET *pkt, unsigned int *data)
|
||||
__owur static ossl_inline int PACKET_peek_net_2(const PACKET *pkt,
|
||||
unsigned int *data)
|
||||
{
|
||||
if (PACKET_remaining(pkt) < 2)
|
||||
return 0;
|
||||
@ -169,7 +174,8 @@ __owur static ossl_inline int PACKET_get_net_2_len(PACKET *pkt, size_t *data)
|
||||
* Peek ahead at 3 bytes in network order from |pkt| and store the value in
|
||||
* |*data|
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_peek_net_3(const PACKET *pkt, unsigned long *data)
|
||||
__owur static ossl_inline int PACKET_peek_net_3(const PACKET *pkt,
|
||||
unsigned long *data)
|
||||
{
|
||||
if (PACKET_remaining(pkt) < 3)
|
||||
return 0;
|
||||
@ -209,7 +215,8 @@ __owur static ossl_inline int PACKET_get_net_3_len(PACKET *pkt, size_t *data)
|
||||
* Peek ahead at 4 bytes in network order from |pkt| and store the value in
|
||||
* |*data|
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_peek_net_4(const PACKET *pkt, unsigned long *data)
|
||||
__owur static ossl_inline int PACKET_peek_net_4(const PACKET *pkt,
|
||||
unsigned long *data)
|
||||
{
|
||||
if (PACKET_remaining(pkt) < 4)
|
||||
return 0;
|
||||
@ -226,7 +233,8 @@ __owur static ossl_inline int PACKET_peek_net_4(const PACKET *pkt, unsigned long
|
||||
* Peek ahead at 8 bytes in network order from |pkt| and store the value in
|
||||
* |*data|
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_peek_net_8(const PACKET *pkt, uint64_t *data)
|
||||
__owur static ossl_inline int PACKET_peek_net_8(const PACKET *pkt,
|
||||
uint64_t *data)
|
||||
{
|
||||
if (PACKET_remaining(pkt) < 8)
|
||||
return 0;
|
||||
@ -269,7 +277,8 @@ __owur static ossl_inline int PACKET_get_quic_vlint(PACKET *pkt, uint64_t *data)
|
||||
* |data|. Unlike PACKET_get_quic_vlint, this does not advance the current
|
||||
* position.
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_peek_quic_vlint(PACKET *pkt, uint64_t *data)
|
||||
__owur static ossl_inline int PACKET_peek_quic_vlint(PACKET *pkt,
|
||||
uint64_t *data)
|
||||
{
|
||||
size_t enclen;
|
||||
|
||||
@ -340,7 +349,8 @@ __owur static ossl_inline int PACKET_get_net_8(PACKET *pkt, uint64_t *data)
|
||||
}
|
||||
|
||||
/* Peek ahead at 1 byte from |pkt| and store the value in |*data| */
|
||||
__owur static ossl_inline int PACKET_peek_1(const PACKET *pkt, unsigned int *data)
|
||||
__owur static ossl_inline int PACKET_peek_1(const PACKET *pkt,
|
||||
unsigned int *data)
|
||||
{
|
||||
if (!PACKET_remaining(pkt))
|
||||
return 0;
|
||||
@ -377,7 +387,8 @@ __owur static ossl_inline int PACKET_get_1_len(PACKET *pkt, size_t *data)
|
||||
* Peek ahead at 4 bytes in reverse network order from |pkt| and store the value
|
||||
* in |*data|
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_peek_4(const PACKET *pkt, unsigned long *data)
|
||||
__owur static ossl_inline int PACKET_peek_4(const PACKET *pkt,
|
||||
unsigned long *data)
|
||||
{
|
||||
if (PACKET_remaining(pkt) < 4)
|
||||
return 0;
|
||||
@ -411,8 +422,8 @@ __owur static ossl_inline int PACKET_get_4(PACKET *pkt, unsigned long *data)
|
||||
* caller should not free this data directly (it will be freed when the
|
||||
* underlying buffer gets freed
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_peek_bytes(const PACKET *pkt, const unsigned char **data,
|
||||
size_t len)
|
||||
__owur static ossl_inline int
|
||||
PACKET_peek_bytes(const PACKET *pkt, const unsigned char **data, size_t len)
|
||||
{
|
||||
if (PACKET_remaining(pkt) < len)
|
||||
return 0;
|
||||
@ -428,7 +439,8 @@ __owur static ossl_inline int PACKET_peek_bytes(const PACKET *pkt, const unsigne
|
||||
* not free this data directly (it will be freed when the underlying buffer gets
|
||||
* freed
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_get_bytes(PACKET *pkt, const unsigned char **data, size_t len)
|
||||
__owur static ossl_inline int
|
||||
PACKET_get_bytes(PACKET *pkt, const unsigned char **data, size_t len)
|
||||
{
|
||||
if (!PACKET_peek_bytes(pkt, data, len))
|
||||
return 0;
|
||||
@ -439,8 +451,8 @@ __owur static ossl_inline int PACKET_get_bytes(PACKET *pkt, const unsigned char
|
||||
}
|
||||
|
||||
/* Peek ahead at |len| bytes from |pkt| and copy them to |data| */
|
||||
__owur static ossl_inline int PACKET_peek_copy_bytes(const PACKET *pkt, unsigned char *data,
|
||||
size_t len)
|
||||
__owur static ossl_inline int
|
||||
PACKET_peek_copy_bytes(const PACKET *pkt, unsigned char *data, size_t len)
|
||||
{
|
||||
if (PACKET_remaining(pkt) < len)
|
||||
return 0;
|
||||
@ -454,7 +466,8 @@ __owur static ossl_inline int PACKET_peek_copy_bytes(const PACKET *pkt, unsigned
|
||||
* Read |len| bytes from |pkt| and copy them to |data|.
|
||||
* The caller is responsible for ensuring that |data| can hold |len| bytes.
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_copy_bytes(PACKET *pkt, unsigned char *data, size_t len)
|
||||
__owur static ossl_inline int PACKET_copy_bytes(PACKET *pkt,
|
||||
unsigned char *data, size_t len)
|
||||
{
|
||||
if (!PACKET_peek_copy_bytes(pkt, data, len))
|
||||
return 0;
|
||||
@ -471,7 +484,8 @@ __owur static ossl_inline int PACKET_copy_bytes(PACKET *pkt, unsigned char *data
|
||||
* Does not forward PACKET position (because it is typically the last thing
|
||||
* done with a given PACKET).
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_copy_all(const PACKET *pkt, unsigned char *dest,
|
||||
__owur static ossl_inline int PACKET_copy_all(const PACKET *pkt,
|
||||
unsigned char *dest,
|
||||
size_t dest_len, size_t *len)
|
||||
{
|
||||
if (PACKET_remaining(pkt) > dest_len)
|
||||
@ -493,7 +507,8 @@ __owur static ossl_inline int PACKET_copy_all(const PACKET *pkt, unsigned char *
|
||||
* Does not forward PACKET position (because it is typically the last thing
|
||||
* done with a given PACKET).
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_memdup(const PACKET *pkt, unsigned char **data, size_t *len)
|
||||
__owur static ossl_inline int PACKET_memdup(const PACKET *pkt,
|
||||
unsigned char **data, size_t *len)
|
||||
{
|
||||
size_t length;
|
||||
|
||||
@ -557,12 +572,14 @@ __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len)
|
||||
* the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
|
||||
* Upon failure, the original |pkt| and |subpkt| are not modified.
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_get_length_prefixed_1(PACKET *pkt, PACKET *subpkt)
|
||||
__owur static ossl_inline int PACKET_get_length_prefixed_1(PACKET *pkt,
|
||||
PACKET *subpkt)
|
||||
{
|
||||
unsigned int length;
|
||||
const unsigned char *data;
|
||||
PACKET tmp = *pkt;
|
||||
if (!PACKET_get_1(&tmp, &length) || !PACKET_get_bytes(&tmp, &data, (size_t)length))
|
||||
if (!PACKET_get_1(&tmp, &length)
|
||||
|| !PACKET_get_bytes(&tmp, &data, (size_t)length))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -578,12 +595,14 @@ __owur static ossl_inline int PACKET_get_length_prefixed_1(PACKET *pkt, PACKET *
|
||||
* Like PACKET_get_length_prefixed_1, but additionally, fails when there are
|
||||
* leftover bytes in |pkt|.
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_as_length_prefixed_1(PACKET *pkt, PACKET *subpkt)
|
||||
__owur static ossl_inline int PACKET_as_length_prefixed_1(PACKET *pkt,
|
||||
PACKET *subpkt)
|
||||
{
|
||||
unsigned int length;
|
||||
const unsigned char *data;
|
||||
PACKET tmp = *pkt;
|
||||
if (!PACKET_get_1(&tmp, &length) || !PACKET_get_bytes(&tmp, &data, (size_t)length)
|
||||
if (!PACKET_get_1(&tmp, &length)
|
||||
|| !PACKET_get_bytes(&tmp, &data, (size_t)length)
|
||||
|| PACKET_remaining(&tmp) != 0)
|
||||
{
|
||||
return 0;
|
||||
@ -603,13 +622,15 @@ __owur static ossl_inline int PACKET_as_length_prefixed_1(PACKET *pkt, PACKET *s
|
||||
* the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
|
||||
* Upon failure, the original |pkt| and |subpkt| are not modified.
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_get_length_prefixed_2(PACKET *pkt, PACKET *subpkt)
|
||||
__owur static ossl_inline int PACKET_get_length_prefixed_2(PACKET *pkt,
|
||||
PACKET *subpkt)
|
||||
{
|
||||
unsigned int length;
|
||||
const unsigned char *data;
|
||||
PACKET tmp = *pkt;
|
||||
|
||||
if (!PACKET_get_net_2(&tmp, &length) || !PACKET_get_bytes(&tmp, &data, (size_t)length))
|
||||
if (!PACKET_get_net_2(&tmp, &length)
|
||||
|| !PACKET_get_bytes(&tmp, &data, (size_t)length))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -625,13 +646,15 @@ __owur static ossl_inline int PACKET_get_length_prefixed_2(PACKET *pkt, PACKET *
|
||||
* Like PACKET_get_length_prefixed_2, but additionally, fails when there are
|
||||
* leftover bytes in |pkt|.
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_as_length_prefixed_2(PACKET *pkt, PACKET *subpkt)
|
||||
__owur static ossl_inline int PACKET_as_length_prefixed_2(PACKET *pkt,
|
||||
PACKET *subpkt)
|
||||
{
|
||||
unsigned int length;
|
||||
const unsigned char *data;
|
||||
PACKET tmp = *pkt;
|
||||
|
||||
if (!PACKET_get_net_2(&tmp, &length) || !PACKET_get_bytes(&tmp, &data, (size_t)length)
|
||||
if (!PACKET_get_net_2(&tmp, &length)
|
||||
|| !PACKET_get_bytes(&tmp, &data, (size_t)length)
|
||||
|| PACKET_remaining(&tmp) != 0)
|
||||
{
|
||||
return 0;
|
||||
@ -651,12 +674,14 @@ __owur static ossl_inline int PACKET_as_length_prefixed_2(PACKET *pkt, PACKET *s
|
||||
* the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|.
|
||||
* Upon failure, the original |pkt| and |subpkt| are not modified.
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_get_length_prefixed_3(PACKET *pkt, PACKET *subpkt)
|
||||
__owur static ossl_inline int PACKET_get_length_prefixed_3(PACKET *pkt,
|
||||
PACKET *subpkt)
|
||||
{
|
||||
unsigned long length;
|
||||
const unsigned char *data;
|
||||
PACKET tmp = *pkt;
|
||||
if (!PACKET_get_net_3(&tmp, &length) || !PACKET_get_bytes(&tmp, &data, (size_t)length))
|
||||
if (!PACKET_get_net_3(&tmp, &length)
|
||||
|| !PACKET_get_bytes(&tmp, &data, (size_t)length))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -675,7 +700,8 @@ __owur static ossl_inline int PACKET_get_length_prefixed_3(PACKET *pkt, PACKET *
|
||||
* buffer with the original |pkt|, so data wrapped by |pkt| must outlive the
|
||||
* |subpkt|. Upon failure, the original |pkt| and |subpkt| are not modified.
|
||||
*/
|
||||
__owur static ossl_inline int PACKET_get_quic_length_prefixed(PACKET *pkt, PACKET *subpkt)
|
||||
__owur static ossl_inline int PACKET_get_quic_length_prefixed(PACKET *pkt,
|
||||
PACKET *subpkt)
|
||||
{
|
||||
uint64_t length;
|
||||
const unsigned char *data;
|
||||
@ -795,7 +821,8 @@ int WPACKET_init_null_der(WPACKET *pkt);
|
||||
* A fixed buffer of memory |buf| of size |len| is used instead. A failure will
|
||||
* occur if you attempt to write beyond the end of the buffer
|
||||
*/
|
||||
int WPACKET_init_static_len(WPACKET *pkt, unsigned char *buf, size_t len, size_t lenbytes);
|
||||
int WPACKET_init_static_len(WPACKET *pkt, unsigned char *buf, size_t len,
|
||||
size_t lenbytes);
|
||||
|
||||
/*
|
||||
* Same as WPACKET_init_static_len except lenbytes is always 0, and we set the
|
||||
@ -843,10 +870,14 @@ int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes);
|
||||
* Convenience macros for calling WPACKET_start_sub_packet_len with different
|
||||
* lengths
|
||||
*/
|
||||
#define WPACKET_start_sub_packet_u8(pkt) WPACKET_start_sub_packet_len__((pkt), 1)
|
||||
#define WPACKET_start_sub_packet_u16(pkt) WPACKET_start_sub_packet_len__((pkt), 2)
|
||||
#define WPACKET_start_sub_packet_u24(pkt) WPACKET_start_sub_packet_len__((pkt), 3)
|
||||
#define WPACKET_start_sub_packet_u32(pkt) WPACKET_start_sub_packet_len__((pkt), 4)
|
||||
#define WPACKET_start_sub_packet_u8(pkt) \
|
||||
WPACKET_start_sub_packet_len__((pkt), 1)
|
||||
#define WPACKET_start_sub_packet_u16(pkt) \
|
||||
WPACKET_start_sub_packet_len__((pkt), 2)
|
||||
#define WPACKET_start_sub_packet_u24(pkt) \
|
||||
WPACKET_start_sub_packet_len__((pkt), 3)
|
||||
#define WPACKET_start_sub_packet_u32(pkt) \
|
||||
WPACKET_start_sub_packet_len__((pkt), 4)
|
||||
|
||||
/*
|
||||
* Same as WPACKET_start_sub_packet_len__() except no bytes are pre-allocated
|
||||
@ -862,7 +893,8 @@ int WPACKET_start_sub_packet(WPACKET *pkt);
|
||||
* WPACKET_* calls. If not then the underlying buffer may be realloc'd and
|
||||
* change its location.
|
||||
*/
|
||||
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes);
|
||||
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len,
|
||||
unsigned char **allocbytes);
|
||||
|
||||
/*
|
||||
* The same as WPACKET_allocate_bytes() except additionally a new sub-packet is
|
||||
@ -870,8 +902,8 @@ int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
|
||||
* number of length bytes for the sub-packet is in |lenbytes|. Don't call this
|
||||
* directly. Use the convenience macros below instead.
|
||||
*/
|
||||
int WPACKET_sub_allocate_bytes__(WPACKET *pkt, size_t len, unsigned char **allocbytes,
|
||||
size_t lenbytes);
|
||||
int WPACKET_sub_allocate_bytes__(WPACKET *pkt, size_t len,
|
||||
unsigned char **allocbytes, size_t lenbytes);
|
||||
|
||||
/*
|
||||
* Convenience macros for calling WPACKET_sub_allocate_bytes with different
|
||||
@ -898,7 +930,8 @@ int WPACKET_sub_allocate_bytes__(WPACKET *pkt, size_t len, unsigned char **alloc
|
||||
* signature may not be known in advance. We can use WPACKET_reserve_bytes() to
|
||||
* handle this:
|
||||
*
|
||||
* if (!WPACKET_sub_reserve_bytes_u16(&pkt, EVP_PKEY_get_size(pkey), &sigbytes1)
|
||||
* if (!WPACKET_sub_reserve_bytes_u16(&pkt, EVP_PKEY_get_size(pkey),
|
||||
* &sigbytes1)
|
||||
* || EVP_SignFinal(md_ctx, sigbytes1, &siglen, pkey) <= 0
|
||||
* || !WPACKET_sub_allocate_bytes_u16(&pkt, siglen, &sigbytes2)
|
||||
* || sigbytes1 != sigbytes2)
|
||||
@ -909,8 +942,8 @@ int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes);
|
||||
/*
|
||||
* The "reserve_bytes" equivalent of WPACKET_sub_allocate_bytes__()
|
||||
*/
|
||||
int WPACKET_sub_reserve_bytes__(WPACKET *pkt, size_t len, unsigned char **allocbytes,
|
||||
size_t lenbytes);
|
||||
int WPACKET_sub_reserve_bytes__(WPACKET *pkt, size_t len,
|
||||
unsigned char **allocbytes, size_t lenbytes);
|
||||
|
||||
/*
|
||||
* Convenience macros for WPACKET_sub_reserve_bytes with different lengths
|
||||
@ -957,13 +990,18 @@ int WPACKET_memset(WPACKET *pkt, int ch, size_t len);
|
||||
* length (consuming |lenbytes| of data for the length). Don't call this
|
||||
* directly. Use the convenience macros below instead.
|
||||
*/
|
||||
int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len, size_t lenbytes);
|
||||
int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len,
|
||||
size_t lenbytes);
|
||||
|
||||
/* Convenience macros for calling WPACKET_sub_memcpy with different lengths */
|
||||
#define WPACKET_sub_memcpy_u8(pkt, src, len) WPACKET_sub_memcpy__((pkt), (src), (len), 1)
|
||||
#define WPACKET_sub_memcpy_u16(pkt, src, len) WPACKET_sub_memcpy__((pkt), (src), (len), 2)
|
||||
#define WPACKET_sub_memcpy_u24(pkt, src, len) WPACKET_sub_memcpy__((pkt), (src), (len), 3)
|
||||
#define WPACKET_sub_memcpy_u32(pkt, src, len) WPACKET_sub_memcpy__((pkt), (src), (len), 4)
|
||||
#define WPACKET_sub_memcpy_u8(pkt, src, len) \
|
||||
WPACKET_sub_memcpy__((pkt), (src), (len), 1)
|
||||
#define WPACKET_sub_memcpy_u16(pkt, src, len) \
|
||||
WPACKET_sub_memcpy__((pkt), (src), (len), 2)
|
||||
#define WPACKET_sub_memcpy_u24(pkt, src, len) \
|
||||
WPACKET_sub_memcpy__((pkt), (src), (len), 3)
|
||||
#define WPACKET_sub_memcpy_u32(pkt, src, len) \
|
||||
WPACKET_sub_memcpy__((pkt), (src), (len), 4)
|
||||
|
||||
/*
|
||||
* Return the total number of bytes written so far to the underlying buffer
|
||||
@ -1010,7 +1048,8 @@ __owur int WPACKET_start_quic_sub_packet_bound(WPACKET *pkt, size_t max_len);
|
||||
* must be filled by the caller. This function assures optimal selection of
|
||||
* variable-length integer encoding length.
|
||||
*/
|
||||
__owur int WPACKET_quic_sub_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **bytes);
|
||||
__owur int WPACKET_quic_sub_allocate_bytes(WPACKET *pkt, size_t len,
|
||||
unsigned char **bytes);
|
||||
|
||||
/*
|
||||
* Write a QUIC variable-length integer to the packet.
|
||||
|
@ -23,22 +23,30 @@ typedef union
|
||||
#define OSSL_PARAM_ALIGN_SIZE sizeof(OSSL_PARAM_ALIGNED_BLOCK)
|
||||
|
||||
size_t ossl_param_bytes_to_blocks(size_t bytes);
|
||||
void ossl_param_set_secure_block(OSSL_PARAM *last, void *secure_buffer, size_t secure_buffer_sz);
|
||||
void ossl_param_set_secure_block(OSSL_PARAM *last, void *secure_buffer,
|
||||
size_t secure_buffer_sz);
|
||||
|
||||
int ossl_param_build_set_int(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *key, int num);
|
||||
int ossl_param_build_set_long(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *key, long num);
|
||||
int ossl_param_build_set_utf8_string(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *key,
|
||||
const char *buf);
|
||||
int ossl_param_build_set_octet_string(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *key,
|
||||
const unsigned char *data, size_t data_len);
|
||||
int ossl_param_build_set_bn(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *key, const BIGNUM *bn);
|
||||
int ossl_param_build_set_bn_pad(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *key,
|
||||
const BIGNUM *bn, size_t sz);
|
||||
int ossl_param_build_set_signed_bn(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *key,
|
||||
int ossl_param_build_set_int(OSSL_PARAM_BLD *bld, OSSL_PARAM *p,
|
||||
const char *key, int num);
|
||||
int ossl_param_build_set_long(OSSL_PARAM_BLD *bld, OSSL_PARAM *p,
|
||||
const char *key, long num);
|
||||
int ossl_param_build_set_utf8_string(OSSL_PARAM_BLD *bld, OSSL_PARAM *p,
|
||||
const char *key, const char *buf);
|
||||
int ossl_param_build_set_octet_string(OSSL_PARAM_BLD *bld, OSSL_PARAM *p,
|
||||
const char *key,
|
||||
const unsigned char *data,
|
||||
size_t data_len);
|
||||
int ossl_param_build_set_bn(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *key,
|
||||
const BIGNUM *bn);
|
||||
int ossl_param_build_set_signed_bn_pad(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *key,
|
||||
const BIGNUM *bn, size_t sz);
|
||||
int ossl_param_build_set_multi_key_bn(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *names[],
|
||||
int ossl_param_build_set_bn_pad(OSSL_PARAM_BLD *bld, OSSL_PARAM *p,
|
||||
const char *key, const BIGNUM *bn, size_t sz);
|
||||
int ossl_param_build_set_signed_bn(OSSL_PARAM_BLD *bld, OSSL_PARAM *p,
|
||||
const char *key, const BIGNUM *bn);
|
||||
int ossl_param_build_set_signed_bn_pad(OSSL_PARAM_BLD *bld, OSSL_PARAM *p,
|
||||
const char *key, const BIGNUM *bn,
|
||||
size_t sz);
|
||||
int ossl_param_build_set_multi_key_bn(OSSL_PARAM_BLD *bld, OSSL_PARAM *p,
|
||||
const char *names[],
|
||||
STACK_OF(BIGNUM_const) * stk);
|
||||
|
||||
#endif /* OSSL_INTERNAL_PARAM_BUILD_SET_H */
|
||||
|
@ -94,14 +94,15 @@ struct ossl_passphrase_data_st
|
||||
void ossl_pw_clear_passphrase_data(struct ossl_passphrase_data_st *data);
|
||||
void ossl_pw_clear_passphrase_cache(struct ossl_passphrase_data_st *data);
|
||||
|
||||
int ossl_pw_set_passphrase(struct ossl_passphrase_data_st *data, const unsigned char *passphrase,
|
||||
int ossl_pw_set_passphrase(struct ossl_passphrase_data_st *data,
|
||||
const unsigned char *passphrase,
|
||||
size_t passphrase_len);
|
||||
int ossl_pw_set_pem_password_cb(struct ossl_passphrase_data_st *data, pem_password_cb *cb,
|
||||
void *cbarg);
|
||||
int ossl_pw_set_pem_password_cb(struct ossl_passphrase_data_st *data,
|
||||
pem_password_cb *cb, void *cbarg);
|
||||
int ossl_pw_set_ossl_passphrase_cb(struct ossl_passphrase_data_st *data,
|
||||
OSSL_PASSPHRASE_CALLBACK *cb, void *cbarg);
|
||||
int ossl_pw_set_ui_method(struct ossl_passphrase_data_st *data, const UI_METHOD *ui_method,
|
||||
void *ui_data);
|
||||
int ossl_pw_set_ui_method(struct ossl_passphrase_data_st *data,
|
||||
const UI_METHOD *ui_method, void *ui_data);
|
||||
|
||||
int ossl_pw_enable_passphrase_caching(struct ossl_passphrase_data_st *data);
|
||||
int ossl_pw_disable_passphrase_caching(struct ossl_passphrase_data_st *data);
|
||||
|
@ -24,7 +24,8 @@
|
||||
return (PRIORITY_QUEUE_OF(type) *)ossl_pqueue_new( \
|
||||
(int (*)(const void *, const void *))compare); \
|
||||
} \
|
||||
static ossl_unused ossl_inline void ossl_pqueue_##type##_free(PRIORITY_QUEUE_OF(type) * pq) \
|
||||
static ossl_unused ossl_inline void ossl_pqueue_##type##_free( \
|
||||
PRIORITY_QUEUE_OF(type) * pq) \
|
||||
{ \
|
||||
ossl_pqueue_free((OSSL_PQUEUE *)pq); \
|
||||
} \
|
||||
@ -33,27 +34,28 @@
|
||||
{ \
|
||||
ossl_pqueue_pop_free((OSSL_PQUEUE *)pq, (void (*)(void *))freefunc); \
|
||||
} \
|
||||
static ossl_unused ossl_inline int ossl_pqueue_##type##_reserve(PRIORITY_QUEUE_OF(type) * pq, \
|
||||
size_t n) \
|
||||
static ossl_unused ossl_inline int ossl_pqueue_##type##_reserve( \
|
||||
PRIORITY_QUEUE_OF(type) * pq, size_t n) \
|
||||
{ \
|
||||
return ossl_pqueue_reserve((OSSL_PQUEUE *)pq, n); \
|
||||
} \
|
||||
static ossl_unused ossl_inline size_t ossl_pqueue_##type##_num(const PRIORITY_QUEUE_OF(type) \
|
||||
* pq) \
|
||||
static ossl_unused ossl_inline size_t ossl_pqueue_##type##_num( \
|
||||
const PRIORITY_QUEUE_OF(type) * pq) \
|
||||
{ \
|
||||
return ossl_pqueue_num((OSSL_PQUEUE *)pq); \
|
||||
} \
|
||||
static ossl_unused ossl_inline int ossl_pqueue_##type##_push(PRIORITY_QUEUE_OF(type) * pq, \
|
||||
ctype * data, size_t * elem) \
|
||||
static ossl_unused ossl_inline int ossl_pqueue_##type##_push( \
|
||||
PRIORITY_QUEUE_OF(type) * pq, ctype * data, size_t * elem) \
|
||||
{ \
|
||||
return ossl_pqueue_push((OSSL_PQUEUE *)pq, (void *)data, elem); \
|
||||
} \
|
||||
static ossl_unused ossl_inline ctype *ossl_pqueue_##type##_peek(const PRIORITY_QUEUE_OF(type) \
|
||||
* pq) \
|
||||
static ossl_unused ossl_inline ctype *ossl_pqueue_##type##_peek( \
|
||||
const PRIORITY_QUEUE_OF(type) * pq) \
|
||||
{ \
|
||||
return (type *)ossl_pqueue_peek((OSSL_PQUEUE *)pq); \
|
||||
} \
|
||||
static ossl_unused ossl_inline ctype *ossl_pqueue_##type##_pop(PRIORITY_QUEUE_OF(type) * pq) \
|
||||
static ossl_unused ossl_inline ctype *ossl_pqueue_##type##_pop( \
|
||||
PRIORITY_QUEUE_OF(type) * pq) \
|
||||
{ \
|
||||
return (type *)ossl_pqueue_pop((OSSL_PQUEUE *)pq); \
|
||||
} \
|
||||
@ -64,7 +66,8 @@
|
||||
} \
|
||||
struct ossl_priority_queue_st_##type
|
||||
|
||||
#define DEFINE_PRIORITY_QUEUE_OF(type) DEFINE_PRIORITY_QUEUE_OF_INTERNAL(type, type)
|
||||
#define DEFINE_PRIORITY_QUEUE_OF(type) \
|
||||
DEFINE_PRIORITY_QUEUE_OF_INTERNAL(type, type)
|
||||
|
||||
typedef struct ossl_pqueue_st OSSL_PQUEUE;
|
||||
|
||||
|
@ -31,19 +31,23 @@ int ossl_property_parse_init(OSSL_LIB_CTX *ctx);
|
||||
/* Property definition parser */
|
||||
OSSL_PROPERTY_LIST *ossl_parse_property(OSSL_LIB_CTX *ctx, const char *defn);
|
||||
/* Property query parser */
|
||||
OSSL_PROPERTY_LIST *ossl_parse_query(OSSL_LIB_CTX *ctx, const char *s, int create_values);
|
||||
OSSL_PROPERTY_LIST *ossl_parse_query(OSSL_LIB_CTX *ctx, const char *s,
|
||||
int create_values);
|
||||
/* Property checker of query vs definition */
|
||||
int ossl_property_match_count(const OSSL_PROPERTY_LIST *query, const OSSL_PROPERTY_LIST *defn);
|
||||
int ossl_property_match_count(const OSSL_PROPERTY_LIST *query,
|
||||
const OSSL_PROPERTY_LIST *defn);
|
||||
int ossl_property_is_enabled(OSSL_LIB_CTX *ctx, const char *property_name,
|
||||
const OSSL_PROPERTY_LIST *prop_list);
|
||||
/* Free a parsed property list */
|
||||
void ossl_property_free(OSSL_PROPERTY_LIST *p);
|
||||
|
||||
/* Get a property from a property list */
|
||||
const OSSL_PROPERTY_DEFINITION *ossl_property_find_property(const OSSL_PROPERTY_LIST *list,
|
||||
const OSSL_PROPERTY_DEFINITION *
|
||||
ossl_property_find_property(const OSSL_PROPERTY_LIST *list,
|
||||
OSSL_LIB_CTX *libctx, const char *name);
|
||||
OSSL_PROPERTY_TYPE ossl_property_get_type(const OSSL_PROPERTY_DEFINITION *prop);
|
||||
const char *ossl_property_get_string_value(OSSL_LIB_CTX *libctx,
|
||||
const char *
|
||||
ossl_property_get_string_value(OSSL_LIB_CTX *libctx,
|
||||
const OSSL_PROPERTY_DEFINITION *prop);
|
||||
int64_t ossl_property_get_number_value(const OSSL_PROPERTY_DEFINITION *prop);
|
||||
|
||||
@ -54,32 +58,41 @@ void ossl_method_store_free(OSSL_METHOD_STORE *store);
|
||||
int ossl_method_lock_store(OSSL_METHOD_STORE *store);
|
||||
int ossl_method_unlock_store(OSSL_METHOD_STORE *store);
|
||||
|
||||
int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov, int nid,
|
||||
const char *properties, void *method, int (*method_up_ref)(void *),
|
||||
int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov,
|
||||
int nid, const char *properties, void *method,
|
||||
int (*method_up_ref)(void *),
|
||||
void (*method_destruct)(void *));
|
||||
int ossl_method_store_remove(OSSL_METHOD_STORE *store, int nid, const void *method);
|
||||
int ossl_method_store_remove(OSSL_METHOD_STORE *store, int nid,
|
||||
const void *method);
|
||||
void ossl_method_store_do_all(OSSL_METHOD_STORE *store,
|
||||
void (*fn)(int id, void *method, void *fnarg), void *fnarg);
|
||||
int ossl_method_store_fetch(OSSL_METHOD_STORE *store, int nid, const char *prop_query,
|
||||
const OSSL_PROVIDER **prov, void **method);
|
||||
int ossl_method_store_remove_all_provided(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov);
|
||||
void (*fn)(int id, void *method, void *fnarg),
|
||||
void *fnarg);
|
||||
int ossl_method_store_fetch(OSSL_METHOD_STORE *store, int nid,
|
||||
const char *prop_query, const OSSL_PROVIDER **prov,
|
||||
void **method);
|
||||
int ossl_method_store_remove_all_provided(OSSL_METHOD_STORE *store,
|
||||
const OSSL_PROVIDER *prov);
|
||||
|
||||
/* Get the global properties associate with the specified library context */
|
||||
OSSL_PROPERTY_LIST **ossl_ctx_global_properties(OSSL_LIB_CTX *ctx, int loadconfig);
|
||||
OSSL_PROPERTY_LIST **ossl_ctx_global_properties(OSSL_LIB_CTX *ctx,
|
||||
int loadconfig);
|
||||
|
||||
/* property query cache functions */
|
||||
int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov, int nid,
|
||||
const char *prop_query, void **result);
|
||||
int ossl_method_store_cache_set(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov, int nid,
|
||||
const char *prop_query, void *result, int (*method_up_ref)(void *),
|
||||
int ossl_method_store_cache_get(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov,
|
||||
int nid, const char *prop_query, void **result);
|
||||
int ossl_method_store_cache_set(OSSL_METHOD_STORE *store, OSSL_PROVIDER *prov,
|
||||
int nid, const char *prop_query, void *result,
|
||||
int (*method_up_ref)(void *),
|
||||
void (*method_destruct)(void *));
|
||||
|
||||
__owur int ossl_method_store_cache_flush_all(OSSL_METHOD_STORE *store);
|
||||
|
||||
/* Merge two property queries together */
|
||||
OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a, const OSSL_PROPERTY_LIST *b);
|
||||
OSSL_PROPERTY_LIST *ossl_property_merge(const OSSL_PROPERTY_LIST *a,
|
||||
const OSSL_PROPERTY_LIST *b);
|
||||
|
||||
size_t ossl_property_list_to_string(OSSL_LIB_CTX *ctx, const OSSL_PROPERTY_LIST *list, char *buf,
|
||||
size_t ossl_property_list_to_string(OSSL_LIB_CTX *ctx,
|
||||
const OSSL_PROPERTY_LIST *list, char *buf,
|
||||
size_t bufsize);
|
||||
|
||||
int ossl_global_properties_no_mirrored(OSSL_LIB_CTX *libctx);
|
||||
|
@ -28,18 +28,22 @@ extern "C" {
|
||||
*/
|
||||
|
||||
/* Provider Object finder, constructor and destructor */
|
||||
OSSL_PROVIDER *ossl_provider_find(OSSL_LIB_CTX *libctx, const char *name, int noconfig);
|
||||
OSSL_PROVIDER *ossl_provider_find(OSSL_LIB_CTX *libctx, const char *name,
|
||||
int noconfig);
|
||||
OSSL_PROVIDER *ossl_provider_new(OSSL_LIB_CTX *libctx, const char *name,
|
||||
OSSL_provider_init_fn *init_function, int noconfig);
|
||||
OSSL_provider_init_fn *init_function,
|
||||
int noconfig);
|
||||
int ossl_provider_up_ref(OSSL_PROVIDER *prov);
|
||||
void ossl_provider_free(OSSL_PROVIDER *prov);
|
||||
|
||||
/* Setters */
|
||||
int ossl_provider_set_module_path(OSSL_PROVIDER *prov, const char *module_path);
|
||||
int ossl_provider_add_parameter(OSSL_PROVIDER *prov, const char *name, const char *value);
|
||||
int ossl_provider_add_parameter(OSSL_PROVIDER *prov, const char *name,
|
||||
const char *value);
|
||||
|
||||
int ossl_provider_is_child(const OSSL_PROVIDER *prov);
|
||||
int ossl_provider_set_child(OSSL_PROVIDER *prov, const OSSL_CORE_HANDLE *handle);
|
||||
int ossl_provider_set_child(OSSL_PROVIDER *prov,
|
||||
const OSSL_CORE_HANDLE *handle);
|
||||
const OSSL_CORE_HANDLE *ossl_provider_get_parent(OSSL_PROVIDER *prov);
|
||||
int ossl_provider_up_ref_parent(OSSL_PROVIDER *prov, int activate);
|
||||
int ossl_provider_free_parent(OSSL_PROVIDER *prov, int deactivate);
|
||||
@ -61,7 +65,9 @@ int ossl_provider_add_to_store(OSSL_PROVIDER *prov, OSSL_PROVIDER **actualprov,
|
||||
void *ossl_provider_ctx(const OSSL_PROVIDER *prov);
|
||||
|
||||
/* Iterate over all loaded providers */
|
||||
int ossl_provider_doall_activated(OSSL_LIB_CTX *, int (*cb)(OSSL_PROVIDER *provider, void *cbdata),
|
||||
int ossl_provider_doall_activated(OSSL_LIB_CTX *,
|
||||
int (*cb)(OSSL_PROVIDER *provider,
|
||||
void *cbdata),
|
||||
void *cbdata);
|
||||
|
||||
/* Getters for other library functions */
|
||||
@ -77,12 +83,15 @@ OSSL_LIB_CTX *ossl_provider_libctx(const OSSL_PROVIDER *prov);
|
||||
void ossl_provider_teardown(const OSSL_PROVIDER *prov);
|
||||
const OSSL_PARAM *ossl_provider_gettable_params(const OSSL_PROVIDER *prov);
|
||||
int ossl_provider_get_params(const OSSL_PROVIDER *prov, OSSL_PARAM params[]);
|
||||
int ossl_provider_get_capabilities(const OSSL_PROVIDER *prov, const char *capability,
|
||||
OSSL_CALLBACK *cb, void *arg);
|
||||
int ossl_provider_get_capabilities(const OSSL_PROVIDER *prov,
|
||||
const char *capability, OSSL_CALLBACK *cb,
|
||||
void *arg);
|
||||
int ossl_provider_self_test(const OSSL_PROVIDER *prov);
|
||||
const OSSL_ALGORITHM *ossl_provider_query_operation(const OSSL_PROVIDER *prov, int operation_id,
|
||||
const OSSL_ALGORITHM *ossl_provider_query_operation(const OSSL_PROVIDER *prov,
|
||||
int operation_id,
|
||||
int *no_cache);
|
||||
void ossl_provider_unquery_operation(const OSSL_PROVIDER *prov, int operation_id,
|
||||
void ossl_provider_unquery_operation(const OSSL_PROVIDER *prov,
|
||||
int operation_id,
|
||||
const OSSL_ALGORITHM *algs);
|
||||
|
||||
/*
|
||||
@ -91,13 +100,15 @@ void ossl_provider_unquery_operation(const OSSL_PROVIDER *prov, int operation_id
|
||||
* They should never be called for temporary method stores!
|
||||
*/
|
||||
int ossl_provider_set_operation_bit(OSSL_PROVIDER *provider, size_t bitnum);
|
||||
int ossl_provider_test_operation_bit(OSSL_PROVIDER *provider, size_t bitnum, int *result);
|
||||
int ossl_provider_test_operation_bit(OSSL_PROVIDER *provider, size_t bitnum,
|
||||
int *result);
|
||||
|
||||
/* Configuration */
|
||||
void ossl_provider_add_conf_module(void);
|
||||
|
||||
/* Child providers */
|
||||
int ossl_provider_init_as_child(OSSL_LIB_CTX *ctx, const OSSL_CORE_HANDLE *handle,
|
||||
int ossl_provider_init_as_child(OSSL_LIB_CTX *ctx,
|
||||
const OSSL_CORE_HANDLE *handle,
|
||||
const OSSL_DISPATCH *in);
|
||||
void ossl_provider_deinit_child(OSSL_LIB_CTX *ctx);
|
||||
|
||||
|
@ -18,16 +18,17 @@
|
||||
|
||||
typedef struct ossl_ackm_st OSSL_ACKM;
|
||||
|
||||
OSSL_ACKM *ossl_ackm_new(OSSL_TIME (*now)(void *arg), void *now_arg, OSSL_STATM *statm,
|
||||
const OSSL_CC_METHOD *cc_method, OSSL_CC_DATA *cc_data);
|
||||
OSSL_ACKM *ossl_ackm_new(OSSL_TIME (*now)(void *arg), void *now_arg,
|
||||
OSSL_STATM *statm, const OSSL_CC_METHOD *cc_method,
|
||||
OSSL_CC_DATA *cc_data);
|
||||
void ossl_ackm_free(OSSL_ACKM *ackm);
|
||||
|
||||
void ossl_ackm_set_loss_detection_deadline_callback(OSSL_ACKM *ackm,
|
||||
void (*fn)(OSSL_TIME deadline, void *arg),
|
||||
void *arg);
|
||||
void ossl_ackm_set_loss_detection_deadline_callback(
|
||||
OSSL_ACKM *ackm, void (*fn)(OSSL_TIME deadline, void *arg), void *arg);
|
||||
|
||||
void ossl_ackm_set_ack_deadline_callback(OSSL_ACKM *ackm,
|
||||
void (*fn)(OSSL_TIME deadline, int pkt_space, void *arg),
|
||||
void (*fn)(OSSL_TIME deadline,
|
||||
int pkt_space, void *arg),
|
||||
void *arg);
|
||||
|
||||
typedef struct ossl_ackm_tx_pkt_st OSSL_ACKM_TX_PKT;
|
||||
@ -130,8 +131,8 @@ typedef struct ossl_ackm_rx_pkt_st
|
||||
|
||||
int ossl_ackm_on_rx_packet(OSSL_ACKM *ackm, const OSSL_ACKM_RX_PKT *pkt);
|
||||
|
||||
int ossl_ackm_on_rx_ack_frame(OSSL_ACKM *ackm, const OSSL_QUIC_FRAME_ACK *ack, int pkt_space,
|
||||
OSSL_TIME rx_time);
|
||||
int ossl_ackm_on_rx_ack_frame(OSSL_ACKM *ackm, const OSSL_QUIC_FRAME_ACK *ack,
|
||||
int pkt_space, OSSL_TIME rx_time);
|
||||
|
||||
/*
|
||||
* Discards a PN space. This must be called for a PN space before freeing the
|
||||
@ -154,7 +155,8 @@ OSSL_TIME ossl_ackm_get_loss_detection_deadline(OSSL_ACKM *ackm);
|
||||
* This clears the flag returned by ossl_ackm_is_ack_desired and the deadline
|
||||
* returned by ossl_ackm_get_ack_deadline.
|
||||
*/
|
||||
const OSSL_QUIC_FRAME_ACK *ossl_ackm_get_ack_frame(OSSL_ACKM *ackm, int pkt_space);
|
||||
const OSSL_QUIC_FRAME_ACK *ossl_ackm_get_ack_frame(OSSL_ACKM *ackm,
|
||||
int pkt_space);
|
||||
|
||||
/*
|
||||
* Returns the deadline after which an ACK frame should be generated by calling
|
||||
@ -204,7 +206,8 @@ typedef struct ossl_ackm_probe_info_st
|
||||
uint32_t pto[QUIC_PN_SPACE_NUM];
|
||||
} OSSL_ACKM_PROBE_INFO;
|
||||
|
||||
int ossl_ackm_get_probe_request(OSSL_ACKM *ackm, int clear, OSSL_ACKM_PROBE_INFO *info);
|
||||
int ossl_ackm_get_probe_request(OSSL_ACKM *ackm, int clear,
|
||||
OSSL_ACKM_PROBE_INFO *info);
|
||||
|
||||
int ossl_ackm_get_largest_unacked(OSSL_ACKM *ackm, int pkt_space, QUIC_PN *pn);
|
||||
|
||||
|
@ -34,7 +34,8 @@ typedef struct ossl_cc_method_st
|
||||
* values are considered permanent and the values can be updated
|
||||
* any time.
|
||||
*/
|
||||
OSSL_CC_DATA *(*new)(OSSL_PARAM *settings, OSSL_PARAM *options, OSSL_PARAM *changeables);
|
||||
OSSL_CC_DATA *(*new)(OSSL_PARAM *settings, OSSL_PARAM *options,
|
||||
OSSL_PARAM *changeables);
|
||||
|
||||
/*
|
||||
* Release the OSSL_CC_DATA.
|
||||
@ -72,7 +73,8 @@ typedef struct ossl_cc_method_st
|
||||
* |time_valid| is 1 if the |time_since_last_send| holds
|
||||
* a meaningful value, 0 otherwise.
|
||||
*/
|
||||
uint64_t (*get_send_allowance)(OSSL_CC_DATA *ccdata, OSSL_TIME time_since_last_send,
|
||||
uint64_t (*get_send_allowance)(OSSL_CC_DATA *ccdata,
|
||||
OSSL_TIME time_since_last_send,
|
||||
int time_valid);
|
||||
|
||||
/*
|
||||
@ -98,7 +100,8 @@ typedef struct ossl_cc_method_st
|
||||
* Returns 1 if sending is unblocked (can_send returns 1), 0
|
||||
* otherwise.
|
||||
*/
|
||||
int (*on_data_invalidated)(OSSL_CC_DATA *ccdata, uint64_t num_retransmittable_bytes);
|
||||
int (*on_data_invalidated)(OSSL_CC_DATA *ccdata,
|
||||
uint64_t num_retransmittable_bytes);
|
||||
|
||||
/*
|
||||
* To be called when sent data was acked.
|
||||
@ -110,7 +113,8 @@ typedef struct ossl_cc_method_st
|
||||
* Returns 1 if sending is unblocked (can_send returns 1), 0
|
||||
* otherwise.
|
||||
*/
|
||||
int (*on_data_acked)(OSSL_CC_DATA *ccdata, OSSL_TIME time_now, uint64_t last_pn_acked,
|
||||
int (*on_data_acked)(OSSL_CC_DATA *ccdata, OSSL_TIME time_now,
|
||||
uint64_t last_pn_acked,
|
||||
uint64_t num_retransmittable_bytes);
|
||||
|
||||
/*
|
||||
@ -124,8 +128,10 @@ typedef struct ossl_cc_method_st
|
||||
* |persistent_congestion| is 1 if the congestion is considered
|
||||
* persistent (see RFC 9002 Section 7.6), 0 otherwise.
|
||||
*/
|
||||
void (*on_data_lost)(OSSL_CC_DATA *ccdata, uint64_t largest_pn_lost, uint64_t largest_pn_sent,
|
||||
uint64_t num_retransmittable_bytes, int persistent_congestion);
|
||||
void (*on_data_lost)(OSSL_CC_DATA *ccdata, uint64_t largest_pn_lost,
|
||||
uint64_t largest_pn_sent,
|
||||
uint64_t num_retransmittable_bytes,
|
||||
int persistent_congestion);
|
||||
|
||||
/*
|
||||
* To be called when all lost data from the previous call to
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user