Skip to content

Commit

Permalink
[c++17] Botan 3.1.1 backported to C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
pstanisz committed Dec 6, 2023
1 parent f60608b commit 1937774
Show file tree
Hide file tree
Showing 263 changed files with 3,224 additions and 1,323 deletions.
285 changes: 285 additions & 0 deletions .github/workflows/3.1.1_cpp17_ci.yml
@@ -0,0 +1,285 @@

# (C) 2020,2022 Jack Lloyd
# (C) 2022 René Meusel, Rohde & Schwarz Cybersecurity
# (C) 2023 Piotr Staniszewski, CodeVision
#
# Botan is released under the Simplified BSD License (see license.txt)

name: 3.1.1_cpp17_ci

permissions:
contents: read
# implicitly all other scopes not listed become none

on:
push:
branches: [ 3.1.1_cpp17 ]
pull_request:
branches: [ 3.1.1_cpp17 ]

# cancel running workflows when new commits are being pushed in pull requests
# but not on the master branch
concurrency:
group: ${{ github.workflow }} @ ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
windows:
name: "Windows"
strategy:
fail-fast: false

matrix:
include:
- target: shared
arch: x86_64
host_os: windows-2022
- target: static
arch: x86_64
host_os: windows-2022
- target: amalgamation
arch: x86_64
host_os: windows-2022
- target: shared
arch: x86
host_os: windows-2022

runs-on: ${{ matrix.host_os }}

steps:
- uses: actions/checkout@v3

- name: Setup Build Agent
uses: ./.github/actions/setup-build-agent
with:
target: ${{ matrix.target }}
cache-key: ${{ matrix.host_os }}-msvc-${{ matrix.arch }}-${{ matrix.target }}
arch: ${{ matrix.arch }}

- name: Build and Test Botan
run: python3 ./src/scripts/ci_build.py --cc='msvc' --make-tool='jom' --cpu='${{ matrix.arch }}' --test-results-dir=junit_results ${{ matrix.target }}

linux:
name: "Linux"
strategy:
fail-fast: false

matrix:
include:
- compiler: gcc
target: shared
- compiler: gcc
target: amalgamation
- compiler: gcc
target: static
- compiler: clang
target: shared

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3

- name: Setup Build Agent
uses: ./.github/actions/setup-build-agent
with:
target: ${{ matrix.target }}
cache-key: linux-${{ matrix.compiler }}-x86_64-${{ matrix.target }}

- name: Build and Test Botan
run: python3 ./src/scripts/ci_build.py --cc='${{ matrix.compiler }}' --test-results-dir=junit_results ${{ matrix.target }}

macos:
name: "macOS"
strategy:
fail-fast: false

matrix:
include:
- target: shared
compiler: clang
- target: amalgamation
compiler: clang

runs-on: macos-13

steps:
- uses: actions/checkout@v3

- name: Setup Build Agent
uses: ./.github/actions/setup-build-agent
with:
target: ${{ matrix.target }}
cache-key: macos-${{ matrix.compiler }}-x86_64-${{ matrix.target }}

- name: Build and Test Botan
run: python3 ./src/scripts/ci_build.py --cc='${{ matrix.compiler }}' --test-results-dir=junit_results ${{ matrix.target }}

# clang-tidy:
# name: "Clang Tidy"
# runs-on: ubuntu-22.04
# steps:
# - uses: actions/checkout@v3

# - name: Setup Build Agent
# uses: ./.github/actions/setup-build-agent
# with:
# target: clang-tidy
# cache-key: linux-x86_64-clang-tidy

# - name: Configure Build
# run: python3 ./configure.py --cc=clang

# - name: Run Clang Tidy
# run: |
# ./src/scripts/ci/gh_get_changes_in_pr.py $(git rev-parse HEAD) --api-token=${{ secrets.GITHUB_TOKEN }} | \
# python3 ./src/scripts/dev_tools/run_clang_tidy.py --verbose --take-file-list-from-stdin

analysis:
name: "Analysis"
strategy:
fail-fast: false

matrix:
include:
- target: coverage
compiler: gcc
host_os: ubuntu-22.04
- target: sanitizer
compiler: msvc
host_os: windows-2022
make_tool: jom
- target: sanitizer
compiler: clang
host_os: ubuntu-22.04
- target: sanitizer
compiler: gcc
host_os: ubuntu-22.04
- target: valgrind
compiler: gcc
host_os: ubuntu-22.04
- target: fuzzers
compiler: gcc
host_os: ubuntu-22.04
- target: lint
compiler: gcc
host_os: ubuntu-22.04
# - target: format
# compiler: gcc
# host_os: ubuntu-22.04

runs-on: ${{ matrix.host_os }}

env:
COVERALLS_REPO_TOKEN: pbLoTMBxC1DFvbws9WfrzVOvfEdEZTcCS

steps:
- uses: actions/checkout@v3
with:
path: ./source

- name: Fetch BoringSSL fork for BoGo tests
uses: actions/checkout@v3
with:
repository: randombit/boringssl
ref: rene/runner-20230705
path: ./boringssl
if: matrix.target == 'coverage' || matrix.target == 'sanitizer'

- name: Setup Build Agent
uses: ./source/.github/actions/setup-build-agent
with:
target: ${{ matrix.target }}
cache-key: ${{ matrix.host_os }}-${{ matrix.compiler }}-x86_64-${{ matrix.target }}

- name: Build and Test Botan
run: python3 ./source/src/scripts/ci_build.py --root-dir=${{ github.workspace }}/source --build-dir=${{ github.workspace }}/build --boringssl-dir=${{ github.workspace }}/boringssl --cc='${{ matrix.compiler }}' --make-tool='${{ matrix.make_tool }}' --test-results-dir=junit_results ${{ matrix.target }}

specials:
name: "Special"
strategy:
fail-fast: false

matrix:
include:
- target: examples
compiler: gcc
host_os: ubuntu-22.04
- target: minimized
compiler: gcc
host_os: ubuntu-22.04
- target: bsi
compiler: gcc
host_os: ubuntu-22.04

runs-on: ${{ matrix.host_os }}

steps:
- uses: actions/checkout@v3
with:
path: ./source

- name: Setup Build Agent
uses: ./source/.github/actions/setup-build-agent
with:
target: ${{ matrix.target }}
cache-key: ${{ matrix.host_os }}-${{ matrix.compiler }}-x86_64-${{ matrix.target }}

- name: Build and Test Botan
run: python3 ./source/src/scripts/ci_build.py --root-dir=${{ github.workspace }}/source --build-dir=${{ github.workspace }}/build --boringssl-dir=${{ github.workspace }}/boringssl --cc='${{ matrix.compiler }}' --make-tool='${{ matrix.make_tool }}' --test-results-dir=junit_results ${{ matrix.target }}

x-compile:
name: "Cross"
strategy:
fail-fast: false

matrix:
include:
- target: cross-i386
compiler: gcc
host_os: ubuntu-22.04
- target: cross-arm32
compiler: gcc
host_os: ubuntu-22.04
- target: cross-arm64
compiler: gcc
host_os: ubuntu-22.04
- target: cross-ppc64
compiler: gcc
host_os: ubuntu-22.04
- target: cross-riscv64
compiler: gcc
host_os: ubuntu-22.04
- target: cross-android-arm32
compiler: clang
host_os: ubuntu-22.04
- target: cross-android-arm64
compiler: clang
host_os: ubuntu-22.04
- target: static
compiler: gcc
host_os: windows-2022
make_tool: mingw32-make
- target: cross-ios-arm64
compiler: clang
host_os: macos-13
- target: emscripten
compiler: emcc
host_os: ubuntu-22.04

runs-on: ${{ matrix.host_os }}

env:
ANDROID_NDK_VERSION: 25

steps:
- uses: actions/checkout@v3

- name: Setup Build Agent
uses: ./.github/actions/setup-build-agent
with:
target: ${{ matrix.target }}
cache-key: ${{ matrix.host_os }}-${{ matrix.compiler }}-xcompile-${{ matrix.target }}

- name: Build and Test Botan
run: python3 ./src/scripts/ci_build.py --cc='${{ matrix.compiler }}' --test-results-dir=junit_results ${{ matrix.target }}
6 changes: 3 additions & 3 deletions doc/api_ref/kdf.rst
Expand Up @@ -36,9 +36,9 @@ two contexts.

.. cpp:function:: template<concepts::resizable_byte_buffer T = secure_vector<uint8_t>> \
T derive_key(size_t key_len, \
std::span<const uint8_t> secret, \
std::span<const uint8_t> salt, \
std::span<const uint8_t> label) const
Botan::span<const uint8_t> secret, \
Botan::span<const uint8_t> salt, \
Botan::span<const uint8_t> label) const

This version is parameterized to the output buffer type, so it can be used
to return a ``std::vector``, a ``secure_vector``, or anything else
Expand Down
12 changes: 6 additions & 6 deletions doc/api_ref/pbkdf.rst
Expand Up @@ -22,17 +22,17 @@ specified with all parameters (say "Scrypt" with ``N`` = 8192, ``r`` = 64, and

.. cpp:class:: PasswordHash

.. cpp:function:: void hash(std::span<uint8_t> out, \
.. cpp:function:: void hash(Botan::span<uint8_t> out, \
std::string_view password, \
std::span<uint8> salt)
Botan::span<uint8> salt)

Derive a key from the specified *password* and *salt*, placing it into *out*.

.. cpp:function:: void hash(std::span<uint8_t> out, \
.. cpp:function:: void hash(Botan::span<uint8_t> out, \
std::string_view password, \
std::span<const uint8> salt, \
std::span<const uint8> ad, \
std::span<const uint8> key)
Botan::span<const uint8> salt, \
Botan::span<const uint8> ad, \
Botan::span<const uint8> key)

Derive a key from the specified *password*, *salt*, associated data (*ad*), and
secret *key*, placing it into *out*. The *ad* and *key* are both allowed
Expand Down

0 comments on commit 1937774

Please sign in to comment.