From 63bef1abe1f3e7a83a2da53a35f6645b441a8a3e Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 2 Aug 2023 15:40:33 -0400 Subject: [PATCH 01/89] Add CodeSonar to the workflows --- .github/workflows/codesonar.yaml | 105 +++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 .github/workflows/codesonar.yaml diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml new file mode 100644 index 0000000000..1993032e02 --- /dev/null +++ b/.github/workflows/codesonar.yaml @@ -0,0 +1,105 @@ +name: CodeSonar +on: + pull_request: + +jobs: + CodeSonar_Analyze: + runs-on: self-hosted + container: + image: canuckmh/wolfssl-cso-builder:7.4p0 + credentials: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + env: + GITHUB_CAFILE: ".github/github.cert.pem" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_API_URL: https://api.github.com + PULL_REQUEST_ID: ${{ github.event.pull_request.number }} + ROOT_TREE: "Mark" + RELEASE_PROJECT_NAME: "wolfssl" + PROJECT_NAME: "Will be set in the first step" + PARALLEL: "6" + CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" + CSONAR_HUB_USER: "${{ secrets.CSONAR_HUB_USER }}" + CSONAR_HUB_PASS: "${{ secrets.CSONAR_HUB_PASS }}" + CSONAR_HUB_PWFILE: "codesonar.hub.pwfile" + BRANCH: ${{ github.head_ref || github.ref_name }} + CODESONAR: /opt/codesonar/codesonar/bin/codesonar + CSPYTHON: /opt/codesonar/codesonar/bin/cspython + CSO_GITHUB: /opt/codesonar-github + steps: + - name: Construct project name + run: | + if [ ${{ github.event.pull_request }} ] + then + echo "PROJECT_NAME=${ROOT_TREE}/${RELEASE_PROJECT_NAME}" >> $GITHUB_ENV + else + echo "PROJECT_NAME=${ROOT_TREE}/Branches/${BRANCH}-${RELEASE_PROJECT_NAME}" >> $GITHUB_ENV + fi + - name: Checkout + uses: actions/checkout@v3 + - name: Safe directory + run: git config --global --add safe.directory `pwd` + - name: Create Hub Credentials + run: echo "$CSONAR_HUB_PASS" > "$CSONAR_HUB_PWFILE" + - name : configure + run: ./autogen.sh ; ./configure --enable-all + - name: Compile and Analyze + run: > + COMMIT_ID=$(git rev-parse --short ${{ github.sha }}); + NAME="$RELEASE_PROJECT_NAME-$BRANCH-$(date "+%Y.%m.%d-%H.%M")"; + "$CODESONAR" analyze -clean $RELEASE_PROJECT_NAME + -remote-archive "/saas/*" -foreground + -auth password + -hubuser "$CSONAR_HUB_USER" + -hubpwfile "$CSONAR_HUB_PWFILE" + -project "$PROJECT_NAME" + -property branch "$BRANCH" + -property target-branch ${{ github.base_ref }} + -property commit ${{ github.sha }} + -name $NAME + -conf-file conf/codesonar-release.conf + -property commitID "$COMMIT_ID" + "$CSONAR_HUB_URL" + make -j "$PARALLEL" + - name: Pull Analysis Results from CodeSonar Hub + run: > + "$CODESONAR" dump_warnings.py + -o warnings.sarif + --hub "$CSONAR_HUB_URL" + -auth password + -hubuser "$CSONAR_HUB_USER" + -hubpwfile "$CSONAR_HUB_PWFILE" + --project-name "$PROJECT_NAME" + --sarif + --src-root "$GITHUB_WORKSPACE" + --visible-warnings "active not clustered" + -t 7200 +# - name: Upload SARIF to GitHub #Use this if you do not have GitHub Enterprise +# uses: actions/upload-artifact@v3 +# with: +# name: SARIF file +# path: warnings.rel.sarif + - name: Cleanup Credential File + run: shred -u "$CSONAR_HUB_PWFILE" + # - name: Push Analysis Results to GitHub #Use this with Github Enterprise + # uses: github/codeql-action/upload-sarif@v2 + # with: + # sarif_file: "${{ env.BRANCH }}/warnings.sarif" + # category: CodeSonar + - name: Push Summary Report + if: ${{ github.event.pull_request }} + run: > + "$CSPYTHON" "$CSO_GITHUB/sarif_summary.py" + warnings.sarif + "$CSONAR_HUB_URL" + $BRANCH-$PROJECT_WORK_DIR + | "$CSPYTHON" "$CSO_GITHUB/push_github_pr_comment.py" + --api-url $GITHUB_API_URL --cafile "$GITHUB_CAFILE" + ${{ github.repository }} + $PULL_REQUEST_ID + GITHUB_TOKEN + + + + From ef958b2b6c7802cc194a6b36634b2d2b9099bf47 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 2 Aug 2023 15:42:43 -0400 Subject: [PATCH 02/89] Update codesonar.yaml --- .github/workflows/codesonar.yaml | 144 ++++++++++++++++++++----------- 1 file changed, 93 insertions(+), 51 deletions(-) diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml index 1993032e02..1f8730a9ce 100644 --- a/.github/workflows/codesonar.yaml +++ b/.github/workflows/codesonar.yaml @@ -1,9 +1,15 @@ name: CodeSonar on: + push: # Only run onces the Pull request is created + branches: + - 'release/**' # Feature Branches pull_request: + branches: + - 'release/**' jobs: CodeSonar_Analyze: + permissions: write-all runs-on: self-hosted container: image: canuckmh/wolfssl-cso-builder:7.4p0 @@ -15,27 +21,28 @@ jobs: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GITHUB_API_URL: https://api.github.com PULL_REQUEST_ID: ${{ github.event.pull_request.number }} - ROOT_TREE: "Mark" - RELEASE_PROJECT_NAME: "wolfssl" - PROJECT_NAME: "Will be set in the first step" - PARALLEL: "6" + ROOT_TREE: "Mark/WOLFSSL" + ROOT_PROJECT_NAME: "wolfssl" + BRANCH: ${{ github.head_ref || github.ref_name }} CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" CSONAR_HUB_USER: "${{ secrets.CSONAR_HUB_USER }}" CSONAR_HUB_PASS: "${{ secrets.CSONAR_HUB_PASS }}" CSONAR_HUB_PWFILE: "codesonar.hub.pwfile" - BRANCH: ${{ github.head_ref || github.ref_name }} CODESONAR: /opt/codesonar/codesonar/bin/codesonar CSPYTHON: /opt/codesonar/codesonar/bin/cspython - CSO_GITHUB: /opt/codesonar-github + CSO_GITHUB: /opt/codesonar-github + GITHUB_REPO_URL: "http://github.com/markhermeling/nginx" # the github.repositoryUrl is not an http-link. + TARGET: none + DIFFLINK: none + PRLINK: none steps: - - name: Construct project name + - name: Set parallelism and project name run: | - if [ ${{ github.event.pull_request }} ] - then - echo "PROJECT_NAME=${ROOT_TREE}/${RELEASE_PROJECT_NAME}" >> $GITHUB_ENV - else - echo "PROJECT_NAME=${ROOT_TREE}/Branches/${BRANCH}-${RELEASE_PROJECT_NAME}" >> $GITHUB_ENV - fi + echo "PARALLEL=`nproc`" >> $GITHUB_ENV + echo "PROJECT_NAME=${ROOT_TREE}/$BRANCH" >> $GITHUB_ENV + - name: Pull Request or Not? + if: ${{ github.event.pull_request }} + run: echo "TARGET=${{ github.base_ref }}" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v3 - name: Safe directory @@ -44,62 +51,97 @@ jobs: run: echo "$CSONAR_HUB_PASS" > "$CSONAR_HUB_PWFILE" - name : configure run: ./autogen.sh ; ./configure --enable-all - - name: Compile and Analyze + - name: Get id of latest analysis on the same branch + if: ${{ github.event.pull_request }} + id: compare-aid + run: | + GETURL=$(urlencode {\"limit\":1,\"orderBy\":[{\"analysisId\":\"DESCENDING\"}],\"columns\":[\"analysisId\"]}) + GETURL2=$(urlencode \"branch.name\"=\"$TARGET\" state=\"Finished\") + "$CODESONAR" get \ + -auth password \ + -hubuser "$CSONAR_HUB_USER" \ + -hubpwfile "$CSONAR_HUB_PWFILE" \ + $CSONAR_HUB_URL/analysis_search.csv?sanlgrid_json=$GETURL\&query=$GETURL2 -o - | tail -1 > result + echo "TARGET_PROJECT_AID=`cat result`" >> $GITHUB_ENV + - name: Build + run: > + COMMIT_ID=$(git rev-parse --short ${{ github.sha }}); + NAME="$BRANCH-$(date "+%Y.%m.%d-%H.%M")"; + "$CODESONAR" build -clean $ROOT_PROJECT_NAME + -remote-archive "/saas/*" -foreground + -auth password + -hubuser "$CSONAR_HUB_USER" + -hubpwfile "$CSONAR_HUB_PWFILE" + -project "$PROJECT_NAME" + -name $NAME + -conf-file conf/codesonar-release.conf + "$CSONAR_HUB_URL" + make -j $PARALLEL + - name: Get id of the analysis + if: ${{ github.event.pull_request }} + run: | + # First get the ID of the latest analysis on the same branch + GETURL=$(urlencode {\"limit\":1,\"orderBy\":[{\"analysisId\":\"DESCENDING\"}],\"columns\":[\"analysisId\"]}) + GETURL2=$(urlencode \"branch.name\"=\"$TARGET\" state=\"Finished\") + "$CODESONAR" get \ + -auth password \ + -hubuser "$CSONAR_HUB_USER" \ + -hubpwfile "$CSONAR_HUB_PWFILE" \ + $CSONAR_HUB_URL/analysis_search.csv?sanlgrid_json=$GETURL\&query=$GETURL2 -o - | tail -1 > result + echo "TARGET_PROJECT_AID=`cat result`" >> $GITHUB_ENV + # second get the ID of the current analysis + echo "CURRENT_PROJECT_AID=`cat $ROOT_PROJECT_NAME.prj_files/aid.txt`" >> $GITHUB_ENV + CURRENT_PROJECT_AID=$(cat $ROOT_PROJECT_NAME.prj_files/aid.txt) + GETURL=$(urlencode aid:$CURRENT_PROJECT_AID DIFFERENCE aid:$TARGET_PROJECT_AID); + echo "DIFFLINK=$CSONAR_HUB_URL/search.html?query=$GETURL&scope=aid%3A$CURRENT_PROJECT_AID&swarnings=BJAW" >> $GITHUB_ENV + echo "PRLINK=$GITHUB_REPO_URL/pull/$PULL_REQUEST_ID" >> $GITHUB_ENV + - name: Analyze run: > COMMIT_ID=$(git rev-parse --short ${{ github.sha }}); - NAME="$RELEASE_PROJECT_NAME-$BRANCH-$(date "+%Y.%m.%d-%H.%M")"; - "$CODESONAR" analyze -clean $RELEASE_PROJECT_NAME - -remote-archive "/saas/*" -foreground + NAME="$BRANCH-$(date "+%Y.%m.%d-%H.%M")"; + "$CODESONAR" analyze $ROOT_PROJECT_NAME + -remote-archive "/saas/*" -foreground -preset fast -auth password -hubuser "$CSONAR_HUB_USER" -hubpwfile "$CSONAR_HUB_PWFILE" -project "$PROJECT_NAME" - -property branch "$BRANCH" - -property target-branch ${{ github.base_ref }} - -property commit ${{ github.sha }} - -name $NAME + -property repo.url ${{ github.repositoryUrl }} + -property commit.sha $COMMIT_ID + -property commit.link "$GITHUB_REPO_URL/commit/$COMMIT_ID" + -property PR.link $PRLINK + -property branch.name $BRANCH + -property target.branch $TARGET + -property target.diff_link $DIFFLINK + -name $NAME -conf-file conf/codesonar-release.conf - -property commitID "$COMMIT_ID" "$CSONAR_HUB_URL" - make -j "$PARALLEL" - - name: Pull Analysis Results from CodeSonar Hub - run: > - "$CODESONAR" dump_warnings.py - -o warnings.sarif - --hub "$CSONAR_HUB_URL" - -auth password - -hubuser "$CSONAR_HUB_USER" - -hubpwfile "$CSONAR_HUB_PWFILE" - --project-name "$PROJECT_NAME" - --sarif - --src-root "$GITHUB_WORKSPACE" - --visible-warnings "active not clustered" - -t 7200 -# - name: Upload SARIF to GitHub #Use this if you do not have GitHub Enterprise -# uses: actions/upload-artifact@v3 -# with: -# name: SARIF file -# path: warnings.rel.sarif + - name: Diff results with the target branch + if: ${{ github.event.pull_request }} + run: | + GETURL=$(urlencode aid:$CURRENT_PROJECT_AID DIFFERENCE aid:$TARGET_PROJECT_AID) + "$CODESONAR" get \ + -auth password \ + -hubuser "$CSONAR_HUB_USER" \ + -hubpwfile "$CSONAR_HUB_PWFILE" \ + $CSONAR_HUB_URL/warning_detail_search.sarif?query=$GETURL\&scope=aid%3A$CURRENT_PROJECT_AID\&swarnings=BJAW -o - > warnings.sarif + - name: Upload SARIF to GitHub #Use this if you do not have GitHub Enterprise + if: ${{ github.event.pull_request }} + uses: actions/upload-artifact@v3 + with: + name: SARIF file + path: warnings.sarif - name: Cleanup Credential File run: shred -u "$CSONAR_HUB_PWFILE" - # - name: Push Analysis Results to GitHub #Use this with Github Enterprise - # uses: github/codeql-action/upload-sarif@v2 - # with: - # sarif_file: "${{ env.BRANCH }}/warnings.sarif" - # category: CodeSonar - name: Push Summary Report if: ${{ github.event.pull_request }} run: > "$CSPYTHON" "$CSO_GITHUB/sarif_summary.py" warnings.sarif "$CSONAR_HUB_URL" - $BRANCH-$PROJECT_WORK_DIR + "$ROOT_PROJECT_NAME" | "$CSPYTHON" "$CSO_GITHUB/push_github_pr_comment.py" --api-url $GITHUB_API_URL --cafile "$GITHUB_CAFILE" ${{ github.repository }} $PULL_REQUEST_ID GITHUB_TOKEN - - - - + From 309d164ce7fada677e41d9f638e3ba74d922450b Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 2 Aug 2023 15:43:14 -0400 Subject: [PATCH 03/89] Create github.cert.pem --- .github/github.cert.pem | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/github.cert.pem diff --git a/.github/github.cert.pem b/.github/github.cert.pem new file mode 100644 index 0000000000..fd4341df26 --- /dev/null +++ b/.github/github.cert.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD +QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT +MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j +b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB +CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 +nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt +43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P +T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 +gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR +TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw +DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr +hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg +06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF +PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls +YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk +CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= +-----END CERTIFICATE----- From adb4f2d1c9c758d7db16cd3df7e819b47d615fe1 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 2 Aug 2023 15:59:20 -0400 Subject: [PATCH 04/89] Delete async.yml --- .github/workflows/async.yml | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 .github/workflows/async.yml diff --git a/.github/workflows/async.yml b/.github/workflows/async.yml deleted file mode 100644 index 949e87dfdf..0000000000 --- a/.github/workflows/async.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Async Tests - -on: - workflow_call: - -jobs: - make_check: - strategy: - matrix: - config: [ - # Add new configs here - '--enable-asynccrypt --enable-all --enable-dtls13', - '--enable-asynccrypt-sw --enable-ocspstapling --enable-ocspstapling2', - '--enable-ocsp CFLAGS="-DTEST_NONBLOCK_CERTS"', - ] - name: make check - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 6 - steps: - - uses: actions/checkout@v3 - name: Checkout wolfSSL - - - name: Test wolfSSL async - run: | - ./async-check.sh setup - ./configure ${{ matrix.config }} - make check - - - name: Print errors - if: ${{ failure() }} - run: | - if [ -f test-suite.log ] ; then - cat test-suite.log - fi From d5913be33e0bbb42f0ba56e8a567910ccb50ef35 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 2 Aug 2023 16:05:22 -0400 Subject: [PATCH 05/89] Remove non-CodeSonar workflows --- .github/workflows/curl.yml | 30 - .github/workflows/docker-Espressif.yml | 34 - .github/workflows/docker-OpenWrt.yml | 54 -- .github/workflows/haproxy.yml | 51 -- .github/workflows/hitch.yml | 94 --- .github/workflows/hostap-files/Makefile | 11 - .github/workflows/hostap-files/README | 2 - .../hostapd.config | 120 --- .../tests | 707 ------------------ .../wpa_supplicant.config | 163 ---- .../configs/hostap_2_10/hostapd.config | 119 --- .../hostap-files/configs/hostap_2_10/tests | 284 ------- .../configs/hostap_2_10/wpa_supplicant.config | 163 ---- .../hostap-files/dbus-wpa_supplicant.conf | 23 - .github/workflows/hostap.yml | 283 ------- .github/workflows/krb5.yml | 79 -- .github/workflows/main.yml | 41 - .github/workflows/multi-compiler.yml | 36 - .github/workflows/nginx.yml | 179 ----- .github/workflows/openvpn.yml | 73 -- .github/workflows/os-check.yml | 132 ---- .github/workflows/stunnel.yml | 65 -- .github/workflows/zephyr.yml | 96 --- 23 files changed, 2839 deletions(-) delete mode 100644 .github/workflows/curl.yml delete mode 100644 .github/workflows/docker-Espressif.yml delete mode 100644 .github/workflows/docker-OpenWrt.yml delete mode 100644 .github/workflows/haproxy.yml delete mode 100644 .github/workflows/hitch.yml delete mode 100644 .github/workflows/hostap-files/Makefile delete mode 100644 .github/workflows/hostap-files/README delete mode 100644 .github/workflows/hostap-files/configs/b607d2723e927a3446d89aed813f1aa6068186bb/hostapd.config delete mode 100644 .github/workflows/hostap-files/configs/b607d2723e927a3446d89aed813f1aa6068186bb/tests delete mode 100644 .github/workflows/hostap-files/configs/b607d2723e927a3446d89aed813f1aa6068186bb/wpa_supplicant.config delete mode 100644 .github/workflows/hostap-files/configs/hostap_2_10/hostapd.config delete mode 100644 .github/workflows/hostap-files/configs/hostap_2_10/tests delete mode 100644 .github/workflows/hostap-files/configs/hostap_2_10/wpa_supplicant.config delete mode 100644 .github/workflows/hostap-files/dbus-wpa_supplicant.conf delete mode 100644 .github/workflows/hostap.yml delete mode 100644 .github/workflows/krb5.yml delete mode 100644 .github/workflows/main.yml delete mode 100644 .github/workflows/multi-compiler.yml delete mode 100644 .github/workflows/nginx.yml delete mode 100644 .github/workflows/openvpn.yml delete mode 100644 .github/workflows/os-check.yml delete mode 100644 .github/workflows/stunnel.yml delete mode 100644 .github/workflows/zephyr.yml diff --git a/.github/workflows/curl.yml b/.github/workflows/curl.yml deleted file mode 100644 index d8e5e1bde2..0000000000 --- a/.github/workflows/curl.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: curl Test - -on: - workflow_call: - -jobs: - build: - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 14 - steps: - - name: Install test dependencies - run: | - sudo apt-get update - sudo apt-get install nghttp2 - - - name: Build wolfSSL - uses: wolfSSL/actions-build-autotools-project@v1 - with: - path: wolfssl - configure: --enable-curl - install: true - - - name: Build and test stunnel - uses: wolfSSL/actions-build-autotools-project@v1 - with: - repository: curl/curl - path: curl - configure: --with-wolfssl=$GITHUB_WORKSPACE/build-dir - check: true diff --git a/.github/workflows/docker-Espressif.yml b/.github/workflows/docker-Espressif.yml deleted file mode 100644 index 9b9b9be203..0000000000 --- a/.github/workflows/docker-Espressif.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Espressif examples tests -on: - workflow_call: - -jobs: - espressif_latest: - name: latest Docker container - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 12 - container: - image: espressif/idf:latest - steps: - - uses: actions/checkout@v3 - - name: Initialize Espressif IDE and build examples - run: . /opt/esp/idf/export.sh; IDE/Espressif/ESP-IDF/compileAllExamples.sh - espressif_v4_4: - name: v4.4 Docker container - runs-on: ubuntu-latest - container: - image: espressif/idf:release-v4.4 - steps: - - uses: actions/checkout@v3 - - name: Initialize Espressif IDE and build examples - run: . /opt/esp/idf/export.sh; IDE/Espressif/ESP-IDF/compileAllExamples.sh - espressif_v5_0: - name: v5.0 Docker container - runs-on: ubuntu-latest - container: - image: espressif/idf:release-v5.0 - steps: - - uses: actions/checkout@v3 - - name: Initialize Espressif IDE and build examples - run: . /opt/esp/idf/export.sh; IDE/Espressif/ESP-IDF/compileAllExamples.sh diff --git a/.github/workflows/docker-OpenWrt.yml b/.github/workflows/docker-OpenWrt.yml deleted file mode 100644 index aa8278950a..0000000000 --- a/.github/workflows/docker-OpenWrt.yml +++ /dev/null @@ -1,54 +0,0 @@ -# This workflow tests out new libraries with existing OpenWrt builds to check -# there aren't any compatibility issues. Take a look at Docker/OpenWrt/README.md -name: OpenWrt test - -on: - workflow_call: - -jobs: - build_library: - name: Compile libwolfssl.so - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 4 - container: - image: alpine:latest - steps: - - name: Install required tools - run: apk add argp-standalone asciidoc bash bc binutils bzip2 cdrkit coreutils diffutils elfutils-dev findutils flex musl-fts-dev g++ gawk gcc gettext git grep intltool libxslt linux-headers make musl-libintl musl-obstack-dev ncurses-dev openssl-dev patch perl python3-dev rsync tar unzip util-linux wget zlib-dev autoconf automake libtool - - uses: actions/checkout@v3 - - name: Compile libwolfssl.so - run: ./autogen.sh && ./configure --enable-all && make - - name: Upload libwolfssl.so - uses: actions/upload-artifact@v3 - with: - name: openwrt-libwolfssl.so - path: src/.libs/libwolfssl.so - retention-days: 1 - compile_container: - name: Compile container - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 2 - needs: build_library - strategy: - fail-fast: false - matrix: - release: [ "22.03-SNAPSHOT", "21.02-SNAPSHOT" ] # some other versions: 21.02.0 21.02.5 22.03.0 22.03.3 snapshot - steps: - - uses: actions/checkout@v3 - - uses: docker/setup-buildx-action@v2 - - uses: actions/download-artifact@v3 - with: - name: openwrt-libwolfssl.so - path: Docker/OpenWrt/. - - name: Build but dont push - uses: docker/build-push-action@v3 - with: - context: Docker/OpenWrt - platforms: linux/amd64 - push: false - tags: openwrt-test:latest - build-args: DOCKER_BASE_CONTAINER=openwrt/rootfs:x86-64-${{ matrix.release }} - cache-from: type=gha - cache-to: type=gha,mode=max diff --git a/.github/workflows/haproxy.yml b/.github/workflows/haproxy.yml deleted file mode 100644 index 54a52b8cf3..0000000000 --- a/.github/workflows/haproxy.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: HaProxy Tests - -on: - workflow_call: - -jobs: - haproxy_check: - strategy: - fail-fast: false - matrix: - # List of refs to test - ref: [ master ] - name: ${{ matrix.ref }} - runs-on: ubuntu-latest - steps: - - name: Build wolfSSL - uses: wolfSSL/actions-build-autotools-project@v1 - with: - path: wolfssl - configure: --enable-quic --enable-haproxy - install: true - - - name: Checkout VTest - uses: actions/checkout@v3 - with: - repository: vtest/VTest - path: VTest - - - name: Build VTest - working-directory: VTest - # Special flags due to: https://github.com/vtest/VTest/issues/12 - run: make FLAGS='-O2 -s -Wall' - - - name: Checkout HaProxy - uses: actions/checkout@v3 - with: - repository: haproxy/haproxy - path: haproxy - ref: ${{ matrix.ref }} - - - name: Build HaProxy - working-directory: haproxy - run: >- - make -j TARGET=linux-glibc DEBUG='-DDEBUG_MEMORY_POOLS -DDEBUG_STRICT' - USE_OPENSSL_WOLFSSL=1 USE_QUIC=1 SSL_INC=$GITHUB_WORKSPACE/build-dir/include/ - SSL_LIB=$GITHUB_WORKSPACE/build-dir/lib/ ADDLIB=-Wl,-rpath=$GITHUB_WORKSPACE/build-dir/lib - - - name: Test HaProxy - working-directory: haproxy - run: make reg-tests reg-tests/ssl VTEST_PROGRAM=$GITHUB_WORKSPACE/VTest/vtest - diff --git a/.github/workflows/hitch.yml b/.github/workflows/hitch.yml deleted file mode 100644 index a7f745dbf8..0000000000 --- a/.github/workflows/hitch.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: hitch Tests - -on: - workflow_call: - -jobs: - build_wolfssl: - name: Build wolfSSL - # Just to keep it the same as the testing target - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 4 - steps: - - name: Build wolfSSL - uses: wolfSSL/actions-build-autotools-project@v1 - with: - path: wolfssl - configure: --enable-hitch - install: true - - - name: Upload built lib - uses: actions/upload-artifact@v3 - with: - name: wolf-install-hitch - path: build-dir - retention-days: 1 - - hitch_check: - strategy: - fail-fast: false - matrix: - # List of releases to test - include: - - ref: 1.7.3 - ignore-tests: >- - test13-r82.sh test15-proxy-v2-npn.sh test39-client-cert-proxy.sh - name: ${{ matrix.ref }} - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 4 - needs: build_wolfssl - steps: - - name: Download lib - uses: actions/download-artifact@v3 - with: - name: wolf-install-hitch - path: build-dir - - - name: Checkout OSP - uses: actions/checkout@v3 - with: - repository: wolfssl/osp - path: osp - - - name: Install dependencies - run: | - export DEBIAN_FRONTEND=noninteractive - sudo apt-get update - sudo apt-get install -y libev-dev libssl-dev automake python3-docutils flex bison pkg-config make - - - name: Checkout hitch - uses: actions/checkout@v3 - with: - repository: varnish/hitch - ref: 1.7.3 - path: hitch - - # Do this before configuring so that it only detects the updated list of - # tests - - if: ${{ matrix.ignore-tests }} - name: Remove tests that we want to ignore - working-directory: ./hitch/src/tests - run: | - rm ${{ matrix.ignore-tests }} - - - name: Configure and build hitch - run: | - cd $GITHUB_WORKSPACE/hitch/ - patch -p1 < $GITHUB_WORKSPACE/osp/hitch/hitch_1.7.3.patch - autoreconf -ivf - SSL_CFLAGS="-I$GITHUB_WORKSPACE/build-dir/include/ -I$GITHUB_WORKSPACE/build-dir/include/wolfssl" SSL_LIBS="-L$GITHUB_WORKSPACE/build-dir/lib -lwolfssl" ./configure --with-wolfssl=$GITHUB_WORKSPACE/build-dir/ --enable-silent-rules --enable-documentation --enable-warnings --with-lex --with-yacc --prefix=$GITHUB_WORKSPACE/build-dir - make -j$(nproc) - - - name: Confirm hitch built with wolfSSL - working-directory: ./hitch - run: | - export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH - ldd src/hitch | grep wolfssl - - - name: Run hitch tests, skipping ignored tests - working-directory: ./hitch - run: | - export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH - make check \ No newline at end of file diff --git a/.github/workflows/hostap-files/Makefile b/.github/workflows/hostap-files/Makefile deleted file mode 100644 index db3876158d..0000000000 --- a/.github/workflows/hostap-files/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -obj-m := mac80211_hwsim.o -KDIR := /lib/modules/$(shell uname -r)/build -PWD := $(shell pwd) -default: - $(MAKE) -C $(KDIR) M=$(PWD) modules -install: - $(MAKE) -C $(KDIR) M=$(PWD) modules_install - depmod -A -clean: - $(MAKE) -C $(KDIR) M=$(PWD) clean - diff --git a/.github/workflows/hostap-files/README b/.github/workflows/hostap-files/README deleted file mode 100644 index 60b3e6a02f..0000000000 --- a/.github/workflows/hostap-files/README +++ /dev/null @@ -1,2 +0,0 @@ -Makefile and directory used in .github/workflows/hostap.yml to -compile the mac80211_hwsim kernel module. diff --git a/.github/workflows/hostap-files/configs/b607d2723e927a3446d89aed813f1aa6068186bb/hostapd.config b/.github/workflows/hostap-files/configs/b607d2723e927a3446d89aed813f1aa6068186bb/hostapd.config deleted file mode 100644 index 27a6c0f6cb..0000000000 --- a/.github/workflows/hostap-files/configs/b607d2723e927a3446d89aed813f1aa6068186bb/hostapd.config +++ /dev/null @@ -1,120 +0,0 @@ -#CC=ccache gcc - -CONFIG_DRIVER_NONE=y -CONFIG_DRIVER_NL80211=y -CONFIG_RSN_PREAUTH=y - -#CONFIG_TLS=internal -#CONFIG_INTERNAL_LIBTOMMATH=y -#CONFIG_INTERNAL_LIBTOMMATH_FAST=y -#CONFIG_TLS=openssl -CONFIG_TLS=wolfssl - -CONFIG_EAP=y -CONFIG_ERP=y -CONFIG_EAP_MD5=y -CONFIG_EAP_TLS=y -CONFIG_EAP_MSCHAPV2=y -CONFIG_EAP_PEAP=y -CONFIG_EAP_GTC=y -CONFIG_EAP_TTLS=y -CONFIG_EAP_SIM=y -CONFIG_EAP_AKA=y -CONFIG_EAP_AKA_PRIME=y -CONFIG_EAP_GPSK=y -CONFIG_EAP_GPSK_SHA256=y -CONFIG_EAP_SAKE=y -CONFIG_EAP_PAX=y -CONFIG_EAP_PSK=y -CONFIG_EAP_VENDOR_TEST=y -CONFIG_EAP_FAST=y -CONFIG_EAP_TEAP=y -CONFIG_EAP_IKEV2=y -CONFIG_EAP_TNC=y -CFLAGS += -DTNC_CONFIG_FILE=\"tnc/tnc_config\" -LIBS += -rdynamic -CONFIG_EAP_UNAUTH_TLS=y -ifeq ($(CONFIG_TLS), openssl) -CONFIG_EAP_PWD=y -endif -ifeq ($(CONFIG_TLS), wolfssl) -CONFIG_EAP_PWD=y -endif -CONFIG_EAP_EKE=y -CONFIG_PKCS12=y -CONFIG_RADIUS_SERVER=y -CONFIG_IPV6=y -CONFIG_TLSV11=y -CONFIG_TLSV12=y - -CONFIG_FULL_DYNAMIC_VLAN=y -CONFIG_VLAN_NETLINK=y -CONFIG_LIBNL32=y -CONFIG_LIBNL3_ROUTE=y -CONFIG_IEEE80211R=y -CONFIG_IEEE80211AC=y -CONFIG_IEEE80211AX=y - -CONFIG_OCV=y - -CONFIG_WPS=y -CONFIG_WPS_UPNP=y -CONFIG_WPS_NFC=y -#CONFIG_WPS_STRICT=y -CONFIG_WPA_TRACE=y -CONFIG_WPA_TRACE_BFD=y - -CONFIG_P2P_MANAGER=y -CONFIG_DEBUG_FILE=y -CONFIG_DEBUG_LINUX_TRACING=y -CONFIG_WPA_CLI_EDIT=y -CONFIG_ACS=y -CONFIG_NO_RANDOM_POOL=y -CONFIG_WNM=y -CONFIG_INTERWORKING=y -CONFIG_HS20=y -CONFIG_SQLITE=y -CONFIG_SAE=y -CONFIG_SAE_PK=y -CFLAGS += -DALL_DH_GROUPS - -CONFIG_FST=y -CONFIG_FST_TEST=y - -CONFIG_TESTING_OPTIONS=y -CFLAGS += -DCONFIG_RADIUS_TEST -CONFIG_MODULE_TESTS=y - -CONFIG_SUITEB=y - -# AddressSanitizer (ASan) can be enabled by uncommenting the following lines. -# This can be used as a more efficient memory error detector than valgrind -# (though, with still some CPU and memory cost, so VM cases will need more -# memory allocated for the guest). -#CFLAGS += -fsanitize=address -O1 -fno-omit-frame-pointer -g -#LIBS += -fsanitize=address -fno-omit-frame-pointer -g -#LIBS_h += -fsanitize=address -fno-omit-frame-pointer -g -#LIBS_n += -fsanitize=address -fno-omit-frame-pointer -g -#LIBS_c += -fsanitize=address -fno-omit-frame-pointer -g - -# Undefined Behavior Sanitizer (UBSan) can be enabled by uncommenting the -# following lines. -#CFLAGS += -Wno-format-nonliteral -#CFLAGS += -fsanitize=undefined -##CFLAGS += -fno-sanitize-recover -#LIBS += -fsanitize=undefined -##LIBS += -fno-sanitize-recover -#LIBS_h += -fsanitize=undefined -#LIBS_n += -fsanitize=undefined -#LIBS_c += -fsanitize=undefined -CONFIG_MBO=y - -CONFIG_TAXONOMY=y -CONFIG_FILS=y -CONFIG_FILS_SK_PFS=y -CONFIG_OWE=y -CONFIG_DPP=y -CONFIG_DPP2=y -CONFIG_WEP=y -CONFIG_PASN=y -CONFIG_AIRTIME_POLICY=y diff --git a/.github/workflows/hostap-files/configs/b607d2723e927a3446d89aed813f1aa6068186bb/tests b/.github/workflows/hostap-files/configs/b607d2723e927a3446d89aed813f1aa6068186bb/tests deleted file mode 100644 index 87fc3320fc..0000000000 --- a/.github/workflows/hostap-files/configs/b607d2723e927a3446d89aed813f1aa6068186bb/tests +++ /dev/null @@ -1,707 +0,0 @@ -sae_pk -sae_pk_group_negotiation -sae_pk_sec_3 -sae_pk_sec_5 -sae_pk_group_20 -sae_pk_group_21 -sae_pk_group_20_sae_group_19 -sae_pk_group_20_sae_group_21 -sae_pk_group_19_sae_group_20 -sae_pk_password_without_pk -sae_pk_only -sae_pk_modes -sae_pk_not_on_ap -sae_pk_mixed -sae_pk_mixed_immediate_confirm -sae_pk_missing_ie -sae_pk_unexpected_status -sae_pk_invalid_signature -sae_pk_invalid_fingerprint -sae_pk_and_psk -sae_pk_and_psk_invalid_password -sae_pk_invalid_pw -sae -sae_password_ecc -sae_pmksa_caching -sae_pmksa_caching_pmkid -sae_pmksa_caching_disabled -sae_groups -sae_group_nego -sae_group_nego_no_match -sae_anti_clogging -sae_forced_anti_clogging -sae_mixed -sae_and_psk -sae_and_psk2 -sae_wpa3_roam -sae_mixed_mfp -sae_mfp -sae_missing_password -sae_key_lifetime_in_memory -sae_oom_wpas -sae_proto_ecc -sae_proto_ffc -sae_proto_commit_delayed -sae_proto_commit_replay -sae_proto_confirm_replay -sae_proto_hostapd -sae_proto_hostapd_ecc -sae_proto_hostapd_ffc -sae_proto_hostapd_status_126 -sae_proto_hostapd_status_127 -sae_reflection_attack_ecc -sae_reflection_attack_ecc_internal -sae_commit_override -sae_commit_override2 -sae_commit_invalid_scalar_element_ap -sae_commit_invalid_element_ap -sae_commit_invalid_scalar_element_sta -sae_commit_invalid_element_sta -sae_anti_clogging_proto -sae_no_random -sae_invalid_anti_clogging_token_req -sae_password -sae_password_short -sae_password_long -sae_connect_cmd -sae_password_id -sae_password_id_ecc -sae_password_id_ffc -sae_password_id_only -sae_password_id_pwe_looping -sae_password_id_pwe_check_ap -sae_password_id_pwe_check_sta -sae_forced_anti_clogging_pw_id -sae_reauth -sae_sync -sae_confirm_immediate -sae_confirm_immediate2 -sae_pwe_group_19 -sae_pwe_group_20 -sae_pwe_group_21 -sae_pwe_group_28 -sae_pwe_group_29 -sae_pwe_group_30 -sae_pwe_group_1 -sae_pwe_group_2 -sae_pwe_group_22 -sae_pwe_h2e_only_ap -sae_pwe_h2e_only_ap_sta_forcing_loop -sae_pwe_loop_only_ap -sae_h2e_rejected_groups -sae_h2e_rejected_groups_unexpected -sae_h2e_password_id -sae_pwe_in_psk_ap -sae_auth_restart -sae_rsne_mismatch -sae_h2e_rsnxe_mismatch -sae_h2e_rsnxe_mismatch_retries -sae_h2e_rsnxe_mismatch_assoc -sae_h2e_rsnxe_mismatch_ap -sae_h2e_rsnxe_mismatch_ap2 -sae_h2e_rsnxe_mismatch_ap3 -sae_forced_anti_clogging_h2e -sae_forced_anti_clogging_h2e_loop -sae_okc -sae_okc_sta_only -sae_okc_pmk_lifetime -sae_pmk_lifetime -sae_and_psk_multiple_passwords -sae_pmf_roam -sae_ocv_pmk -sae_ocv_pmk_failure -sae_reject -eap_tls_pkcs8_pkcs5_v2_des3 -eap_tls_pkcs8_pkcs5_v15 -eap_tls_session_resumption -eap_tls_session_resumption_expiration -eap_tls_session_resumption_radius -eap_tls_sha512 -eap_tls_sha384 -eap_tls_ext_cert_check -eap_tls_errors -ap_wpa2_delayed_m3_retransmission -ap_wpa2_delayed_m1_m3_retransmission -ap_wpa2_delayed_m1_m3_retransmission2 -ap_wpa2_delayed_group_m1_retransmission -ap_wpa2_delayed_group_m1_retransmission_igtk -ap_wpa2_delayed_m1_m3_zero_tk -ap_wpa2_plaintext_m1_m3 -ap_wpa2_plaintext_m1_m3_pmf -ap_wpa2_plaintext_m3 -ap_wpa2_plaintext_group_m1 -ap_wpa2_plaintext_group_m1_pmf -ap_wpa2_test_command_failures -ap_wpa2_gtk_initial_rsc_tkip -ap_wpa2_gtk_initial_rsc_ccmp -ap_wpa2_gtk_initial_rsc_ccmp_256 -ap_wpa2_gtk_initial_rsc_gcmp -ap_wpa2_gtk_initial_rsc_gcmp_256 -ap_wpa2_igtk_initial_rsc_aes_128_cmac -ap_wpa2_igtk_initial_rsc_bip_gmac_128 -ap_wpa2_igtk_initial_rsc_bip_gmac_256 -ap_wpa2_igtk_initial_rsc_bip_cmac_256 -ap_wpa2_psk -ap_wpa2_psk_file -ap_wpa2_psk_file_keyid -ap_wpa2_psk_mem -ap_wpa2_ptk_rekey -ap_wpa2_ptk_rekey_blocked_ap -ap_wpa2_ptk_rekey_blocked_sta -ap_wpa2_ptk_rekey_anonce -ap_wpa2_ptk_rekey_ap -ap_wpa2_sha256_ptk_rekey -ap_wpa2_sha256_ptk_rekey_ap -ap_wpa2_psk_file_errors -ap_wpa2_psk_wildcard_ssid -ap_wpa2_gtk_rekey -ap_wpa2_gtk_rekey_request -ap_wpa2_gtk_rekey_failure -ap_wpa2_gtk_rekey_fail_1_sta -ap_wpa2_gmk_rekey -ap_wpa2_strict_rekey -ap_wpa2_psk_ext -ap_wpa2_psk_unexpected -ap_wpa2_psk_ext_retry_msg_3 -ap_wpa2_psk_ext_retry_msg_3b -ap_wpa2_psk_ext_retry_msg_3c -ap_wpa2_psk_ext_retry_msg_3d -ap_wpa2_psk_ext_retry_msg_3e -ap_wpa2_psk_ext_delayed_ptk_rekey -ap_wpa2_psk_ext_eapol -ap_wpa2_psk_ext_eapol_retry1 -ap_wpa2_psk_ext_eapol_retry1b -ap_wpa2_psk_ext_eapol_retry1c -ap_wpa2_psk_ext_eapol_retry1d -ap_wpa2_psk_ext_eapol_type_diff -ap_wpa2_psk_ext_eapol_key_info -ap_wpa2_psk_supp_proto -ap_wpa2_psk_supp_proto_no_ie -ap_wpa2_psk_supp_proto_ie_mismatch -ap_wpa2_psk_supp_proto_ok -ap_wpa2_psk_supp_proto_no_gtk -ap_wpa2_psk_supp_proto_anonce_change -ap_wpa2_psk_supp_proto_unexpected_group_msg -ap_wpa2_psk_supp_proto_msg_1_invalid_kde -ap_wpa2_psk_supp_proto_wrong_pairwise_key_len -ap_wpa2_psk_supp_proto_wrong_group_key_len -ap_wpa2_psk_supp_proto_gtk_tx_bit_workaround -ap_wpa2_psk_supp_proto_gtk_keyidx_0_and_3 -ap_wpa2_psk_supp_proto_no_gtk_in_group_msg -ap_wpa2_psk_supp_proto_too_long_gtk_in_group_msg -ap_wpa2_psk_supp_proto_too_long_gtk_kde -ap_wpa2_psk_supp_proto_gtk_not_encrypted -ap_wpa2_psk_supp_proto_no_igtk -ap_wpa2_psk_supp_proto_igtk_ok -ap_wpa2_psk_supp_proto_igtk_keyid_swap -ap_wpa2_psk_supp_proto_igtk_keyid_too_large -ap_wpa2_psk_supp_proto_igtk_keyid_unexpected -ap_wpa2_psk_wep -ap_wpa2_psk_ifdown -ap_wpa2_psk_drop_first_msg_4 -ap_wpa2_psk_disable_enable -ap_wpa2_psk_incorrect_passphrase -ap_wpa2_psk_no_random -ap_wpa2_psk_assoc_rsn -ap_wpa2_psk_ft_workaround -ap_wpa2_psk_assoc_rsn_pmkid -ap_wpa2_eapol_retry_limit -ap_wpa2_disable_eapol_retry -ap_wpa2_disable_eapol_retry_group -ap_wpa2_psk_mic_0 -ap_wpa2_psk_local_error -ap_wpa2_psk_inject_assoc -ap_wpa2_psk_no_control_port -ap_wpa2_psk_ap_control_port -ap_wpa2_psk_ap_control_port_disabled -ap_wpa2_psk_rsne_mismatch_ap -ap_wpa2_psk_rsne_mismatch_ap2 -ap_wpa2_psk_rsne_mismatch_ap3 -ap_wpa2_psk_rsnxe_mismatch_ap -ap_wpa2_psk_ext_key_id_ptk_rekey_ap0 -ap_wpa2_psk_ext_key_id_ptk_rekey_ap1 -ap_wpa2_psk_ext_key_id_ptk_rekey_ap2 -ap_wpa2_psk_ext_key_id_ptk_rekey_sta0 -ap_wpa2_psk_ext_key_id_ptk_rekey_sta1 -ap_wpa2_psk_ext_key_id_ptk_rekey_sta2 -ap_wpa2_eap_sim -ap_wpa2_eap_sim_imsi_identity -ap_wpa2_eap_sim_imsi_privacy_key -ap_wpa2_eap_sim_imsi_privacy_attr -ap_wpa2_eap_sim_sql -ap_wpa2_eap_sim_config -ap_wpa2_eap_sim_id_0 -ap_wpa2_eap_sim_id_1 -ap_wpa2_eap_sim_id_2 -ap_wpa2_eap_sim_id_3 -ap_wpa2_eap_sim_ext -ap_wpa2_eap_sim_ext_replace_sim -ap_wpa2_eap_sim_ext_replace_sim2 -ap_wpa2_eap_sim_ext_replace_sim3 -ap_wpa2_eap_sim_ext_auth_fail -ap_wpa2_eap_sim_change_bssid -ap_wpa2_eap_sim_no_change_set -ap_wpa2_eap_sim_ext_anonymous -ap_wpa2_eap_sim_ext_anonymous_no_pseudonym -ap_wpa2_eap_sim_oom -ap_wpa2_eap_aka -ap_wpa2_eap_aka_imsi_identity -ap_wpa2_eap_aka_imsi_privacy_key -ap_wpa2_eap_aka_imsi_privacy_attr -ap_wpa2_eap_aka_imsi_privacy_key_expired -ap_wpa2_eap_aka_sql -ap_wpa2_eap_aka_config -ap_wpa2_eap_aka_ext -ap_wpa2_eap_aka_ext_auth_fail -ap_wpa2_eap_aka_prime -ap_wpa2_eap_aka_prime_imsi_identity -ap_wpa2_eap_aka_prime_imsi_privacy_key -ap_wpa2_eap_aka_prime_sql -ap_wpa2_eap_aka_prime_ext_auth_fail -ap_wpa2_eap_aka_prime_ext -ap_wpa2_eap_ttls_pap -ap_wpa2_eap_ttls_pap_subject_match -ap_wpa2_eap_ttls_pap_check_cert_subject -ap_wpa2_eap_ttls_pap_incorrect_password -ap_wpa2_eap_ttls_chap -ap_wpa2_eap_ttls_chap_altsubject_match -ap_wpa2_eap_ttls_chap_incorrect_password -ap_wpa2_eap_ttls_mschap -ap_wpa2_eap_ttls_mschap_incorrect_password -ap_wpa2_eap_ttls_mschapv2 -ap_wpa2_eap_ttls_invalid_phase2 -ap_wpa2_eap_ttls_mschapv2_suffix_match -ap_wpa2_eap_ttls_mschapv2_domain_match -ap_wpa2_eap_ttls_mschapv2_incorrect_password -ap_wpa2_eap_ttls_mschapv2_utf8 -ap_wpa2_eap_ttls_eap_gtc -ap_wpa2_eap_ttls_eap_gtc_incorrect_password -ap_wpa2_eap_ttls_eap_gtc_no_password -ap_wpa2_eap_ttls_eap_gtc_server_oom -ap_wpa2_eap_ttls_eap_gtc_oom -ap_wpa2_eap_ttls_eap_md5 -ap_wpa2_eap_ttls_eap_md5_incorrect_password -ap_wpa2_eap_ttls_eap_md5_no_password -ap_wpa2_eap_ttls_eap_md5_server_oom -ap_wpa2_eap_ttls_eap_mschapv2 -ap_wpa2_eap_ttls_eap_mschapv2_no_password -ap_wpa2_eap_ttls_eap_mschapv2_server_oom -ap_wpa2_eap_ttls_eap_sim -ap_wpa2_eap_ttls_eap_sim_ext -ap_wpa2_eap_ttls_eap_vendor -ap_wpa2_eap_peap_eap_sim -ap_wpa2_eap_peap_eap_sim_ext -ap_wpa2_eap_fast_eap_sim_ext -ap_wpa2_eap_ttls_eap_aka -ap_wpa2_eap_peap_eap_aka -ap_wpa2_eap_peap_eap_mschapv2 -ap_wpa2_eap_peap_eap_mschapv2_domain -ap_wpa2_eap_peap_eap_mschapv2_incorrect_password -ap_wpa2_eap_peap_crypto_binding -ap_wpa2_eap_peap_crypto_binding_server_oom -ap_wpa2_eap_peap_params -ap_wpa2_eap_peap_eap_gtc -ap_wpa2_eap_peap_eap_tls -ap_wpa2_eap_peap_eap_vendor -ap_wpa2_eap_tls -ap_wpa2_eap_tls_blob -ap_wpa2_eap_tls_blob_pem -ap_wpa2_eap_tls_blob_missing -ap_wpa2_eap_tls_with_tls_len -ap_wpa2_eap_tls_pkcs12 -ap_wpa2_eap_tls_pkcs12_blob -ap_wpa2_eap_tls_pkcs12_blob_pem -ap_wpa2_eap_tls_diff_ca_trust -ap_wpa2_eap_tls_diff_ca_trust2 -ap_wpa2_eap_tls_diff_ca_trust3 -ap_wpa2_eap_tls_neg_suffix_match -ap_wpa2_eap_tls_neg_domain_match -ap_wpa2_eap_tls_neg_subject_match -ap_wpa2_eap_tls_neg_altsubject_match -ap_wpa2_eap_unauth_tls -ap_wpa2_eap_ttls_server_cert_hash -ap_wpa2_eap_ttls_server_cert_hash_invalid -ap_wpa2_eap_pwd -ap_wpa2_eap_pwd_nthash -ap_wpa2_eap_pwd_salt_sha1 -ap_wpa2_eap_pwd_salt_sha256 -ap_wpa2_eap_pwd_salt_sha512 -ap_wpa2_eap_pwd_groups -ap_wpa2_eap_pwd_invalid_group -ap_wpa2_eap_pwd_disabled_group -ap_wpa2_eap_pwd_as_frag -ap_wpa2_eap_gpsk -ap_wpa2_eap_sake -ap_wpa2_eap_eke -ap_wpa2_eap_eke_many -ap_wpa2_eap_eke_serverid_nai -ap_wpa2_eap_eke_server_oom -ap_wpa2_eap_ikev2 -ap_wpa2_eap_ikev2_as_frag -ap_wpa2_eap_ikev2_oom -ap_wpa2_eap_pax -ap_wpa2_eap_psk -ap_wpa2_eap_psk_oom -ap_wpa2_eap_interactive -ap_wpa2_eap_ext_enable_network_while_connected -ap_wpa2_eap_vendor_test -ap_wpa2_eap_vendor_test_oom -ap_wpa2_eap_fast_gtc_identity_change -ap_wpa2_eap_fast_eap_vendor -ap_wpa2_eap_tls_ocsp -ap_wpa2_eap_tls_ocsp_multi -ap_wpa2_eap_tls_ocsp_key_id -ap_wpa2_eap_tls_ocsp_ca_signed_good -ap_wpa2_eap_tls_ocsp_ca_signed_revoked -ap_wpa2_eap_tls_ocsp_ca_signed_unknown -ap_wpa2_eap_tls_ocsp_server_signed -ap_wpa2_eap_tls_ocsp_invalid_data -ap_wpa2_eap_tls_ocsp_invalid -ap_wpa2_eap_tls_ocsp_unknown_sign -ap_wpa2_eap_tls_intermediate_ca -ap_wpa2_eap_tls_ocsp_multi_revoked -ap_wpa2_eap_tls_domain_suffix_match_cn_full -ap_wpa2_eap_tls_domain_match_cn -ap_wpa2_eap_tls_domain_suffix_match_cn -ap_wpa2_eap_tls_domain_suffix_mismatch_cn -ap_wpa2_eap_tls_domain_mismatch_cn -ap_wpa2_eap_ttls_long_duration -ap_wpa2_eap_ttls_server_cert_eku_client -ap_wpa2_eap_ttls_server_cert_eku_client_server -ap_wpa2_eap_ttls_server_pkcs12 -ap_wpa2_eap_ttls_server_pkcs12_extra -ap_wpa2_eap_ttls_dh_params_server -ap_wpa2_eap_ttls_dh_params_dsa_server -ap_wpa2_eap_ttls_dh_params_not_found -ap_wpa2_eap_ttls_dh_params_invalid -ap_wpa2_eap_reauth -ap_wpa2_eap_reauth_ptk_rekey_blocked_sta -ap_wpa2_eap_request_identity_message -ap_wpa2_eap_sim_aka_result_ind -ap_wpa2_eap_sim_zero_db_timeout -ap_wpa2_eap_too_many_roundtrips -ap_wpa2_eap_too_many_roundtrips_server -ap_wpa2_eap_too_many_roundtrips_server2 -ap_wpa2_eap_expanded_nak -ap_wpa2_eap_sql -ap_wpa2_eap_non_ascii_identity -ap_wpa2_eap_non_ascii_identity2 -ap_wpa2_eap_unexpected_wep_eapol_key -ap_wpa2_eap_session_ticket -ap_wpa2_eap_no_workaround -ap_wpa2_eap_tls_check_crl -ap_wpa2_eap_tls_check_crl_not_strict -ap_wpa2_eap_tls_crl_reload -ap_wpa2_eap_tls_check_cert_subject -ap_wpa2_eap_tls_check_cert_subject_neg -ap_wpa2_eap_tls_oom -ap_wpa2_eap_tls_macacl -ap_wpa2_eap_oom -ap_wpa2_eap_tls_13 -ap_wpa2_eap_tls_13_ocsp -ap_wpa2_eap_tls_13_missing_prot_success -ap_wpa2_eap_tls_13_fragmentation -ap_wpa2_eap_ttls_13 -ap_wpa2_eap_peap_13 -ap_wpa2_eap_tls_13_ec -ap_wpa2_eap_sim_db -ap_wpa2_eap_sim_db_sqlite -ap_wpa2_eap_assoc_rsn -ap_wpa2_eap_status -ap_wpa2_eap_gpsk_ptk_rekey_ap -ap_wpa2_eap_wildcard_ssid -ap_wpa2_eap_psk_mac_addr_change -ap_wpa2_eap_server_get_id -ap_wpa2_radius_server_get_id -ap_wpa2_eap_tls_tod -ap_wpa2_eap_tls_tod_tofu -ap_wpa2_eap_sake_no_control_port -ap_wpa2_tdls -ap_wpa2_tdls_concurrent_init -ap_wpa2_tdls_concurrent_init2 -ap_wpa2_tdls_decline_resp -ap_wpa2_tdls_long_lifetime -ap_wpa2_tdls_long_frame -ap_wpa2_tdls_reneg -ap_wpa2_tdls_wrong_lifetime_resp -ap_wpa2_tdls_diff_rsnie -ap_wpa2_tdls_wrong_tpk_m2_mic -ap_wpa2_tdls_wrong_tpk_m3_mic -ap_wpa2_tdls_double_tpk_m2 -ap_wpa2_tdls_responder_teardown -dpp_network_intro_version -dpp_network_intro_version_change -dpp_network_intro_version_missing_req -dpp_tcp_pkex -dpp_tcp_pkex_auto_connect_2 -dpp_tcp_pkex_auto_connect_2_status -dpp_tcp_pkex_auto_connect_2_status_fail -dpp_tcp_pkex_while_associated -dpp_tcp_pkex_while_associated_conn_status -dpp_controller_relay_pkex -dpp_push_button -dpp_push_button_session_overlap_sta -dpp_push_button_session_overlap_ap -dpp_push_button_session_overlap_configurator -dpp_push_button_2sta -dpp_push_button_r_hash_mismatch_sta -dpp_push_button_i_hash_mismatch_ap -dpp_push_button_r_hash_mismatch_ap -dpp_push_button_ext_conf -dpp_push_button_wpas_conf -dpp_private_peer_introduction -dpp_qr_code_parsing -dpp_uri_version -dpp_uri_supported_curves -dpp_uri_host -dpp_qr_code_parsing_fail -dpp_qr_code_curves -dpp_qr_code_curves_brainpool -dpp_qr_code_unsupported_curve -dpp_qr_code_keygen_fail -dpp_qr_code_curve_select -dpp_qr_code_auth_broadcast -dpp_configurator_enrollee -dpp_configurator_enrollee_prime256v1 -dpp_configurator_enrollee_secp384r1 -dpp_configurator_enrollee_secp521r1 -dpp_configurator_enrollee_brainpoolP256r1 -dpp_configurator_enrollee_brainpoolP384r1 -dpp_configurator_enrollee_brainpoolP512r1 -dpp_configurator_enroll_conf -dpp_qr_code_curve_prime256v1 -dpp_qr_code_curve_secp384r1 -dpp_qr_code_curve_secp521r1 -dpp_qr_code_curve_brainpoolP256r1 -dpp_qr_code_curve_brainpoolP384r1 -dpp_qr_code_curve_brainpoolP512r1 -dpp_qr_code_set_key -dpp_qr_code_auth_mutual -dpp_qr_code_auth_mutual2 -dpp_qr_code_auth_mutual_p_256 -dpp_qr_code_auth_mutual_p_384 -dpp_qr_code_auth_mutual_p_521 -dpp_qr_code_auth_mutual_bp_256 -dpp_qr_code_auth_mutual_bp_384 -dpp_qr_code_auth_mutual_bp_512 -dpp_auth_resp_retries -dpp_qr_code_auth_mutual_not_used -dpp_qr_code_auth_mutual_curve_mismatch -dpp_qr_code_auth_hostapd_mutual2 -dpp_qr_code_listen_continue -dpp_qr_code_auth_initiator_enrollee -dpp_qr_code_auth_initiator_either_2 -dpp_qr_code_auth_initiator_either_3 -dpp_config_legacy -dpp_config_legacy_psk_hex -dpp_config_fragmentation -dpp_config_legacy_gen -dpp_config_legacy_gen_psk -dpp_config_dpp_gen_prime256v1 -dpp_config_dpp_gen_secp384r1 -dpp_config_dpp_gen_secp521r1 -dpp_config_dpp_gen_expiry -dpp_config_dpp_gen_expired_key -dpp_config_dpp_gen_3rd_party -dpp_config_dpp_override_prime256v1 -dpp_config_dpp_override_secp384r1 -dpp_config_override_objects -dpp_config_signed_connector_error_no_dot_1 -dpp_config_signed_connector_error_no_dot_2 -dpp_config_signed_connector_error_unexpected_signature_len -dpp_config_no_csign -dpp_config_no_signed_connector -dpp_config_unexpected_signed_connector_char -dpp_config_root_not_an_object -dpp_config_no_wi_fi_tech -dpp_config_unsupported_wi_fi_tech -dpp_config_no_discovery -dpp_config_no_discovery_ssid -dpp_config_too_long_discovery_ssid -dpp_config_no_cred -dpp_config_no_cred_akm -dpp_config_unsupported_cred_akm -dpp_config_error_legacy_no_pass -dpp_config_error_legacy_too_long_pass -dpp_config_error_legacy_psk_with_sae -dpp_config_error_legacy_no_pass_for_sae -dpp_config_error_legacy_invalid_psk -dpp_config_error_legacy_too_short_psk -dpp_config_connector_error_ext_sign -dpp_config_connector_error_too_short_timestamp -dpp_config_connector_error_invalid_timestamp -dpp_config_connector_error_invalid_timestamp_date -dpp_config_connector_error_invalid_time_zone -dpp_config_connector_error_invalid_time_zone_2 -dpp_config_connector_error_expired_1 -dpp_config_connector_error_expired_2 -dpp_config_connector_error_expired_3 -dpp_config_connector_error_expired_4 -dpp_config_connector_error_expired_5 -dpp_config_connector_error_expired_6 -dpp_config_connector_error_no_groups -dpp_config_connector_error_empty_groups -dpp_config_connector_error_missing_group_id -dpp_config_connector_error_missing_net_role -dpp_config_connector_error_missing_net_access_key -dpp_config_connector_error_net_access_key_mismatch -dpp_akm_sha256 -dpp_akm_sha384 -dpp_akm_sha512 -dpp_network_introduction -dpp_network_introduction_expired -dpp_and_sae_akm -dpp_ap_config -dpp_ap_config_p256_p256 -dpp_ap_config_p256_p384 -dpp_ap_config_p384_p256 -dpp_ap_config_p384_p384 -dpp_ap_config_p521_p256 -dpp_ap_config_p521_p384 -dpp_ap_config_bp256_bp256 -dpp_ap_config_bp384_bp384 -dpp_ap_config_bp512_bp512 -dpp_ap_config_p256_bp256 -dpp_ap_config_bp256_p256 -dpp_ap_config_p521_bp512 -dpp_ap_config_reconfig_configurator -dpp_auto_connect_1 -dpp_auto_connect_2 -dpp_auto_connect_2_connect_cmd -dpp_auto_connect_2_sta_ver1 -dpp_auto_connect_2_ap_ver1 -dpp_auto_connect_2_ver1 -dpp_auto_connect_2_conf_ver1 -dpp_auto_connect_legacy -dpp_auto_connect_legacy_ssid_charset -dpp_auto_connect_legacy_sae_1 -dpp_auto_connect_legacy_sae_2 -dpp_auto_connect_legacy_psk_sae_1 -dpp_auto_connect_legacy_psk_sae_2 -dpp_auto_connect_legacy_psk_sae_3 -dpp_auto_connect_legacy_pmf_required -dpp_qr_code_auth_responder_configurator -dpp_qr_code_auth_responder_configurator_group_id -dpp_qr_code_auth_enrollee_init_netrole -dpp_qr_code_hostapd_init -dpp_qr_code_hostapd_init_offchannel -dpp_qr_code_hostapd_init_offchannel_neg_freq -dpp_qr_code_hostapd_ignore_mismatch -dpp_test_vector_p_256 -dpp_test_vector_p_256_b -dpp_test_vector_p_521 -dpp_pkex -dpp_pkex_v2 -dpp_pkex_p256 -dpp_pkex_p384 -dpp_pkex_p521 -dpp_pkex_bp256 -dpp_pkex_bp384 -dpp_pkex_bp512 -dpp_pkex_config -dpp_pkex_no_identifier -dpp_pkex_identifier_mismatch -dpp_pkex_identifier_mismatch2 -dpp_pkex_identifier_mismatch3 -dpp_pkex_5ghz -dpp_pkex_test_vector -dpp_pkex_code_mismatch -dpp_pkex_code_mismatch_limit -dpp_pkex_curve_mismatch -dpp_pkex_curve_mismatch_failure -dpp_pkex_curve_mismatch_failure2 -dpp_pkex_exchange_resp_processing_failure -dpp_pkex_commit_reveal_req_processing_failure -dpp_pkex_config2 -dpp_pkex_no_responder -dpp_pkex_after_retry -dpp_pkex_hostapd_responder -dpp_pkex_v2_hostapd_responder -dpp_pkex_hostapd_initiator -dpp_pkex_v2_hostapd_initiator -dpp_pkex_hostapd_initiator_fallback -dpp_pkex_hostapd_initiator_no_response -dpp_pkex_hostapd_errors -dpp_pkex_nak_curve_change -dpp_pkex_nak_curve_change2 -dpp_hostapd_configurator -dpp_hostapd_configurator_enrollee_v1 -dpp_hostapd_configurator_responder -dpp_hostapd_configurator_fragmentation -dpp_hostapd_enrollee_fragmentation -dpp_hostapd_enrollee_gas_timeout -dpp_hostapd_enrollee_gas_timeout_comeback -dpp_hostapd_enrollee_gas_errors -dpp_hostapd_enrollee_gas_proto -dpp_hostapd_enrollee_gas_tx_status_errors -dpp_hostapd_configurator_override_objects -dpp_own_config -dpp_own_config_group_id -dpp_proto_after_wrapped_data_auth_req -dpp_auth_req_stop_after_ack -dpp_auth_req_retries -dpp_auth_req_retries_multi_chan -dpp_proto_after_wrapped_data_auth_resp -dpp_proto_after_wrapped_data_auth_conf -dpp_proto_after_wrapped_data_conf_req -dpp_proto_after_wrapped_data_conf_resp -dpp_proto_stop_at_pkex_exchange_resp -dpp_proto_stop_at_pkex_cr_req -dpp_proto_stop_at_pkex_cr_resp -dpp_proto_network_introduction -dpp_hostapd_auth_conf_timeout -dpp_hostapd_auth_resp_retries -dpp_tcp -dpp_tcp_port -dpp_tcp_mutual -dpp_tcp_mutual_hostapd_conf -dpp_tcp_conf_init -dpp_tcp_conf_init_hostapd_enrollee -dpp_tcp_controller_management_hostapd -dpp_tcp_controller_management_hostapd2 -dpp_tcp_controller_start_failure -dpp_tcp_init_failure -dpp_controller_rx_failure -dpp_controller_rx_errors -dpp_conn_status_success -dpp_conn_status_wrong_passphrase -dpp_conn_status_no_ap -dpp_conn_status_connector_mismatch -dpp_conn_status_assoc_reject -dpp_conn_status_success_hostapd_configurator -dpp_mud_url -dpp_mud_url_hostapd -dpp_config_save -dpp_config_save2 -dpp_config_save3 -dpp_nfc_uri -dpp_nfc_uri_hostapd -dpp_nfc_uri_hostapd_tag_read -dpp_nfc_negotiated_handover -dpp_nfc_negotiated_handover_diff_curve -dpp_nfc_negotiated_handover_hostapd_sel -dpp_nfc_negotiated_handover_hostapd_req -dpp_nfc_errors_hostapd -dpp_with_p2p_device -dpp_pfs_ap_0 -dpp_pfs_ap_1 -dpp_pfs_ap_2 -dpp_pfs_connect_cmd -dpp_pfs_connect_cmd_ap_2 -dpp_pfs_connect_cmd_ap_2_sae -dpp_pfs_ap_0_sta_ver1 -dpp_pfs_errors -dpp_qr_code_auth_rand_mac_addr -dpp_enterprise -dpp_enterprise_tcp -dpp_enterprise_tcp2 -dpp_qr_code_config_event_initiator -dpp_qr_code_config_event_initiator_set_comeback -dpp_qr_code_config_event_initiator_slow -dpp_qr_code_config_event_initiator_failure -dpp_qr_code_config_event_initiator_no_response -dpp_qr_code_config_event_initiator_both -dpp_tcp_qr_code_config_event_initiator -dpp_qr_code_config_event_responder -dpp_discard_public_action - diff --git a/.github/workflows/hostap-files/configs/b607d2723e927a3446d89aed813f1aa6068186bb/wpa_supplicant.config b/.github/workflows/hostap-files/configs/b607d2723e927a3446d89aed813f1aa6068186bb/wpa_supplicant.config deleted file mode 100644 index 777b2d7d1e..0000000000 --- a/.github/workflows/hostap-files/configs/b607d2723e927a3446d89aed813f1aa6068186bb/wpa_supplicant.config +++ /dev/null @@ -1,163 +0,0 @@ -#CC=ccache gcc - -#CONFIG_TLS=openssl -CONFIG_TLS=wolfssl -#CONFIG_TLS=internal -#CONFIG_INTERNAL_LIBTOMMATH=y -#CONFIG_INTERNAL_LIBTOMMATH_FAST=y - -CONFIG_IEEE8021X_EAPOL=y - -CONFIG_ERP=y -CONFIG_EAP_MD5=y -CONFIG_MSCHAPV2=y -CONFIG_EAP_TLS=y -CONFIG_EAP_PEAP=y -CONFIG_EAP_TTLS=y -CONFIG_EAP_GTC=y -CONFIG_EAP_OTP=y -CONFIG_EAP_PSK=y -CONFIG_EAP_PAX=y -CONFIG_EAP_LEAP=y -CONFIG_EAP_SIM=y -CONFIG_EAP_AKA=y -CONFIG_EAP_AKA_PRIME=y -CONFIG_EAP_VENDOR_TEST=y -CONFIG_EAP_TLV=y -CONFIG_EAP_SAKE=y -CONFIG_EAP_GPSK=y -CONFIG_EAP_GPSK_SHA256=y -CONFIG_EAP_EKE=y -CONFIG_EAP_TNC=y -CFLAGS += -DTNC_CONFIG_FILE=\"tnc/tnc_config\" -LIBS += -rdynamic -CONFIG_EAP_FAST=y -CONFIG_EAP_TEAP=y -CONFIG_EAP_IKEV2=y - -ifeq ($(CONFIG_TLS), openssl) -CONFIG_EAP_PWD=y -endif -ifeq ($(CONFIG_TLS), wolfssl) -CONFIG_EAP_PWD=y -endif - -CONFIG_USIM_SIMULATOR=y -CONFIG_SIM_SIMULATOR=y - -#CONFIG_PCSC=y -CONFIG_IPV6=y -CONFIG_DRIVER_NONE=y -CONFIG_PKCS12=y -CONFIG_CTRL_IFACE=unix - -CONFIG_WPA_CLI_EDIT=y - -CONFIG_OCSP=y - -#CONFIG_ELOOP_POLL=y - -CONFIG_CTRL_IFACE_DBUS_NEW=y -CONFIG_CTRL_IFACE_DBUS_INTRO=y - -CONFIG_IEEE80211R=y -CONFIG_IEEE80211AC=y -CONFIG_IEEE80211AX=y - -CONFIG_OCV=y - -CONFIG_DEBUG_FILE=y - -CONFIG_WPS=y -#CONFIG_WPS_STRICT=y -CONFIG_WPS_UPNP=y -CONFIG_WPS_NFC=y -CONFIG_WPS_ER=y -#CONFIG_WPS_REG_DISABLE_OPEN=y - -CONFIG_DRIVER_WEXT=y - -CONFIG_DRIVER_NL80211=y -CFLAGS += -I/usr/include/libnl3 -CONFIG_LIBNL32=y - -CONFIG_IBSS_RSN=y - -CONFIG_AP=y -CONFIG_MESH=y -CONFIG_P2P=y -CONFIG_WIFI_DISPLAY=y - -CONFIG_ACS=y - -CONFIG_BGSCAN_SIMPLE=y -CONFIG_BGSCAN_LEARN=y - -CONFIG_WPA_TRACE=y -CONFIG_WPA_TRACE_BFD=y - -CONFIG_TDLS=y -CONFIG_TDLS_TESTING=y -CONFIG_NO_RANDOM_POOL=y - -CONFIG_TLSV11=y -CONFIG_TLSV12=y - -CONFIG_HT_OVERRIDES=y -CONFIG_VHT_OVERRIDES=y -CONFIG_HE_OVERRIDES=y - -CONFIG_DEBUG_LINUX_TRACING=y - -CONFIG_INTERWORKING=y -CONFIG_HS20=y - -CONFIG_AUTOSCAN_EXPONENTIAL=y -CONFIG_AUTOSCAN_PERIODIC=y - -CONFIG_EXT_PASSWORD_TEST=y -CONFIG_EXT_PASSWORD_FILE=y - -CONFIG_EAP_UNAUTH_TLS=y - -CONFIG_SAE=y -CONFIG_SAE_PK=y -CFLAGS += -DALL_DH_GROUPS - -CONFIG_WNM=y - -CONFIG_FST=y -CONFIG_FST_TEST=y - -CONFIG_TESTING_OPTIONS=y -CONFIG_MODULE_TESTS=y - -CONFIG_SUITEB=y - -# AddressSanitizer (ASan) can be enabled by uncommenting the following lines. -# This can be used as a more efficient memory error detector than valgrind -# (though, with still some CPU and memory cost, so VM cases will need more -# memory allocated for the guest). -#CFLAGS += -fsanitize=address -O1 -fno-omit-frame-pointer -g -#LIBS += -fsanitize=address -fno-omit-frame-pointer -g -#LIBS_c += -fsanitize=address -fno-omit-frame-pointer -g -#LIBS_p += -fsanitize=address -fno-omit-frame-pointer -g - -# Undefined Behavior Sanitizer (UBSan) can be enabled by uncommenting the -# following lines. -#CFLAGS += -Wno-format-nonliteral -#CFLAGS += -fsanitize=undefined -##CFLAGS += -fno-sanitize-recover -#LIBS += -fsanitize=undefined -##LIBS += -fno-sanitize-recover -#LIBS_c += -fsanitize=undefined -#LIBS_p += -fsanitize=undefined -CONFIG_MBO=y -CONFIG_FILS=y -CONFIG_FILS_SK_PFS=y -CONFIG_PMKSA_CACHE_EXTERNAL=y -CONFIG_OWE=y -CONFIG_DPP=y -CONFIG_DPP2=y -CONFIG_WEP=y -CONFIG_PASN=y diff --git a/.github/workflows/hostap-files/configs/hostap_2_10/hostapd.config b/.github/workflows/hostap-files/configs/hostap_2_10/hostapd.config deleted file mode 100644 index 540380179e..0000000000 --- a/.github/workflows/hostap-files/configs/hostap_2_10/hostapd.config +++ /dev/null @@ -1,119 +0,0 @@ -#CC=ccache gcc - -CONFIG_DRIVER_NONE=y -CONFIG_DRIVER_NL80211=y -CONFIG_RSN_PREAUTH=y - -#CONFIG_TLS=internal -#CONFIG_INTERNAL_LIBTOMMATH=y -#CONFIG_INTERNAL_LIBTOMMATH_FAST=y -CONFIG_TLS=wolfssl - -CONFIG_EAP=y -CONFIG_ERP=y -CONFIG_EAP_MD5=y -CONFIG_EAP_TLS=y -CONFIG_EAP_MSCHAPV2=y -CONFIG_EAP_PEAP=y -CONFIG_EAP_GTC=y -CONFIG_EAP_TTLS=y -CONFIG_EAP_SIM=y -CONFIG_EAP_AKA=y -CONFIG_EAP_AKA_PRIME=y -CONFIG_EAP_GPSK=y -CONFIG_EAP_GPSK_SHA256=y -CONFIG_EAP_SAKE=y -CONFIG_EAP_PAX=y -CONFIG_EAP_PSK=y -CONFIG_EAP_VENDOR_TEST=y -CONFIG_EAP_FAST=y -#CONFIG_EAP_TEAP=y -CONFIG_EAP_IKEV2=y -CONFIG_EAP_TNC=y -CFLAGS += -DTNC_CONFIG_FILE=\"tnc/tnc_config\" -LIBS += -rdynamic -CONFIG_EAP_UNAUTH_TLS=y -ifeq ($(CONFIG_TLS), wolfssl) -CONFIG_EAP_PWD=y -endif -ifeq ($(CONFIG_TLS), openssl) -CONFIG_EAP_PWD=y -endif -CONFIG_EAP_EKE=y -CONFIG_PKCS12=y -CONFIG_RADIUS_SERVER=y -CONFIG_IPV6=y -CONFIG_TLSV11=y -CONFIG_TLSV12=y - -CONFIG_FULL_DYNAMIC_VLAN=y -CONFIG_VLAN_NETLINK=y -CONFIG_LIBNL32=y -CONFIG_LIBNL3_ROUTE=y -CONFIG_IEEE80211R=y -CONFIG_IEEE80211AC=y -CONFIG_IEEE80211AX=y - -CONFIG_OCV=y - -CONFIG_WPS=y -CONFIG_WPS_UPNP=y -CONFIG_WPS_NFC=y -#CONFIG_WPS_STRICT=y -CONFIG_WPA_TRACE=y -CONFIG_WPA_TRACE_BFD=y - -CONFIG_P2P_MANAGER=y -CONFIG_DEBUG_FILE=y -CONFIG_DEBUG_LINUX_TRACING=y -CONFIG_WPA_CLI_EDIT=y -CONFIG_ACS=y -CONFIG_NO_RANDOM_POOL=y -CONFIG_WNM=y -CONFIG_INTERWORKING=y -CONFIG_HS20=y -CONFIG_SQLITE=y -CONFIG_SAE=y -#CONFIG_SAE_PK=y -CFLAGS += -DALL_DH_GROUPS - -CONFIG_FST=y -CONFIG_FST_TEST=y - -CONFIG_TESTING_OPTIONS=y -CFLAGS += -DCONFIG_RADIUS_TEST -CONFIG_MODULE_TESTS=y - -CONFIG_SUITEB=y - -# AddressSanitizer (ASan) can be enabled by uncommenting the following lines. -# This can be used as a more efficient memory error detector than valgrind -# (though, with still some CPU and memory cost, so VM cases will need more -# memory allocated for the guest). -#CFLAGS += -fsanitize=address -O1 -fno-omit-frame-pointer -g -#LIBS += -fsanitize=address -fno-omit-frame-pointer -g -#LIBS_h += -fsanitize=address -fno-omit-frame-pointer -g -#LIBS_n += -fsanitize=address -fno-omit-frame-pointer -g -#LIBS_c += -fsanitize=address -fno-omit-frame-pointer -g - -# Undefined Behavior Sanitizer (UBSan) can be enabled by uncommenting the -# following lines. -#CFLAGS += -Wno-format-nonliteral -#CFLAGS += -fsanitize=undefined -##CFLAGS += -fno-sanitize-recover -#LIBS += -fsanitize=undefined -##LIBS += -fno-sanitize-recover -#LIBS_h += -fsanitize=undefined -#LIBS_n += -fsanitize=undefined -#LIBS_c += -fsanitize=undefined -CONFIG_MBO=y - -CONFIG_TAXONOMY=y -CONFIG_FILS=y -CONFIG_FILS_SK_PFS=y -CONFIG_OWE=y -#CONFIG_DPP=y -#CONFIG_DPP2=y -CONFIG_WEP=y -CONFIG_PASN=y -CONFIG_AIRTIME_POLICY=y diff --git a/.github/workflows/hostap-files/configs/hostap_2_10/tests b/.github/workflows/hostap-files/configs/hostap_2_10/tests deleted file mode 100644 index 732a054414..0000000000 --- a/.github/workflows/hostap-files/configs/hostap_2_10/tests +++ /dev/null @@ -1,284 +0,0 @@ -sae -sae_password_ecc -sae_pmksa_caching -sae_pmksa_caching_pmkid -sae_pmksa_caching_disabled -sae_groups -sae_group_nego -sae_group_nego_no_match -sae_anti_clogging -sae_forced_anti_clogging -sae_mixed -sae_and_psk -sae_and_psk2 -sae_wpa3_roam -sae_mixed_mfp -sae_mfp -sae_missing_password -sae_key_lifetime_in_memory -sae_oom_wpas -sae_proto_ecc -sae_proto_ffc -sae_proto_commit_delayed -sae_proto_commit_replay -sae_proto_confirm_replay -sae_proto_hostapd -sae_proto_hostapd_ecc -sae_proto_hostapd_ffc -sae_proto_hostapd_status_126 -sae_proto_hostapd_status_127 -sae_reflection_attack_ecc -sae_reflection_attack_ecc_internal -sae_commit_override -sae_commit_override2 -sae_commit_invalid_scalar_element_ap -sae_commit_invalid_element_ap -sae_commit_invalid_scalar_element_sta -sae_commit_invalid_element_sta -sae_anti_clogging_proto -sae_no_random -sae_bignum_failure_unsafe_group -sae_invalid_anti_clogging_token_req -sae_password -sae_password_short -sae_password_long -sae_connect_cmd -sae_password_id -sae_password_id_ecc -sae_password_id_ffc -sae_password_id_only -sae_password_id_pwe_looping -sae_password_id_pwe_check_ap -sae_password_id_pwe_check_sta -sae_forced_anti_clogging_pw_id -sae_reauth -sae_sync -sae_confirm_immediate -sae_confirm_immediate2 -sae_pwe_group_19 -sae_pwe_group_20 -sae_pwe_group_21 -sae_pwe_group_1 -sae_pwe_group_2 -sae_pwe_group_22 -sae_pwe_h2e_only_ap -sae_pwe_h2e_only_ap_sta_forcing_loop -sae_pwe_loop_only_ap -sae_h2e_rejected_groups -sae_h2e_rejected_groups_unexpected -sae_h2e_password_id -sae_pwe_in_psk_ap -sae_auth_restart -sae_rsne_mismatch -sae_h2e_rsnxe_mismatch -sae_h2e_rsnxe_mismatch_retries -sae_h2e_rsnxe_mismatch_assoc -sae_h2e_rsnxe_mismatch_ap -sae_h2e_rsnxe_mismatch_ap2 -sae_h2e_rsnxe_mismatch_ap3 -sae_forced_anti_clogging_h2e -sae_forced_anti_clogging_h2e_loop -sae_okc -sae_okc_sta_only -sae_okc_pmk_lifetime -sae_pmk_lifetime -sae_and_psk_multiple_passwords -sae_pmf_roam -sae_ocv_pmk -sae_ocv_pmk_failure -sae_reject -eap_tls_pkcs8_pkcs5_v2_des3 -eap_tls_pkcs8_pkcs5_v15 -eap_tls_sha512 -eap_tls_sha384 -eap_tls_errors -eap_proto_peap_errors_server -eap_proto_peap_errors -ap_wpa2_delayed_m3_retransmission -ap_wpa2_delayed_m1_m3_retransmission -ap_wpa2_delayed_m1_m3_retransmission2 -ap_wpa2_delayed_group_m1_retransmission -ap_wpa2_delayed_group_m1_retransmission_igtk -ap_wpa2_delayed_m1_m3_zero_tk -ap_wpa2_plaintext_m1_m3 -ap_wpa2_plaintext_m1_m3_pmf -ap_wpa2_plaintext_m3 -ap_wpa2_plaintext_group_m1 -ap_wpa2_plaintext_group_m1_pmf -ap_wpa2_test_command_failures -ap_wpa2_gtk_initial_rsc_tkip -ap_wpa2_gtk_initial_rsc_ccmp -ap_wpa2_gtk_initial_rsc_ccmp_256 -ap_wpa2_gtk_initial_rsc_gcmp -ap_wpa2_gtk_initial_rsc_gcmp_256 -ap_wpa2_igtk_initial_rsc_aes_128_cmac -ap_wpa2_igtk_initial_rsc_bip_gmac_128 -ap_wpa2_igtk_initial_rsc_bip_gmac_256 -ap_wpa2_igtk_initial_rsc_bip_cmac_256 -ap_wpa2_psk -ap_wpa2_psk_file -ap_wpa2_psk_file_keyid -ap_wpa2_psk_mem -ap_wpa2_ptk_rekey -ap_wpa2_ptk_rekey_blocked_ap -ap_wpa2_ptk_rekey_blocked_sta -ap_wpa2_ptk_rekey_anonce -ap_wpa2_ptk_rekey_ap -ap_wpa2_sha256_ptk_rekey -ap_wpa2_sha256_ptk_rekey_ap -ap_wpa2_psk_file_errors -ap_wpa2_psk_wildcard_ssid -ap_wpa2_gtk_rekey -ap_wpa2_gtk_rekey_request -ap_wpa2_gtk_rekey_failure -ap_wpa2_gmk_rekey -ap_wpa2_strict_rekey -ap_wpa2_psk_ext -ap_wpa2_psk_unexpected -ap_wpa2_psk_ext_retry_msg_3 -ap_wpa2_psk_ext_retry_msg_3b -ap_wpa2_psk_ext_retry_msg_3c -ap_wpa2_psk_ext_retry_msg_3d -ap_wpa2_psk_ext_retry_msg_3e -ap_wpa2_psk_ext_delayed_ptk_rekey -ap_wpa2_psk_ext_eapol -ap_wpa2_psk_ext_eapol_retry1 -ap_wpa2_psk_ext_eapol_retry1b -ap_wpa2_psk_ext_eapol_retry1c -ap_wpa2_psk_ext_eapol_retry1d -ap_wpa2_psk_ext_eapol_type_diff -ap_wpa2_psk_ext_eapol_key_info -ap_wpa2_psk_wep -ap_wpa2_psk_ifdown -ap_wpa2_psk_drop_first_msg_4 -ap_wpa2_psk_disable_enable -ap_wpa2_psk_incorrect_passphrase -ap_wpa2_psk_no_random -ap_wpa2_psk_assoc_rsn -ap_wpa2_psk_ft_workaround -ap_wpa2_psk_assoc_rsn_pmkid -ap_wpa2_eapol_retry_limit -ap_wpa2_disable_eapol_retry -ap_wpa2_disable_eapol_retry_group -ap_wpa2_psk_mic_0 -ap_wpa2_psk_local_error -ap_wpa2_psk_inject_assoc -ap_wpa2_psk_no_control_port -ap_wpa2_psk_ap_control_port -ap_wpa2_psk_ap_control_port_disabled -ap_wpa2_psk_rsne_mismatch_ap -ap_wpa2_psk_rsne_mismatch_ap2 -ap_wpa2_psk_rsne_mismatch_ap3 -ap_wpa2_psk_rsnxe_mismatch_ap -ap_wpa2_psk_ext_key_id_ptk_rekey_ap0 -ap_wpa2_psk_ext_key_id_ptk_rekey_ap1 -ap_wpa2_psk_ext_key_id_ptk_rekey_ap2 -ap_wpa2_psk_ext_key_id_ptk_rekey_sta0 -ap_wpa2_psk_ext_key_id_ptk_rekey_sta1 -ap_wpa2_psk_ext_key_id_ptk_rekey_sta2 -ap_wpa2_eap_sim -ap_wpa2_eap_sim_sql -ap_wpa2_eap_sim_config -ap_wpa2_eap_sim_id_0 -ap_wpa2_eap_sim_id_1 -ap_wpa2_eap_sim_id_2 -ap_wpa2_eap_sim_id_3 -ap_wpa2_eap_sim_ext -ap_wpa2_eap_sim_ext_replace_sim -ap_wpa2_eap_sim_ext_replace_sim2 -ap_wpa2_eap_sim_ext_replace_sim3 -ap_wpa2_eap_sim_ext_auth_fail -ap_wpa2_eap_sim_change_bssid -ap_wpa2_eap_sim_no_change_set -ap_wpa2_eap_sim_ext_anonymous -ap_wpa2_eap_sim_ext_anonymous_no_pseudonym -ap_wpa2_eap_sim_oom -ap_wpa2_eap_aka -ap_wpa2_eap_aka_sql -ap_wpa2_eap_aka_config -ap_wpa2_eap_aka_ext -ap_wpa2_eap_aka_ext_auth_fail -ap_wpa2_eap_aka_prime -ap_wpa2_eap_aka_prime_sql -ap_wpa2_eap_aka_prime_ext_auth_fail -ap_wpa2_eap_aka_prime_ext -ap_wpa2_eap_ttls_invalid_phase2 -ap_wpa2_eap_ttls_eap_vendor -ap_wpa2_eap_fast_eap_sim -ap_wpa2_eap_fast_eap_aka -ap_wpa2_eap_peap_params -ap_wpa2_eap_peap_eap_gtc -ap_wpa2_eap_peap_eap_vendor -ap_wpa2_eap_ttls_server_cert_hash -ap_wpa2_eap_ttls_server_cert_hash_invalid -ap_wpa2_eap_pwd -ap_wpa2_eap_pwd_nthash -ap_wpa2_eap_pwd_salt_sha1 -ap_wpa2_eap_pwd_salt_sha256 -ap_wpa2_eap_pwd_salt_sha512 -ap_wpa2_eap_pwd_groups -ap_wpa2_eap_pwd_invalid_group -ap_wpa2_eap_pwd_disabled_group -ap_wpa2_eap_pwd_as_frag -ap_wpa2_eap_gpsk -ap_wpa2_eap_sake -ap_wpa2_eap_ikev2 -ap_wpa2_eap_ikev2_as_frag -ap_wpa2_eap_ikev2_oom -ap_wpa2_eap_pax -ap_wpa2_eap_psk -ap_wpa2_eap_psk_oom -ap_wpa2_eap_interactive -ap_wpa2_eap_ext_enable_network_while_connected -ap_wpa2_eap_vendor_test -ap_wpa2_eap_vendor_test_oom -ap_wpa2_eap_ttls_ocsp_revoked -ap_wpa2_eap_ttls_ocsp_unknown -ap_wpa2_eap_ttls_optional_ocsp_unknown -ap_wpa2_eap_ttls_long_duration -ap_wpa2_eap_ttls_server_cert_eku_client -ap_wpa2_eap_ttls_server_cert_eku_client_server -ap_wpa2_eap_ttls_dh_params -ap_wpa2_eap_ttls_dh_params_dsa -ap_wpa2_eap_ttls_dh_params_not_found -ap_wpa2_eap_ttls_dh_params_invalid -ap_wpa2_eap_ttls_dh_params_blob -ap_wpa2_eap_ttls_dh_params_server -ap_wpa2_eap_ttls_dh_params_dsa_server -ap_wpa2_eap_reauth -ap_wpa2_eap_reauth_ptk_rekey_blocked_sta -ap_wpa2_eap_request_identity_message -ap_wpa2_eap_sim_aka_result_ind -ap_wpa2_eap_sim_zero_db_timeout -ap_wpa2_eap_too_many_roundtrips -ap_wpa2_eap_too_many_roundtrips_server -ap_wpa2_eap_too_many_roundtrips_server2 -ap_wpa2_eap_expanded_nak -ap_wpa2_eap_sql -ap_wpa2_eap_non_ascii_identity -ap_wpa2_eap_non_ascii_identity2 -ap_wpa2_eap_unexpected_wep_eapol_key -ap_wpa2_eap_oom -ap_wpa2_eap_sim_db -ap_wpa2_eap_sim_db_sqlite -ap_wpa2_eap_assoc_rsn -ap_wpa2_eap_status -ap_wpa2_eap_gpsk_ptk_rekey_ap -ap_wpa2_eap_wildcard_ssid -ap_wpa2_eap_psk_mac_addr_change -ap_wpa2_eap_server_get_id -ap_wpa2_radius_server_get_id -ap_wpa2_eap_sake_no_control_port -ap_wpa2_tdls -ap_wpa2_tdls_concurrent_init -ap_wpa2_tdls_concurrent_init2 -ap_wpa2_tdls_decline_resp -ap_wpa2_tdls_long_lifetime -ap_wpa2_tdls_long_frame -ap_wpa2_tdls_reneg -ap_wpa2_tdls_wrong_lifetime_resp -ap_wpa2_tdls_diff_rsnie -ap_wpa2_tdls_wrong_tpk_m2_mic -ap_wpa2_tdls_wrong_tpk_m3_mic -ap_wpa2_tdls_double_tpk_m2 -ap_wpa2_tdls_responder_teardown diff --git a/.github/workflows/hostap-files/configs/hostap_2_10/wpa_supplicant.config b/.github/workflows/hostap-files/configs/hostap_2_10/wpa_supplicant.config deleted file mode 100644 index c123a98474..0000000000 --- a/.github/workflows/hostap-files/configs/hostap_2_10/wpa_supplicant.config +++ /dev/null @@ -1,163 +0,0 @@ -#CC=ccache gcc - -#CONFIG_TLS=openssl -CONFIG_TLS=wolfssl -#CONFIG_TLS=internal -#CONFIG_INTERNAL_LIBTOMMATH=y -#CONFIG_INTERNAL_LIBTOMMATH_FAST=y - -CONFIG_IEEE8021X_EAPOL=y - -CONFIG_ERP=y -CONFIG_EAP_MD5=y -CONFIG_MSCHAPV2=y -CONFIG_EAP_TLS=y -CONFIG_EAP_PEAP=y -CONFIG_EAP_TTLS=y -CONFIG_EAP_GTC=y -CONFIG_EAP_OTP=y -CONFIG_EAP_PSK=y -CONFIG_EAP_PAX=y -CONFIG_EAP_LEAP=y -CONFIG_EAP_SIM=y -CONFIG_EAP_AKA=y -CONFIG_EAP_AKA_PRIME=y -CONFIG_EAP_VENDOR_TEST=y -CONFIG_EAP_TLV=y -CONFIG_EAP_SAKE=y -CONFIG_EAP_GPSK=y -CONFIG_EAP_GPSK_SHA256=y -CONFIG_EAP_EKE=y -CONFIG_EAP_TNC=y -CFLAGS += -DTNC_CONFIG_FILE=\"tnc/tnc_config\" -LIBS += -rdynamic -CONFIG_EAP_FAST=y -#CONFIG_EAP_TEAP=y -CONFIG_EAP_IKEV2=y - -ifeq ($(CONFIG_TLS), wolfssl) -CONFIG_EAP_PWD=y -endif -ifeq ($(CONFIG_TLS), openssl) -CONFIG_EAP_PWD=y -endif - -CONFIG_USIM_SIMULATOR=y -CONFIG_SIM_SIMULATOR=y - -#CONFIG_PCSC=y -CONFIG_IPV6=y -CONFIG_DRIVER_NONE=y -CONFIG_PKCS12=y -CONFIG_CTRL_IFACE=unix - -CONFIG_WPA_CLI_EDIT=y - -CONFIG_OCSP=y - -#CONFIG_ELOOP_POLL=y - -CONFIG_CTRL_IFACE_DBUS_NEW=y -CONFIG_CTRL_IFACE_DBUS_INTRO=y - -CONFIG_IEEE80211R=y -CONFIG_IEEE80211AC=y -CONFIG_IEEE80211AX=y - -CONFIG_OCV=y - -CONFIG_DEBUG_FILE=y - -CONFIG_WPS=y -#CONFIG_WPS_STRICT=y -CONFIG_WPS_UPNP=y -CONFIG_WPS_NFC=y -CONFIG_WPS_ER=y -#CONFIG_WPS_REG_DISABLE_OPEN=y - -CONFIG_DRIVER_WEXT=y - -CONFIG_DRIVER_NL80211=y -CFLAGS += -I/usr/include/libnl3 -CONFIG_LIBNL32=y - -CONFIG_IBSS_RSN=y - -CONFIG_AP=y -CONFIG_MESH=y -CONFIG_P2P=y -CONFIG_WIFI_DISPLAY=y - -CONFIG_ACS=y - -CONFIG_BGSCAN_SIMPLE=y -CONFIG_BGSCAN_LEARN=y - -CONFIG_WPA_TRACE=y -CONFIG_WPA_TRACE_BFD=y - -CONFIG_TDLS=y -CONFIG_TDLS_TESTING=y -CONFIG_NO_RANDOM_POOL=y - -CONFIG_TLSV11=y -CONFIG_TLSV12=y - -CONFIG_HT_OVERRIDES=y -CONFIG_VHT_OVERRIDES=y -CONFIG_HE_OVERRIDES=y - -CONFIG_DEBUG_LINUX_TRACING=y - -CONFIG_INTERWORKING=y -CONFIG_HS20=y - -CONFIG_AUTOSCAN_EXPONENTIAL=y -CONFIG_AUTOSCAN_PERIODIC=y - -CONFIG_EXT_PASSWORD_TEST=y -CONFIG_EXT_PASSWORD_FILE=y - -CONFIG_EAP_UNAUTH_TLS=y - -CONFIG_SAE=y -#CONFIG_SAE_PK=y -CFLAGS += -DALL_DH_GROUPS - -CONFIG_WNM=y - -CONFIG_FST=y -CONFIG_FST_TEST=y - -CONFIG_TESTING_OPTIONS=y -CONFIG_MODULE_TESTS=y - -CONFIG_SUITEB=y - -# AddressSanitizer (ASan) can be enabled by uncommenting the following lines. -# This can be used as a more efficient memory error detector than valgrind -# (though, with still some CPU and memory cost, so VM cases will need more -# memory allocated for the guest). -#CFLAGS += -fsanitize=address -O1 -fno-omit-frame-pointer -g -#LIBS += -fsanitize=address -fno-omit-frame-pointer -g -#LIBS_c += -fsanitize=address -fno-omit-frame-pointer -g -#LIBS_p += -fsanitize=address -fno-omit-frame-pointer -g - -# Undefined Behavior Sanitizer (UBSan) can be enabled by uncommenting the -# following lines. -#CFLAGS += -Wno-format-nonliteral -#CFLAGS += -fsanitize=undefined -##CFLAGS += -fno-sanitize-recover -#LIBS += -fsanitize=undefined -##LIBS += -fno-sanitize-recover -#LIBS_c += -fsanitize=undefined -#LIBS_p += -fsanitize=undefined -CONFIG_MBO=y -CONFIG_FILS=y -CONFIG_FILS_SK_PFS=y -CONFIG_PMKSA_CACHE_EXTERNAL=y -CONFIG_OWE=y -#CONFIG_DPP=y -#CONFIG_DPP2=y -CONFIG_WEP=y -CONFIG_PASN=y diff --git a/.github/workflows/hostap-files/dbus-wpa_supplicant.conf b/.github/workflows/hostap-files/dbus-wpa_supplicant.conf deleted file mode 100644 index 4523237e18..0000000000 --- a/.github/workflows/hostap-files/dbus-wpa_supplicant.conf +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/.github/workflows/hostap.yml b/.github/workflows/hostap.yml deleted file mode 100644 index 92eddd9ecc..0000000000 --- a/.github/workflows/hostap.yml +++ /dev/null @@ -1,283 +0,0 @@ -name: hostap and wpa-supplicant Tests - -on: - workflow_call: - -jobs: - build_wolfssl: - strategy: - matrix: - include: - - build_id: hostap-build1 - wolf_extra_config: --disable-tls13 - - build_id: hostap-build2 - wolf_extra_config: --enable-brainpool --enable-wpas-dpp - name: Build wolfSSL - # Just to keep it the same as the testing target - runs-on: ubuntu-20.04 - # This should be a safe limit for the tests to run. - timeout-minutes: 4 - steps: - # No way to view the full strategy in the browser (really weird) - - name: Print strategy - run: | - cat <> $GITHUB_ENV - - - name: Build wolfSSL - uses: wolfSSL/actions-build-autotools-project@v1 - with: - path: wolfssl - configure: >- - --enable-wpas CFLAGS=-DWOLFSSL_STATIC_RSA - ${{ env.wolf_debug_flags }} ${{ matrix.wolf_extra_config }} - install: true - - - name: Upload built lib - uses: actions/upload-artifact@v3 - with: - name: ${{ matrix.build_id }} - path: build-dir - retention-days: 1 - - # Build wpa_supplicant with wolfSSL and hostapd with OpenSSL and interop. - hostap_test: - strategy: - fail-fast: false - matrix: - # should hostapd be compiled with wolfssl - hostapd: [true, false] - # should wpa_supplicant be compiled with wolfssl - wpa_supplicant: [true, false] - # Fix the versions of hostap and osp to not break testing when a new - # patch is added in to osp. hostap_cherry_pick is used to apply the - # commit that updates the certificates used for testing. Tests are read - # from the corresponding configs/hostap_ref/tests file. - config: [ - { - hostap_ref: hostap_2_10, - hostap_cherry_pick: 5679ec5c3dda25a0547a5f66407fd9b0b55fd04a, - remove_teap: true, - # TLS 1.3 does not work for this version - build_id: hostap-build1, - }, - # Test the dpp patch - { - hostap_ref: b607d2723e927a3446d89aed813f1aa6068186bb, - hostap_cherry_pick: 5679ec5c3dda25a0547a5f66407fd9b0b55fd04a, - osp_ref: ad5b52a49b3cc2a5bfb47ccc1d6a5137132e9446, - build_id: hostap-build2 - }, - ] - # parallelize the tests to be able to run all tests within 10 minutes - # Update the in the ./run-tests.py step when changing. - server: [1, 2, 3, 4, 5] - exclude: - # don't test openssl on both sides - - hostapd: false - wpa_supplicant: false - # no hostapd support for dpp yet - - hostapd: true - config: { - hostap_ref: b607d2723e927a3446d89aed813f1aa6068186bb, - osp_ref: ad5b52a49b3cc2a5bfb47ccc1d6a5137132e9446, - build_id: hostap-build2 - } - name: hwsim test - # For openssl 1.1 - runs-on: ubuntu-20.04 - # This should be a safe limit for the tests to run. - timeout-minutes: 12 - needs: build_wolfssl - steps: - # No way to view the full strategy in the browser (really weird) - - name: Print strategy - run: | - cat <> $GITHUB_ENV - echo Our job run ID is $SHA_SUM - - - name: Checkout wolfSSL - uses: actions/checkout@v3 - with: - path: wolfssl - - - name: Install dependencies - run: | - # Don't prompt for anything - export DEBIAN_FRONTEND=noninteractive - sudo apt-get update - # hostap dependencies - sudo apt-get install -y libpcap0.8 libpcap-dev curl libcurl4-openssl-dev \ - libnl-3-dev binutils-dev libssl-dev libiberty-dev libnl-genl-3-dev \ - libnl-route-3-dev libdbus-1-dev linux-modules-extra-`uname -r` \ - bridge-utils - sudo pip3 install pycryptodome - - - name: Enable mac80211 - run: | - sudo modprobe mac80211 - lsmod | grep mac80211 - - - if: ${{ runner.debug }} - name: Enable hostap debug logging - run: | - echo "hostap_debug_flags=-d" >> $GITHUB_ENV - - - name: Download lib - uses: actions/download-artifact@v3 - with: - name: ${{ matrix.config.build_id }} - path: build-dir - - - name: Setup d-bus - working-directory: wolfssl/.github/workflows/hostap-files - run: | - sudo cp dbus-wpa_supplicant.conf /usr/share/dbus-1/system.d/wpa_supplicant.conf - sudo service dbus reload - - # This is super hack-ish :P - # If you are trying to reproduce this on a more generic system, you can - # just run `sudo apt install linux-modules-extra-$(uname -r)` and - # this should have the module in the package. No need to compile it. - - name: Compile and install mac80211_hwsim - working-directory: wolfssl/.github/workflows/hostap-files - run: | - # The tag will be the first two numbers of from uname -r - LINUX_TAG=$(uname -r | grep -oP '^\d+\.\d+') - # Download the correct version of the driver - wget https://raw.githubusercontent.com/torvalds/linux/v$LINUX_TAG/drivers/net/wireless/mac80211_hwsim.c - wget https://raw.githubusercontent.com/torvalds/linux/v$LINUX_TAG/drivers/net/wireless/mac80211_hwsim.h - make - sudo make install - sudo modprobe mac80211_hwsim - lsmod | grep mac80211_hwsim - sudo rmmod mac80211_hwsim - - - name: Checkout hostap - uses: actions/checkout@v3 - with: - repository: julek-wolfssl/hostap-mirror - path: hostap - ref: ${{ matrix.config.hostap_ref }} - # necessary for cherry pick step - fetch-depth: 0 - - - if: ${{ matrix.config.hostap_cherry_pick }} - name: Cherry pick certificate update - working-directory: hostap - run: git cherry-pick -n -X theirs ${{ matrix.config.hostap_cherry_pick }} - - - if: ${{ matrix.config.osp_ref }} - name: Checkout OSP - uses: actions/checkout@v3 - with: - repository: wolfssl/osp - path: osp - ref: ${{ matrix.config.osp_ref }} - - - if: ${{ matrix.config.osp_ref }} - name: Apply patch files - working-directory: hostap - run: | - for f in $GITHUB_WORKSPACE/osp/hostap-patches/pending/* - do - patch -p1 < $f - done - - - if: ${{ matrix.hostapd }} - name: Setup hostapd config file - run: | - cp wolfssl/.github/workflows/hostap-files/configs/${{ matrix.config.hostap_ref }}/hostapd.config \ - hostap/hostapd/.config - cat <> hostap/hostapd/.config - CFLAGS += -I$GITHUB_WORKSPACE/build-dir/include -Wl,-rpath=$GITHUB_WORKSPACE/build-dir/lib - LIBS += -L$GITHUB_WORKSPACE/build-dir/lib -Wl,-rpath=$GITHUB_WORKSPACE/build-dir/lib - EOF - - - if: ${{ matrix.wpa_supplicant }} - name: Setup wpa_supplicant config file - run: | - cp wolfssl/.github/workflows/hostap-files/configs/${{ matrix.config.hostap_ref }}/wpa_supplicant.config \ - hostap/wpa_supplicant/.config - cat <> hostap/wpa_supplicant/.config - CFLAGS += -I$GITHUB_WORKSPACE/build-dir/include -Wl,-rpath=$GITHUB_WORKSPACE/build-dir/lib - LIBS += -L$GITHUB_WORKSPACE/build-dir/lib -Wl,-rpath=$GITHUB_WORKSPACE/build-dir/lib - EOF - - - name: Build hostap - working-directory: hostap/tests/hwsim/ - run: ./build.sh - - - if: ${{ matrix.hostapd }} - name: Confirm hostapd linking with wolfSSL - run: ldd hostap/hostapd/hostapd | grep wolfssl - - - if: ${{ matrix.wpa_supplicant }} - name: Confirm wpa_supplicant linking with wolfSSL - run: ldd hostap/wpa_supplicant/wpa_supplicant | grep wolfssl - - - if: ${{ matrix.config.remove_teap }} - name: Remove EAP-TEAP from test configuration - working-directory: hostap/tests/hwsim/auth_serv - run: | - sed -e 's/"erp-teap@example.com"\tTEAP//' -i eap_user.conf - sed -e 's/"erp-teap@example.com"\tMSCHAPV2\t"password"\t\[2\]//' -i eap_user.conf - sed -e 's/"TEAP"\t\tTEAP//' -i eap_user.conf - sed -e 's/TEAP,//' -i eap_user.conf - - - name: Run tests - id: testing - working-directory: hostap/tests/hwsim/ - run: | - # Run tests in increments of 50 to cut down on the uploaded log size. - while mapfile -t -n 50 ary && ((${#ary[@]})); do - TESTS=$(printf '%s\n' "${ary[@]}" | tr '\n' ' ') - # Retry up to three times - for i in {1..3}; do - HWSIM_RES=0 - # Logs can grow quickly especially in debug mode - sudo rm -rf logs - sudo ./start.sh - sudo ./run-tests.py ${{ env.hostap_debug_flags }} --split ${{ matrix.server }}/5 $TESTS || HWSIM_RES=$? - sudo ./stop.sh - if [ "$HWSIM_RES" -eq "0" ]; then - break - fi - done - echo "test ran $i times" - if [ "$HWSIM_RES" -ne "0" ]; then - exit $HWSIM_RES - fi - done < $GITHUB_WORKSPACE/wolfssl/.github/workflows/hostap-files/configs/${{ matrix.config.hostap_ref }}/tests - - - name: Change failure log permissions - if: ${{ failure() && steps.testing.outcome == 'failure' }} - working-directory: hostap/tests/hwsim/ - run: | - sudo chown -R $USER:$USER logs - zip -9 -r logs.zip logs/current - - - name: Upload failure logs - if: ${{ failure() && steps.testing.outcome == 'failure' }} - uses: actions/upload-artifact@v3 - with: - name: hostap-logs-${{ env.our_job_run_id }} - path: hostap/tests/hwsim/logs.zip - retention-days: 5 - diff --git a/.github/workflows/krb5.yml b/.github/workflows/krb5.yml deleted file mode 100644 index f03237c857..0000000000 --- a/.github/workflows/krb5.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Kerberos 5 Tests - -on: - workflow_call: - -jobs: - build_wolfssl: - name: Build wolfSSL - # Just to keep it the same as the testing target - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 5 - steps: - - name: Build wolfSSL - uses: wolfSSL/actions-build-autotools-project@v1 - with: - path: wolfssl - configure: --enable-krb CFLAGS='-fsanitize=address' - install: true - - - name: Upload built lib - uses: actions/upload-artifact@v3 - with: - name: wolf-install-krb5 - path: build-dir - retention-days: 1 - - krb5_check: - strategy: - fail-fast: false - matrix: - # List of releases to test - ref: [ 1.21.1 ] - name: ${{ matrix.ref }} - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 8 - needs: build_wolfssl - steps: - - name: Download lib - uses: actions/download-artifact@v3 - with: - name: wolf-install-krb5 - path: build-dir - - - name: Checkout OSP - uses: actions/checkout@v3 - with: - repository: wolfssl/osp - path: osp - - - name: Checkout krb5 - uses: actions/checkout@v3 - with: - repository: krb5/krb5 - ref: krb5-${{ matrix.ref }}-final - path: krb5 - - - name: Apply patch - working-directory: ./krb5 - run: | - patch -p1 < $GITHUB_WORKSPACE/osp/krb5/Patch-for-Kerberos-5-${{ matrix.ref }}.patch - - - name: Build krb5 - working-directory: ./krb5/src - run: | - autoreconf -ivf - # Using rpath because LD_LIBRARY_PATH is overwritten during testing - export WOLFSSL_CFLAGS="-I$GITHUB_WORKSPACE/build-dir/include -I$GITHUB_WORKSPACE/build-dir/include/wolfssl -Wl,-rpath=$GITHUB_WORKSPACE/build-dir/lib" - export WOLFSSL_LIBS="-lwolfssl -L$GITHUB_WORKSPACE/build-dir/lib -Wl,-rpath=$GITHUB_WORKSPACE/build-dir/lib" - ./configure --with-crypto-impl=wolfssl --with-tls-impl=wolfssl --disable-pkinit \ - CFLAGS='-fsanitize=address' LDFLAGS='-fsanitize=address' - CFLAGS='-fsanitize=address' LDFLAGS='-fsanitize=address' make -j - - - name: Run tests - working-directory: ./krb5/src - run: | - CFLAGS='-fsanitize=address' LDFLAGS='-fsanitize=address' make -j check - diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index dd550a9c87..0000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: CI -concurrency: - group: ${{ github.ref }} - cancel-in-progress: true - -on: - push: - branches: [ 'master', 'main', 'release/**' ] - pull_request: - branches: [ '*' ] - -jobs: - espressif: - uses: ./.github/workflows/docker-Espressif.yml - multi-compiler: - uses: ./.github/workflows/multi-compiler.yml - openwrt: - uses: ./.github/workflows/docker-OpenWrt.yml - os-check: - uses: ./.github/workflows/os-check.yml - async: - uses: ./.github/workflows/async.yml - stunnel: - uses: ./.github/workflows/stunnel.yml - openvpn: - uses: ./.github/workflows/openvpn.yml - hostap: - uses: ./.github/workflows/hostap.yml - nginx: - uses: ./.github/workflows/nginx.yml - zephyr: - uses: ./.github/workflows/zephyr.yml - hitch: - uses: ./.github/workflows/hitch.yml - curl: - uses: ./.github/workflows/curl.yml - krb5: - uses: ./.github/workflows/krb5.yml -# TODO: Currently this test fails. Enable it once it becomes passing. -# haproxy: -# uses: ./.github/workflows/haproxy.yml diff --git a/.github/workflows/multi-compiler.yml b/.github/workflows/multi-compiler.yml deleted file mode 100644 index 60feb3b417..0000000000 --- a/.github/workflows/multi-compiler.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Multiple compilers and versions - -on: - workflow_call: - -jobs: - my_matrix: - name: Compiler test - strategy: - fail-fast: false - matrix: - include: - - CC: gcc-9 - CXX: g++-9 - - CC: gcc-10 - CXX: g++-10 - - CC: gcc-11 - CXX: g++-11 - - CC: gcc-12 - CXX: g++-12 - - CC: clang-12 - CXX: clang++-12 - - CC: clang-13 - CXX: clang++-13 - - CC: clang-14 - CXX: clang++-14 - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 2 - steps: - - uses: actions/checkout@v3 - - name: Build - env: - CC: ${{ matrix.CC }} - CXX: ${{ matrix.CXX }} - run: ./autogen.sh && ./configure && make && make dist diff --git a/.github/workflows/nginx.yml b/.github/workflows/nginx.yml deleted file mode 100644 index 7fc50b2e88..0000000000 --- a/.github/workflows/nginx.yml +++ /dev/null @@ -1,179 +0,0 @@ -name: nginx Tests - -on: - workflow_call: - -jobs: - build_wolfssl: - name: Build wolfSSL - # Just to keep it the same as the testing target - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 4 - steps: - - if: ${{ runner.debug }} - name: Enable wolfSSL debug logging - run: | - # We don't use --enable-debug since it makes the logs too loud - echo "wolf_debug_flags= CFLAGS='-g3 -O0'" >> $GITHUB_ENV - - - name: Build wolfSSL - uses: wolfSSL/actions-build-autotools-project@v1 - with: - path: wolfssl - configure: --enable-nginx ${{ env.wolf_debug_flags }} - install: true - - - name: Upload built lib - uses: actions/upload-artifact@v3 - with: - name: wolf-install-nginx - path: build-dir - retention-days: 1 - - nginx_check: - strategy: - fail-fast: false - matrix: - include: - # in general we want to pass all tests that match *ssl* - - ref: 1.25.0 - test-ref: 5b2894ea1afd01a26c589ce11f310df118e42592 - # Following tests pass with sanitizer on - sanitize-ok: >- - h2_ssl_proxy_cache.t h2_ssl.t h2_ssl_variables.t h2_ssl_verify_client.t - mail_imap_ssl.t mail_ssl_conf_command.t mail_ssl_session_reuse.t - mail_ssl.t proxy_ssl_certificate_empty.t proxy_ssl_certificate.t - proxy_ssl_certificate_vars.t proxy_ssl_conf_command.t proxy_ssl_name.t - ssl_certificate_chain.t ssl_certificate_perl.t ssl_certificates.t - ssl_certificate.t ssl_client_escaped_cert.t ssl_conf_command.t - ssl_crl.t ssl_curve.t ssl_engine_keys.t ssl_ocsp.t ssl_password_file.t - ssl_proxy_protocol.t ssl_proxy_upgrade.t ssl_reject_handshake.t - ssl_session_reuse.t ssl_session_ticket_key.t ssl_sni_reneg.t - ssl_sni_sessions.t ssl_sni.t ssl_stapling.t ssl.t ssl_verify_client.t - ssl_verify_depth.t stream_proxy_ssl_certificate.t stream_proxy_ssl_certificate_vars.t - stream_proxy_ssl_conf_command.t stream_proxy_ssl_name_complex.t - stream_proxy_ssl_name.t stream_ssl_certificate.t stream_ssl_conf_command.t - stream_ssl_preread_alpn.t stream_ssl_preread_protocol.t stream_ssl_preread.t - stream_ssl_realip.t stream_ssl_session_reuse.t stream_ssl.t stream_ssl_variables.t - stream_ssl_verify_client.t stream_upstream_zone_ssl.t upstream_zone_ssl.t - uwsgi_ssl_certificate.t uwsgi_ssl_certificate_vars.t uwsgi_ssl.t - uwsgi_ssl_verify.t - # Following tests do not pass with sanitizer on (with OpenSSL too) - sanitize-not-ok: >- - grpc_ssl.t h2_proxy_request_buffering_ssl.t h2_proxy_ssl.t - proxy_request_buffering_ssl.t proxy_ssl_keepalive.t proxy_ssl.t - proxy_ssl_verify.t stream_proxy_protocol_ssl.t stream_proxy_ssl.t - stream_proxy_ssl_verify.t stream_ssl_alpn.t - name: ${{ matrix.ref }} - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 6 - needs: build_wolfssl - steps: - - name: Download lib - uses: actions/download-artifact@v3 - with: - name: wolf-install-nginx - path: build-dir - - - name: Install dependencies - run: | - sudo cpan -iT Proc::Find Net::SSLeay IO::Socket::SSL - - - name: Checkout wolfssl-nginx - uses: actions/checkout@v3 - with: - repository: wolfssl/wolfssl-nginx - path: wolfssl-nginx - - - name: Checkout nginx - uses: actions/checkout@v3 - with: - repository: nginx/nginx - path: nginx - ref: release-${{ matrix.ref }} - - - name: Apply nginx patch - working-directory: nginx - run: patch -p1 < ../wolfssl-nginx/nginx-${{ matrix.ref }}-wolfssl.patch - - - if: ${{ runner.debug }} - name: Apply nginx debug patch - working-directory: nginx - run: patch -p1 < ../wolfssl-nginx/nginx-${{ matrix.ref }}-wolfssl-debug.patch - - - name: Checkout nginx-tests - uses: actions/checkout@v3 - with: - repository: nginx/nginx-tests - path: nginx-tests - ref: ${{ matrix.test-ref }} - - - name: Apply nginx-tests patch - working-directory: nginx-tests - run: patch -p1 < ../wolfssl-nginx/nginx-tests-patches/*${{ matrix.test-ref }}.patch - - - name: Build nginx without sanitizer - working-directory: nginx - run: | - ./auto/configure --with-wolfssl=$GITHUB_WORKSPACE/build-dir --with-http_ssl_module \ - --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module \ - --with-http_v2_module --with-mail --with-mail_ssl_module - make -j - - - name: Confirm nginx built with wolfSSL - working-directory: nginx - run: ldd objs/nginx | grep wolfssl - - - if: ${{ runner.debug }} - name: Run nginx-tests without sanitizer (debug) - working-directory: nginx-tests - run: | - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib \ - TMPDIR=$GITHUB_WORKSPACE TEST_NGINX_VERBOSE=y TEST_NGINX_CATLOG=y \ - TEST_NGINX_BINARY=../nginx/objs/nginx prove -v ${{ matrix.sanitize-not-ok }} - - - if: ${{ !runner.debug }} - name: Run nginx-tests without sanitizer - working-directory: nginx-tests - run: | - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib \ - TMPDIR=$GITHUB_WORKSPACE TEST_NGINX_BINARY=../nginx/objs/nginx \ - prove ${{ matrix.sanitize-not-ok }} - - - if: ${{ runner.debug }} - name: Enable wolfSSL debug logging - run: | - echo "nginx_c_flags=-O0" >> $GITHUB_ENV - - - name: Build nginx with sanitizer - working-directory: nginx - run: | - ./auto/configure --with-wolfssl=$GITHUB_WORKSPACE/build-dir --with-http_ssl_module \ - --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module \ - --with-http_v2_module --with-mail --with-mail_ssl_module \ - --with-cc-opt='-fsanitize=address -DNGX_DEBUG_PALLOC=1 -g3 ${{ env.nginx_c_flags }}' \ - --with-ld-opt='-fsanitize=address ${{ env.nginx_c_flags }}' - make -j - - - name: Confirm nginx built with wolfSSL - working-directory: nginx - run: ldd objs/nginx | grep wolfssl - - - if: ${{ runner.debug }} - name: Run nginx-tests with sanitizer (debug) - working-directory: nginx-tests - run: | - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib \ - TMPDIR=$GITHUB_WORKSPACE TEST_NGINX_VERBOSE=y TEST_NGINX_CATLOG=y \ - TEST_NGINX_BINARY=../nginx/objs/nginx prove -v ${{ matrix.sanitize-ok }} - - - if: ${{ !runner.debug }} - name: Run nginx-tests with sanitizer - working-directory: nginx-tests - run: | - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib \ - TMPDIR=$GITHUB_WORKSPACE TEST_NGINX_BINARY=../nginx/objs/nginx \ - prove ${{ matrix.sanitize-ok }} - \ No newline at end of file diff --git a/.github/workflows/openvpn.yml b/.github/workflows/openvpn.yml deleted file mode 100644 index 10f206ff6f..0000000000 --- a/.github/workflows/openvpn.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: OpenVPN Tests - -on: - workflow_call: - -jobs: - build_wolfssl: - name: Build wolfSSL - # Just to keep it the same as the testing target - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 4 - steps: - - name: Build wolfSSL - uses: wolfSSL/actions-build-autotools-project@v1 - with: - path: wolfssl - configure: --enable-openvpn - install: true - - - name: Upload built lib - uses: actions/upload-artifact@v3 - with: - name: wolf-install-openvpn - path: build-dir - retention-days: 1 - - openvpn_check: - strategy: - fail-fast: false - matrix: - # List of refs to test - ref: [ master, release/2.6, v2.6.0 ] - name: ${{ matrix.ref }} - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 6 - needs: build_wolfssl - steps: - - name: Download lib - uses: actions/download-artifact@v3 - with: - name: wolf-install-openvpn - path: build-dir - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install liblzo2-dev libpam0g-dev liblz4-dev libcap-ng-dev \ - linux-libc-dev man2html libcmocka-dev python3-docutils \ - libtool automake autoconf libnl-genl-3-dev libnl-genl-3-200 - - - if: ${{ matrix.ref != 'master' }} - name: Build and test openvpn with fsanitize - run: | - echo 'extra_c_flags=CFLAGS="-fsanitize=address -fno-omit-frame-pointer -O2"' >> $GITHUB_ENV - - - name: Build and test openvpn - uses: wolfSSL/actions-build-autotools-project@v1 - with: - repository: OpenVPN/openvpn - ref: ${{ matrix.ref }} - path: openvpn - configure: >- - --with-crypto-library=wolfssl - WOLFSSL_CFLAGS="-I$GITHUB_WORKSPACE/build-dir/include/ -I$GITHUB_WORKSPACE/build-dir/include/wolfssl" - WOLFSSL_LIBS="-L$GITHUB_WORKSPACE/build-dir/lib -lwolfssl" - ${{ env.extra_c_flags }} - check: true - - - name: Confirm OpenVPN built with wolfSSL - working-directory: ./openvpn - run: ldd src/openvpn/openvpn | grep wolfssl diff --git a/.github/workflows/os-check.yml b/.github/workflows/os-check.yml deleted file mode 100644 index b2183111e3..0000000000 --- a/.github/workflows/os-check.yml +++ /dev/null @@ -1,132 +0,0 @@ -name: Ubuntu-Macos-Windows Tests - -on: - workflow_call: - -jobs: - make_check: - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, macos-latest ] - config: [ - # Add new configs here - '', - '--enable-all --enable-asn=template', - '--enable-all --enable-asn=original', - '--enable-harden-tls', - '--enable-tls13 --enable-session-ticket --enable-dtls --enable-dtls13 - --enable-opensslextra --enable-sessioncerts - CPPFLAGS=''-DWOLFSSL_DTLS_NO_HVR_ON_RESUME -DHAVE_EXT_CACHE - -DWOLFSSL_TICKET_HAVE_ID -DHAVE_EX_DATA -DSESSION_CACHE_DYNAMIC_MEM'' ', - ] - name: make check - runs-on: ${{ matrix.os }} - # This should be a safe limit for the tests to run. - timeout-minutes: 8 - steps: - - name: Build and test wolfSSL - uses: wolfSSL/actions-build-autotools-project@v1 - with: - configure: ${{ matrix.config }} - check: true - - make_user_settings: - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, macos-latest ] - user-settings: [ - # Add new user_settings.h here - 'examples/configs/user_settings_all.h', - ] - name: make user_setting.h - runs-on: ${{ matrix.os }} - # This should be a safe limit for the tests to run. - timeout-minutes: 6 - steps: - - name: Build and test wolfSSL - uses: wolfSSL/actions-build-autotools-project@v1 - with: - configure: --enable-usersettings - check: true - user-settings: ${{ matrix.user-settings }} - - make_user_settings_testwolfcrypt: - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, macos-latest ] - user-settings: [ - # Add new user_settings.h here - 'examples/configs/user_settings_min_ecc.h', - 'examples/configs/user_settings_wolfboot_keytools.h', - 'examples/configs/user_settings_wolftpm.h', - ] - name: make user_setting.h (testwolfcrypt only) - runs-on: ${{ matrix.os }} - # This should be a safe limit for the tests to run. - timeout-minutes: 4 - steps: - - name: Build and test wolfSSL - uses: wolfSSL/actions-build-autotools-project@v1 - with: - configure: --enable-usersettings --disable-examples - check: false - user-settings: ${{ matrix.user-settings }} - - - name: Run wolfcrypt/test/testwolfcrypt - run: ./wolfcrypt/test/testwolfcrypt - - # Has to be dedicated function due to the sed call - make_user_all: - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, macos-latest ] - name: make user_setting.h (with sed) - runs-on: ${{ matrix.os }} - # This should be a safe limit for the tests to run. - timeout-minutes: 8 - steps: - - uses: actions/checkout@v3 - - if: ${{ matrix.os == 'macos-latest' }} - run: brew install automake libtool - - run: ./autogen.sh - - name: user_settings_all.h with compatibility layer - run: | - cp ./examples/configs/user_settings_all.h user_settings.h - sed -i -e "s/if 0/if 1/" user_settings.h - ./configure --enable-usersettings - make - make check - - windows_build: - name: Windows Build Test - runs-on: windows-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 6 - env: - # Path to the solution file relative to the root of the project. - SOLUTION_FILE_PATH: wolfssl64.sln - - # Configuration type to build. - # You can convert this to a build matrix if you need coverage of multiple configuration types. - # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - BUILD_CONFIGURATION: Release - BUILD_PLATFORM: x64 - steps: - - uses: actions/checkout@v3 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1 - - - name: Restore NuGet packages - working-directory: ${{env.GITHUB_WORKSPACE}} - run: nuget restore ${{env.SOLUTION_FILE_PATH}} - - - name: Build - working-directory: ${{env.GITHUB_WORKSPACE}} - # Add additional options to the MSBuild command line here (like platform or verbosity level). - # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference - run: msbuild /m /p:PlatformToolset=v142 /p:Platform=${{env.BUILD_PLATFORM}} /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} diff --git a/.github/workflows/stunnel.yml b/.github/workflows/stunnel.yml deleted file mode 100644 index ac25126d56..0000000000 --- a/.github/workflows/stunnel.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: stunnel Tests - -on: - workflow_call: - -jobs: - build_wolfssl: - name: Build wolfSSL - # Just to keep it the same as the testing target - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 4 - steps: - - name: Build wolfSSL - uses: wolfSSL/actions-build-autotools-project@v1 - with: - path: wolfssl - configure: --enable-stunnel - install: true - - - name: Upload built lib - uses: actions/upload-artifact@v3 - with: - name: wolf-install-stunnel - path: build-dir - retention-days: 1 - - stunnel_check: - strategy: - fail-fast: false - matrix: - # List of releases to test - ref: [ 5.67 ] - name: ${{ matrix.ref }} - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 4 - needs: build_wolfssl - steps: - - name: Download lib - uses: actions/download-artifact@v3 - with: - name: wolf-install-stunnel - path: build-dir - - - name: Checkout OSP - uses: actions/checkout@v3 - with: - repository: wolfssl/osp - path: osp - - - name: Build and test stunnel - uses: wolfSSL/actions-build-autotools-project@v1 - with: - repository: mtrojnar/stunnel - ref: stunnel-${{ matrix.ref }} - path: stunnel - patch-file: $GITHUB_WORKSPACE/osp/stunnel/${{ matrix.ref }}/stunnel-${{ matrix.ref }}.patch - configure: --enable-wolfssl SSLDIR=$GITHUB_WORKSPACE/build-dir - check: true - - - name: Confirm stunnel built with wolfSSL - working-directory: ./stunnel - run: ldd src/stunnel | grep wolfssl - diff --git a/.github/workflows/zephyr.yml b/.github/workflows/zephyr.yml deleted file mode 100644 index 3f00ed221e..0000000000 --- a/.github/workflows/zephyr.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Zephyr tests - -on: - workflow_call: - -jobs: - run_test: - name: Build and run - runs-on: ubuntu-latest - # This should be a safe limit for the tests to run. - timeout-minutes: 15 - steps: - - name: Install dependencies - run: | - # Don't prompt for anything - export DEBIAN_FRONTEND=noninteractive - sudo apt-get update - # most of the ci-base zephyr docker image packages - sudo apt-get install -y zip bridge-utils uml-utilities \ - git cmake ninja-build gperf ccache dfu-util device-tree-compiler wget \ - python3-dev python3-pip python3-setuptools python3-tk python3-wheel xz-utils file \ - make gcc gcc-multilib g++-multilib libsdl2-dev libmagic1 \ - autoconf automake bison build-essential ca-certificates cargo ccache chrpath cmake \ - cpio device-tree-compiler dfu-util diffstat dos2unix doxygen file flex g++ gawk gcc \ - gcovr git git-core gnupg gperf gtk-sharp2 help2man iproute2 lcov libcairo2-dev \ - libglib2.0-dev libgtk2.0-0 liblocale-gettext-perl libncurses5-dev libpcap-dev \ - libpopt0 libsdl1.2-dev libsdl2-dev libssl-dev libtool libtool-bin locales make \ - net-tools ninja-build openssh-client parallel pkg-config python3-dev python3-pip \ - python3-ply python3-setuptools python-is-python3 qemu rsync socat srecord sudo \ - texinfo unzip wget ovmf xz-utils - - - name: Install west - run: sudo pip install west - - - name: Init west workspace - run: west init zephyr - - - name: Update west.yml - working-directory: zephyr/zephyr - run: | - REF=$(echo '${{ github.ref }}' | sed -e 's/\//\\\//g') - sed -e 's/remotes:/remotes:\n \- name: wolfssl\n url\-base: https:\/\/github.com\/${{ github.repository_owner }}/' -i west.yml - sed -e "s/projects:/projects:\n \- name: wolfssl\n path: modules\/crypto\/wolfssl\n remote: wolfssl\n revision: $REF/" -i west.yml - - - name: Update west workspace - working-directory: zephyr - run: west update -n -o=--depth=1 - - - name: Export zephyr - working-directory: zephyr - run: west zephyr-export - - - name: Install pip dependencies - working-directory: zephyr - run: sudo pip install -r zephyr/scripts/requirements.txt - - - name: Install zephyr SDK - run: | - wget -q https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.1/zephyr-sdk-0.16.1_linux-x86_64.tar.xz - tar xf zephyr-sdk-0.16.1_linux-x86_64.tar.xz - cd zephyr-sdk-0.16.1 - ./setup.sh -h -c - - - name: Run wolfssl test - id: wolfssl-test - working-directory: zephyr - run: | - ./zephyr/scripts/twister --testsuite-root modules/crypto/wolfssl --test zephyr/samples/wolfssl_test/sample.crypto.wolfssl_test -vvv - rm -rf zephyr/twister-out - - - name: Run wolfssl TLS sock test - id: wolfssl-tls-sock - working-directory: zephyr - run: | - ./zephyr/scripts/twister --testsuite-root modules/crypto/wolfssl --test zephyr/samples/wolfssl_tls_sock/sample.crypto.wolfssl_tls_sock -vvv - rm -rf zephyr/twister-out - - - name: Run wolfssl TLS thread test - id: wolfssl-tls-thread - working-directory: zephyr - run: | - ./zephyr/scripts/twister --testsuite-root modules/crypto/wolfssl --test zephyr/samples/wolfssl_tls_thread/sample.crypto.wolfssl_tls_thread -vvv - rm -rf zephyr/twister-out - - - name: Zip failure logs - if: ${{ failure() && (steps.wolfssl-test.outcome == 'failure' || steps.wolfssl-tls-sock.outcome == 'failure' || steps.wolfssl-tls-thread.outcome == 'failure') }} - run: | - zip -9 -r logs.zip zephyr/twister-out - - - name: Upload failure logs - if: ${{ failure() && (steps.wolfssl-test.outcome == 'failure' || steps.wolfssl-tls-sock.outcome == 'failure' || steps.wolfssl-tls-thread.outcome == 'failure') }} - uses: actions/upload-artifact@v3 - with: - name: zephyr-client-test-logs - path: logs.zip - retention-days: 5 From e4a2da9062d3b293698db9b7a818da299bda4b34 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 2 Aug 2023 16:10:46 -0400 Subject: [PATCH 06/89] Small change in workflow --- .github/workflows/codesonar.yaml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml index 1f8730a9ce..4f4bb9c6d2 100644 --- a/.github/workflows/codesonar.yaml +++ b/.github/workflows/codesonar.yaml @@ -5,8 +5,8 @@ on: - 'release/**' # Feature Branches pull_request: branches: - - 'release/**' - + - 'release/**' + jobs: CodeSonar_Analyze: permissions: write-all @@ -17,20 +17,20 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} env: - GITHUB_CAFILE: ".github/github.cert.pem" + GITHUB_CAFILE: ".github/github.cert.pem" GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GITHUB_API_URL: https://api.github.com PULL_REQUEST_ID: ${{ github.event.pull_request.number }} - ROOT_TREE: "Mark/WOLFSSL" + ROOT_TREE: "Mark/WOLFSSL" ROOT_PROJECT_NAME: "wolfssl" - BRANCH: ${{ github.head_ref || github.ref_name }} - CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" + BRANCH: ${{ github.head_ref || github.ref_name }} + CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" CSONAR_HUB_USER: "${{ secrets.CSONAR_HUB_USER }}" CSONAR_HUB_PASS: "${{ secrets.CSONAR_HUB_PASS }}" CSONAR_HUB_PWFILE: "codesonar.hub.pwfile" CODESONAR: /opt/codesonar/codesonar/bin/codesonar CSPYTHON: /opt/codesonar/codesonar/bin/cspython - CSO_GITHUB: /opt/codesonar-github + CSO_GITHUB: /opt/codesonar-github GITHUB_REPO_URL: "http://github.com/markhermeling/nginx" # the github.repositoryUrl is not an http-link. TARGET: none DIFFLINK: none @@ -43,7 +43,7 @@ jobs: - name: Pull Request or Not? if: ${{ github.event.pull_request }} run: echo "TARGET=${{ github.base_ref }}" >> $GITHUB_ENV - - name: Checkout + - name: Checkout uses: actions/checkout@v3 - name: Safe directory run: git config --global --add safe.directory `pwd` @@ -61,7 +61,7 @@ jobs: -auth password \ -hubuser "$CSONAR_HUB_USER" \ -hubpwfile "$CSONAR_HUB_PWFILE" \ - $CSONAR_HUB_URL/analysis_search.csv?sanlgrid_json=$GETURL\&query=$GETURL2 -o - | tail -1 > result + $CSONAR_HUB_URL/analysis_search.csv?sanlgrid_json=$GETURL\&query=$GETURL2 -o - | tail -1 > result echo "TARGET_PROJECT_AID=`cat result`" >> $GITHUB_ENV - name: Build run: > @@ -87,7 +87,7 @@ jobs: -auth password \ -hubuser "$CSONAR_HUB_USER" \ -hubpwfile "$CSONAR_HUB_PWFILE" \ - $CSONAR_HUB_URL/analysis_search.csv?sanlgrid_json=$GETURL\&query=$GETURL2 -o - | tail -1 > result + $CSONAR_HUB_URL/analysis_search.csv?sanlgrid_json=$GETURL\&query=$GETURL2 -o - | tail -1 > result echo "TARGET_PROJECT_AID=`cat result`" >> $GITHUB_ENV # second get the ID of the current analysis echo "CURRENT_PROJECT_AID=`cat $ROOT_PROJECT_NAME.prj_files/aid.txt`" >> $GITHUB_ENV @@ -144,4 +144,5 @@ jobs: ${{ github.repository }} $PULL_REQUEST_ID GITHUB_TOKEN - + + From ad549f7a90d3799fa1acb6e46d3cec5e35eb38d8 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 2 Aug 2023 16:15:49 -0400 Subject: [PATCH 07/89] Fix access to the CodeSonar conf-file --- .github/workflows/codesonar.yaml | 4 ++-- codesonar.conf | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 codesonar.conf diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml index 4f4bb9c6d2..77eefcb279 100644 --- a/.github/workflows/codesonar.yaml +++ b/.github/workflows/codesonar.yaml @@ -74,7 +74,7 @@ jobs: -hubpwfile "$CSONAR_HUB_PWFILE" -project "$PROJECT_NAME" -name $NAME - -conf-file conf/codesonar-release.conf + -conf-file codesonar.conf "$CSONAR_HUB_URL" make -j $PARALLEL - name: Get id of the analysis @@ -113,7 +113,7 @@ jobs: -property target.branch $TARGET -property target.diff_link $DIFFLINK -name $NAME - -conf-file conf/codesonar-release.conf + -conf-file codesonar.conf "$CSONAR_HUB_URL" - name: Diff results with the target branch if: ${{ github.event.pull_request }} diff --git a/codesonar.conf b/codesonar.conf new file mode 100644 index 0000000000..2cbe667446 --- /dev/null +++ b/codesonar.conf @@ -0,0 +1 @@ +# Empty configuration file for now From d4b15fa67bca416adfc302dcfad144670d748f4a Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Fri, 11 Aug 2023 11:34:22 -0700 Subject: [PATCH 08/89] Remove warning class --- codesonar.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/codesonar.conf b/codesonar.conf index 2cbe667446..424844b7e1 100644 --- a/codesonar.conf +++ b/codesonar.conf @@ -1 +1,2 @@ # Empty configuration file for now +WARNING_FILTER += discard class="Null Test After Dereference" From 13680f05fa8961733dccf4084c3105021f98ca41 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Mon, 4 Sep 2023 20:47:24 +1000 Subject: [PATCH 09/89] Curve25519/Ed25519: align buffers Make data structures align buffers. Align buffers in functions. --- tests/api.c | 47 +- wolfcrypt/src/asn.c | 4 +- wolfcrypt/src/curve25519.c | 11 +- wolfcrypt/src/ed25519.c | 16 +- wolfcrypt/src/ge_operations.c | 10 +- wolfcrypt/src/port/arm/armv8-32-aes-asm.S | 48 +- wolfcrypt/src/port/arm/armv8-32-aes-asm_c.c | 48 +- wolfcrypt/src/port/arm/armv8-32-curve25519.S | 536 ++++-------------- .../src/port/arm/armv8-32-curve25519_c.c | 530 ++++------------- wolfcrypt/src/port/arm/thumb2-curve25519.S | 55 +- wolfcrypt/src/port/arm/thumb2-curve25519_c.c | 49 +- wolfcrypt/src/port/arm/thumb2-sha256-asm.S | 26 +- wolfcrypt/src/port/arm/thumb2-sha256-asm_c.c | 24 +- wolfssl/wolfcrypt/curve25519.h | 8 +- wolfssl/wolfcrypt/ed25519.h | 8 +- wolfssl/wolfcrypt/ge_operations.h | 10 +- 16 files changed, 463 insertions(+), 967 deletions(-) diff --git a/tests/api.c b/tests/api.c index a46feb7568..f53c50ba43 100644 --- a/tests/api.c +++ b/tests/api.c @@ -12494,6 +12494,7 @@ static int test_wc_Sha256Update(void) #ifndef NO_SHA256 wc_Sha256 sha256; byte hash[WC_SHA256_DIGEST_SIZE]; + byte hash_unaligned[WC_SHA256_DIGEST_SIZE+1]; testVector a, b, c; ExpectIntEQ(wc_InitSha256(&sha256), 0); @@ -12517,6 +12518,11 @@ static int test_wc_Sha256Update(void) ExpectIntEQ(wc_Sha256Final(&sha256, hash), 0); ExpectIntEQ(XMEMCMP(hash, a.output, WC_SHA256_DIGEST_SIZE), 0); + /* Unaligned check. */ + ExpectIntEQ(wc_Sha256Update(&sha256, (byte*)a.input+1, (word32)a.inLen-1), + 0); + ExpectIntEQ(wc_Sha256Final(&sha256, hash_unaligned + 1), 0); + /* Try passing in bad values */ b.input = NULL; b.inLen = 0; @@ -12721,6 +12727,7 @@ static int test_wc_Sha512Update(void) #ifdef WOLFSSL_SHA512 wc_Sha512 sha512; byte hash[WC_SHA512_DIGEST_SIZE]; + byte hash_unaligned[WC_SHA512_DIGEST_SIZE + 1]; testVector a, b, c; ExpectIntEQ(wc_InitSha512(&sha512), 0); @@ -12747,6 +12754,11 @@ static int test_wc_Sha512Update(void) ExpectIntEQ(XMEMCMP(hash, a.output, WC_SHA512_DIGEST_SIZE), 0); + /* Unaligned check. */ + ExpectIntEQ(wc_Sha512Update(&sha512, (byte*)a.input+1, (word32)a.inLen-1), + 0); + ExpectIntEQ(wc_Sha512Final(&sha512, hash_unaligned+1), 0); + /* Try passing in bad values */ b.input = NULL; b.inLen = 0; @@ -20091,7 +20103,8 @@ static int test_wc_ed25519_make_key(void) #if defined(HAVE_ED25519) && defined(HAVE_ED25519_MAKE_KEY) ed25519_key key; WC_RNG rng; - unsigned char pubkey[ED25519_PUB_KEY_SIZE]; + unsigned char pubkey[ED25519_PUB_KEY_SIZE+1]; + int pubkey_sz = ED25519_PUB_KEY_SIZE; XMEMSET(&key, 0, sizeof(ed25519_key)); XMEMSET(&rng, 0, sizeof(WC_RNG)); @@ -20099,7 +20112,9 @@ static int test_wc_ed25519_make_key(void) ExpectIntEQ(wc_ed25519_init(&key), 0); ExpectIntEQ(wc_InitRng(&rng), 0); - ExpectIntEQ(wc_ed25519_make_public(&key, pubkey, sizeof(pubkey)), + ExpectIntEQ(wc_ed25519_make_public(&key, pubkey, pubkey_sz), + ECC_PRIV_KEY_E); + ExpectIntEQ(wc_ed25519_make_public(&key, pubkey+1, pubkey_sz), ECC_PRIV_KEY_E); ExpectIntEQ(wc_ed25519_make_key(&rng, ED25519_KEY_SIZE, &key), 0); @@ -20149,10 +20164,10 @@ static int test_wc_ed25519_sign_msg(void) WC_RNG rng; ed25519_key key; byte msg[] = "Everybody gets Friday off.\n"; - byte sig[ED25519_SIG_SIZE]; + byte sig[ED25519_SIG_SIZE+1]; word32 msglen = sizeof(msg); - word32 siglen = sizeof(sig); - word32 badSigLen = sizeof(sig) - 1; + word32 siglen = ED25519_SIG_SIZE; + word32 badSigLen = ED25519_SIG_SIZE - 1; #ifdef HAVE_ED25519_VERIFY int verify_ok = 0; /*1 = Verify success.*/ #endif @@ -20160,7 +20175,7 @@ static int test_wc_ed25519_sign_msg(void) /* Initialize stack variables. */ XMEMSET(&key, 0, sizeof(ed25519_key)); XMEMSET(&rng, 0, sizeof(WC_RNG)); - XMEMSET(sig, 0, siglen); + XMEMSET(sig, 0, sizeof(sig)); /* Initialize key. */ ExpectIntEQ(wc_ed25519_init(&key), 0); @@ -20169,6 +20184,8 @@ static int test_wc_ed25519_sign_msg(void) ExpectIntEQ(wc_ed25519_sign_msg(msg, msglen, sig, &siglen, &key), 0); ExpectIntEQ(siglen, ED25519_SIG_SIZE); + ExpectIntEQ(wc_ed25519_sign_msg(msg, msglen, sig+1, &siglen, &key), 0); + ExpectIntEQ(siglen, ED25519_SIG_SIZE); /* Test bad args. */ ExpectIntEQ(wc_ed25519_sign_msg(NULL, msglen, sig, &siglen, &key), @@ -20185,24 +20202,24 @@ static int test_wc_ed25519_sign_msg(void) badSigLen -= 1; #ifdef HAVE_ED25519_VERIFY - ExpectIntEQ(wc_ed25519_verify_msg(sig, siglen, msg, msglen, &verify_ok, + ExpectIntEQ(wc_ed25519_verify_msg(sig+1, siglen, msg, msglen, &verify_ok, &key), 0); ExpectIntEQ(verify_ok, 1); /* Test bad args. */ - ExpectIntEQ(wc_ed25519_verify_msg(sig, siglen - 1, msg, msglen, &verify_ok, - &key), BAD_FUNC_ARG); - ExpectIntEQ(wc_ed25519_verify_msg(sig, siglen + 1, msg, msglen, &verify_ok, - &key), BAD_FUNC_ARG); + ExpectIntEQ(wc_ed25519_verify_msg(sig+1, siglen - 1, msg, msglen, + &verify_ok, &key), BAD_FUNC_ARG); + ExpectIntEQ(wc_ed25519_verify_msg(sig+1, siglen + 1, msg, msglen, + &verify_ok, &key), BAD_FUNC_ARG); ExpectIntEQ(wc_ed25519_verify_msg(NULL, siglen, msg, msglen, &verify_ok, &key), BAD_FUNC_ARG); - ExpectIntEQ(wc_ed25519_verify_msg(sig, siglen, NULL, msglen, &verify_ok, + ExpectIntEQ(wc_ed25519_verify_msg(sig+1, siglen, NULL, msglen, &verify_ok, &key), BAD_FUNC_ARG); - ExpectIntEQ(wc_ed25519_verify_msg(sig, siglen, msg, msglen, NULL, &key), + ExpectIntEQ(wc_ed25519_verify_msg(sig+1, siglen, msg, msglen, NULL, &key), BAD_FUNC_ARG); - ExpectIntEQ(wc_ed25519_verify_msg(sig, siglen, msg, msglen, &verify_ok, + ExpectIntEQ(wc_ed25519_verify_msg(sig+1, siglen, msg, msglen, &verify_ok, NULL), BAD_FUNC_ARG); - ExpectIntEQ(wc_ed25519_verify_msg(sig, badSigLen, msg, msglen, &verify_ok, + ExpectIntEQ(wc_ed25519_verify_msg(sig+1, badSigLen, msg, msglen, &verify_ok, &key), BAD_FUNC_ARG); #endif /* Verify. */ diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 483a659f2c..98737b4b6a 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -33836,7 +33836,7 @@ int wc_Ed25519PublicKeyDecode(const byte* input, word32* inOutIdx, ed25519_key* key, word32 inSz) { int ret; - byte pubKey[ED25519_PUB_KEY_SIZE]; + byte pubKey[2*ED25519_PUB_KEY_SIZE+1]; word32 pubKeyLen = (word32)sizeof(pubKey); if (input == NULL || inOutIdx == NULL || key == NULL || inSz == 0) { @@ -34127,7 +34127,7 @@ int wc_Ed448PublicKeyDecode(const byte* input, word32* inOutIdx, ed448_key* key, word32 inSz) { int ret; - byte pubKey[ED448_PUB_KEY_SIZE]; + byte pubKey[2 * ED448_PUB_KEY_SIZE + 1]; word32 pubKeyLen = (word32)sizeof(pubKey); if (input == NULL || inOutIdx == NULL || key == NULL || inSz == 0) { diff --git a/wolfcrypt/src/curve25519.c b/wolfcrypt/src/curve25519.c index e5c3593bae..75dbcdc05e 100644 --- a/wolfcrypt/src/curve25519.c +++ b/wolfcrypt/src/curve25519.c @@ -58,13 +58,8 @@ const curve25519_set_type curve25519_sets[] = { } }; -static const word32 kCurve25519BasePoint[CURVE25519_KEYSIZE/sizeof(word32)] = { -#ifdef BIG_ENDIAN_ORDER - 0x09000000 -#else - 9 -#endif -}; +ALIGN16 static const unsigned char kCurve25519BasePoint[CURVE25519_KEYSIZE] = + { 9 }; /* Curve25519 private key must be less than order */ /* These functions clamp private k and check it */ @@ -139,7 +134,7 @@ int wc_curve25519_make_pub(int public_size, byte* pub, int private_size, SAVE_VECTOR_REGISTERS(return _svr_ret;); - ret = curve25519(pub, priv, (byte*)kCurve25519BasePoint); + ret = curve25519(pub, priv, kCurve25519BasePoint); RESTORE_VECTOR_REGISTERS(); #endif diff --git a/wolfcrypt/src/ed25519.c b/wolfcrypt/src/ed25519.c index aa82590d41..6dfb7a0f26 100644 --- a/wolfcrypt/src/ed25519.c +++ b/wolfcrypt/src/ed25519.c @@ -187,7 +187,7 @@ int wc_ed25519_make_public(ed25519_key* key, unsigned char* pubKey, word32 pubKeySz) { int ret = 0; - byte az[ED25519_PRV_KEY_SIZE]; + ALIGN16 byte az[ED25519_PRV_KEY_SIZE]; #if !defined(FREESCALE_LTC_ECC) ge_p3 A; #endif @@ -296,14 +296,14 @@ int wc_ed25519_sign_msg_ex(const byte* in, word32 inLen, byte* out, ret = se050_ed25519_sign_msg(in, inLen, out, outLen, key); #else #ifdef FREESCALE_LTC_ECC - byte tempBuf[ED25519_PRV_KEY_SIZE]; + ALIGN16 byte tempBuf[ED25519_PRV_KEY_SIZE]; ltc_pkha_ecc_point_t ltcPoint = {0}; #else ge_p3 R; #endif - byte nonce[WC_SHA512_DIGEST_SIZE]; - byte hram[WC_SHA512_DIGEST_SIZE]; - byte az[ED25519_PRV_KEY_SIZE]; + ALIGN16 byte nonce[WC_SHA512_DIGEST_SIZE]; + ALIGN16 byte hram[WC_SHA512_DIGEST_SIZE]; + ALIGN16 byte az[ED25519_PRV_KEY_SIZE]; /* sanity check on arguments */ if (in == NULL || out == NULL || outLen == NULL || key == NULL || @@ -617,8 +617,8 @@ static int ed25519_verify_msg_final_with_sha(const byte* sig, word32 sigLen, int* res, ed25519_key* key, wc_Sha512 *sha) { - byte rcheck[ED25519_KEY_SIZE]; - byte h[WC_SHA512_DIGEST_SIZE]; + ALIGN16 byte rcheck[ED25519_KEY_SIZE]; + ALIGN16 byte h[WC_SHA512_DIGEST_SIZE]; #ifndef FREESCALE_LTC_ECC ge_p3 A; ge_p2 R; @@ -1239,7 +1239,7 @@ int wc_ed25519_check_key(ed25519_key* key) { int ret = 0; #ifdef HAVE_ED25519_MAKE_KEY - unsigned char pubKey[ED25519_PUB_KEY_SIZE]; + ALIGN16 unsigned char pubKey[ED25519_PUB_KEY_SIZE]; if (!key->pubKeySet) ret = PUBLIC_KEY_E; diff --git a/wolfcrypt/src/ge_operations.c b/wolfcrypt/src/ge_operations.c index 995e1c59cf..57a838cda7 100644 --- a/wolfcrypt/src/ge_operations.c +++ b/wolfcrypt/src/ge_operations.c @@ -920,13 +920,13 @@ void sc_muladd(byte* s, const byte* a, const byte* b, const byte* c) int ge_compress_key(byte* out, const byte* xIn, const byte* yIn, word32 keySz) { ge_p2 g; - byte bArray[ED25519_KEY_SIZE]; - byte x[ED25519_KEY_SIZE]; - byte y[ED25519_KEY_SIZE]; + ALIGN16 byte bArray[ED25519_KEY_SIZE]; + ALIGN16 byte x[ED25519_PUB_KEY_SIZE]; + ALIGN16 byte y[ED25519_PUB_KEY_SIZE]; word32 i; - XMEMCPY(x, xIn, ED25519_KEY_SIZE); - XMEMCPY(y, yIn, ED25519_KEY_SIZE); + XMEMCPY(x, xIn, ED25519_PUB_KEY_SIZE); + XMEMCPY(y, yIn, ED25519_PUB_KEY_SIZE); fe_frombytes(g.X, x); fe_frombytes(g.Y, y); fe_1(g.Z); diff --git a/wolfcrypt/src/port/arm/armv8-32-aes-asm.S b/wolfcrypt/src/port/arm/armv8-32-aes-asm.S index 365d0c342d..cb238f8e53 100644 --- a/wolfcrypt/src/port/arm/armv8-32-aes-asm.S +++ b/wolfcrypt/src/port/arm/armv8-32-aes-asm.S @@ -1447,10 +1447,10 @@ L_AES_CTR_encrypt_loop_block_256: ldr r9, [lr, #4] ldr r10, [lr, #8] ldr r11, [lr, #12] - eor r4, r8 - eor r5, r9 - eor r6, r10 - eor r7, r11 + eor r4, r4, r8 + eor r5, r5, r9 + eor r6, r6, r10 + eor r7, r7, r11 ldr r8, [sp, #4] str r4, [r1] str r5, [r1, #4] @@ -1489,10 +1489,10 @@ L_AES_CTR_encrypt_loop_block_192: ldr r9, [lr, #4] ldr r10, [lr, #8] ldr r11, [lr, #12] - eor r4, r8 - eor r5, r9 - eor r6, r10 - eor r7, r11 + eor r4, r4, r8 + eor r5, r5, r9 + eor r6, r6, r10 + eor r7, r7, r11 ldr r8, [sp, #4] str r4, [r1] str r5, [r1, #4] @@ -1531,10 +1531,10 @@ L_AES_CTR_encrypt_loop_block_128: ldr r9, [lr, #4] ldr r10, [lr, #8] ldr r11, [lr, #12] - eor r4, r8 - eor r5, r9 - eor r6, r10 - eor r7, r11 + eor r4, r4, r8 + eor r5, r5, r9 + eor r6, r6, r10 + eor r7, r7, r11 ldr r8, [sp, #4] str r4, [r1] str r5, [r1, #4] @@ -3172,10 +3172,10 @@ L_AES_GCM_encrypt_loop_block_256: ldr r9, [lr, #4] ldr r10, [lr, #8] ldr r11, [lr, #12] - eor r4, r8 - eor r5, r9 - eor r6, r10 - eor r7, r11 + eor r4, r4, r8 + eor r5, r5, r9 + eor r6, r6, r10 + eor r7, r7, r11 ldr r8, [sp, #4] str r4, [r1] str r5, [r1, #4] @@ -3211,10 +3211,10 @@ L_AES_GCM_encrypt_loop_block_192: ldr r9, [lr, #4] ldr r10, [lr, #8] ldr r11, [lr, #12] - eor r4, r8 - eor r5, r9 - eor r6, r10 - eor r7, r11 + eor r4, r4, r8 + eor r5, r5, r9 + eor r6, r6, r10 + eor r7, r7, r11 ldr r8, [sp, #4] str r4, [r1] str r5, [r1, #4] @@ -3250,10 +3250,10 @@ L_AES_GCM_encrypt_loop_block_128: ldr r9, [lr, #4] ldr r10, [lr, #8] ldr r11, [lr, #12] - eor r4, r8 - eor r5, r9 - eor r6, r10 - eor r7, r11 + eor r4, r4, r8 + eor r5, r5, r9 + eor r6, r6, r10 + eor r7, r7, r11 ldr r8, [sp, #4] str r4, [r1] str r5, [r1, #4] diff --git a/wolfcrypt/src/port/arm/armv8-32-aes-asm_c.c b/wolfcrypt/src/port/arm/armv8-32-aes-asm_c.c index cfa532a589..a2da625980 100644 --- a/wolfcrypt/src/port/arm/armv8-32-aes-asm_c.c +++ b/wolfcrypt/src/port/arm/armv8-32-aes-asm_c.c @@ -1110,10 +1110,10 @@ void AES_CTR_encrypt(const unsigned char* in_p, unsigned char* out_p, unsigned l "ldr r9, [lr, #4]\n\t" "ldr r10, [lr, #8]\n\t" "ldr r11, [lr, #12]\n\t" - "eor r4, r8\n\t" - "eor r5, r9\n\t" - "eor r6, r10\n\t" - "eor r7, r11\n\t" + "eor r4, r4, r8\n\t" + "eor r5, r5, r9\n\t" + "eor r6, r6, r10\n\t" + "eor r7, r7, r11\n\t" "ldr r8, [sp, #4]\n\t" "str r4, [%[out]]\n\t" "str r5, [%[out], #4]\n\t" @@ -1154,10 +1154,10 @@ void AES_CTR_encrypt(const unsigned char* in_p, unsigned char* out_p, unsigned l "ldr r9, [lr, #4]\n\t" "ldr r10, [lr, #8]\n\t" "ldr r11, [lr, #12]\n\t" - "eor r4, r8\n\t" - "eor r5, r9\n\t" - "eor r6, r10\n\t" - "eor r7, r11\n\t" + "eor r4, r4, r8\n\t" + "eor r5, r5, r9\n\t" + "eor r6, r6, r10\n\t" + "eor r7, r7, r11\n\t" "ldr r8, [sp, #4]\n\t" "str r4, [%[out]]\n\t" "str r5, [%[out], #4]\n\t" @@ -1198,10 +1198,10 @@ void AES_CTR_encrypt(const unsigned char* in_p, unsigned char* out_p, unsigned l "ldr r9, [lr, #4]\n\t" "ldr r10, [lr, #8]\n\t" "ldr r11, [lr, #12]\n\t" - "eor r4, r8\n\t" - "eor r5, r9\n\t" - "eor r6, r10\n\t" - "eor r7, r11\n\t" + "eor r4, r4, r8\n\t" + "eor r5, r5, r9\n\t" + "eor r6, r6, r10\n\t" + "eor r7, r7, r11\n\t" "ldr r8, [sp, #4]\n\t" "str r4, [%[out]]\n\t" "str r5, [%[out], #4]\n\t" @@ -2651,10 +2651,10 @@ void AES_GCM_encrypt(const unsigned char* in_p, unsigned char* out_p, unsigned l "ldr r9, [lr, #4]\n\t" "ldr r10, [lr, #8]\n\t" "ldr r11, [lr, #12]\n\t" - "eor r4, r8\n\t" - "eor r5, r9\n\t" - "eor r6, r10\n\t" - "eor r7, r11\n\t" + "eor r4, r4, r8\n\t" + "eor r5, r5, r9\n\t" + "eor r6, r6, r10\n\t" + "eor r7, r7, r11\n\t" "ldr r8, [sp, #4]\n\t" "str r4, [%[out]]\n\t" "str r5, [%[out], #4]\n\t" @@ -2692,10 +2692,10 @@ void AES_GCM_encrypt(const unsigned char* in_p, unsigned char* out_p, unsigned l "ldr r9, [lr, #4]\n\t" "ldr r10, [lr, #8]\n\t" "ldr r11, [lr, #12]\n\t" - "eor r4, r8\n\t" - "eor r5, r9\n\t" - "eor r6, r10\n\t" - "eor r7, r11\n\t" + "eor r4, r4, r8\n\t" + "eor r5, r5, r9\n\t" + "eor r6, r6, r10\n\t" + "eor r7, r7, r11\n\t" "ldr r8, [sp, #4]\n\t" "str r4, [%[out]]\n\t" "str r5, [%[out], #4]\n\t" @@ -2733,10 +2733,10 @@ void AES_GCM_encrypt(const unsigned char* in_p, unsigned char* out_p, unsigned l "ldr r9, [lr, #4]\n\t" "ldr r10, [lr, #8]\n\t" "ldr r11, [lr, #12]\n\t" - "eor r4, r8\n\t" - "eor r5, r9\n\t" - "eor r6, r10\n\t" - "eor r7, r11\n\t" + "eor r4, r4, r8\n\t" + "eor r5, r5, r9\n\t" + "eor r6, r6, r10\n\t" + "eor r7, r7, r11\n\t" "ldr r8, [sp, #4]\n\t" "str r4, [%[out]]\n\t" "str r5, [%[out], #4]\n\t" diff --git a/wolfcrypt/src/port/arm/armv8-32-curve25519.S b/wolfcrypt/src/port/arm/armv8-32-curve25519.S index 1f83fcc625..45be9a90e3 100644 --- a/wolfcrypt/src/port/arm/armv8-32-curve25519.S +++ b/wolfcrypt/src/port/arm/armv8-32-curve25519.S @@ -32,10 +32,6 @@ #ifdef WOLFSSL_ARMASM #if !defined(__aarch64__) && defined(__arm__) #ifndef WOLFSSL_ARMASM_INLINE -/* Based on work by: Emil Lenngren - * https://github.com/pornin/X25519-Cortex-M4 - */ - #if defined(HAVE_CURVE25519) || defined(HAVE_ED25519) #if !defined(CURVE25519_SMALL) || !defined(ED25519_SMALL) @@ -348,9 +344,23 @@ fe_add: .type fe_frombytes, %function fe_frombytes: push {r4, r5, r6, r7, r8, r9, lr} - ldm r1, {r2, r3, r4, r5, r6, r7, r8, r9} + ldr r2, [r1] + ldr r3, [r1, #4] + ldr r4, [r1, #8] + ldr r5, [r1, #12] + ldr r6, [r1, #16] + ldr r7, [r1, #20] + ldr r8, [r1, #24] + ldr r9, [r1, #28] bfc r9, #31, #1 - stm r0, {r2, r3, r4, r5, r6, r7, r8, r9} + str r2, [r0] + str r3, [r0, #4] + str r4, [r0, #8] + str r5, [r0, #12] + str r6, [r0, #16] + str r7, [r0, #20] + str r8, [r0, #24] + str r9, [r0, #28] pop {r4, r5, r6, r7, r8, r9, pc} .size fe_frombytes,.-fe_frombytes .text @@ -379,7 +389,14 @@ fe_tobytes: adcs r8, r8, #0 adc r9, r9, #0 bfc r9, #31, #1 - stm r0, {r2, r3, r4, r5, r6, r7, r8, r9} + str r2, [r0] + str r3, [r0, #4] + str r4, [r0, #8] + str r5, [r0, #12] + str r6, [r0, #16] + str r7, [r0, #20] + str r8, [r0, #24] + str r9, [r0, #28] pop {r4, r5, r6, r7, r8, r9, pc} .size fe_tobytes,.-fe_tobytes .text @@ -387,69 +404,36 @@ fe_tobytes: .globl fe_1 .type fe_1, %function fe_1: + push {r4, r5, r6, r7, r8, r9, lr} # Set one mov r2, #1 mov r3, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r2, [r0] - str r3, [r0, #4] -#else - strd r2, r3, [r0] -#endif - mov r2, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r2, [r0, #8] - str r3, [r0, #12] -#else - strd r2, r3, [r0, #8] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r2, [r0, #16] - str r3, [r0, #20] -#else - strd r2, r3, [r0, #16] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r2, [r0, #24] - str r3, [r0, #28] -#else - strd r2, r3, [r0, #24] -#endif - bx lr + mov r4, #0 + mov r5, #0 + mov r6, #0 + mov r7, #0 + mov r8, #0 + mov r9, #0 + stm r0, {r2, r3, r4, r5, r6, r7, r8, r9} + pop {r4, r5, r6, r7, r8, r9, pc} .size fe_1,.-fe_1 .text .align 4 .globl fe_0 .type fe_0, %function fe_0: + push {r4, r5, r6, r7, r8, r9, lr} # Set zero mov r2, #0 mov r3, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r2, [r0] - str r3, [r0, #4] -#else - strd r2, r3, [r0] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r2, [r0, #8] - str r3, [r0, #12] -#else - strd r2, r3, [r0, #8] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r2, [r0, #16] - str r3, [r0, #20] -#else - strd r2, r3, [r0, #16] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r2, [r0, #24] - str r3, [r0, #28] -#else - strd r2, r3, [r0, #24] -#endif - bx lr + mov r4, #0 + mov r5, #0 + mov r6, #0 + mov r7, #0 + mov r8, #0 + mov r9, #0 + stm r0, {r2, r3, r4, r5, r6, r7, r8, r9} + pop {r4, r5, r6, r7, r8, r9, pc} .size fe_0,.-fe_0 .text .align 4 @@ -588,6 +572,7 @@ fe_isnegative: eor r0, r0, r1 pop {r4, r5, pc} .size fe_isnegative,.-fe_isnegative +#if defined(HAVE_ED25519_MAKE_KEY) || defined(HAVE_ED25519_SIGN) #ifndef WC_NO_CACHE_RESISTANT .text .align 4 @@ -2394,6 +2379,7 @@ fe_cmov_table: pop {r4, r5, r6, r7, r8, r9, r10, r11, pc} .size fe_cmov_table,.-fe_cmov_table #endif /* WC_NO_CACHE_RESISTANT */ +#endif /* HAVE_ED25519_MAKE_KEY || HAVE_ED25519_SIGN */ #endif /* HAVE_ED25519 */ .text .align 4 @@ -2671,6 +2657,7 @@ fe_sq: bl fe_sq_op pop {r4, r5, r6, r7, r8, r9, r10, r11, pc} .size fe_sq,.-fe_sq +#ifdef HAVE_CURVE25519 .text .align 4 .globl fe_mul121666 @@ -2725,89 +2712,20 @@ curve25519: str r2, [sp, #168] mov r1, #0 str r1, [sp, #172] - # Set one - mov r10, #1 - mov r11, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [r0] - str r11, [r0, #4] -#else - strd r10, r11, [r0] -#endif - mov r10, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [r0, #8] - str r11, [r0, #12] -#else - strd r10, r11, [r0, #8] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [r0, #16] - str r11, [r0, #20] -#else - strd r10, r11, [r0, #16] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [r0, #24] - str r11, [r0, #28] -#else - strd r10, r11, [r0, #24] -#endif - # Set zero + mov r4, #1 + mov r5, #0 + mov r6, #0 + mov r7, #0 + mov r8, #0 + mov r9, #0 mov r10, #0 mov r11, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp] - str r11, [sp, #4] -#else - strd r10, r11, [sp] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #8] - str r11, [sp, #12] -#else - strd r10, r11, [sp, #8] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #16] - str r11, [sp, #20] -#else - strd r10, r11, [sp, #16] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #24] - str r11, [sp, #28] -#else - strd r10, r11, [sp, #24] -#endif - # Set one - mov r10, #1 - mov r11, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #32] - str r11, [sp, #36] -#else - strd r10, r11, [sp, #32] -#endif - mov r10, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #40] - str r11, [sp, #44] -#else - strd r10, r11, [sp, #40] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #48] - str r11, [sp, #52] -#else - strd r10, r11, [sp, #48] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #56] - str r11, [sp, #60] -#else - strd r10, r11, [sp, #56] -#endif + stm r0, {r4, r5, r6, r7, r8, r9, r10, r11} + add r3, sp, #32 + stm r3, {r4, r5, r6, r7, r8, r9, r10, r11} + mov r4, #0 + mov r3, sp + stm r3, {r4, r5, r6, r7, r8, r9, r10, r11} add r3, sp, #0x40 # Copy ldm r2, {r4, r5, r6, r7, r8, r9, r10, r11} @@ -2830,18 +2748,10 @@ L_curve25519_bits: ldr r0, [sp, #160] # Conditional Swap rsb r1, r1, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r4, [r0] - ldr r5, [r0, #4] -#else - ldrd r4, r5, [r0] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r6, [sp, #64] - ldr r7, [sp, #68] -#else - ldrd r6, r7, [sp, #64] -#endif + mov r3, r0 + add r12, sp, #0x40 + ldm r3, {r4, r5} + ldm r12, {r6, r7} eor r8, r4, r6 eor r9, r5, r7 and r8, r8, r1 @@ -2850,30 +2760,10 @@ L_curve25519_bits: eor r5, r5, r9 eor r6, r6, r8 eor r7, r7, r9 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r4, [r0] - str r5, [r0, #4] -#else - strd r4, r5, [r0] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r6, [sp, #64] - str r7, [sp, #68] -#else - strd r6, r7, [sp, #64] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r4, [r0, #8] - ldr r5, [r0, #12] -#else - ldrd r4, r5, [r0, #8] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r6, [sp, #72] - ldr r7, [sp, #76] -#else - ldrd r6, r7, [sp, #72] -#endif + stm r3!, {r4, r5} + stm r12!, {r6, r7} + ldm r3, {r4, r5} + ldm r12, {r6, r7} eor r8, r4, r6 eor r9, r5, r7 and r8, r8, r1 @@ -2882,30 +2772,10 @@ L_curve25519_bits: eor r5, r5, r9 eor r6, r6, r8 eor r7, r7, r9 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r4, [r0, #8] - str r5, [r0, #12] -#else - strd r4, r5, [r0, #8] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r6, [sp, #72] - str r7, [sp, #76] -#else - strd r6, r7, [sp, #72] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r4, [r0, #16] - ldr r5, [r0, #20] -#else - ldrd r4, r5, [r0, #16] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r6, [sp, #80] - ldr r7, [sp, #84] -#else - ldrd r6, r7, [sp, #80] -#endif + stm r3!, {r4, r5} + stm r12!, {r6, r7} + ldm r3, {r4, r5} + ldm r12, {r6, r7} eor r8, r4, r6 eor r9, r5, r7 and r8, r8, r1 @@ -2914,30 +2784,10 @@ L_curve25519_bits: eor r5, r5, r9 eor r6, r6, r8 eor r7, r7, r9 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r4, [r0, #16] - str r5, [r0, #20] -#else - strd r4, r5, [r0, #16] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r6, [sp, #80] - str r7, [sp, #84] -#else - strd r6, r7, [sp, #80] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r4, [r0, #24] - ldr r5, [r0, #28] -#else - ldrd r4, r5, [r0, #24] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r6, [sp, #88] - ldr r7, [sp, #92] -#else - ldrd r6, r7, [sp, #88] -#endif + stm r3!, {r4, r5} + stm r12!, {r6, r7} + ldm r3, {r4, r5} + ldm r12, {r6, r7} eor r8, r4, r6 eor r9, r5, r7 and r8, r8, r1 @@ -2946,33 +2796,15 @@ L_curve25519_bits: eor r5, r5, r9 eor r6, r6, r8 eor r7, r7, r9 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r4, [r0, #24] - str r5, [r0, #28] -#else - strd r4, r5, [r0, #24] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r6, [sp, #88] - str r7, [sp, #92] -#else - strd r6, r7, [sp, #88] -#endif + stm r3!, {r4, r5} + stm r12!, {r6, r7} ldr r1, [sp, #172] # Conditional Swap rsb r1, r1, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r4, [sp] - ldr r5, [sp, #4] -#else - ldrd r4, r5, [sp] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r6, [sp, #32] - ldr r7, [sp, #36] -#else - ldrd r6, r7, [sp, #32] -#endif + mov r3, sp + add r12, sp, #32 + ldm r3, {r4, r5} + ldm r12, {r6, r7} eor r8, r4, r6 eor r9, r5, r7 and r8, r8, r1 @@ -2981,30 +2813,10 @@ L_curve25519_bits: eor r5, r5, r9 eor r6, r6, r8 eor r7, r7, r9 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r4, [sp] - str r5, [sp, #4] -#else - strd r4, r5, [sp] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r6, [sp, #32] - str r7, [sp, #36] -#else - strd r6, r7, [sp, #32] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r4, [sp, #8] - ldr r5, [sp, #12] -#else - ldrd r4, r5, [sp, #8] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r6, [sp, #40] - ldr r7, [sp, #44] -#else - ldrd r6, r7, [sp, #40] -#endif + stm r3!, {r4, r5} + stm r12!, {r6, r7} + ldm r3, {r4, r5} + ldm r12, {r6, r7} eor r8, r4, r6 eor r9, r5, r7 and r8, r8, r1 @@ -3013,30 +2825,10 @@ L_curve25519_bits: eor r5, r5, r9 eor r6, r6, r8 eor r7, r7, r9 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r4, [sp, #8] - str r5, [sp, #12] -#else - strd r4, r5, [sp, #8] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r6, [sp, #40] - str r7, [sp, #44] -#else - strd r6, r7, [sp, #40] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r4, [sp, #16] - ldr r5, [sp, #20] -#else - ldrd r4, r5, [sp, #16] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r6, [sp, #48] - ldr r7, [sp, #52] -#else - ldrd r6, r7, [sp, #48] -#endif + stm r3!, {r4, r5} + stm r12!, {r6, r7} + ldm r3, {r4, r5} + ldm r12, {r6, r7} eor r8, r4, r6 eor r9, r5, r7 and r8, r8, r1 @@ -3045,30 +2837,10 @@ L_curve25519_bits: eor r5, r5, r9 eor r6, r6, r8 eor r7, r7, r9 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r4, [sp, #16] - str r5, [sp, #20] -#else - strd r4, r5, [sp, #16] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r6, [sp, #48] - str r7, [sp, #52] -#else - strd r6, r7, [sp, #48] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r4, [sp, #24] - ldr r5, [sp, #28] -#else - ldrd r4, r5, [sp, #24] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - ldr r6, [sp, #56] - ldr r7, [sp, #60] -#else - ldrd r6, r7, [sp, #56] -#endif + stm r3!, {r4, r5} + stm r12!, {r6, r7} + ldm r3, {r4, r5} + ldm r12, {r6, r7} eor r8, r4, r6 eor r9, r5, r7 and r8, r8, r1 @@ -3077,18 +2849,8 @@ L_curve25519_bits: eor r5, r5, r9 eor r6, r6, r8 eor r7, r7, r9 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r4, [sp, #24] - str r5, [sp, #28] -#else - strd r4, r5, [sp, #24] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r6, [sp, #56] - str r7, [sp, #60] -#else - strd r6, r7, [sp, #56] -#endif + stm r3!, {r4, r5} + stm r12!, {r6, r7} ldr r1, [sp, #184] str r1, [sp, #172] mov r3, sp @@ -3329,89 +3091,20 @@ curve25519: str r4, [sp, #188] mov r1, #0 str r1, [sp, #164] - # Set one - mov r10, #1 - mov r11, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [r0] - str r11, [r0, #4] -#else - strd r10, r11, [r0] -#endif - mov r10, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [r0, #8] - str r11, [r0, #12] -#else - strd r10, r11, [r0, #8] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [r0, #16] - str r11, [r0, #20] -#else - strd r10, r11, [r0, #16] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [r0, #24] - str r11, [r0, #28] -#else - strd r10, r11, [r0, #24] -#endif - # Set zero + mov r4, #1 + mov r5, #0 + mov r6, #0 + mov r7, #0 + mov r8, #0 + mov r9, #0 mov r10, #0 mov r11, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp] - str r11, [sp, #4] -#else - strd r10, r11, [sp] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #8] - str r11, [sp, #12] -#else - strd r10, r11, [sp, #8] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #16] - str r11, [sp, #20] -#else - strd r10, r11, [sp, #16] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #24] - str r11, [sp, #28] -#else - strd r10, r11, [sp, #24] -#endif - # Set one - mov r10, #1 - mov r11, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #32] - str r11, [sp, #36] -#else - strd r10, r11, [sp, #32] -#endif - mov r10, #0 -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #40] - str r11, [sp, #44] -#else - strd r10, r11, [sp, #40] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #48] - str r11, [sp, #52] -#else - strd r10, r11, [sp, #48] -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - str r10, [sp, #56] - str r11, [sp, #60] -#else - strd r10, r11, [sp, #56] -#endif + stm r0, {r4, r5, r6, r7, r8, r9, r10, r11} + add r3, sp, #32 + stm r3, {r4, r5, r6, r7, r8, r9, r10, r11} + mov r4, #0 + mov r3, sp + stm r3, {r4, r5, r6, r7, r8, r9, r10, r11} add r3, sp, #0x40 # Copy ldm r2, {r4, r5, r6, r7, r8, r9, r10, r11} @@ -3675,6 +3368,7 @@ L_curve25519_inv_8: pop {r4, r5, r6, r7, r8, r9, r10, r11, pc} .size curve25519,.-curve25519 #endif /* WC_NO_CACHE_RESISTANT */ +#endif /* HAVE_CURVE25519 */ #ifdef HAVE_ED25519 .text .align 4 @@ -4974,13 +4668,14 @@ sc_reduce: add sp, sp, #52 pop {r4, r5, r6, r7, r8, r9, r10, r11, pc} .size sc_reduce,.-sc_reduce +#ifdef HAVE_ED25519_SIGN .text .align 4 .globl sc_muladd .type sc_muladd, %function sc_muladd: push {r4, r5, r6, r7, r8, r9, r10, r11, lr} - sub sp, sp, #0x50 + sub sp, sp, #0x70 add lr, sp, #0x44 stm lr, {r0, r1, r3} mov lr, r2 @@ -5082,7 +4777,7 @@ sc_muladd: mov r3, r12 add lr, sp, #32 stm lr, {r3, r4, r5, r6, r7, r8, r9, r10} - ldr r0, [sp, #68] + add r0, sp, #0x50 # Add c to a * b ldr lr, [sp, #76] ldm sp!, {r2, r3, r4, r5, r6, r7, r8, r9} @@ -5502,11 +5197,20 @@ sc_muladd: adcs r8, r8, #0 adc r9, r9, r1 bfc r9, #28, #4 + ldr r0, [sp, #68] # Store result - stm r0, {r2, r3, r4, r5, r6, r7, r8, r9} - add sp, sp, #0x50 + str r2, [r0] + str r3, [r0, #4] + str r4, [r0, #8] + str r5, [r0, #12] + str r6, [r0, #16] + str r7, [r0, #20] + str r8, [r0, #24] + str r9, [r0, #28] + add sp, sp, #0x70 pop {r4, r5, r6, r7, r8, r9, r10, r11, pc} .size sc_muladd,.-sc_muladd +#endif /* HAVE_ED25519_SIGN */ #endif /* HAVE_ED25519 */ #endif /* !CURVE25519_SMALL || !ED25519_SMALL */ diff --git a/wolfcrypt/src/port/arm/armv8-32-curve25519_c.c b/wolfcrypt/src/port/arm/armv8-32-curve25519_c.c index 627b74edb8..1de8c9c77e 100644 --- a/wolfcrypt/src/port/arm/armv8-32-curve25519_c.c +++ b/wolfcrypt/src/port/arm/armv8-32-curve25519_c.c @@ -378,9 +378,23 @@ void fe_frombytes(fe out_p, const unsigned char* in_p) register const unsigned char* in asm ("r1") = (const unsigned char*)in_p; __asm__ __volatile__ ( - "ldm %[in], {r2, r3, r4, r5, r6, r7, r8, r9}\n\t" + "ldr r2, [%[in]]\n\t" + "ldr r3, [%[in], #4]\n\t" + "ldr r4, [%[in], #8]\n\t" + "ldr r5, [%[in], #12]\n\t" + "ldr r6, [%[in], #16]\n\t" + "ldr r7, [%[in], #20]\n\t" + "ldr r8, [%[in], #24]\n\t" + "ldr r9, [%[in], #28]\n\t" "bfc r9, #31, #1\n\t" - "stm %[out], {r2, r3, r4, r5, r6, r7, r8, r9}\n\t" + "str r2, [%[out]]\n\t" + "str r3, [%[out], #4]\n\t" + "str r4, [%[out], #8]\n\t" + "str r5, [%[out], #12]\n\t" + "str r6, [%[out], #16]\n\t" + "str r7, [%[out], #20]\n\t" + "str r8, [%[out], #24]\n\t" + "str r9, [%[out], #28]\n\t" : [out] "+r" (out), [in] "+r" (in) : : "memory", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" @@ -413,7 +427,14 @@ void fe_tobytes(unsigned char* out_p, const fe n_p) "adcs r8, r8, #0\n\t" "adc r9, r9, #0\n\t" "bfc r9, #31, #1\n\t" - "stm %[out], {r2, r3, r4, r5, r6, r7, r8, r9}\n\t" + "str r2, [%[out]]\n\t" + "str r3, [%[out], #4]\n\t" + "str r4, [%[out], #8]\n\t" + "str r5, [%[out], #12]\n\t" + "str r6, [%[out], #16]\n\t" + "str r7, [%[out], #20]\n\t" + "str r8, [%[out], #24]\n\t" + "str r9, [%[out], #28]\n\t" : [out] "+r" (out), [n] "+r" (n) : : "memory", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r12" @@ -428,34 +449,16 @@ void fe_1(fe n_p) /* Set one */ "mov r2, #1\n\t" "mov r3, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r2, [%[n]]\n\t" - "str r3, [%[n], #4]\n\t" -#else - "strd r2, r3, [%[n]]\n\t" -#endif - "mov r2, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r2, [%[n], #8]\n\t" - "str r3, [%[n], #12]\n\t" -#else - "strd r2, r3, [%[n], #8]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r2, [%[n], #16]\n\t" - "str r3, [%[n], #20]\n\t" -#else - "strd r2, r3, [%[n], #16]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r2, [%[n], #24]\n\t" - "str r3, [%[n], #28]\n\t" -#else - "strd r2, r3, [%[n], #24]\n\t" -#endif + "mov r4, #0\n\t" + "mov r5, #0\n\t" + "mov r6, #0\n\t" + "mov r7, #0\n\t" + "mov r8, #0\n\t" + "mov r9, #0\n\t" + "stm %[n], {r2, r3, r4, r5, r6, r7, r8, r9}\n\t" : [n] "+r" (n) : - : "memory", "r2", "r3" + : "memory", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" ); } @@ -467,33 +470,16 @@ void fe_0(fe n_p) /* Set zero */ "mov r2, #0\n\t" "mov r3, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r2, [%[n]]\n\t" - "str r3, [%[n], #4]\n\t" -#else - "strd r2, r3, [%[n]]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r2, [%[n], #8]\n\t" - "str r3, [%[n], #12]\n\t" -#else - "strd r2, r3, [%[n], #8]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r2, [%[n], #16]\n\t" - "str r3, [%[n], #20]\n\t" -#else - "strd r2, r3, [%[n], #16]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r2, [%[n], #24]\n\t" - "str r3, [%[n], #28]\n\t" -#else - "strd r2, r3, [%[n], #24]\n\t" -#endif + "mov r4, #0\n\t" + "mov r5, #0\n\t" + "mov r6, #0\n\t" + "mov r7, #0\n\t" + "mov r8, #0\n\t" + "mov r9, #0\n\t" + "stm %[n], {r2, r3, r4, r5, r6, r7, r8, r9}\n\t" : [n] "+r" (n) : - : "memory", "r2", "r3" + : "memory", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" ); } @@ -650,6 +636,7 @@ int fe_isnegative(const fe a_p) return (uint32_t)(size_t)a; } +#if defined(HAVE_ED25519_MAKE_KEY) || defined(HAVE_ED25519_SIGN) #ifndef WC_NO_CACHE_RESISTANT void fe_cmov_table(fe* r_p, fe* base_p, signed char b_p) { @@ -2466,6 +2453,7 @@ void fe_cmov_table(fe* r_p, fe* base_p, signed char b_p) } #endif /* WC_NO_CACHE_RESISTANT */ +#endif /* HAVE_ED25519_MAKE_KEY || HAVE_ED25519_SIGN */ #endif /* HAVE_ED25519 */ void fe_mul_op(void); void fe_mul_op() @@ -2756,6 +2744,7 @@ void fe_sq(fe r_p, const fe a_p) ); } +#ifdef HAVE_CURVE25519 void fe_mul121666(fe r_p, fe a_p) { register sword32* r asm ("r0") = (sword32*)r_p; @@ -2815,89 +2804,20 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) "str %[a], [sp, #168]\n\t" "mov %[n], #0\n\t" "str %[n], [sp, #172]\n\t" - /* Set one */ - "mov r10, #1\n\t" - "mov r11, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [%[r]]\n\t" - "str r11, [%[r], #4]\n\t" -#else - "strd r10, r11, [%[r]]\n\t" -#endif - "mov r10, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [%[r], #8]\n\t" - "str r11, [%[r], #12]\n\t" -#else - "strd r10, r11, [%[r], #8]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [%[r], #16]\n\t" - "str r11, [%[r], #20]\n\t" -#else - "strd r10, r11, [%[r], #16]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [%[r], #24]\n\t" - "str r11, [%[r], #28]\n\t" -#else - "strd r10, r11, [%[r], #24]\n\t" -#endif - /* Set zero */ + "mov r4, #1\n\t" + "mov r5, #0\n\t" + "mov r6, #0\n\t" + "mov r7, #0\n\t" + "mov r8, #0\n\t" + "mov r9, #0\n\t" "mov r10, #0\n\t" "mov r11, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp]\n\t" - "str r11, [sp, #4]\n\t" -#else - "strd r10, r11, [sp]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #8]\n\t" - "str r11, [sp, #12]\n\t" -#else - "strd r10, r11, [sp, #8]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #16]\n\t" - "str r11, [sp, #20]\n\t" -#else - "strd r10, r11, [sp, #16]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #24]\n\t" - "str r11, [sp, #28]\n\t" -#else - "strd r10, r11, [sp, #24]\n\t" -#endif - /* Set one */ - "mov r10, #1\n\t" - "mov r11, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #32]\n\t" - "str r11, [sp, #36]\n\t" -#else - "strd r10, r11, [sp, #32]\n\t" -#endif - "mov r10, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #40]\n\t" - "str r11, [sp, #44]\n\t" -#else - "strd r10, r11, [sp, #40]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #48]\n\t" - "str r11, [sp, #52]\n\t" -#else - "strd r10, r11, [sp, #48]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #56]\n\t" - "str r11, [sp, #60]\n\t" -#else - "strd r10, r11, [sp, #56]\n\t" -#endif + "stm %[r], {r4, r5, r6, r7, r8, r9, r10, r11}\n\t" + "add r3, sp, #32\n\t" + "stm r3, {r4, r5, r6, r7, r8, r9, r10, r11}\n\t" + "mov r4, #0\n\t" + "mov r3, sp\n\t" + "stm r3, {r4, r5, r6, r7, r8, r9, r10, r11}\n\t" "add r3, sp, #0x40\n\t" /* Copy */ "ldm r2, {r4, r5, r6, r7, r8, r9, r10, r11}\n\t" @@ -2922,18 +2842,10 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) "ldr %[r], [sp, #160]\n\t" /* Conditional Swap */ "rsb %[n], %[n], #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r4, [%[r]]\n\t" - "ldr r5, [%[r], #4]\n\t" -#else - "ldrd r4, r5, [%[r]]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r6, [sp, #64]\n\t" - "ldr r7, [sp, #68]\n\t" -#else - "ldrd r6, r7, [sp, #64]\n\t" -#endif + "mov r3, r0\n\t" + "add r12, sp, #0x40\n\t" + "ldm r3, {r4, r5}\n\t" + "ldm r12, {r6, r7}\n\t" "eor r8, r4, r6\n\t" "eor r9, r5, r7\n\t" "and r8, r8, %[n]\n\t" @@ -2942,30 +2854,10 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) "eor r5, r5, r9\n\t" "eor r6, r6, r8\n\t" "eor r7, r7, r9\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r4, [%[r]]\n\t" - "str r5, [%[r], #4]\n\t" -#else - "strd r4, r5, [%[r]]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r6, [sp, #64]\n\t" - "str r7, [sp, #68]\n\t" -#else - "strd r6, r7, [sp, #64]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r4, [%[r], #8]\n\t" - "ldr r5, [%[r], #12]\n\t" -#else - "ldrd r4, r5, [%[r], #8]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r6, [sp, #72]\n\t" - "ldr r7, [sp, #76]\n\t" -#else - "ldrd r6, r7, [sp, #72]\n\t" -#endif + "stm r3!, {r4, r5}\n\t" + "stm r12!, {r6, r7}\n\t" + "ldm r3, {r4, r5}\n\t" + "ldm r12, {r6, r7}\n\t" "eor r8, r4, r6\n\t" "eor r9, r5, r7\n\t" "and r8, r8, %[n]\n\t" @@ -2974,30 +2866,10 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) "eor r5, r5, r9\n\t" "eor r6, r6, r8\n\t" "eor r7, r7, r9\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r4, [%[r], #8]\n\t" - "str r5, [%[r], #12]\n\t" -#else - "strd r4, r5, [%[r], #8]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r6, [sp, #72]\n\t" - "str r7, [sp, #76]\n\t" -#else - "strd r6, r7, [sp, #72]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r4, [%[r], #16]\n\t" - "ldr r5, [%[r], #20]\n\t" -#else - "ldrd r4, r5, [%[r], #16]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r6, [sp, #80]\n\t" - "ldr r7, [sp, #84]\n\t" -#else - "ldrd r6, r7, [sp, #80]\n\t" -#endif + "stm r3!, {r4, r5}\n\t" + "stm r12!, {r6, r7}\n\t" + "ldm r3, {r4, r5}\n\t" + "ldm r12, {r6, r7}\n\t" "eor r8, r4, r6\n\t" "eor r9, r5, r7\n\t" "and r8, r8, %[n]\n\t" @@ -3006,30 +2878,10 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) "eor r5, r5, r9\n\t" "eor r6, r6, r8\n\t" "eor r7, r7, r9\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r4, [%[r], #16]\n\t" - "str r5, [%[r], #20]\n\t" -#else - "strd r4, r5, [%[r], #16]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r6, [sp, #80]\n\t" - "str r7, [sp, #84]\n\t" -#else - "strd r6, r7, [sp, #80]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r4, [%[r], #24]\n\t" - "ldr r5, [%[r], #28]\n\t" -#else - "ldrd r4, r5, [%[r], #24]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r6, [sp, #88]\n\t" - "ldr r7, [sp, #92]\n\t" -#else - "ldrd r6, r7, [sp, #88]\n\t" -#endif + "stm r3!, {r4, r5}\n\t" + "stm r12!, {r6, r7}\n\t" + "ldm r3, {r4, r5}\n\t" + "ldm r12, {r6, r7}\n\t" "eor r8, r4, r6\n\t" "eor r9, r5, r7\n\t" "and r8, r8, %[n]\n\t" @@ -3038,33 +2890,15 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) "eor r5, r5, r9\n\t" "eor r6, r6, r8\n\t" "eor r7, r7, r9\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r4, [%[r], #24]\n\t" - "str r5, [%[r], #28]\n\t" -#else - "strd r4, r5, [%[r], #24]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r6, [sp, #88]\n\t" - "str r7, [sp, #92]\n\t" -#else - "strd r6, r7, [sp, #88]\n\t" -#endif + "stm r3!, {r4, r5}\n\t" + "stm r12!, {r6, r7}\n\t" "ldr %[n], [sp, #172]\n\t" /* Conditional Swap */ "rsb %[n], %[n], #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r4, [sp]\n\t" - "ldr r5, [sp, #4]\n\t" -#else - "ldrd r4, r5, [sp]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r6, [sp, #32]\n\t" - "ldr r7, [sp, #36]\n\t" -#else - "ldrd r6, r7, [sp, #32]\n\t" -#endif + "mov r3, sp\n\t" + "add r12, sp, #32\n\t" + "ldm r3, {r4, r5}\n\t" + "ldm r12, {r6, r7}\n\t" "eor r8, r4, r6\n\t" "eor r9, r5, r7\n\t" "and r8, r8, %[n]\n\t" @@ -3073,30 +2907,10 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) "eor r5, r5, r9\n\t" "eor r6, r6, r8\n\t" "eor r7, r7, r9\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r4, [sp]\n\t" - "str r5, [sp, #4]\n\t" -#else - "strd r4, r5, [sp]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r6, [sp, #32]\n\t" - "str r7, [sp, #36]\n\t" -#else - "strd r6, r7, [sp, #32]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r4, [sp, #8]\n\t" - "ldr r5, [sp, #12]\n\t" -#else - "ldrd r4, r5, [sp, #8]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r6, [sp, #40]\n\t" - "ldr r7, [sp, #44]\n\t" -#else - "ldrd r6, r7, [sp, #40]\n\t" -#endif + "stm r3!, {r4, r5}\n\t" + "stm r12!, {r6, r7}\n\t" + "ldm r3, {r4, r5}\n\t" + "ldm r12, {r6, r7}\n\t" "eor r8, r4, r6\n\t" "eor r9, r5, r7\n\t" "and r8, r8, %[n]\n\t" @@ -3105,30 +2919,10 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) "eor r5, r5, r9\n\t" "eor r6, r6, r8\n\t" "eor r7, r7, r9\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r4, [sp, #8]\n\t" - "str r5, [sp, #12]\n\t" -#else - "strd r4, r5, [sp, #8]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r6, [sp, #40]\n\t" - "str r7, [sp, #44]\n\t" -#else - "strd r6, r7, [sp, #40]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r4, [sp, #16]\n\t" - "ldr r5, [sp, #20]\n\t" -#else - "ldrd r4, r5, [sp, #16]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r6, [sp, #48]\n\t" - "ldr r7, [sp, #52]\n\t" -#else - "ldrd r6, r7, [sp, #48]\n\t" -#endif + "stm r3!, {r4, r5}\n\t" + "stm r12!, {r6, r7}\n\t" + "ldm r3, {r4, r5}\n\t" + "ldm r12, {r6, r7}\n\t" "eor r8, r4, r6\n\t" "eor r9, r5, r7\n\t" "and r8, r8, %[n]\n\t" @@ -3137,30 +2931,10 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) "eor r5, r5, r9\n\t" "eor r6, r6, r8\n\t" "eor r7, r7, r9\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r4, [sp, #16]\n\t" - "str r5, [sp, #20]\n\t" -#else - "strd r4, r5, [sp, #16]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r6, [sp, #48]\n\t" - "str r7, [sp, #52]\n\t" -#else - "strd r6, r7, [sp, #48]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r4, [sp, #24]\n\t" - "ldr r5, [sp, #28]\n\t" -#else - "ldrd r4, r5, [sp, #24]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "ldr r6, [sp, #56]\n\t" - "ldr r7, [sp, #60]\n\t" -#else - "ldrd r6, r7, [sp, #56]\n\t" -#endif + "stm r3!, {r4, r5}\n\t" + "stm r12!, {r6, r7}\n\t" + "ldm r3, {r4, r5}\n\t" + "ldm r12, {r6, r7}\n\t" "eor r8, r4, r6\n\t" "eor r9, r5, r7\n\t" "and r8, r8, %[n]\n\t" @@ -3169,18 +2943,8 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) "eor r5, r5, r9\n\t" "eor r6, r6, r8\n\t" "eor r7, r7, r9\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r4, [sp, #24]\n\t" - "str r5, [sp, #28]\n\t" -#else - "strd r4, r5, [sp, #24]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r6, [sp, #56]\n\t" - "str r7, [sp, #60]\n\t" -#else - "strd r6, r7, [sp, #56]\n\t" -#endif + "stm r3!, {r4, r5}\n\t" + "stm r12!, {r6, r7}\n\t" "ldr %[n], [sp, #184]\n\t" "str %[n], [sp, #172]\n\t" "mov r3, sp\n\t" @@ -3435,89 +3199,20 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) "str r4, [sp, #188]\n\t" "mov %[n], #0\n\t" "str %[n], [sp, #164]\n\t" - /* Set one */ - "mov r10, #1\n\t" - "mov r11, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [%[r]]\n\t" - "str r11, [%[r], #4]\n\t" -#else - "strd r10, r11, [%[r]]\n\t" -#endif - "mov r10, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [%[r], #8]\n\t" - "str r11, [%[r], #12]\n\t" -#else - "strd r10, r11, [%[r], #8]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [%[r], #16]\n\t" - "str r11, [%[r], #20]\n\t" -#else - "strd r10, r11, [%[r], #16]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [%[r], #24]\n\t" - "str r11, [%[r], #28]\n\t" -#else - "strd r10, r11, [%[r], #24]\n\t" -#endif - /* Set zero */ + "mov r4, #1\n\t" + "mov r5, #0\n\t" + "mov r6, #0\n\t" + "mov r7, #0\n\t" + "mov r8, #0\n\t" + "mov r9, #0\n\t" "mov r10, #0\n\t" "mov r11, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp]\n\t" - "str r11, [sp, #4]\n\t" -#else - "strd r10, r11, [sp]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #8]\n\t" - "str r11, [sp, #12]\n\t" -#else - "strd r10, r11, [sp, #8]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #16]\n\t" - "str r11, [sp, #20]\n\t" -#else - "strd r10, r11, [sp, #16]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #24]\n\t" - "str r11, [sp, #28]\n\t" -#else - "strd r10, r11, [sp, #24]\n\t" -#endif - /* Set one */ - "mov r10, #1\n\t" - "mov r11, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #32]\n\t" - "str r11, [sp, #36]\n\t" -#else - "strd r10, r11, [sp, #32]\n\t" -#endif - "mov r10, #0\n\t" -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #40]\n\t" - "str r11, [sp, #44]\n\t" -#else - "strd r10, r11, [sp, #40]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #48]\n\t" - "str r11, [sp, #52]\n\t" -#else - "strd r10, r11, [sp, #48]\n\t" -#endif -#if defined(WOLFSSL_SP_ARM_ARCH) && (WOLFSSL_SP_ARM_ARCH < 7) - "str r10, [sp, #56]\n\t" - "str r11, [sp, #60]\n\t" -#else - "strd r10, r11, [sp, #56]\n\t" -#endif + "stm %[r], {r4, r5, r6, r7, r8, r9, r10, r11}\n\t" + "add r3, sp, #32\n\t" + "stm r3, {r4, r5, r6, r7, r8, r9, r10, r11}\n\t" + "mov r4, #0\n\t" + "mov r3, sp\n\t" + "stm r3, {r4, r5, r6, r7, r8, r9, r10, r11}\n\t" "add r3, sp, #0x40\n\t" /* Copy */ "ldm r2, {r4, r5, r6, r7, r8, r9, r10, r11}\n\t" @@ -3795,6 +3490,7 @@ int curve25519(byte* r_p, const byte* n_p, const byte* a_p) } #endif /* WC_NO_CACHE_RESISTANT */ +#endif /* HAVE_CURVE25519 */ #ifdef HAVE_ED25519 void fe_invert(fe r_p, const fe a_p) { @@ -5157,6 +4853,7 @@ void sc_reduce(byte* s_p) ); } +#ifdef HAVE_ED25519_SIGN void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) { register byte* s asm ("r0") = (byte*)s_p; @@ -5165,7 +4862,7 @@ void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) register const byte* c asm ("r3") = (const byte*)c_p; __asm__ __volatile__ ( - "sub sp, sp, #0x50\n\t" + "sub sp, sp, #0x70\n\t" "add lr, sp, #0x44\n\t" "stm lr, {%[s], %[a], %[c]}\n\t" "mov lr, %[b]\n\t" @@ -5267,7 +4964,7 @@ void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) "mov %[c], r12\n\t" "add lr, sp, #32\n\t" "stm lr, {%[c], r4, r5, r6, r7, r8, r9, r10}\n\t" - "ldr %[s], [sp, #68]\n\t" + "add %[s], sp, #0x50\n\t" /* Add c to a * b */ "ldr lr, [sp, #76]\n\t" "ldm sp!, {%[b], %[c], r4, r5, r6, r7, r8, r9}\n\t" @@ -5687,15 +5384,24 @@ void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) "adcs r8, r8, #0\n\t" "adc r9, r9, %[a]\n\t" "bfc r9, #28, #4\n\t" + "ldr %[s], [sp, #68]\n\t" /* Store result */ - "stm %[s], {%[b], %[c], r4, r5, r6, r7, r8, r9}\n\t" - "add sp, sp, #0x50\n\t" + "str %[b], [%[s]]\n\t" + "str %[c], [%[s], #4]\n\t" + "str r4, [%[s], #8]\n\t" + "str r5, [%[s], #12]\n\t" + "str r6, [%[s], #16]\n\t" + "str r7, [%[s], #20]\n\t" + "str r8, [%[s], #24]\n\t" + "str r9, [%[s], #28]\n\t" + "add sp, sp, #0x70\n\t" : [s] "+r" (s), [a] "+r" (a), [b] "+r" (b), [c] "+r" (c) : : "memory", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr" ); } +#endif /* HAVE_ED25519_SIGN */ #endif /* HAVE_ED25519 */ #endif /* !CURVE25519_SMALL || !ED25519_SMALL */ diff --git a/wolfcrypt/src/port/arm/thumb2-curve25519.S b/wolfcrypt/src/port/arm/thumb2-curve25519.S index d46e13d05d..8422cef6d2 100644 --- a/wolfcrypt/src/port/arm/thumb2-curve25519.S +++ b/wolfcrypt/src/port/arm/thumb2-curve25519.S @@ -236,11 +236,25 @@ fe_add: .type fe_frombytes, %function fe_frombytes: PUSH {r4, r5, r6, r7, r8, r9, lr} - LDM r1, {r2, r3, r4, r5, r6, r7, r8, r9} + LDR r2, [r1] + LDR r3, [r1, #4] + LDR r4, [r1, #8] + LDR r5, [r1, #12] + LDR r6, [r1, #16] + LDR r7, [r1, #20] + LDR r8, [r1, #24] + LDR r9, [r1, #28] BFC r9, #31, #1 - STM r0, {r2, r3, r4, r5, r6, r7, r8, r9} + STR r2, [r0] + STR r3, [r0, #4] + STR r4, [r0, #8] + STR r5, [r0, #12] + STR r6, [r0, #16] + STR r7, [r0, #20] + STR r8, [r0, #24] + STR r9, [r0, #28] POP {r4, r5, r6, r7, r8, r9, pc} - # Cycle Count = 35 + # Cycle Count = 49 .size fe_frombytes,.-fe_frombytes .text .align 4 @@ -268,9 +282,16 @@ fe_tobytes: ADCS r8, r8, #0x0 ADC r9, r9, #0x0 BFC r9, #31, #1 - STM r0, {r2, r3, r4, r5, r6, r7, r8, r9} + STR r2, [r0] + STR r3, [r0, #4] + STR r4, [r0, #8] + STR r5, [r0, #12] + STR r6, [r0, #16] + STR r7, [r0, #20] + STR r8, [r0, #24] + STR r9, [r0, #28] POP {r4, r5, r6, r7, r8, r9, r10, pc} - # Cycle Count = 55 + # Cycle Count = 62 .size fe_tobytes,.-fe_tobytes .text .align 4 @@ -3747,10 +3768,10 @@ sc_muladd: MOV r3, r12 ADD lr, sp, #0x20 STM lr, {r3, r4, r5, r6, r7, r8, r9, r10} - LDR r0, [sp, #68] + MOV r0, sp # Add c to a * b LDR lr, [sp, #76] - LDM sp!, {r2, r3, r4, r5, r6, r7, r8, r9} + LDM r0, {r2, r3, r4, r5, r6, r7, r8, r9} LDM lr!, {r1, r10, r11, r12} ADDS r2, r2, r1 ADCS r3, r3, r10 @@ -3762,8 +3783,8 @@ sc_muladd: ADCS r8, r8, r11 ADCS r9, r9, r12 MOV r1, r9 - STM r0, {r2, r3, r4, r5, r6, r7, r8, r9} - LDM sp, {r2, r3, r4, r5, r6, r7, r8, r9} + STM r0!, {r2, r3, r4, r5, r6, r7, r8, r9} + LDM r0, {r2, r3, r4, r5, r6, r7, r8, r9} ADCS r2, r2, #0x0 ADCS r3, r3, #0x0 ADCS r4, r4, #0x0 @@ -3772,10 +3793,9 @@ sc_muladd: ADCS r7, r7, #0x0 ADCS r8, r8, #0x0 ADC r9, r9, #0x0 - SUB sp, sp, #0x20 + SUB r0, r0, #0x20 # Get 252..503 and 504..507 LSR lr, r9, #24 - BFC r9, #24, #8 LSL r9, r9, #4 ORR r9, r9, r8, LSR #28 LSL r8, r8, #4 @@ -3792,6 +3812,7 @@ sc_muladd: ORR r3, r3, r2, LSR #28 LSL r2, r2, #4 ORR r2, r2, r1, LSR #28 + BFC r9, #28, #4 # Add order times bits 504..507 MOV r10, #0x2c13 MOVT r10, #0xa30a @@ -4035,11 +4056,19 @@ sc_muladd: ADCS r8, r8, #0x0 ADC r9, r9, r1 BFC r9, #28, #4 + LDR r0, [sp, #68] # Store result - STM r0, {r2, r3, r4, r5, r6, r7, r8, r9} + STR r2, [r0] + STR r3, [r0, #4] + STR r4, [r0, #8] + STR r5, [r0, #12] + STR r6, [r0, #16] + STR r7, [r0, #20] + STR r8, [r0, #24] + STR r9, [r0, #28] ADD sp, sp, #0x50 POP {r4, r5, r6, r7, r8, r9, r10, r11, pc} - # Cycle Count = 728 + # Cycle Count = 736 .size sc_muladd,.-sc_muladd #endif /* HAVE_ED25519_SIGN */ #endif /* HAVE_ED25519 */ diff --git a/wolfcrypt/src/port/arm/thumb2-curve25519_c.c b/wolfcrypt/src/port/arm/thumb2-curve25519_c.c index 43c79b5edc..1202779f71 100644 --- a/wolfcrypt/src/port/arm/thumb2-curve25519_c.c +++ b/wolfcrypt/src/port/arm/thumb2-curve25519_c.c @@ -260,9 +260,23 @@ void fe_frombytes(fe out_p, const unsigned char* in_p) register const unsigned char* in asm ("r1") = (const unsigned char*)in_p; __asm__ __volatile__ ( - "LDM %[in], {r2, r3, r4, r5, r6, r7, r8, r9}\n\t" + "LDR r2, [%[in]]\n\t" + "LDR r3, [%[in], #4]\n\t" + "LDR r4, [%[in], #8]\n\t" + "LDR r5, [%[in], #12]\n\t" + "LDR r6, [%[in], #16]\n\t" + "LDR r7, [%[in], #20]\n\t" + "LDR r8, [%[in], #24]\n\t" + "LDR r9, [%[in], #28]\n\t" "BFC r9, #31, #1\n\t" - "STM %[out], {r2, r3, r4, r5, r6, r7, r8, r9}\n\t" + "STR r2, [%[out]]\n\t" + "STR r3, [%[out], #4]\n\t" + "STR r4, [%[out], #8]\n\t" + "STR r5, [%[out], #12]\n\t" + "STR r6, [%[out], #16]\n\t" + "STR r7, [%[out], #20]\n\t" + "STR r8, [%[out], #24]\n\t" + "STR r9, [%[out], #28]\n\t" : [out] "+r" (out), [in] "+r" (in) : : "memory", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9" @@ -295,7 +309,14 @@ void fe_tobytes(unsigned char* out_p, const fe n_p) "ADCS r8, r8, #0x0\n\t" "ADC r9, r9, #0x0\n\t" "BFC r9, #31, #1\n\t" - "STM %[out], {r2, r3, r4, r5, r6, r7, r8, r9}\n\t" + "STR r2, [%[out]]\n\t" + "STR r3, [%[out], #4]\n\t" + "STR r4, [%[out], #8]\n\t" + "STR r5, [%[out], #12]\n\t" + "STR r6, [%[out], #16]\n\t" + "STR r7, [%[out], #20]\n\t" + "STR r8, [%[out], #24]\n\t" + "STR r9, [%[out], #28]\n\t" : [out] "+r" (out), [n] "+r" (n) : : "memory", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10" @@ -3896,10 +3917,10 @@ void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) "MOV %[c], r12\n\t" "ADD lr, sp, #0x20\n\t" "STM lr, {%[c], r4, r5, r6, r7, r8, r9, r10}\n\t" - "LDR %[s], [sp, #68]\n\t" + "MOV %[s], sp\n\t" /* Add c to a * b */ "LDR lr, [sp, #76]\n\t" - "LDM sp!, {%[b], %[c], r4, r5, r6, r7, r8, r9}\n\t" + "LDM %[s], {%[b], %[c], r4, r5, r6, r7, r8, r9}\n\t" "LDM lr!, {%[a], r10, r11, r12}\n\t" "ADDS %[b], %[b], %[a]\n\t" "ADCS %[c], %[c], r10\n\t" @@ -3911,8 +3932,8 @@ void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) "ADCS r8, r8, r11\n\t" "ADCS r9, r9, r12\n\t" "MOV %[a], r9\n\t" - "STM %[s], {%[b], %[c], r4, r5, r6, r7, r8, r9}\n\t" - "LDM sp, {%[b], %[c], r4, r5, r6, r7, r8, r9}\n\t" + "STM %[s]!, {%[b], %[c], r4, r5, r6, r7, r8, r9}\n\t" + "LDM %[s], {%[b], %[c], r4, r5, r6, r7, r8, r9}\n\t" "ADCS %[b], %[b], #0x0\n\t" "ADCS %[c], %[c], #0x0\n\t" "ADCS r4, r4, #0x0\n\t" @@ -3921,10 +3942,9 @@ void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) "ADCS r7, r7, #0x0\n\t" "ADCS r8, r8, #0x0\n\t" "ADC r9, r9, #0x0\n\t" - "SUB sp, sp, #0x20\n\t" + "SUB %[s], %[s], #0x20\n\t" /* Get 252..503 and 504..507 */ "LSR lr, r9, #24\n\t" - "BFC r9, #24, #8\n\t" "LSL r9, r9, #4\n\t" "ORR r9, r9, r8, LSR #28\n\t" "LSL r8, r8, #4\n\t" @@ -3941,6 +3961,7 @@ void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) "ORR %[c], %[c], %[b], LSR #28\n\t" "LSL %[b], %[b], #4\n\t" "ORR %[b], %[b], %[a], LSR #28\n\t" + "BFC r9, #28, #4\n\t" /* Add order times bits 504..507 */ "MOV r10, #0x2c13\n\t" "MOVT r10, #0xa30a\n\t" @@ -4184,8 +4205,16 @@ void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) "ADCS r8, r8, #0x0\n\t" "ADC r9, r9, %[a]\n\t" "BFC r9, #28, #4\n\t" + "LDR %[s], [sp, #68]\n\t" /* Store result */ - "STM %[s], {%[b], %[c], r4, r5, r6, r7, r8, r9}\n\t" + "STR %[b], [%[s]]\n\t" + "STR %[c], [%[s], #4]\n\t" + "STR r4, [%[s], #8]\n\t" + "STR r5, [%[s], #12]\n\t" + "STR r6, [%[s], #16]\n\t" + "STR r7, [%[s], #20]\n\t" + "STR r8, [%[s], #24]\n\t" + "STR r9, [%[s], #28]\n\t" "ADD sp, sp, #0x50\n\t" : [s] "+r" (s), [a] "+r" (a), [b] "+r" (b), [c] "+r" (c) : diff --git a/wolfcrypt/src/port/arm/thumb2-sha256-asm.S b/wolfcrypt/src/port/arm/thumb2-sha256-asm.S index e9721428e1..91dc10b37f 100644 --- a/wolfcrypt/src/port/arm/thumb2-sha256-asm.S +++ b/wolfcrypt/src/port/arm/thumb2-sha256-asm.S @@ -125,10 +125,14 @@ Transform_Sha256_Len: # Start of loop processing a block L_SHA256_transform_len_begin: # Load, Reverse and Store W - 64 bytes - LDRD r4, r5, [r1] - LDRD r6, r7, [r1, #8] - LDRD r8, r9, [r1, #16] - LDRD r10, r11, [r1, #24] + LDR r4, [r1] + LDR r5, [r1, #4] + LDR r6, [r1, #8] + LDR r7, [r1, #12] + LDR r8, [r1, #16] + LDR r9, [r1, #20] + LDR r10, [r1, #24] + LDR r11, [r1, #28] REV r4, r4 REV r5, r5 REV r6, r6 @@ -141,10 +145,14 @@ L_SHA256_transform_len_begin: STRD r6, r7, [sp, #8] STRD r8, r9, [sp, #16] STRD r10, r11, [sp, #24] - LDRD r4, r5, [r1, #32] - LDRD r6, r7, [r1, #40] - LDRD r8, r9, [r1, #48] - LDRD r10, r11, [r1, #56] + LDR r4, [r1, #32] + LDR r5, [r1, #36] + LDR r6, [r1, #40] + LDR r7, [r1, #44] + LDR r8, [r1, #48] + LDR r9, [r1, #52] + LDR r10, [r1, #56] + LDR r11, [r1, #60] REV r4, r4 REV r5, r5 REV r6, r6 @@ -1461,7 +1469,7 @@ L_SHA256_transform_len_start: BNE L_SHA256_transform_len_begin ADD sp, sp, #0xc0 POP {r4, r5, r6, r7, r8, r9, r10, r11, pc} - # Cycle Count = 1866 + # Cycle Count = 1874 .size Transform_Sha256_Len,.-Transform_Sha256_Len #endif /* WOLFSSL_ARMASM_NO_NEON */ #endif /* !NO_SHA256 */ diff --git a/wolfcrypt/src/port/arm/thumb2-sha256-asm_c.c b/wolfcrypt/src/port/arm/thumb2-sha256-asm_c.c index f7b396a82e..a21a607fe5 100644 --- a/wolfcrypt/src/port/arm/thumb2-sha256-asm_c.c +++ b/wolfcrypt/src/port/arm/thumb2-sha256-asm_c.c @@ -84,10 +84,14 @@ void Transform_Sha256_Len(wc_Sha256* sha256_p, const byte* data_p, word32 len_p) "\n" "L_SHA256_transform_len_begin_%=:\n\t" /* Load, Reverse and Store W - 64 bytes */ - "LDRD r4, r5, [%[data]]\n\t" - "LDRD r6, r7, [%[data], #8]\n\t" - "LDRD r8, r9, [%[data], #16]\n\t" - "LDRD r10, r11, [%[data], #24]\n\t" + "LDR r4, [%[data]]\n\t" + "LDR r5, [%[data], #4]\n\t" + "LDR r6, [%[data], #8]\n\t" + "LDR r7, [%[data], #12]\n\t" + "LDR r8, [%[data], #16]\n\t" + "LDR r9, [%[data], #20]\n\t" + "LDR r10, [%[data], #24]\n\t" + "LDR r11, [%[data], #28]\n\t" "REV r4, r4\n\t" "REV r5, r5\n\t" "REV r6, r6\n\t" @@ -100,10 +104,14 @@ void Transform_Sha256_Len(wc_Sha256* sha256_p, const byte* data_p, word32 len_p) "STRD r6, r7, [sp, #8]\n\t" "STRD r8, r9, [sp, #16]\n\t" "STRD r10, r11, [sp, #24]\n\t" - "LDRD r4, r5, [%[data], #32]\n\t" - "LDRD r6, r7, [%[data], #40]\n\t" - "LDRD r8, r9, [%[data], #48]\n\t" - "LDRD r10, r11, [%[data], #56]\n\t" + "LDR r4, [%[data], #32]\n\t" + "LDR r5, [%[data], #36]\n\t" + "LDR r6, [%[data], #40]\n\t" + "LDR r7, [%[data], #44]\n\t" + "LDR r8, [%[data], #48]\n\t" + "LDR r9, [%[data], #52]\n\t" + "LDR r10, [%[data], #56]\n\t" + "LDR r11, [%[data], #60]\n\t" "REV r4, r4\n\t" "REV r5, r5\n\t" "REV r6, r6\n\t" diff --git a/wolfssl/wolfcrypt/curve25519.h b/wolfssl/wolfcrypt/curve25519.h index 7f6bed03b9..7ebb2d542e 100644 --- a/wolfssl/wolfcrypt/curve25519.h +++ b/wolfssl/wolfcrypt/curve25519.h @@ -61,9 +61,9 @@ typedef struct { /* ECC point, the internal structure is Little endian * the mathematical functions used the endianness */ typedef struct ECPoint { - byte point[CURVE25519_KEYSIZE]; + ALIGN16 byte point[CURVE25519_KEYSIZE]; #ifdef FREESCALE_LTC_ECC - byte pointY[CURVE25519_KEYSIZE]; + ALIGN16 byte pointY[CURVE25519_KEYSIZE]; #endif byte pointSz; } ECPoint; @@ -80,8 +80,8 @@ struct curve25519_key { curve in dp */ const curve25519_set_type* dp; /* domain parameters, either points to curves (idx >= 0) or user supplied */ - ECPoint p; /* public point for key */ - byte k[CURVE25519_KEYSIZE]; /* private scaler for key */ + ECPoint p; /* public point for key */ + ALIGN16 byte k[CURVE25519_KEYSIZE]; /* private scaler for key */ #ifdef WOLFSSL_ASYNC_CRYPT WC_ASYNC_DEV asyncDev; diff --git a/wolfssl/wolfcrypt/ed25519.h b/wolfssl/wolfcrypt/ed25519.h index 8306f44b17..7d14418f0e 100644 --- a/wolfssl/wolfcrypt/ed25519.h +++ b/wolfssl/wolfcrypt/ed25519.h @@ -85,12 +85,12 @@ enum { /* An ED25519 Key */ struct ed25519_key { - byte p[ED25519_PUB_KEY_SIZE]; /* compressed public key */ - byte k[ED25519_PRV_KEY_SIZE]; /* private key : 32 secret -- 32 public */ + ALIGN16 byte p[ED25519_PUB_KEY_SIZE]; /* compressed public key */ + ALIGN16 byte k[ED25519_PRV_KEY_SIZE]; /* private key: 32 secret, 32 pub */ #ifdef FREESCALE_LTC_ECC /* uncompressed point coordinates */ - byte pointX[ED25519_KEY_SIZE]; /* recovered X coordinate */ - byte pointY[ED25519_KEY_SIZE]; /* Y coordinate is the public key with The most significant bit of the final octet always zero. */ + ALIGN16 byte pointX[ED25519_KEY_SIZE]; /* recovered X coordinate */ + ALIGN16 byte pointY[ED25519_KEY_SIZE]; /* Y coordinate is the public key with The most significant bit of the final octet always zero. */ #endif #ifdef WOLFSSL_SE050 word32 keyId; diff --git a/wolfssl/wolfcrypt/ge_operations.h b/wolfssl/wolfcrypt/ge_operations.h index c8a8b8a943..4438f8fca0 100644 --- a/wolfssl/wolfcrypt/ge_operations.h +++ b/wolfssl/wolfcrypt/ge_operations.h @@ -46,15 +46,15 @@ where d = -121665/121666. */ #ifdef ED25519_SMALL - typedef byte ge[F25519_SIZE]; + ALIGN16 typedef byte ge[F25519_SIZE]; #elif defined(CURVED25519_ASM_64BIT) - typedef sword64 ge[4]; + ALIGN16 typedef sword64 ge[4]; #elif defined(CURVED25519_ASM_32BIT) - typedef sword32 ge[8]; + ALIGN16 typedef sword32 ge[8]; #elif defined(CURVED25519_128BIT) - typedef sword64 ge[5]; + ALIGN16 typedef sword64 ge[5]; #else - typedef sword32 ge[10]; + ALIGN16 typedef sword32 ge[10]; #endif typedef struct { From d0d1f4db24f95c19552fcbb5881f9c040a1ec7af Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Thu, 7 Sep 2023 16:50:21 +1000 Subject: [PATCH 10/89] Thumb2 Curve25519 ASM: add versions that don't use umaal --- wolfcrypt/src/curve25519.c | 11 +- wolfcrypt/src/port/arm/thumb2-curve25519.S | 2291 ++++++++++++++++- wolfcrypt/src/port/arm/thumb2-curve25519_c.c | 2302 +++++++++++++++++- 3 files changed, 4505 insertions(+), 99 deletions(-) diff --git a/wolfcrypt/src/curve25519.c b/wolfcrypt/src/curve25519.c index 75dbcdc05e..e5c3593bae 100644 --- a/wolfcrypt/src/curve25519.c +++ b/wolfcrypt/src/curve25519.c @@ -58,8 +58,13 @@ const curve25519_set_type curve25519_sets[] = { } }; -ALIGN16 static const unsigned char kCurve25519BasePoint[CURVE25519_KEYSIZE] = - { 9 }; +static const word32 kCurve25519BasePoint[CURVE25519_KEYSIZE/sizeof(word32)] = { +#ifdef BIG_ENDIAN_ORDER + 0x09000000 +#else + 9 +#endif +}; /* Curve25519 private key must be less than order */ /* These functions clamp private k and check it */ @@ -134,7 +139,7 @@ int wc_curve25519_make_pub(int public_size, byte* pub, int private_size, SAVE_VECTOR_REGISTERS(return _svr_ret;); - ret = curve25519(pub, priv, kCurve25519BasePoint); + ret = curve25519(pub, priv, (byte*)kCurve25519BasePoint); RESTORE_VECTOR_REGISTERS(); #endif diff --git a/wolfcrypt/src/port/arm/thumb2-curve25519.S b/wolfcrypt/src/port/arm/thumb2-curve25519.S index 8422cef6d2..a6e7ad6726 100644 --- a/wolfcrypt/src/port/arm/thumb2-curve25519.S +++ b/wolfcrypt/src/port/arm/thumb2-curve25519.S @@ -1511,6 +1511,386 @@ fe_cmov_table: #endif /* WC_NO_CACHE_RESISTANT */ #endif /* HAVE_ED25519_MAKE_KEY || HAVE_ED25519_SIGN */ #endif /* HAVE_ED25519 */ +#ifdef WOLFSSL_SP_NO_UMAAL + .text + .align 4 + .globl fe_mul_op + .type fe_mul_op, %function +fe_mul_op: + PUSH {lr} + SUB sp, sp, #0x28 + STR r0, [sp, #36] + MOV r0, #0x0 + LDR r12, [r1] + # A[0] * B[0] + LDR lr, [r2] + UMULL r3, r4, r12, lr + # A[0] * B[2] + LDR lr, [r2, #8] + UMULL r5, r6, r12, lr + # A[0] * B[4] + LDR lr, [r2, #16] + UMULL r7, r8, r12, lr + # A[0] * B[6] + LDR lr, [r2, #24] + UMULL r9, r10, r12, lr + STR r3, [sp] + # A[0] * B[1] + LDR lr, [r2, #4] + MOV r11, r0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[0] * B[3] + LDR lr, [r2, #12] + ADCS r6, r6, #0x0 + ADC r11, r0, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[0] * B[5] + LDR lr, [r2, #20] + ADCS r8, r8, #0x0 + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[0] * B[7] + LDR lr, [r2, #28] + ADCS r10, r10, #0x0 + ADC r3, r0, #0x0 + UMLAL r10, r3, r12, lr + # A[1] * B[0] + LDR r12, [r1, #4] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r4, r11, r12, lr + STR r4, [sp, #4] + ADDS r5, r5, r11 + # A[1] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[1] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[1] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + ADDS r8, r8, r11 + # A[1] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[1] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + # A[1] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[1] * B[7] + LDR lr, [r2, #28] + ADC r4, r0, #0x0 + UMLAL r3, r4, r12, lr + # A[2] * B[0] + LDR r12, [r1, #8] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r5, r11, r12, lr + STR r5, [sp, #8] + ADDS r6, r6, r11 + # A[2] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[2] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + ADDS r8, r8, r11 + # A[2] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[2] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + # A[2] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[2] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[2] * B[7] + LDR lr, [r2, #28] + ADC r5, r0, #0x0 + UMLAL r4, r5, r12, lr + # A[3] * B[0] + LDR r12, [r1, #12] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r6, r11, r12, lr + STR r6, [sp, #12] + ADDS r7, r7, r11 + # A[3] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + ADDS r8, r8, r11 + # A[3] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[3] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + # A[3] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[3] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[3] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[3] * B[7] + LDR lr, [r2, #28] + ADC r6, r0, #0x0 + UMLAL r5, r6, r12, lr + # A[4] * B[0] + LDR r12, [r1, #16] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r7, r11, r12, lr + STR r7, [sp, #16] + ADDS r8, r8, r11 + # A[4] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[4] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + # A[4] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[4] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[4] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[4] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[4] * B[7] + LDR lr, [r2, #28] + ADC r7, r0, #0x0 + UMLAL r6, r7, r12, lr + # A[5] * B[0] + LDR r12, [r1, #20] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r8, r11, r12, lr + STR r8, [sp, #20] + ADDS r9, r9, r11 + # A[5] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + # A[5] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[5] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[5] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[5] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[5] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[5] * B[7] + LDR lr, [r2, #28] + ADC r8, r0, #0x0 + UMLAL r7, r8, r12, lr + # A[6] * B[0] + LDR r12, [r1, #24] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r9, r11, r12, lr + STR r9, [sp, #24] + ADDS r10, r10, r11 + # A[6] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[6] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[6] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[6] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[6] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[6] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + ADDS r8, r8, r11 + # A[6] * B[7] + LDR lr, [r2, #28] + ADC r9, r0, #0x0 + UMLAL r8, r9, r12, lr + # A[7] * B[0] + LDR r12, [r1, #28] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r10, r11, r12, lr + STR r10, [sp, #28] + ADDS r3, r3, r11 + # A[7] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[7] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[7] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[7] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[7] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + ADDS r8, r8, r11 + # A[7] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[7] * B[7] + LDR lr, [r2, #28] + ADC r10, r0, #0x0 + UMLAL r9, r10, r12, lr + # Reduce + LDR r2, [sp, #28] + MOV lr, sp + MOV r12, #0x26 + UMULL r10, r11, r10, r12 + ADDS r10, r10, r2 + ADC r11, r11, #0x0 + MOV r12, #0x13 + LSL r11, r11, #1 + ORR r11, r11, r10, LSR #31 + MUL r11, r11, r12 + LDM lr!, {r1, r2} + MOV r12, #0x26 + ADDS r1, r1, r11 + ADC r11, r0, #0x0 + UMLAL r1, r11, r3, r12 + ADDS r2, r2, r11 + ADC r11, r0, #0x0 + UMLAL r2, r11, r4, r12 + LDM lr!, {r3, r4} + ADDS r3, r3, r11 + ADC r11, r0, #0x0 + UMLAL r3, r11, r5, r12 + ADDS r4, r4, r11 + ADC r11, r0, #0x0 + UMLAL r4, r11, r6, r12 + LDM lr!, {r5, r6} + ADDS r5, r5, r11 + ADC r11, r0, #0x0 + UMLAL r5, r11, r7, r12 + ADDS r6, r6, r11 + ADC r11, r0, #0x0 + UMLAL r6, r11, r8, r12 + LDM lr!, {r7, r8} + ADDS r7, r7, r11 + ADC r11, r0, #0x0 + UMLAL r7, r11, r9, r12 + BFC r10, #31, #1 + ADDS r8, r10, r11 + # Store + LDR r0, [sp, #36] + STM r0, {r1, r2, r3, r4, r5, r6, r7, r8} + ADD sp, sp, #0x28 + POP {pc} + # Cycle Count = 406 + .size fe_mul_op,.-fe_mul_op +#else .text .align 4 .globl fe_mul_op @@ -1643,6 +2023,7 @@ fe_mul_op: POP {pc} # Cycle Count = 239 .size fe_mul_op,.-fe_mul_op +#endif /* WOLFSSL_SP_NO_UMAAL */ .text .align 4 .globl fe_mul @@ -1653,6 +2034,279 @@ fe_mul: POP {r4, r5, r6, r7, r8, r9, r10, r11, pc} # Cycle Count = 24 .size fe_mul,.-fe_mul +#ifdef WOLFSSL_SP_NO_UMAAL + .text + .align 4 + .globl fe_sq_op + .type fe_sq_op, %function +fe_sq_op: + PUSH {lr} + SUB sp, sp, #0x44 + STR r0, [sp, #64] + # Square + MOV r0, #0x0 + LDR r12, [r1] + # A[0] * A[1] + LDR lr, [r1, #4] + UMULL r4, r5, r12, lr + # A[0] * A[3] + LDR lr, [r1, #12] + UMULL r6, r7, r12, lr + # A[0] * A[5] + LDR lr, [r1, #20] + UMULL r8, r9, r12, lr + # A[0] * A[7] + LDR lr, [r1, #28] + UMULL r10, r3, r12, lr + # A[0] * A[2] + LDR lr, [r1, #8] + MOV r11, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[0] * A[4] + LDR lr, [r1, #16] + ADCS r7, r7, #0x0 + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + ADDS r8, r8, r11 + # A[0] * A[6] + LDR lr, [r1, #24] + ADCS r9, r9, #0x0 + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + ADCS r3, r3, #0x0 + STR r4, [sp, #4] + STR r5, [sp, #8] + # A[1] * A[2] + LDR r12, [r1, #4] + LDR lr, [r1, #8] + MOV r11, #0x0 + UMLAL r6, r11, r12, lr + STR r6, [sp, #12] + ADDS r7, r7, r11 + # A[1] * A[3] + LDR lr, [r1, #12] + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + STR r7, [sp, #16] + ADDS r8, r8, r11 + # A[1] * A[4] + LDR lr, [r1, #16] + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[1] * A[5] + LDR lr, [r1, #20] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + # A[1] * A[6] + LDR lr, [r1, #24] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[1] * A[7] + LDR lr, [r1, #28] + ADC r4, r0, #0x0 + UMLAL r3, r4, r12, lr + # A[2] * A[3] + LDR r12, [r1, #8] + LDR lr, [r1, #12] + MOV r11, #0x0 + UMLAL r8, r11, r12, lr + STR r8, [sp, #20] + ADDS r9, r9, r11 + # A[2] * A[4] + LDR lr, [r1, #16] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + STR r9, [sp, #24] + ADDS r10, r10, r11 + # A[2] * A[5] + LDR lr, [r1, #20] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[2] * A[6] + LDR lr, [r1, #24] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[2] * A[7] + LDR lr, [r1, #28] + ADC r5, r0, #0x0 + UMLAL r4, r5, r12, lr + # A[3] * A[4] + LDR r12, [r1, #12] + LDR lr, [r1, #16] + MOV r11, #0x0 + UMLAL r10, r11, r12, lr + STR r10, [sp, #28] + ADDS r3, r3, r11 + # A[3] * A[5] + LDR lr, [r1, #20] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[3] * A[6] + LDR lr, [r1, #24] + ADC r11, r0, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[3] * A[7] + LDR lr, [r1, #28] + ADC r6, r0, #0x0 + UMLAL r5, r6, r12, lr + # A[4] * A[5] + LDR r12, [r1, #16] + LDR lr, [r1, #20] + MOV r11, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[4] * A[6] + LDR lr, [r1, #24] + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[4] * A[7] + LDR lr, [r1, #28] + ADC r7, r0, #0x0 + UMLAL r6, r7, r12, lr + # A[5] * A[6] + LDR r12, [r1, #20] + LDR lr, [r1, #24] + MOV r11, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[5] * A[7] + LDR lr, [r1, #28] + ADC r8, r0, #0x0 + UMLAL r7, r8, r12, lr + # A[6] * A[7] + LDR r12, [r1, #24] + LDR lr, [r1, #28] + MOV r9, #0x0 + UMLAL r8, r9, r12, lr + ADD lr, sp, #0x20 + STM lr, {r3, r4, r5, r6, r7, r8, r9} + ADD lr, sp, #0x4 + LDM lr, {r4, r5, r6, r7, r8, r9, r10} + ADDS r4, r4, r4 + ADCS r5, r5, r5 + ADCS r6, r6, r6 + ADCS r7, r7, r7 + ADCS r8, r8, r8 + ADCS r9, r9, r9 + ADCS r10, r10, r10 + STM lr!, {r4, r5, r6, r7, r8, r9, r10} + LDM lr, {r3, r4, r5, r6, r7, r8, r9} + ADCS r3, r3, r3 + ADCS r4, r4, r4 + ADCS r5, r5, r5 + ADCS r6, r6, r6 + ADCS r7, r7, r7 + ADCS r8, r8, r8 + ADCS r9, r9, r9 + ADC r10, r0, #0x0 + STM lr, {r3, r4, r5, r6, r7, r8, r9, r10} + ADD lr, sp, #0x4 + LDM lr, {r4, r5, r6, r7, r8, r9, r10} + MOV lr, sp + # A[0] * A[0] + LDR r12, [r1] + UMULL r3, r11, r12, r12 + ADDS r4, r4, r11 + # A[1] * A[1] + LDR r12, [r1, #4] + ADCS r5, r5, #0x0 + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, r12 + ADDS r6, r6, r11 + # A[2] * A[2] + LDR r12, [r1, #8] + ADCS r7, r7, #0x0 + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, r12 + ADDS r8, r8, r11 + # A[3] * A[3] + LDR r12, [r1, #12] + ADCS r9, r9, #0x0 + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, r12 + ADDS r10, r10, r11 + STM lr!, {r3, r4, r5, r6, r7, r8, r9, r10} + LDM lr, {r3, r4, r5, r6, r7, r8, r9, r10} + # A[4] * A[4] + LDR r12, [r1, #16] + ADCS r3, r3, #0x0 + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, r12 + ADDS r4, r4, r11 + # A[5] * A[5] + LDR r12, [r1, #20] + ADCS r5, r5, #0x0 + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, r12 + ADDS r6, r6, r11 + # A[6] * A[6] + LDR r12, [r1, #24] + ADCS r7, r7, #0x0 + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, r12 + ADDS r8, r8, r11 + # A[7] * A[7] + LDR r12, [r1, #28] + ADCS r9, r9, #0x0 + ADC r10, r10, #0x0 + UMLAL r9, r10, r12, r12 + # Reduce + LDR r2, [sp, #28] + MOV lr, sp + MOV r12, #0x26 + UMULL r10, r11, r10, r12 + ADDS r10, r10, r2 + ADC r11, r11, #0x0 + MOV r12, #0x13 + LSL r11, r11, #1 + ORR r11, r11, r10, LSR #31 + MUL r11, r11, r12 + LDM lr!, {r1, r2} + MOV r12, #0x26 + ADDS r1, r1, r11 + ADC r11, r0, #0x0 + UMLAL r1, r11, r3, r12 + ADDS r2, r2, r11 + ADC r11, r0, #0x0 + UMLAL r2, r11, r4, r12 + LDM lr!, {r3, r4} + ADDS r3, r3, r11 + ADC r11, r0, #0x0 + UMLAL r3, r11, r5, r12 + ADDS r4, r4, r11 + ADC r11, r0, #0x0 + UMLAL r4, r11, r6, r12 + LDM lr!, {r5, r6} + ADDS r5, r5, r11 + ADC r11, r0, #0x0 + UMLAL r5, r11, r7, r12 + ADDS r6, r6, r11 + ADC r11, r0, #0x0 + UMLAL r6, r11, r8, r12 + LDM lr!, {r7, r8} + ADDS r7, r7, r11 + ADC r11, r0, #0x0 + UMLAL r7, r11, r9, r12 + BFC r10, #31, #1 + ADDS r8, r10, r11 + # Store + LDR r0, [sp, #64] + STM r0, {r1, r2, r3, r4, r5, r6, r7, r8} + ADD sp, sp, #0x44 + POP {pc} + # Cycle Count = 355 + .size fe_sq_op,.-fe_sq_op +#else .text .align 4 .globl fe_sq_op @@ -1771,6 +2425,7 @@ fe_sq_op: POP {pc} # Cycle Count = 179 .size fe_sq_op,.-fe_sq_op +#endif /* WOLFSSL_SP_NO_UMAAL */ .text .align 4 .globl fe_sq @@ -1782,6 +2437,57 @@ fe_sq: # Cycle Count = 24 .size fe_sq,.-fe_sq #ifdef HAVE_CURVE25519 +#ifdef WOLFSSL_SP_NO_UMAAL + .text + .align 4 + .globl fe_mul121666 + .type fe_mul121666, %function +fe_mul121666: + PUSH {r4, r5, r6, r7, r8, r9, r10, r11, lr} + # Multiply by 121666 + LDM r1, {r2, r3, r4, r5, r6, r7, r8, r9} + MOV r12, #0xdb42 + MOVT r12, #0x1 + UMULL r2, r10, r2, r12 + UMULL r3, r11, r3, r12 + ADDS r3, r3, r10 + ADC r11, r11, #0x0 + UMULL r4, r10, r4, r12 + ADDS r4, r4, r11 + ADC r10, r10, #0x0 + UMULL r5, r11, r5, r12 + ADDS r5, r5, r10 + ADC r11, r11, #0x0 + UMULL r6, r10, r6, r12 + ADDS r6, r6, r11 + ADC r10, r10, #0x0 + UMULL r7, r11, r7, r12 + ADDS r7, r7, r10 + ADC r11, r11, #0x0 + UMULL r8, r10, r8, r12 + ADDS r8, r8, r11 + ADC r10, r10, #0x0 + UMULL r9, r11, r9, r12 + ADDS r9, r9, r10 + MOV r12, #0x13 + ADC r11, r11, #0x0 + LSL r11, r11, #1 + ORR r11, r11, r9, LSR #31 + MUL r11, r11, r12 + ADDS r2, r2, r11 + ADCS r3, r3, #0x0 + ADCS r4, r4, #0x0 + ADCS r5, r5, #0x0 + ADCS r6, r6, #0x0 + ADCS r7, r7, #0x0 + BFC r9, #31, #1 + ADCS r8, r8, #0x0 + ADC r9, r9, #0x0 + STM r0, {r2, r3, r4, r5, r6, r7, r8, r9} + POP {r4, r5, r6, r7, r8, r9, r10, r11, pc} + # Cycle Count = 75 + .size fe_mul121666,.-fe_mul121666 +#else .text .align 4 .globl fe_mul121666 @@ -1818,6 +2524,7 @@ fe_mul121666: POP {r4, r5, r6, r7, r8, r9, r10, r11, pc} # Cycle Count = 69 .size fe_mul121666,.-fe_mul121666 +#endif /* WOLFSSL_SP_NO_UMAAL */ #ifndef WC_NO_CACHE_RESISTANT .text .align 4 @@ -2651,6 +3358,312 @@ L_fe_invert8: POP {r4, r5, r6, r7, r8, r9, r10, r11, pc} # Cycle Count = 292 .size fe_invert,.-fe_invert +#ifdef WOLFSSL_SP_NO_UMAAL + .text + .align 4 + .globl fe_sq2 + .type fe_sq2, %function +fe_sq2: + PUSH {lr} + SUB sp, sp, #0x44 + STR r0, [sp, #64] + # Square * 2 + MOV r0, #0x0 + LDR r12, [r1] + # A[0] * A[1] + LDR lr, [r1, #4] + UMULL r4, r5, r12, lr + # A[0] * A[3] + LDR lr, [r1, #12] + UMULL r6, r7, r12, lr + # A[0] * A[5] + LDR lr, [r1, #20] + UMULL r8, r9, r12, lr + # A[0] * A[7] + LDR lr, [r1, #28] + UMULL r10, r3, r12, lr + # A[0] * A[2] + LDR lr, [r1, #8] + MOV r11, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[0] * A[4] + LDR lr, [r1, #16] + ADCS r7, r7, #0x0 + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + ADDS r8, r8, r11 + # A[0] * A[6] + LDR lr, [r1, #24] + ADCS r9, r9, #0x0 + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + ADCS r3, r3, #0x0 + STR r4, [sp, #4] + STR r5, [sp, #8] + # A[1] * A[2] + LDR r12, [r1, #4] + LDR lr, [r1, #8] + MOV r11, #0x0 + UMLAL r6, r11, r12, lr + STR r6, [sp, #12] + ADDS r7, r7, r11 + # A[1] * A[3] + LDR lr, [r1, #12] + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + STR r7, [sp, #16] + ADDS r8, r8, r11 + # A[1] * A[4] + LDR lr, [r1, #16] + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[1] * A[5] + LDR lr, [r1, #20] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + # A[1] * A[6] + LDR lr, [r1, #24] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[1] * A[7] + LDR lr, [r1, #28] + ADC r4, r0, #0x0 + UMLAL r3, r4, r12, lr + # A[2] * A[3] + LDR r12, [r1, #8] + LDR lr, [r1, #12] + MOV r11, #0x0 + UMLAL r8, r11, r12, lr + STR r8, [sp, #20] + ADDS r9, r9, r11 + # A[2] * A[4] + LDR lr, [r1, #16] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + STR r9, [sp, #24] + ADDS r10, r10, r11 + # A[2] * A[5] + LDR lr, [r1, #20] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[2] * A[6] + LDR lr, [r1, #24] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[2] * A[7] + LDR lr, [r1, #28] + ADC r5, r0, #0x0 + UMLAL r4, r5, r12, lr + # A[3] * A[4] + LDR r12, [r1, #12] + LDR lr, [r1, #16] + MOV r11, #0x0 + UMLAL r10, r11, r12, lr + STR r10, [sp, #28] + ADDS r3, r3, r11 + # A[3] * A[5] + LDR lr, [r1, #20] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[3] * A[6] + LDR lr, [r1, #24] + ADC r11, r0, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[3] * A[7] + LDR lr, [r1, #28] + ADC r6, r0, #0x0 + UMLAL r5, r6, r12, lr + # A[4] * A[5] + LDR r12, [r1, #16] + LDR lr, [r1, #20] + MOV r11, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[4] * A[6] + LDR lr, [r1, #24] + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[4] * A[7] + LDR lr, [r1, #28] + ADC r7, r0, #0x0 + UMLAL r6, r7, r12, lr + # A[5] * A[6] + LDR r12, [r1, #20] + LDR lr, [r1, #24] + MOV r11, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[5] * A[7] + LDR lr, [r1, #28] + ADC r8, r0, #0x0 + UMLAL r7, r8, r12, lr + # A[6] * A[7] + LDR r12, [r1, #24] + LDR lr, [r1, #28] + MOV r9, #0x0 + UMLAL r8, r9, r12, lr + ADD lr, sp, #0x20 + STM lr, {r3, r4, r5, r6, r7, r8, r9} + ADD lr, sp, #0x4 + LDM lr, {r4, r5, r6, r7, r8, r9, r10} + ADDS r4, r4, r4 + ADCS r5, r5, r5 + ADCS r6, r6, r6 + ADCS r7, r7, r7 + ADCS r8, r8, r8 + ADCS r9, r9, r9 + ADCS r10, r10, r10 + STM lr!, {r4, r5, r6, r7, r8, r9, r10} + LDM lr, {r3, r4, r5, r6, r7, r8, r9} + ADCS r3, r3, r3 + ADCS r4, r4, r4 + ADCS r5, r5, r5 + ADCS r6, r6, r6 + ADCS r7, r7, r7 + ADCS r8, r8, r8 + ADCS r9, r9, r9 + ADC r10, r0, #0x0 + STM lr, {r3, r4, r5, r6, r7, r8, r9, r10} + ADD lr, sp, #0x4 + LDM lr, {r4, r5, r6, r7, r8, r9, r10} + MOV lr, sp + # A[0] * A[0] + LDR r12, [r1] + UMULL r3, r11, r12, r12 + ADDS r4, r4, r11 + # A[1] * A[1] + LDR r12, [r1, #4] + ADCS r5, r5, #0x0 + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, r12 + ADDS r6, r6, r11 + # A[2] * A[2] + LDR r12, [r1, #8] + ADCS r7, r7, #0x0 + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, r12 + ADDS r8, r8, r11 + # A[3] * A[3] + LDR r12, [r1, #12] + ADCS r9, r9, #0x0 + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, r12 + ADDS r10, r10, r11 + STM lr!, {r3, r4, r5, r6, r7, r8, r9, r10} + LDM lr, {r3, r4, r5, r6, r7, r8, r9, r10} + # A[4] * A[4] + LDR r12, [r1, #16] + ADCS r3, r3, #0x0 + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, r12 + ADDS r4, r4, r11 + # A[5] * A[5] + LDR r12, [r1, #20] + ADCS r5, r5, #0x0 + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, r12 + ADDS r6, r6, r11 + # A[6] * A[6] + LDR r12, [r1, #24] + ADCS r7, r7, #0x0 + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, r12 + ADDS r8, r8, r11 + # A[7] * A[7] + LDR r12, [r1, #28] + ADCS r9, r9, #0x0 + ADC r10, r10, #0x0 + UMLAL r9, r10, r12, r12 + # Reduce + LDR r2, [sp, #28] + MOV lr, sp + MOV r12, #0x26 + UMULL r10, r11, r10, r12 + ADDS r10, r10, r2 + ADC r11, r11, #0x0 + MOV r12, #0x13 + LSL r11, r11, #1 + ORR r11, r11, r10, LSR #31 + MUL r11, r11, r12 + LDM lr!, {r1, r2} + MOV r12, #0x26 + ADDS r1, r1, r11 + ADC r11, r0, #0x0 + UMLAL r1, r11, r3, r12 + ADDS r2, r2, r11 + ADC r11, r0, #0x0 + UMLAL r2, r11, r4, r12 + LDM lr!, {r3, r4} + ADDS r3, r3, r11 + ADC r11, r0, #0x0 + UMLAL r3, r11, r5, r12 + ADDS r4, r4, r11 + ADC r11, r0, #0x0 + UMLAL r4, r11, r6, r12 + LDM lr!, {r5, r6} + ADDS r5, r5, r11 + ADC r11, r0, #0x0 + UMLAL r5, r11, r7, r12 + ADDS r6, r6, r11 + ADC r11, r0, #0x0 + UMLAL r6, r11, r8, r12 + LDM lr!, {r7, r8} + ADDS r7, r7, r11 + ADC r11, r0, #0x0 + UMLAL r7, r11, r9, r12 + BFC r10, #31, #1 + ADDS r8, r10, r11 + # Reduce if top bit set + MOV r12, #0x13 + AND r11, r12, r8, ASR #31 + ADDS r1, r1, r11 + ADCS r2, r2, #0x0 + ADCS r3, r3, #0x0 + ADCS r4, r4, #0x0 + ADCS r5, r5, #0x0 + ADCS r6, r6, #0x0 + BFC r8, #31, #1 + ADCS r7, r7, #0x0 + ADC r8, r8, #0x0 + # Double + ADDS r1, r1, r1 + ADCS r2, r2, r2 + ADCS r3, r3, r3 + ADCS r4, r4, r4 + ADCS r5, r5, r5 + ADCS r6, r6, r6 + ADCS r7, r7, r7 + ADC r8, r8, r8 + # Reduce if top bit set + MOV r12, #0x13 + AND r11, r12, r8, ASR #31 + ADDS r1, r1, r11 + ADCS r2, r2, #0x0 + ADCS r3, r3, #0x0 + ADCS r4, r4, #0x0 + ADCS r5, r5, #0x0 + ADCS r6, r6, #0x0 + BFC r8, #31, #1 + ADCS r7, r7, #0x0 + ADC r8, r8, #0x0 + # Store + LDR r0, [sp, #64] + STM r0, {r1, r2, r3, r4, r5, r6, r7, r8} + ADD sp, sp, #0x44 + POP {pc} + # Cycle Count = 385 + .size fe_sq2,.-fe_sq2 +#else .text .align 4 .globl fe_sq2 @@ -2804,6 +3817,7 @@ fe_sq2: POP {pc} # Cycle Count = 213 .size fe_sq2,.-fe_sq2 +#endif /* WOLFSSL_SP_NO_UMAAL */ .text .align 4 .globl fe_pow22523 @@ -3381,6 +4395,7 @@ ge_sub: POP {r4, r5, r6, r7, r8, r9, r10, r11, pc} # Cycle Count = 138 .size ge_sub,.-ge_sub +#ifndef WOLFSSL_SP_NO_UMAAL .text .align 4 .globl sc_reduce @@ -3417,13 +4432,22 @@ sc_reduce: MOVT r11, #0xa7ed MOV r1, #0x0 UMLAL r2, r1, r10, lr - UMAAL r3, r1, r11, lr + ADDS r3, r3, r1 + MOV r1, #0x0 + ADC r1, r1, #0x0 + UMLAL r3, r1, r11, lr MOV r10, #0x6329 MOVT r10, #0x5d08 MOV r11, #0x621 MOVT r11, #0xeb21 - UMAAL r4, r1, r10, lr - UMAAL r5, r1, r11, lr + ADDS r4, r4, r1 + MOV r1, #0x0 + ADC r1, r1, #0x0 + UMLAL r4, r1, r10, lr + ADDS r5, r5, r1 + MOV r1, #0x0 + ADC r1, r1, #0x0 + UMLAL r5, r1, r11, lr ADDS r6, r6, r1 ADCS r7, r7, #0x0 ADCS r8, r8, #0x0 @@ -3438,18 +4462,39 @@ sc_reduce: MOV lr, #0x0 LDM r0!, {r10, r11, r12} UMLAL r10, lr, r2, r1 - UMAAL r11, lr, r3, r1 - UMAAL r12, lr, r4, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r3, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r4, r1 STM sp!, {r10, r11, r12} LDM r0!, {r10, r11, r12} - UMAAL r10, lr, r5, r1 - UMAAL r11, lr, r6, r1 - UMAAL r12, lr, r7, r1 + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r5, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r6, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r7, r1 STM sp!, {r10, r11, r12} LDM r0!, {r10, r11} - UMAAL r10, lr, r8, r1 + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r8, r1 BFC r11, #28, #4 - UMAAL r11, lr, r9, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r9, r1 STM sp!, {r10, r11, lr} SUB r0, r0, #0x10 SUB sp, sp, #0x20 @@ -3458,17 +4503,38 @@ sc_reduce: MOV lr, #0x0 LDM sp, {r10, r11, r12} UMLAL r10, lr, r2, r1 - UMAAL r11, lr, r3, r1 - UMAAL r12, lr, r4, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r3, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r4, r1 STM sp!, {r10, r11, r12} LDM sp, {r10, r11, r12} - UMAAL r10, lr, r5, r1 - UMAAL r11, lr, r6, r1 - UMAAL r12, lr, r7, r1 + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r5, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r6, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r7, r1 STM sp!, {r10, r11, r12} LDM sp, {r10, r11} - UMAAL r10, lr, r8, r1 - UMAAL r11, lr, r9, r1 + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r8, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r9, r1 STM sp!, {r10, r11, lr} SUB sp, sp, #0x20 MOV r1, #0x6329 @@ -3476,17 +4542,38 @@ sc_reduce: MOV lr, #0x0 LDM sp, {r10, r11, r12} UMLAL r10, lr, r2, r1 - UMAAL r11, lr, r3, r1 - UMAAL r12, lr, r4, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r3, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r4, r1 STM sp!, {r10, r11, r12} LDM sp, {r10, r11, r12} - UMAAL r10, lr, r5, r1 - UMAAL r11, lr, r6, r1 - UMAAL r12, lr, r7, r1 + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r5, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r6, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r7, r1 STM sp!, {r10, r11, r12} LDM sp, {r10, r11} - UMAAL r10, lr, r8, r1 - UMAAL r11, lr, r9, r1 + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r8, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r9, r1 STM sp!, {r10, r11, lr} SUB sp, sp, #0x20 MOV r1, #0x621 @@ -3494,17 +4581,38 @@ sc_reduce: MOV lr, #0x0 LDM sp, {r10, r11, r12} UMLAL r10, lr, r2, r1 - UMAAL r11, lr, r3, r1 - UMAAL r12, lr, r4, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r3, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r4, r1 STM sp!, {r10, r11, r12} LDM sp, {r10, r11, r12} - UMAAL r10, lr, r5, r1 - UMAAL r11, lr, r6, r1 - UMAAL r12, lr, r7, r1 - STM sp!, {r10, r11, r12} - LDM sp, {r10, r11} - UMAAL r10, lr, r8, r1 - UMAAL r11, lr, r9, r1 + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r5, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r6, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r7, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11} + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r8, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r9, r1 STM sp!, {r10, r11, lr} SUB sp, sp, #0x20 # Subtract at 4 * 32 @@ -3554,7 +4662,7 @@ sc_reduce: LDM sp, {r10, r11, r12} ADCS r10, r10, #0x0 ADCS r11, r11, #0x0 - ADCS r12, r12, r9 + ADC r12, r12, r9 STM sp!, {r10, r11, r12} SUB sp, sp, #0x30 SUB r0, r0, #0x10 @@ -3578,9 +4686,18 @@ sc_reduce: MOV lr, #0x0 LDM sp, {r6, r7, r8, r9} UMLAL r6, lr, r2, r1 - UMAAL r7, lr, r3, r1 - UMAAL r8, lr, r4, r1 - UMAAL r9, lr, r5, r1 + ADDS r7, r7, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r7, lr, r3, r1 + ADDS r8, r8, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r8, lr, r4, r1 + ADDS r9, r9, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r9, lr, r5, r1 STM sp, {r6, r7, r8, r9} ADD sp, sp, #0x4 # * -5812631b @@ -3589,9 +4706,18 @@ sc_reduce: MOV r10, #0x0 LDM sp, {r6, r7, r8, r9} UMLAL r6, r10, r2, r1 - UMAAL r7, r10, r3, r1 - UMAAL r8, r10, r4, r1 - UMAAL r9, r10, r5, r1 + ADDS r7, r7, r10 + MOV r10, #0x0 + ADC r10, r10, #0x0 + UMLAL r7, r10, r3, r1 + ADDS r8, r8, r10 + MOV r10, #0x0 + ADC r10, r10, #0x0 + UMLAL r8, r10, r4, r1 + ADDS r9, r9, r10 + MOV r10, #0x0 + ADC r10, r10, #0x0 + UMLAL r9, r10, r5, r1 STM sp, {r6, r7, r8, r9} ADD sp, sp, #0x4 # * -a2f79cd7 @@ -3600,9 +4726,18 @@ sc_reduce: MOV r11, #0x0 LDM sp, {r6, r7, r8, r9} UMLAL r6, r11, r2, r1 - UMAAL r7, r11, r3, r1 - UMAAL r8, r11, r4, r1 - UMAAL r9, r11, r5, r1 + ADDS r7, r7, r11 + MOV r11, #0x0 + ADC r11, r11, #0x0 + UMLAL r7, r11, r3, r1 + ADDS r8, r8, r11 + MOV r11, #0x0 + ADC r11, r11, #0x0 + UMLAL r8, r11, r4, r1 + ADDS r9, r9, r11 + MOV r11, #0x0 + ADC r11, r11, #0x0 + UMLAL r9, r11, r5, r1 STM sp, {r6, r7, r8, r9} ADD sp, sp, #0x4 # * -14def9df @@ -3611,9 +4746,18 @@ sc_reduce: MOV r12, #0x0 LDM sp, {r6, r7, r8, r9} UMLAL r6, r12, r2, r1 - UMAAL r7, r12, r3, r1 - UMAAL r8, r12, r4, r1 - UMAAL r9, r12, r5, r1 + ADDS r7, r7, r12 + MOV r12, #0x0 + ADC r12, r12, #0x0 + UMLAL r7, r12, r3, r1 + ADDS r8, r8, r12 + MOV r12, #0x0 + ADC r12, r12, #0x0 + UMLAL r8, r12, r4, r1 + ADDS r9, r9, r12 + MOV r12, #0x0 + ADC r12, r12, #0x0 + UMLAL r9, r12, r5, r1 STM sp, {r6, r7, r8, r9} ADD sp, sp, #0x4 # Add overflows at 4 * 32 @@ -3657,9 +4801,1057 @@ sc_reduce: STM r0, {r2, r3, r4, r5, r6, r7, r8, r9} ADD sp, sp, #0x34 POP {r4, r5, r6, r7, r8, r9, r10, r11, pc} - # Cycle Count = 482 + # Cycle Count = 568 .size sc_reduce,.-sc_reduce -#ifdef HAVE_ED25519_SIGN +#else + .text + .align 4 + .globl sc_reduce + .type sc_reduce, %function +sc_reduce: + PUSH {r4, r5, r6, r7, r8, r9, r10, r11, lr} + SUB sp, sp, #0x34 + # Load bits 252-511 + ADD r0, r0, #0x1c + LDM r0, {r1, r2, r3, r4, r5, r6, r7, r8, r9} + LSR lr, r9, #24 + LSL r9, r9, #4 + ORR r9, r9, r8, LSR #28 + LSL r8, r8, #4 + ORR r8, r8, r7, LSR #28 + LSL r7, r7, #4 + ORR r7, r7, r6, LSR #28 + LSL r6, r6, #4 + ORR r6, r6, r5, LSR #28 + LSL r5, r5, #4 + ORR r5, r5, r4, LSR #28 + LSL r4, r4, #4 + ORR r4, r4, r3, LSR #28 + LSL r3, r3, #4 + ORR r3, r3, r2, LSR #28 + LSL r2, r2, #4 + ORR r2, r2, r1, LSR #28 + BFC r9, #28, #4 + SUB r0, r0, #0x1c + # Add order times bits 504..511 + MOV r10, #0x2c13 + MOVT r10, #0xa30a + MOV r11, #0x9ce5 + MOVT r11, #0xa7ed + MOV r1, #0x0 + UMLAL r2, r1, r10, lr + UMAAL r3, r1, r11, lr + MOV r10, #0x6329 + MOVT r10, #0x5d08 + MOV r11, #0x621 + MOVT r11, #0xeb21 + UMAAL r4, r1, r10, lr + UMAAL r5, r1, r11, lr + ADDS r6, r6, r1 + ADCS r7, r7, #0x0 + ADCS r8, r8, #0x0 + ADC r9, r9, #0x0 + SUBS r6, r6, lr + SBCS r7, r7, #0x0 + SBCS r8, r8, #0x0 + SBC r9, r9, #0x0 + # Sub product of top 8 words and order + MOV r1, #0x2c13 + MOVT r1, #0xa30a + MOV lr, #0x0 + LDM r0!, {r10, r11, r12} + UMLAL r10, lr, r2, r1 + UMAAL r11, lr, r3, r1 + UMAAL r12, lr, r4, r1 + STM sp!, {r10, r11, r12} + LDM r0!, {r10, r11, r12} + UMAAL r10, lr, r5, r1 + UMAAL r11, lr, r6, r1 + UMAAL r12, lr, r7, r1 + STM sp!, {r10, r11, r12} + LDM r0!, {r10, r11} + UMAAL r10, lr, r8, r1 + BFC r11, #28, #4 + UMAAL r11, lr, r9, r1 + STM sp!, {r10, r11, lr} + SUB r0, r0, #0x10 + SUB sp, sp, #0x20 + MOV r1, #0x9ce5 + MOVT r1, #0xa7ed + MOV lr, #0x0 + LDM sp, {r10, r11, r12} + UMLAL r10, lr, r2, r1 + UMAAL r11, lr, r3, r1 + UMAAL r12, lr, r4, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11, r12} + UMAAL r10, lr, r5, r1 + UMAAL r11, lr, r6, r1 + UMAAL r12, lr, r7, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11} + UMAAL r10, lr, r8, r1 + UMAAL r11, lr, r9, r1 + STM sp!, {r10, r11, lr} + SUB sp, sp, #0x20 + MOV r1, #0x6329 + MOVT r1, #0x5d08 + MOV lr, #0x0 + LDM sp, {r10, r11, r12} + UMLAL r10, lr, r2, r1 + UMAAL r11, lr, r3, r1 + UMAAL r12, lr, r4, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11, r12} + UMAAL r10, lr, r5, r1 + UMAAL r11, lr, r6, r1 + UMAAL r12, lr, r7, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11} + UMAAL r10, lr, r8, r1 + UMAAL r11, lr, r9, r1 + STM sp!, {r10, r11, lr} + SUB sp, sp, #0x20 + MOV r1, #0x621 + MOVT r1, #0xeb21 + MOV lr, #0x0 + LDM sp, {r10, r11, r12} + UMLAL r10, lr, r2, r1 + UMAAL r11, lr, r3, r1 + UMAAL r12, lr, r4, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11, r12} + UMAAL r10, lr, r5, r1 + UMAAL r11, lr, r6, r1 + UMAAL r12, lr, r7, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11} + UMAAL r10, lr, r8, r1 + UMAAL r11, lr, r9, r1 + STM sp!, {r10, r11, lr} + SUB sp, sp, #0x20 + # Subtract at 4 * 32 + LDM sp, {r10, r11, r12} + SUBS r10, r10, r2 + SBCS r11, r11, r3 + SBCS r12, r12, r4 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11, r12} + SBCS r10, r10, r5 + SBCS r11, r11, r6 + SBCS r12, r12, r7 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11} + SBCS r10, r10, r8 + SBC r11, r11, r9 + STM sp!, {r10, r11} + SUB sp, sp, #0x24 + ASR lr, r11, #25 + # Conditionally subtract order starting at bit 125 + MOV r1, #0xa0000000 + MOV r2, #0xba7d + MOVT r2, #0x4b9e + MOV r3, #0x4c63 + MOVT r3, #0xcb02 + MOV r4, #0xf39a + MOVT r4, #0xd45e + MOV r5, #0xdf3b + MOVT r5, #0x29b + MOV r9, #0x2000000 + AND r1, r1, lr + AND r2, r2, lr + AND r3, r3, lr + AND r4, r4, lr + AND r5, r5, lr + AND r9, r9, lr + LDM sp, {r10, r11, r12} + ADDS r10, r10, r1 + ADCS r11, r11, r2 + ADCS r12, r12, r3 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11, r12} + ADCS r10, r10, r4 + ADCS r11, r11, r5 + ADCS r12, r12, #0x0 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11, r12} + ADCS r10, r10, #0x0 + ADCS r11, r11, #0x0 + ADC r12, r12, r9 + STM sp!, {r10, r11, r12} + SUB sp, sp, #0x30 + SUB r0, r0, #0x10 + # Load bits 252-376 + ADD sp, sp, #0x1c + LDM sp, {r1, r2, r3, r4, r5} + LSL r5, r5, #4 + ORR r5, r5, r4, LSR #28 + LSL r4, r4, #4 + ORR r4, r4, r3, LSR #28 + LSL r3, r3, #4 + ORR r3, r3, r2, LSR #28 + LSL r2, r2, #4 + ORR r2, r2, r1, LSR #28 + BFC r5, #29, #3 + SUB sp, sp, #0x1c + # Sub product of top 8 words and order + # * -5cf5d3ed + MOV r1, #0x2c13 + MOVT r1, #0xa30a + MOV lr, #0x0 + LDM sp, {r6, r7, r8, r9} + UMLAL r6, lr, r2, r1 + UMAAL r7, lr, r3, r1 + UMAAL r8, lr, r4, r1 + UMAAL r9, lr, r5, r1 + STM sp, {r6, r7, r8, r9} + ADD sp, sp, #0x4 + # * -5812631b + MOV r1, #0x9ce5 + MOVT r1, #0xa7ed + MOV r10, #0x0 + LDM sp, {r6, r7, r8, r9} + UMLAL r6, r10, r2, r1 + UMAAL r7, r10, r3, r1 + UMAAL r8, r10, r4, r1 + UMAAL r9, r10, r5, r1 + STM sp, {r6, r7, r8, r9} + ADD sp, sp, #0x4 + # * -a2f79cd7 + MOV r1, #0x6329 + MOVT r1, #0x5d08 + MOV r11, #0x0 + LDM sp, {r6, r7, r8, r9} + UMLAL r6, r11, r2, r1 + UMAAL r7, r11, r3, r1 + UMAAL r8, r11, r4, r1 + UMAAL r9, r11, r5, r1 + STM sp, {r6, r7, r8, r9} + ADD sp, sp, #0x4 + # * -14def9df + MOV r1, #0x621 + MOVT r1, #0xeb21 + MOV r12, #0x0 + LDM sp, {r6, r7, r8, r9} + UMLAL r6, r12, r2, r1 + UMAAL r7, r12, r3, r1 + UMAAL r8, r12, r4, r1 + UMAAL r9, r12, r5, r1 + STM sp, {r6, r7, r8, r9} + ADD sp, sp, #0x4 + # Add overflows at 4 * 32 + LDM sp, {r6, r7, r8, r9} + BFC r9, #28, #4 + ADDS r6, r6, lr + ADCS r7, r7, r10 + ADCS r8, r8, r11 + ADC r9, r9, r12 + # Subtract top at 4 * 32 + SUBS r6, r6, r2 + SBCS r7, r7, r3 + SBCS r8, r8, r4 + SBCS r9, r9, r5 + SBC r1, r1, r1 + SUB sp, sp, #0x10 + LDM sp, {r2, r3, r4, r5} + MOV r10, #0xd3ed + MOVT r10, #0x5cf5 + MOV r11, #0x631a + MOVT r11, #0x5812 + MOV r12, #0x9cd6 + MOVT r12, #0xa2f7 + MOV lr, #0xf9de + MOVT lr, #0x14de + AND r10, r10, r1 + AND r11, r11, r1 + AND r12, r12, r1 + AND lr, lr, r1 + ADDS r2, r2, r10 + ADCS r3, r3, r11 + ADCS r4, r4, r12 + ADCS r5, r5, lr + ADCS r6, r6, #0x0 + ADCS r7, r7, #0x0 + AND r1, r1, #0x10000000 + ADCS r8, r8, #0x0 + ADC r9, r9, r1 + BFC r9, #28, #4 + # Store result + STM r0, {r2, r3, r4, r5, r6, r7, r8, r9} + ADD sp, sp, #0x34 + POP {r4, r5, r6, r7, r8, r9, r10, r11, pc} + # Cycle Count = 482 + .size sc_reduce,.-sc_reduce +#endif /* WOLFSSL_SP_NO_UMAAL */ +#ifdef HAVE_ED25519_SIGN +#ifndef WOLFSSL_SP_NO_UMAAL + .text + .align 4 + .globl sc_muladd + .type sc_muladd, %function +sc_muladd: + PUSH {r4, r5, r6, r7, r8, r9, r10, r11, lr} + SUB sp, sp, #0x50 + ADD lr, sp, #0x44 + STM lr, {r0, r1, r3} + MOV r0, #0x0 + LDR r12, [r1] + # A[0] * B[0] + LDR lr, [r2] + UMULL r3, r4, r12, lr + # A[0] * B[2] + LDR lr, [r2, #8] + UMULL r5, r6, r12, lr + # A[0] * B[4] + LDR lr, [r2, #16] + UMULL r7, r8, r12, lr + # A[0] * B[6] + LDR lr, [r2, #24] + UMULL r9, r10, r12, lr + STR r3, [sp] + # A[0] * B[1] + LDR lr, [r2, #4] + MOV r11, r0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[0] * B[3] + LDR lr, [r2, #12] + ADCS r6, r6, #0x0 + ADC r11, r0, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[0] * B[5] + LDR lr, [r2, #20] + ADCS r8, r8, #0x0 + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[0] * B[7] + LDR lr, [r2, #28] + ADCS r10, r10, #0x0 + ADC r3, r0, #0x0 + UMLAL r10, r3, r12, lr + # A[1] * B[0] + LDR r12, [r1, #4] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r4, r11, r12, lr + STR r4, [sp, #4] + ADDS r5, r5, r11 + # A[1] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[1] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[1] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + ADDS r8, r8, r11 + # A[1] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[1] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + # A[1] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[1] * B[7] + LDR lr, [r2, #28] + ADC r4, r0, #0x0 + UMLAL r3, r4, r12, lr + # A[2] * B[0] + LDR r12, [r1, #8] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r5, r11, r12, lr + STR r5, [sp, #8] + ADDS r6, r6, r11 + # A[2] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[2] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + ADDS r8, r8, r11 + # A[2] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[2] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + # A[2] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[2] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[2] * B[7] + LDR lr, [r2, #28] + ADC r5, r0, #0x0 + UMLAL r4, r5, r12, lr + # A[3] * B[0] + LDR r12, [r1, #12] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r6, r11, r12, lr + STR r6, [sp, #12] + ADDS r7, r7, r11 + # A[3] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + ADDS r8, r8, r11 + # A[3] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[3] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + # A[3] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[3] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[3] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[3] * B[7] + LDR lr, [r2, #28] + ADC r6, r0, #0x0 + UMLAL r5, r6, r12, lr + # A[4] * B[0] + LDR r12, [r1, #16] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r7, r11, r12, lr + STR r7, [sp, #16] + ADDS r8, r8, r11 + # A[4] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[4] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + # A[4] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[4] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[4] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[4] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[4] * B[7] + LDR lr, [r2, #28] + ADC r7, r0, #0x0 + UMLAL r6, r7, r12, lr + # A[5] * B[0] + LDR r12, [r1, #20] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r8, r11, r12, lr + STR r8, [sp, #20] + ADDS r9, r9, r11 + # A[5] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r9, r11, r12, lr + ADDS r10, r10, r11 + # A[5] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[5] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[5] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[5] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[5] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[5] * B[7] + LDR lr, [r2, #28] + ADC r8, r0, #0x0 + UMLAL r7, r8, r12, lr + # A[6] * B[0] + LDR r12, [r1, #24] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r9, r11, r12, lr + STR r9, [sp, #24] + ADDS r10, r10, r11 + # A[6] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r10, r11, r12, lr + ADDS r3, r3, r11 + # A[6] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[6] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[6] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[6] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[6] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + ADDS r8, r8, r11 + # A[6] * B[7] + LDR lr, [r2, #28] + ADC r9, r0, #0x0 + UMLAL r8, r9, r12, lr + # A[7] * B[0] + LDR r12, [r1, #28] + LDR lr, [r2] + MOV r11, #0x0 + UMLAL r10, r11, r12, lr + STR r10, [sp, #28] + ADDS r3, r3, r11 + # A[7] * B[1] + LDR lr, [r2, #4] + ADC r11, r0, #0x0 + UMLAL r3, r11, r12, lr + ADDS r4, r4, r11 + # A[7] * B[2] + LDR lr, [r2, #8] + ADC r11, r0, #0x0 + UMLAL r4, r11, r12, lr + ADDS r5, r5, r11 + # A[7] * B[3] + LDR lr, [r2, #12] + ADC r11, r0, #0x0 + UMLAL r5, r11, r12, lr + ADDS r6, r6, r11 + # A[7] * B[4] + LDR lr, [r2, #16] + ADC r11, r0, #0x0 + UMLAL r6, r11, r12, lr + ADDS r7, r7, r11 + # A[7] * B[5] + LDR lr, [r2, #20] + ADC r11, r0, #0x0 + UMLAL r7, r11, r12, lr + ADDS r8, r8, r11 + # A[7] * B[6] + LDR lr, [r2, #24] + ADC r11, r0, #0x0 + UMLAL r8, r11, r12, lr + ADDS r9, r9, r11 + # A[7] * B[7] + LDR lr, [r2, #28] + ADC r10, r0, #0x0 + UMLAL r9, r10, r12, lr + ADD lr, sp, #0x20 + STM lr, {r3, r4, r5, r6, r7, r8, r9, r10} + MOV r0, sp + # Add c to a * b + LDR lr, [sp, #76] + LDM r0, {r2, r3, r4, r5, r6, r7, r8, r9} + LDM lr!, {r1, r10, r11, r12} + ADDS r2, r2, r1 + ADCS r3, r3, r10 + ADCS r4, r4, r11 + ADCS r5, r5, r12 + LDM lr!, {r1, r10, r11, r12} + ADCS r6, r6, r1 + ADCS r7, r7, r10 + ADCS r8, r8, r11 + ADCS r9, r9, r12 + MOV r1, r9 + STM r0!, {r2, r3, r4, r5, r6, r7, r8, r9} + LDM r0, {r2, r3, r4, r5, r6, r7, r8, r9} + ADCS r2, r2, #0x0 + ADCS r3, r3, #0x0 + ADCS r4, r4, #0x0 + ADCS r5, r5, #0x0 + ADCS r6, r6, #0x0 + ADCS r7, r7, #0x0 + ADCS r8, r8, #0x0 + ADC r9, r9, #0x0 + SUB r0, r0, #0x20 + # Get 252..503 and 504..507 + LSR lr, r9, #24 + LSL r9, r9, #4 + ORR r9, r9, r8, LSR #28 + LSL r8, r8, #4 + ORR r8, r8, r7, LSR #28 + LSL r7, r7, #4 + ORR r7, r7, r6, LSR #28 + LSL r6, r6, #4 + ORR r6, r6, r5, LSR #28 + LSL r5, r5, #4 + ORR r5, r5, r4, LSR #28 + LSL r4, r4, #4 + ORR r4, r4, r3, LSR #28 + LSL r3, r3, #4 + ORR r3, r3, r2, LSR #28 + LSL r2, r2, #4 + ORR r2, r2, r1, LSR #28 + BFC r9, #28, #4 + # Add order times bits 504..507 + MOV r10, #0x2c13 + MOVT r10, #0xa30a + MOV r11, #0x9ce5 + MOVT r11, #0xa7ed + MOV r1, #0x0 + UMLAL r2, r1, r10, lr + ADDS r3, r3, r1 + MOV r1, #0x0 + ADC r1, r1, #0x0 + UMLAL r3, r1, r11, lr + MOV r10, #0x6329 + MOVT r10, #0x5d08 + MOV r11, #0x621 + MOVT r11, #0xeb21 + ADDS r4, r4, r1 + MOV r1, #0x0 + ADC r1, r1, #0x0 + UMLAL r4, r1, r10, lr + ADDS r5, r5, r1 + MOV r1, #0x0 + ADC r1, r1, #0x0 + UMLAL r5, r1, r11, lr + ADDS r6, r6, r1 + ADCS r7, r7, #0x0 + ADCS r8, r8, #0x0 + ADC r9, r9, #0x0 + SUBS r6, r6, lr + SBCS r7, r7, #0x0 + SBCS r8, r8, #0x0 + SBC r9, r9, #0x0 + # Sub product of top 8 words and order + MOV r1, #0x2c13 + MOVT r1, #0xa30a + MOV lr, #0x0 + LDM r0!, {r10, r11, r12} + UMLAL r10, lr, r2, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r3, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r4, r1 + STM sp!, {r10, r11, r12} + LDM r0!, {r10, r11, r12} + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r5, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r6, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r7, r1 + STM sp!, {r10, r11, r12} + LDM r0!, {r10, r11} + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r8, r1 + BFC r11, #28, #4 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r9, r1 + STM sp!, {r10, r11, lr} + SUB r0, r0, #0x10 + SUB sp, sp, #0x20 + MOV r1, #0x9ce5 + MOVT r1, #0xa7ed + MOV lr, #0x0 + LDM sp, {r10, r11, r12} + UMLAL r10, lr, r2, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r3, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r4, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11, r12} + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r5, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r6, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r7, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11} + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r8, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r9, r1 + STM sp!, {r10, r11, lr} + SUB sp, sp, #0x20 + MOV r1, #0x6329 + MOVT r1, #0x5d08 + MOV lr, #0x0 + LDM sp, {r10, r11, r12} + UMLAL r10, lr, r2, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r3, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r4, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11, r12} + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r5, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r6, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r7, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11} + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r8, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r9, r1 + STM sp!, {r10, r11, lr} + SUB sp, sp, #0x20 + MOV r1, #0x621 + MOVT r1, #0xeb21 + MOV lr, #0x0 + LDM sp, {r10, r11, r12} + UMLAL r10, lr, r2, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r3, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r4, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11, r12} + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r5, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r6, r1 + ADDS r12, r12, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r12, lr, r7, r1 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11} + ADDS r10, r10, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r10, lr, r8, r1 + ADDS r11, r11, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r11, lr, r9, r1 + STM sp!, {r10, r11, lr} + SUB sp, sp, #0x20 + # Subtract at 4 * 32 + LDM sp, {r10, r11, r12} + SUBS r10, r10, r2 + SBCS r11, r11, r3 + SBCS r12, r12, r4 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11, r12} + SBCS r10, r10, r5 + SBCS r11, r11, r6 + SBCS r12, r12, r7 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11} + SBCS r10, r10, r8 + SBC r11, r11, r9 + STM sp!, {r10, r11} + SUB sp, sp, #0x24 + ASR lr, r11, #25 + # Conditionally subtract order starting at bit 125 + MOV r1, #0xa0000000 + MOV r2, #0xba7d + MOVT r2, #0x4b9e + MOV r3, #0x4c63 + MOVT r3, #0xcb02 + MOV r4, #0xf39a + MOVT r4, #0xd45e + MOV r5, #0xdf3b + MOVT r5, #0x29b + MOV r9, #0x2000000 + AND r1, r1, lr + AND r2, r2, lr + AND r3, r3, lr + AND r4, r4, lr + AND r5, r5, lr + AND r9, r9, lr + LDM sp, {r10, r11, r12} + ADDS r10, r10, r1 + ADCS r11, r11, r2 + ADCS r12, r12, r3 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11, r12} + ADCS r10, r10, r4 + ADCS r11, r11, r5 + ADCS r12, r12, #0x0 + STM sp!, {r10, r11, r12} + LDM sp, {r10, r11, r12} + ADCS r10, r10, #0x0 + ADCS r11, r11, #0x0 + ADC r12, r12, r9 + STM sp!, {r10, r11, r12} + SUB sp, sp, #0x30 + SUB r0, r0, #0x10 + # Load bits 252-376 + ADD sp, sp, #0x1c + LDM sp, {r1, r2, r3, r4, r5} + LSL r5, r5, #4 + ORR r5, r5, r4, LSR #28 + LSL r4, r4, #4 + ORR r4, r4, r3, LSR #28 + LSL r3, r3, #4 + ORR r3, r3, r2, LSR #28 + LSL r2, r2, #4 + ORR r2, r2, r1, LSR #28 + BFC r5, #29, #3 + SUB sp, sp, #0x1c + # Sub product of top 8 words and order + # * -5cf5d3ed + MOV r1, #0x2c13 + MOVT r1, #0xa30a + MOV lr, #0x0 + LDM sp, {r6, r7, r8, r9} + UMLAL r6, lr, r2, r1 + ADDS r7, r7, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r7, lr, r3, r1 + ADDS r8, r8, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r8, lr, r4, r1 + ADDS r9, r9, lr + MOV lr, #0x0 + ADC lr, lr, #0x0 + UMLAL r9, lr, r5, r1 + STM sp, {r6, r7, r8, r9} + ADD sp, sp, #0x4 + # * -5812631b + MOV r1, #0x9ce5 + MOVT r1, #0xa7ed + MOV r10, #0x0 + LDM sp, {r6, r7, r8, r9} + UMLAL r6, r10, r2, r1 + ADDS r7, r7, r10 + MOV r10, #0x0 + ADC r10, r10, #0x0 + UMLAL r7, r10, r3, r1 + ADDS r8, r8, r10 + MOV r10, #0x0 + ADC r10, r10, #0x0 + UMLAL r8, r10, r4, r1 + ADDS r9, r9, r10 + MOV r10, #0x0 + ADC r10, r10, #0x0 + UMLAL r9, r10, r5, r1 + STM sp, {r6, r7, r8, r9} + ADD sp, sp, #0x4 + # * -a2f79cd7 + MOV r1, #0x6329 + MOVT r1, #0x5d08 + MOV r11, #0x0 + LDM sp, {r6, r7, r8, r9} + UMLAL r6, r11, r2, r1 + ADDS r7, r7, r11 + MOV r11, #0x0 + ADC r11, r11, #0x0 + UMLAL r7, r11, r3, r1 + ADDS r8, r8, r11 + MOV r11, #0x0 + ADC r11, r11, #0x0 + UMLAL r8, r11, r4, r1 + ADDS r9, r9, r11 + MOV r11, #0x0 + ADC r11, r11, #0x0 + UMLAL r9, r11, r5, r1 + STM sp, {r6, r7, r8, r9} + ADD sp, sp, #0x4 + # * -14def9df + MOV r1, #0x621 + MOVT r1, #0xeb21 + MOV r12, #0x0 + LDM sp, {r6, r7, r8, r9} + UMLAL r6, r12, r2, r1 + ADDS r7, r7, r12 + MOV r12, #0x0 + ADC r12, r12, #0x0 + UMLAL r7, r12, r3, r1 + ADDS r8, r8, r12 + MOV r12, #0x0 + ADC r12, r12, #0x0 + UMLAL r8, r12, r4, r1 + ADDS r9, r9, r12 + MOV r12, #0x0 + ADC r12, r12, #0x0 + UMLAL r9, r12, r5, r1 + STM sp, {r6, r7, r8, r9} + ADD sp, sp, #0x4 + # Add overflows at 4 * 32 + LDM sp, {r6, r7, r8, r9} + BFC r9, #28, #4 + ADDS r6, r6, lr + ADCS r7, r7, r10 + ADCS r8, r8, r11 + ADC r9, r9, r12 + # Subtract top at 4 * 32 + SUBS r6, r6, r2 + SBCS r7, r7, r3 + SBCS r8, r8, r4 + SBCS r9, r9, r5 + SBC r1, r1, r1 + SUB sp, sp, #0x10 + LDM sp, {r2, r3, r4, r5} + MOV r10, #0xd3ed + MOVT r10, #0x5cf5 + MOV r11, #0x631a + MOVT r11, #0x5812 + MOV r12, #0x9cd6 + MOVT r12, #0xa2f7 + MOV lr, #0xf9de + MOVT lr, #0x14de + AND r10, r10, r1 + AND r11, r11, r1 + AND r12, r12, r1 + AND lr, lr, r1 + ADDS r2, r2, r10 + ADCS r3, r3, r11 + ADCS r4, r4, r12 + ADCS r5, r5, lr + ADCS r6, r6, #0x0 + ADCS r7, r7, #0x0 + AND r1, r1, #0x10000000 + ADCS r8, r8, #0x0 + ADC r9, r9, r1 + BFC r9, #28, #4 + LDR r0, [sp, #68] + # Store result + STR r2, [r0] + STR r3, [r0, #4] + STR r4, [r0, #8] + STR r5, [r0, #12] + STR r6, [r0, #16] + STR r7, [r0, #20] + STR r8, [r0, #24] + STR r9, [r0, #28] + ADD sp, sp, #0x50 + POP {r4, r5, r6, r7, r8, r9, r10, r11, pc} + # Cycle Count = 978 + .size sc_muladd,.-sc_muladd +#else .text .align 4 .globl sc_muladd @@ -3957,7 +6149,7 @@ sc_muladd: LDM sp, {r10, r11, r12} ADCS r10, r10, #0x0 ADCS r11, r11, #0x0 - ADCS r12, r12, r9 + ADC r12, r12, r9 STM sp!, {r10, r11, r12} SUB sp, sp, #0x30 SUB r0, r0, #0x10 @@ -4070,6 +6262,7 @@ sc_muladd: POP {r4, r5, r6, r7, r8, r9, r10, r11, pc} # Cycle Count = 736 .size sc_muladd,.-sc_muladd +#endif /* WOLFSSL_SP_NO_UMAAL */ #endif /* HAVE_ED25519_SIGN */ #endif /* HAVE_ED25519 */ diff --git a/wolfcrypt/src/port/arm/thumb2-curve25519_c.c b/wolfcrypt/src/port/arm/thumb2-curve25519_c.c index 1202779f71..412a856d2d 100644 --- a/wolfcrypt/src/port/arm/thumb2-curve25519_c.c +++ b/wolfcrypt/src/port/arm/thumb2-curve25519_c.c @@ -1565,6 +1565,387 @@ void fe_cmov_table(fe* r_p, fe* base_p, signed char b_p) #endif /* WC_NO_CACHE_RESISTANT */ #endif /* HAVE_ED25519_MAKE_KEY || HAVE_ED25519_SIGN */ #endif /* HAVE_ED25519 */ +#ifdef WOLFSSL_SP_NO_UMAAL +void fe_mul_op(void); +void fe_mul_op() +{ + __asm__ __volatile__ ( + "SUB sp, sp, #0x28\n\t" + "STR r0, [sp, #36]\n\t" + "MOV r0, #0x0\n\t" + "LDR r12, [r1]\n\t" + /* A[0] * B[0] */ + "LDR lr, [r2]\n\t" + "UMULL r3, r4, r12, lr\n\t" + /* A[0] * B[2] */ + "LDR lr, [r2, #8]\n\t" + "UMULL r5, r6, r12, lr\n\t" + /* A[0] * B[4] */ + "LDR lr, [r2, #16]\n\t" + "UMULL r7, r8, r12, lr\n\t" + /* A[0] * B[6] */ + "LDR lr, [r2, #24]\n\t" + "UMULL r9, r10, r12, lr\n\t" + "STR r3, [sp]\n\t" + /* A[0] * B[1] */ + "LDR lr, [r2, #4]\n\t" + "MOV r11, r0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[0] * B[3] */ + "LDR lr, [r2, #12]\n\t" + "ADCS r6, r6, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[0] * B[5] */ + "LDR lr, [r2, #20]\n\t" + "ADCS r8, r8, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[0] * B[7] */ + "LDR lr, [r2, #28]\n\t" + "ADCS r10, r10, #0x0\n\t" + "ADC r3, r0, #0x0\n\t" + "UMLAL r10, r3, r12, lr\n\t" + /* A[1] * B[0] */ + "LDR r12, [r1, #4]\n\t" + "LDR lr, [r2]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "STR r4, [sp, #4]\n\t" + "ADDS r5, r5, r11\n\t" + /* A[1] * B[1] */ + "LDR lr, [r2, #4]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[1] * B[2] */ + "LDR lr, [r2, #8]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[1] * B[3] */ + "LDR lr, [r2, #12]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "ADDS r8, r8, r11\n\t" + /* A[1] * B[4] */ + "LDR lr, [r2, #16]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[1] * B[5] */ + "LDR lr, [r2, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + /* A[1] * B[6] */ + "LDR lr, [r2, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS r3, r3, r11\n\t" + /* A[1] * B[7] */ + "LDR lr, [r2, #28]\n\t" + "ADC r4, r0, #0x0\n\t" + "UMLAL r3, r4, r12, lr\n\t" + /* A[2] * B[0] */ + "LDR r12, [r1, #8]\n\t" + "LDR lr, [r2]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "STR r5, [sp, #8]\n\t" + "ADDS r6, r6, r11\n\t" + /* A[2] * B[1] */ + "LDR lr, [r2, #4]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[2] * B[2] */ + "LDR lr, [r2, #8]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "ADDS r8, r8, r11\n\t" + /* A[2] * B[3] */ + "LDR lr, [r2, #12]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[2] * B[4] */ + "LDR lr, [r2, #16]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + /* A[2] * B[5] */ + "LDR lr, [r2, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS r3, r3, r11\n\t" + /* A[2] * B[6] */ + "LDR lr, [r2, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[2] * B[7] */ + "LDR lr, [r2, #28]\n\t" + "ADC r5, r0, #0x0\n\t" + "UMLAL r4, r5, r12, lr\n\t" + /* A[3] * B[0] */ + "LDR r12, [r1, #12]\n\t" + "LDR lr, [r2]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "STR r6, [sp, #12]\n\t" + "ADDS r7, r7, r11\n\t" + /* A[3] * B[1] */ + "LDR lr, [r2, #4]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "ADDS r8, r8, r11\n\t" + /* A[3] * B[2] */ + "LDR lr, [r2, #8]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[3] * B[3] */ + "LDR lr, [r2, #12]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + /* A[3] * B[4] */ + "LDR lr, [r2, #16]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS r3, r3, r11\n\t" + /* A[3] * B[5] */ + "LDR lr, [r2, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[3] * B[6] */ + "LDR lr, [r2, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[3] * B[7] */ + "LDR lr, [r2, #28]\n\t" + "ADC r6, r0, #0x0\n\t" + "UMLAL r5, r6, r12, lr\n\t" + /* A[4] * B[0] */ + "LDR r12, [r1, #16]\n\t" + "LDR lr, [r2]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "STR r7, [sp, #16]\n\t" + "ADDS r8, r8, r11\n\t" + /* A[4] * B[1] */ + "LDR lr, [r2, #4]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[4] * B[2] */ + "LDR lr, [r2, #8]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + /* A[4] * B[3] */ + "LDR lr, [r2, #12]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS r3, r3, r11\n\t" + /* A[4] * B[4] */ + "LDR lr, [r2, #16]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[4] * B[5] */ + "LDR lr, [r2, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[4] * B[6] */ + "LDR lr, [r2, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[4] * B[7] */ + "LDR lr, [r2, #28]\n\t" + "ADC r7, r0, #0x0\n\t" + "UMLAL r6, r7, r12, lr\n\t" + /* A[5] * B[0] */ + "LDR r12, [r1, #20]\n\t" + "LDR lr, [r2]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "STR r8, [sp, #20]\n\t" + "ADDS r9, r9, r11\n\t" + /* A[5] * B[1] */ + "LDR lr, [r2, #4]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + /* A[5] * B[2] */ + "LDR lr, [r2, #8]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS r3, r3, r11\n\t" + /* A[5] * B[3] */ + "LDR lr, [r2, #12]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[5] * B[4] */ + "LDR lr, [r2, #16]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[5] * B[5] */ + "LDR lr, [r2, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[5] * B[6] */ + "LDR lr, [r2, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[5] * B[7] */ + "LDR lr, [r2, #28]\n\t" + "ADC r8, r0, #0x0\n\t" + "UMLAL r7, r8, r12, lr\n\t" + /* A[6] * B[0] */ + "LDR r12, [r1, #24]\n\t" + "LDR lr, [r2]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "STR r9, [sp, #24]\n\t" + "ADDS r10, r10, r11\n\t" + /* A[6] * B[1] */ + "LDR lr, [r2, #4]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS r3, r3, r11\n\t" + /* A[6] * B[2] */ + "LDR lr, [r2, #8]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[6] * B[3] */ + "LDR lr, [r2, #12]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[6] * B[4] */ + "LDR lr, [r2, #16]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[6] * B[5] */ + "LDR lr, [r2, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[6] * B[6] */ + "LDR lr, [r2, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "ADDS r8, r8, r11\n\t" + /* A[6] * B[7] */ + "LDR lr, [r2, #28]\n\t" + "ADC r9, r0, #0x0\n\t" + "UMLAL r8, r9, r12, lr\n\t" + /* A[7] * B[0] */ + "LDR r12, [r1, #28]\n\t" + "LDR lr, [r2]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "STR r10, [sp, #28]\n\t" + "ADDS r3, r3, r11\n\t" + /* A[7] * B[1] */ + "LDR lr, [r2, #4]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[7] * B[2] */ + "LDR lr, [r2, #8]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[7] * B[3] */ + "LDR lr, [r2, #12]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[7] * B[4] */ + "LDR lr, [r2, #16]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[7] * B[5] */ + "LDR lr, [r2, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "ADDS r8, r8, r11\n\t" + /* A[7] * B[6] */ + "LDR lr, [r2, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[7] * B[7] */ + "LDR lr, [r2, #28]\n\t" + "ADC r10, r0, #0x0\n\t" + "UMLAL r9, r10, r12, lr\n\t" + /* Reduce */ + "LDR r2, [sp, #28]\n\t" + "MOV lr, sp\n\t" + "MOV r12, #0x26\n\t" + "UMULL r10, r11, r10, r12\n\t" + "ADDS r10, r10, r2\n\t" + "ADC r11, r11, #0x0\n\t" + "MOV r12, #0x13\n\t" + "LSL r11, r11, #1\n\t" + "ORR r11, r11, r10, LSR #31\n\t" + "MUL r11, r11, r12\n\t" + "LDM lr!, {r1, r2}\n\t" + "MOV r12, #0x26\n\t" + "ADDS r1, r1, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r1, r11, r3, r12\n\t" + "ADDS r2, r2, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r2, r11, r4, r12\n\t" + "LDM lr!, {r3, r4}\n\t" + "ADDS r3, r3, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r5, r12\n\t" + "ADDS r4, r4, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r4, r11, r6, r12\n\t" + "LDM lr!, {r5, r6}\n\t" + "ADDS r5, r5, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r7, r12\n\t" + "ADDS r6, r6, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r6, r11, r8, r12\n\t" + "LDM lr!, {r7, r8}\n\t" + "ADDS r7, r7, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r9, r12\n\t" + "BFC r10, #31, #1\n\t" + "ADDS r8, r10, r11\n\t" + /* Store */ + "LDR r0, [sp, #36]\n\t" + "STM r0, {r1, r2, r3, r4, r5, r6, r7, r8}\n\t" + "ADD sp, sp, #0x28\n\t" + : + : + : "memory", "lr" + ); +} + +#else void fe_mul_op(void); void fe_mul_op() { @@ -1698,6 +2079,7 @@ void fe_mul_op() ); } +#endif /* WOLFSSL_SP_NO_UMAAL */ void fe_mul(fe r_p, const fe a_p, const fe b_p) { register sword32* r asm ("r0") = (sword32*)r_p; @@ -1712,6 +2094,280 @@ void fe_mul(fe r_p, const fe a_p, const fe b_p) ); } +#ifdef WOLFSSL_SP_NO_UMAAL +void fe_sq_op(void); +void fe_sq_op() +{ + __asm__ __volatile__ ( + "SUB sp, sp, #0x44\n\t" + "STR r0, [sp, #64]\n\t" + /* Square */ + "MOV r0, #0x0\n\t" + "LDR r12, [r1]\n\t" + /* A[0] * A[1] */ + "LDR lr, [r1, #4]\n\t" + "UMULL r4, r5, r12, lr\n\t" + /* A[0] * A[3] */ + "LDR lr, [r1, #12]\n\t" + "UMULL r6, r7, r12, lr\n\t" + /* A[0] * A[5] */ + "LDR lr, [r1, #20]\n\t" + "UMULL r8, r9, r12, lr\n\t" + /* A[0] * A[7] */ + "LDR lr, [r1, #28]\n\t" + "UMULL r10, r3, r12, lr\n\t" + /* A[0] * A[2] */ + "LDR lr, [r1, #8]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[0] * A[4] */ + "LDR lr, [r1, #16]\n\t" + "ADCS r7, r7, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "ADDS r8, r8, r11\n\t" + /* A[0] * A[6] */ + "LDR lr, [r1, #24]\n\t" + "ADCS r9, r9, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + "ADCS r3, r3, #0x0\n\t" + "STR r4, [sp, #4]\n\t" + "STR r5, [sp, #8]\n\t" + /* A[1] * A[2] */ + "LDR r12, [r1, #4]\n\t" + "LDR lr, [r1, #8]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "STR r6, [sp, #12]\n\t" + "ADDS r7, r7, r11\n\t" + /* A[1] * A[3] */ + "LDR lr, [r1, #12]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "STR r7, [sp, #16]\n\t" + "ADDS r8, r8, r11\n\t" + /* A[1] * A[4] */ + "LDR lr, [r1, #16]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[1] * A[5] */ + "LDR lr, [r1, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + /* A[1] * A[6] */ + "LDR lr, [r1, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS r3, r3, r11\n\t" + /* A[1] * A[7] */ + "LDR lr, [r1, #28]\n\t" + "ADC r4, r0, #0x0\n\t" + "UMLAL r3, r4, r12, lr\n\t" + /* A[2] * A[3] */ + "LDR r12, [r1, #8]\n\t" + "LDR lr, [r1, #12]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "STR r8, [sp, #20]\n\t" + "ADDS r9, r9, r11\n\t" + /* A[2] * A[4] */ + "LDR lr, [r1, #16]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "STR r9, [sp, #24]\n\t" + "ADDS r10, r10, r11\n\t" + /* A[2] * A[5] */ + "LDR lr, [r1, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS r3, r3, r11\n\t" + /* A[2] * A[6] */ + "LDR lr, [r1, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[2] * A[7] */ + "LDR lr, [r1, #28]\n\t" + "ADC r5, r0, #0x0\n\t" + "UMLAL r4, r5, r12, lr\n\t" + /* A[3] * A[4] */ + "LDR r12, [r1, #12]\n\t" + "LDR lr, [r1, #16]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "STR r10, [sp, #28]\n\t" + "ADDS r3, r3, r11\n\t" + /* A[3] * A[5] */ + "LDR lr, [r1, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[3] * A[6] */ + "LDR lr, [r1, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[3] * A[7] */ + "LDR lr, [r1, #28]\n\t" + "ADC r6, r0, #0x0\n\t" + "UMLAL r5, r6, r12, lr\n\t" + /* A[4] * A[5] */ + "LDR r12, [r1, #16]\n\t" + "LDR lr, [r1, #20]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[4] * A[6] */ + "LDR lr, [r1, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[4] * A[7] */ + "LDR lr, [r1, #28]\n\t" + "ADC r7, r0, #0x0\n\t" + "UMLAL r6, r7, r12, lr\n\t" + /* A[5] * A[6] */ + "LDR r12, [r1, #20]\n\t" + "LDR lr, [r1, #24]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[5] * A[7] */ + "LDR lr, [r1, #28]\n\t" + "ADC r8, r0, #0x0\n\t" + "UMLAL r7, r8, r12, lr\n\t" + /* A[6] * A[7] */ + "LDR r12, [r1, #24]\n\t" + "LDR lr, [r1, #28]\n\t" + "MOV r9, #0x0\n\t" + "UMLAL r8, r9, r12, lr\n\t" + "ADD lr, sp, #0x20\n\t" + "STM lr, {r3, r4, r5, r6, r7, r8, r9}\n\t" + "ADD lr, sp, #0x4\n\t" + "LDM lr, {r4, r5, r6, r7, r8, r9, r10}\n\t" + "ADDS r4, r4, r4\n\t" + "ADCS r5, r5, r5\n\t" + "ADCS r6, r6, r6\n\t" + "ADCS r7, r7, r7\n\t" + "ADCS r8, r8, r8\n\t" + "ADCS r9, r9, r9\n\t" + "ADCS r10, r10, r10\n\t" + "STM lr!, {r4, r5, r6, r7, r8, r9, r10}\n\t" + "LDM lr, {r3, r4, r5, r6, r7, r8, r9}\n\t" + "ADCS r3, r3, r3\n\t" + "ADCS r4, r4, r4\n\t" + "ADCS r5, r5, r5\n\t" + "ADCS r6, r6, r6\n\t" + "ADCS r7, r7, r7\n\t" + "ADCS r8, r8, r8\n\t" + "ADCS r9, r9, r9\n\t" + "ADC r10, r0, #0x0\n\t" + "STM lr, {r3, r4, r5, r6, r7, r8, r9, r10}\n\t" + "ADD lr, sp, #0x4\n\t" + "LDM lr, {r4, r5, r6, r7, r8, r9, r10}\n\t" + "MOV lr, sp\n\t" + /* A[0] * A[0] */ + "LDR r12, [r1]\n\t" + "UMULL r3, r11, r12, r12\n\t" + "ADDS r4, r4, r11\n\t" + /* A[1] * A[1] */ + "LDR r12, [r1, #4]\n\t" + "ADCS r5, r5, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r12, r12\n\t" + "ADDS r6, r6, r11\n\t" + /* A[2] * A[2] */ + "LDR r12, [r1, #8]\n\t" + "ADCS r7, r7, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, r12\n\t" + "ADDS r8, r8, r11\n\t" + /* A[3] * A[3] */ + "LDR r12, [r1, #12]\n\t" + "ADCS r9, r9, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, r12\n\t" + "ADDS r10, r10, r11\n\t" + "STM lr!, {r3, r4, r5, r6, r7, r8, r9, r10}\n\t" + "LDM lr, {r3, r4, r5, r6, r7, r8, r9, r10}\n\t" + /* A[4] * A[4] */ + "LDR r12, [r1, #16]\n\t" + "ADCS r3, r3, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r12, r12\n\t" + "ADDS r4, r4, r11\n\t" + /* A[5] * A[5] */ + "LDR r12, [r1, #20]\n\t" + "ADCS r5, r5, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r12, r12\n\t" + "ADDS r6, r6, r11\n\t" + /* A[6] * A[6] */ + "LDR r12, [r1, #24]\n\t" + "ADCS r7, r7, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, r12\n\t" + "ADDS r8, r8, r11\n\t" + /* A[7] * A[7] */ + "LDR r12, [r1, #28]\n\t" + "ADCS r9, r9, #0x0\n\t" + "ADC r10, r10, #0x0\n\t" + "UMLAL r9, r10, r12, r12\n\t" + /* Reduce */ + "LDR r2, [sp, #28]\n\t" + "MOV lr, sp\n\t" + "MOV r12, #0x26\n\t" + "UMULL r10, r11, r10, r12\n\t" + "ADDS r10, r10, r2\n\t" + "ADC r11, r11, #0x0\n\t" + "MOV r12, #0x13\n\t" + "LSL r11, r11, #1\n\t" + "ORR r11, r11, r10, LSR #31\n\t" + "MUL r11, r11, r12\n\t" + "LDM lr!, {r1, r2}\n\t" + "MOV r12, #0x26\n\t" + "ADDS r1, r1, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r1, r11, r3, r12\n\t" + "ADDS r2, r2, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r2, r11, r4, r12\n\t" + "LDM lr!, {r3, r4}\n\t" + "ADDS r3, r3, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r5, r12\n\t" + "ADDS r4, r4, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r4, r11, r6, r12\n\t" + "LDM lr!, {r5, r6}\n\t" + "ADDS r5, r5, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r7, r12\n\t" + "ADDS r6, r6, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r6, r11, r8, r12\n\t" + "LDM lr!, {r7, r8}\n\t" + "ADDS r7, r7, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r9, r12\n\t" + "BFC r10, #31, #1\n\t" + "ADDS r8, r10, r11\n\t" + /* Store */ + "LDR r0, [sp, #64]\n\t" + "STM r0, {r1, r2, r3, r4, r5, r6, r7, r8}\n\t" + "ADD sp, sp, #0x44\n\t" + : + : + : "memory", "lr" + ); +} + +#else void fe_sq_op(void); void fe_sq_op() { @@ -1831,6 +2487,7 @@ void fe_sq_op() ); } +#endif /* WOLFSSL_SP_NO_UMAAL */ void fe_sq(fe r_p, const fe a_p) { register sword32* r asm ("r0") = (sword32*)r_p; @@ -1845,6 +2502,60 @@ void fe_sq(fe r_p, const fe a_p) } #ifdef HAVE_CURVE25519 +#ifdef WOLFSSL_SP_NO_UMAAL +void fe_mul121666(fe r_p, fe a_p) +{ + register sword32* r asm ("r0") = (sword32*)r_p; + register sword32* a asm ("r1") = (sword32*)a_p; + + __asm__ __volatile__ ( + /* Multiply by 121666 */ + "LDM %[a], {r2, r3, r4, r5, r6, r7, r8, r9}\n\t" + "MOV r12, #0xdb42\n\t" + "MOVT r12, #0x1\n\t" + "UMULL r2, r10, r2, r12\n\t" + "UMULL r3, r11, r3, r12\n\t" + "ADDS r3, r3, r10\n\t" + "ADC r11, r11, #0x0\n\t" + "UMULL r4, r10, r4, r12\n\t" + "ADDS r4, r4, r11\n\t" + "ADC r10, r10, #0x0\n\t" + "UMULL r5, r11, r5, r12\n\t" + "ADDS r5, r5, r10\n\t" + "ADC r11, r11, #0x0\n\t" + "UMULL r6, r10, r6, r12\n\t" + "ADDS r6, r6, r11\n\t" + "ADC r10, r10, #0x0\n\t" + "UMULL r7, r11, r7, r12\n\t" + "ADDS r7, r7, r10\n\t" + "ADC r11, r11, #0x0\n\t" + "UMULL r8, r10, r8, r12\n\t" + "ADDS r8, r8, r11\n\t" + "ADC r10, r10, #0x0\n\t" + "UMULL r9, r11, r9, r12\n\t" + "ADDS r9, r9, r10\n\t" + "MOV r12, #0x13\n\t" + "ADC r11, r11, #0x0\n\t" + "LSL r11, r11, #1\n\t" + "ORR r11, r11, r9, LSR #31\n\t" + "MUL r11, r11, r12\n\t" + "ADDS r2, r2, r11\n\t" + "ADCS r3, r3, #0x0\n\t" + "ADCS r4, r4, #0x0\n\t" + "ADCS r5, r5, #0x0\n\t" + "ADCS r6, r6, #0x0\n\t" + "ADCS r7, r7, #0x0\n\t" + "BFC r9, #31, #1\n\t" + "ADCS r8, r8, #0x0\n\t" + "ADC r9, r9, #0x0\n\t" + "STM %[r], {r2, r3, r4, r5, r6, r7, r8, r9}\n\t" + : [r] "+r" (r), [a] "+r" (a) + : + : "memory", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" + ); +} + +#else void fe_mul121666(fe r_p, fe a_p) { register sword32* r asm ("r0") = (sword32*)r_p; @@ -1884,6 +2595,7 @@ void fe_mul121666(fe r_p, fe a_p) ); } +#endif /* WOLFSSL_SP_NO_UMAAL */ #ifndef WC_NO_CACHE_RESISTANT int curve25519(byte* r_p, const byte* n_p, const byte* a_p) { @@ -2757,6 +3469,315 @@ void fe_invert(fe r_p, const fe a_p) ); } +#ifdef WOLFSSL_SP_NO_UMAAL +void fe_sq2(fe r_p, const fe a_p) +{ + register sword32* r asm ("r0") = (sword32*)r_p; + register const sword32* a asm ("r1") = (const sword32*)a_p; + + __asm__ __volatile__ ( + "SUB sp, sp, #0x44\n\t" + "STR r0, [sp, #64]\n\t" + /* Square * 2 */ + "MOV r0, #0x0\n\t" + "LDR r12, [r1]\n\t" + /* A[0] * A[1] */ + "LDR lr, [r1, #4]\n\t" + "UMULL r4, r5, r12, lr\n\t" + /* A[0] * A[3] */ + "LDR lr, [r1, #12]\n\t" + "UMULL r6, r7, r12, lr\n\t" + /* A[0] * A[5] */ + "LDR lr, [r1, #20]\n\t" + "UMULL r8, r9, r12, lr\n\t" + /* A[0] * A[7] */ + "LDR lr, [r1, #28]\n\t" + "UMULL r10, r3, r12, lr\n\t" + /* A[0] * A[2] */ + "LDR lr, [r1, #8]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[0] * A[4] */ + "LDR lr, [r1, #16]\n\t" + "ADCS r7, r7, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "ADDS r8, r8, r11\n\t" + /* A[0] * A[6] */ + "LDR lr, [r1, #24]\n\t" + "ADCS r9, r9, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + "ADCS r3, r3, #0x0\n\t" + "STR r4, [sp, #4]\n\t" + "STR r5, [sp, #8]\n\t" + /* A[1] * A[2] */ + "LDR r12, [r1, #4]\n\t" + "LDR lr, [r1, #8]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "STR r6, [sp, #12]\n\t" + "ADDS r7, r7, r11\n\t" + /* A[1] * A[3] */ + "LDR lr, [r1, #12]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "STR r7, [sp, #16]\n\t" + "ADDS r8, r8, r11\n\t" + /* A[1] * A[4] */ + "LDR lr, [r1, #16]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[1] * A[5] */ + "LDR lr, [r1, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + /* A[1] * A[6] */ + "LDR lr, [r1, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS r3, r3, r11\n\t" + /* A[1] * A[7] */ + "LDR lr, [r1, #28]\n\t" + "ADC r4, r0, #0x0\n\t" + "UMLAL r3, r4, r12, lr\n\t" + /* A[2] * A[3] */ + "LDR r12, [r1, #8]\n\t" + "LDR lr, [r1, #12]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "STR r8, [sp, #20]\n\t" + "ADDS r9, r9, r11\n\t" + /* A[2] * A[4] */ + "LDR lr, [r1, #16]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "STR r9, [sp, #24]\n\t" + "ADDS r10, r10, r11\n\t" + /* A[2] * A[5] */ + "LDR lr, [r1, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS r3, r3, r11\n\t" + /* A[2] * A[6] */ + "LDR lr, [r1, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[2] * A[7] */ + "LDR lr, [r1, #28]\n\t" + "ADC r5, r0, #0x0\n\t" + "UMLAL r4, r5, r12, lr\n\t" + /* A[3] * A[4] */ + "LDR r12, [r1, #12]\n\t" + "LDR lr, [r1, #16]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "STR r10, [sp, #28]\n\t" + "ADDS r3, r3, r11\n\t" + /* A[3] * A[5] */ + "LDR lr, [r1, #20]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[3] * A[6] */ + "LDR lr, [r1, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[3] * A[7] */ + "LDR lr, [r1, #28]\n\t" + "ADC r6, r0, #0x0\n\t" + "UMLAL r5, r6, r12, lr\n\t" + /* A[4] * A[5] */ + "LDR r12, [r1, #16]\n\t" + "LDR lr, [r1, #20]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[4] * A[6] */ + "LDR lr, [r1, #24]\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[4] * A[7] */ + "LDR lr, [r1, #28]\n\t" + "ADC r7, r0, #0x0\n\t" + "UMLAL r6, r7, r12, lr\n\t" + /* A[5] * A[6] */ + "LDR r12, [r1, #20]\n\t" + "LDR lr, [r1, #24]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[5] * A[7] */ + "LDR lr, [r1, #28]\n\t" + "ADC r8, r0, #0x0\n\t" + "UMLAL r7, r8, r12, lr\n\t" + /* A[6] * A[7] */ + "LDR r12, [r1, #24]\n\t" + "LDR lr, [r1, #28]\n\t" + "MOV r9, #0x0\n\t" + "UMLAL r8, r9, r12, lr\n\t" + "ADD lr, sp, #0x20\n\t" + "STM lr, {r3, r4, r5, r6, r7, r8, r9}\n\t" + "ADD lr, sp, #0x4\n\t" + "LDM lr, {r4, r5, r6, r7, r8, r9, r10}\n\t" + "ADDS r4, r4, r4\n\t" + "ADCS r5, r5, r5\n\t" + "ADCS r6, r6, r6\n\t" + "ADCS r7, r7, r7\n\t" + "ADCS r8, r8, r8\n\t" + "ADCS r9, r9, r9\n\t" + "ADCS r10, r10, r10\n\t" + "STM lr!, {r4, r5, r6, r7, r8, r9, r10}\n\t" + "LDM lr, {r3, r4, r5, r6, r7, r8, r9}\n\t" + "ADCS r3, r3, r3\n\t" + "ADCS r4, r4, r4\n\t" + "ADCS r5, r5, r5\n\t" + "ADCS r6, r6, r6\n\t" + "ADCS r7, r7, r7\n\t" + "ADCS r8, r8, r8\n\t" + "ADCS r9, r9, r9\n\t" + "ADC r10, r0, #0x0\n\t" + "STM lr, {r3, r4, r5, r6, r7, r8, r9, r10}\n\t" + "ADD lr, sp, #0x4\n\t" + "LDM lr, {r4, r5, r6, r7, r8, r9, r10}\n\t" + "MOV lr, sp\n\t" + /* A[0] * A[0] */ + "LDR r12, [r1]\n\t" + "UMULL r3, r11, r12, r12\n\t" + "ADDS r4, r4, r11\n\t" + /* A[1] * A[1] */ + "LDR r12, [r1, #4]\n\t" + "ADCS r5, r5, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r12, r12\n\t" + "ADDS r6, r6, r11\n\t" + /* A[2] * A[2] */ + "LDR r12, [r1, #8]\n\t" + "ADCS r7, r7, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, r12\n\t" + "ADDS r8, r8, r11\n\t" + /* A[3] * A[3] */ + "LDR r12, [r1, #12]\n\t" + "ADCS r9, r9, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r9, r11, r12, r12\n\t" + "ADDS r10, r10, r11\n\t" + "STM lr!, {r3, r4, r5, r6, r7, r8, r9, r10}\n\t" + "LDM lr, {r3, r4, r5, r6, r7, r8, r9, r10}\n\t" + /* A[4] * A[4] */ + "LDR r12, [r1, #16]\n\t" + "ADCS r3, r3, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r12, r12\n\t" + "ADDS r4, r4, r11\n\t" + /* A[5] * A[5] */ + "LDR r12, [r1, #20]\n\t" + "ADCS r5, r5, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r12, r12\n\t" + "ADDS r6, r6, r11\n\t" + /* A[6] * A[6] */ + "LDR r12, [r1, #24]\n\t" + "ADCS r7, r7, #0x0\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r12, r12\n\t" + "ADDS r8, r8, r11\n\t" + /* A[7] * A[7] */ + "LDR r12, [r1, #28]\n\t" + "ADCS r9, r9, #0x0\n\t" + "ADC r10, r10, #0x0\n\t" + "UMLAL r9, r10, r12, r12\n\t" + /* Reduce */ + "LDR r2, [sp, #28]\n\t" + "MOV lr, sp\n\t" + "MOV r12, #0x26\n\t" + "UMULL r10, r11, r10, r12\n\t" + "ADDS r10, r10, r2\n\t" + "ADC r11, r11, #0x0\n\t" + "MOV r12, #0x13\n\t" + "LSL r11, r11, #1\n\t" + "ORR r11, r11, r10, LSR #31\n\t" + "MUL r11, r11, r12\n\t" + "LDM lr!, {r1, r2}\n\t" + "MOV r12, #0x26\n\t" + "ADDS r1, r1, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r1, r11, r3, r12\n\t" + "ADDS r2, r2, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r2, r11, r4, r12\n\t" + "LDM lr!, {r3, r4}\n\t" + "ADDS r3, r3, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r3, r11, r5, r12\n\t" + "ADDS r4, r4, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r4, r11, r6, r12\n\t" + "LDM lr!, {r5, r6}\n\t" + "ADDS r5, r5, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r5, r11, r7, r12\n\t" + "ADDS r6, r6, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r6, r11, r8, r12\n\t" + "LDM lr!, {r7, r8}\n\t" + "ADDS r7, r7, r11\n\t" + "ADC r11, r0, #0x0\n\t" + "UMLAL r7, r11, r9, r12\n\t" + "BFC r10, #31, #1\n\t" + "ADDS r8, r10, r11\n\t" + /* Reduce if top bit set */ + "MOV r12, #0x13\n\t" + "AND r11, r12, r8, ASR #31\n\t" + "ADDS r1, r1, r11\n\t" + "ADCS r2, r2, #0x0\n\t" + "ADCS r3, r3, #0x0\n\t" + "ADCS r4, r4, #0x0\n\t" + "ADCS r5, r5, #0x0\n\t" + "ADCS r6, r6, #0x0\n\t" + "BFC r8, #31, #1\n\t" + "ADCS r7, r7, #0x0\n\t" + "ADC r8, r8, #0x0\n\t" + /* Double */ + "ADDS r1, r1, r1\n\t" + "ADCS r2, r2, r2\n\t" + "ADCS r3, r3, r3\n\t" + "ADCS r4, r4, r4\n\t" + "ADCS r5, r5, r5\n\t" + "ADCS r6, r6, r6\n\t" + "ADCS r7, r7, r7\n\t" + "ADC r8, r8, r8\n\t" + /* Reduce if top bit set */ + "MOV r12, #0x13\n\t" + "AND r11, r12, r8, ASR #31\n\t" + "ADDS r1, r1, r11\n\t" + "ADCS r2, r2, #0x0\n\t" + "ADCS r3, r3, #0x0\n\t" + "ADCS r4, r4, #0x0\n\t" + "ADCS r5, r5, #0x0\n\t" + "ADCS r6, r6, #0x0\n\t" + "BFC r8, #31, #1\n\t" + "ADCS r7, r7, #0x0\n\t" + "ADC r8, r8, #0x0\n\t" + /* Store */ + "LDR r0, [sp, #64]\n\t" + "STM r0, {r1, r2, r3, r4, r5, r6, r7, r8}\n\t" + "ADD sp, sp, #0x44\n\t" + : [r] "+r" (r), [a] "+r" (a) + : + : "memory", "lr" + ); +} + +#else void fe_sq2(fe r_p, const fe a_p) { register sword32* r asm ("r0") = (sword32*)r_p; @@ -2913,6 +3934,7 @@ void fe_sq2(fe r_p, const fe a_p) ); } +#endif /* WOLFSSL_SP_NO_UMAAL */ void fe_pow22523(fe r_p, const fe a_p) { register sword32* r asm ("r0") = (sword32*)r_p; @@ -3526,6 +4548,7 @@ void ge_sub(ge_p1p1 * r_p, const ge_p3 * p_p, const ge_cached* q_p) ); } +#ifndef WOLFSSL_SP_NO_UMAAL void sc_reduce(byte* s_p) { register byte* s asm ("r0") = (byte*)s_p; @@ -3561,13 +4584,22 @@ void sc_reduce(byte* s_p) "MOVT r11, #0xa7ed\n\t" "MOV r1, #0x0\n\t" "UMLAL r2, r1, r10, lr\n\t" - "UMAAL r3, r1, r11, lr\n\t" + "ADDS r3, r3, r1\n\t" + "MOV r1, #0x0\n\t" + "ADC r1, r1, #0x0\n\t" + "UMLAL r3, r1, r11, lr\n\t" "MOV r10, #0x6329\n\t" "MOVT r10, #0x5d08\n\t" "MOV r11, #0x621\n\t" "MOVT r11, #0xeb21\n\t" - "UMAAL r4, r1, r10, lr\n\t" - "UMAAL r5, r1, r11, lr\n\t" + "ADDS r4, r4, r1\n\t" + "MOV r1, #0x0\n\t" + "ADC r1, r1, #0x0\n\t" + "UMLAL r4, r1, r10, lr\n\t" + "ADDS r5, r5, r1\n\t" + "MOV r1, #0x0\n\t" + "ADC r1, r1, #0x0\n\t" + "UMLAL r5, r1, r11, lr\n\t" "ADDS r6, r6, r1\n\t" "ADCS r7, r7, #0x0\n\t" "ADCS r8, r8, #0x0\n\t" @@ -3582,18 +4614,39 @@ void sc_reduce(byte* s_p) "MOV lr, #0x0\n\t" "LDM %[s]!, {r10, r11, r12}\n\t" "UMLAL r10, lr, r2, r1\n\t" - "UMAAL r11, lr, r3, r1\n\t" - "UMAAL r12, lr, r4, r1\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r3, r1\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r4, r1\n\t" "STM sp!, {r10, r11, r12}\n\t" "LDM %[s]!, {r10, r11, r12}\n\t" - "UMAAL r10, lr, r5, r1\n\t" - "UMAAL r11, lr, r6, r1\n\t" - "UMAAL r12, lr, r7, r1\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r5, r1\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r6, r1\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r7, r1\n\t" "STM sp!, {r10, r11, r12}\n\t" "LDM %[s]!, {r10, r11}\n\t" - "UMAAL r10, lr, r8, r1\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r8, r1\n\t" "BFC r11, #28, #4\n\t" - "UMAAL r11, lr, r9, r1\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r9, r1\n\t" "STM sp!, {r10, r11, lr}\n\t" "SUB %[s], %[s], #0x10\n\t" "SUB sp, sp, #0x20\n\t" @@ -3602,17 +4655,38 @@ void sc_reduce(byte* s_p) "MOV lr, #0x0\n\t" "LDM sp, {r10, r11, r12}\n\t" "UMLAL r10, lr, r2, r1\n\t" - "UMAAL r11, lr, r3, r1\n\t" - "UMAAL r12, lr, r4, r1\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r3, r1\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r4, r1\n\t" "STM sp!, {r10, r11, r12}\n\t" "LDM sp, {r10, r11, r12}\n\t" - "UMAAL r10, lr, r5, r1\n\t" - "UMAAL r11, lr, r6, r1\n\t" - "UMAAL r12, lr, r7, r1\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r5, r1\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r6, r1\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r7, r1\n\t" "STM sp!, {r10, r11, r12}\n\t" "LDM sp, {r10, r11}\n\t" - "UMAAL r10, lr, r8, r1\n\t" - "UMAAL r11, lr, r9, r1\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r8, r1\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r9, r1\n\t" "STM sp!, {r10, r11, lr}\n\t" "SUB sp, sp, #0x20\n\t" "MOV r1, #0x6329\n\t" @@ -3620,17 +4694,38 @@ void sc_reduce(byte* s_p) "MOV lr, #0x0\n\t" "LDM sp, {r10, r11, r12}\n\t" "UMLAL r10, lr, r2, r1\n\t" - "UMAAL r11, lr, r3, r1\n\t" - "UMAAL r12, lr, r4, r1\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r3, r1\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r4, r1\n\t" "STM sp!, {r10, r11, r12}\n\t" "LDM sp, {r10, r11, r12}\n\t" - "UMAAL r10, lr, r5, r1\n\t" - "UMAAL r11, lr, r6, r1\n\t" - "UMAAL r12, lr, r7, r1\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r5, r1\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r6, r1\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r7, r1\n\t" "STM sp!, {r10, r11, r12}\n\t" "LDM sp, {r10, r11}\n\t" - "UMAAL r10, lr, r8, r1\n\t" - "UMAAL r11, lr, r9, r1\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r8, r1\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r9, r1\n\t" "STM sp!, {r10, r11, lr}\n\t" "SUB sp, sp, #0x20\n\t" "MOV r1, #0x621\n\t" @@ -3638,17 +4733,38 @@ void sc_reduce(byte* s_p) "MOV lr, #0x0\n\t" "LDM sp, {r10, r11, r12}\n\t" "UMLAL r10, lr, r2, r1\n\t" - "UMAAL r11, lr, r3, r1\n\t" - "UMAAL r12, lr, r4, r1\n\t" - "STM sp!, {r10, r11, r12}\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r3, r1\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r4, r1\n\t" + "STM sp!, {r10, r11, r12}\n\t" "LDM sp, {r10, r11, r12}\n\t" - "UMAAL r10, lr, r5, r1\n\t" - "UMAAL r11, lr, r6, r1\n\t" - "UMAAL r12, lr, r7, r1\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r5, r1\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r6, r1\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r7, r1\n\t" "STM sp!, {r10, r11, r12}\n\t" "LDM sp, {r10, r11}\n\t" - "UMAAL r10, lr, r8, r1\n\t" - "UMAAL r11, lr, r9, r1\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r8, r1\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r9, r1\n\t" "STM sp!, {r10, r11, lr}\n\t" "SUB sp, sp, #0x20\n\t" /* Subtract at 4 * 32 */ @@ -3698,7 +4814,7 @@ void sc_reduce(byte* s_p) "LDM sp, {r10, r11, r12}\n\t" "ADCS r10, r10, #0x0\n\t" "ADCS r11, r11, #0x0\n\t" - "ADCS r12, r12, r9\n\t" + "ADC r12, r12, r9\n\t" "STM sp!, {r10, r11, r12}\n\t" "SUB sp, sp, #0x30\n\t" "SUB %[s], %[s], #0x10\n\t" @@ -3722,9 +4838,18 @@ void sc_reduce(byte* s_p) "MOV lr, #0x0\n\t" "LDM sp, {r6, r7, r8, r9}\n\t" "UMLAL r6, lr, r2, r1\n\t" - "UMAAL r7, lr, r3, r1\n\t" - "UMAAL r8, lr, r4, r1\n\t" - "UMAAL r9, lr, r5, r1\n\t" + "ADDS r7, r7, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r7, lr, r3, r1\n\t" + "ADDS r8, r8, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r8, lr, r4, r1\n\t" + "ADDS r9, r9, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r9, lr, r5, r1\n\t" "STM sp, {r6, r7, r8, r9}\n\t" "ADD sp, sp, #0x4\n\t" /* * -5812631b */ @@ -3733,9 +4858,18 @@ void sc_reduce(byte* s_p) "MOV r10, #0x0\n\t" "LDM sp, {r6, r7, r8, r9}\n\t" "UMLAL r6, r10, r2, r1\n\t" - "UMAAL r7, r10, r3, r1\n\t" - "UMAAL r8, r10, r4, r1\n\t" - "UMAAL r9, r10, r5, r1\n\t" + "ADDS r7, r7, r10\n\t" + "MOV r10, #0x0\n\t" + "ADC r10, r10, #0x0\n\t" + "UMLAL r7, r10, r3, r1\n\t" + "ADDS r8, r8, r10\n\t" + "MOV r10, #0x0\n\t" + "ADC r10, r10, #0x0\n\t" + "UMLAL r8, r10, r4, r1\n\t" + "ADDS r9, r9, r10\n\t" + "MOV r10, #0x0\n\t" + "ADC r10, r10, #0x0\n\t" + "UMLAL r9, r10, r5, r1\n\t" "STM sp, {r6, r7, r8, r9}\n\t" "ADD sp, sp, #0x4\n\t" /* * -a2f79cd7 */ @@ -3744,9 +4878,18 @@ void sc_reduce(byte* s_p) "MOV r11, #0x0\n\t" "LDM sp, {r6, r7, r8, r9}\n\t" "UMLAL r6, r11, r2, r1\n\t" - "UMAAL r7, r11, r3, r1\n\t" - "UMAAL r8, r11, r4, r1\n\t" - "UMAAL r9, r11, r5, r1\n\t" + "ADDS r7, r7, r11\n\t" + "MOV r11, #0x0\n\t" + "ADC r11, r11, #0x0\n\t" + "UMLAL r7, r11, r3, r1\n\t" + "ADDS r8, r8, r11\n\t" + "MOV r11, #0x0\n\t" + "ADC r11, r11, #0x0\n\t" + "UMLAL r8, r11, r4, r1\n\t" + "ADDS r9, r9, r11\n\t" + "MOV r11, #0x0\n\t" + "ADC r11, r11, #0x0\n\t" + "UMLAL r9, r11, r5, r1\n\t" "STM sp, {r6, r7, r8, r9}\n\t" "ADD sp, sp, #0x4\n\t" /* * -14def9df */ @@ -3755,9 +4898,18 @@ void sc_reduce(byte* s_p) "MOV r12, #0x0\n\t" "LDM sp, {r6, r7, r8, r9}\n\t" "UMLAL r6, r12, r2, r1\n\t" - "UMAAL r7, r12, r3, r1\n\t" - "UMAAL r8, r12, r4, r1\n\t" - "UMAAL r9, r12, r5, r1\n\t" + "ADDS r7, r7, r12\n\t" + "MOV r12, #0x0\n\t" + "ADC r12, r12, #0x0\n\t" + "UMLAL r7, r12, r3, r1\n\t" + "ADDS r8, r8, r12\n\t" + "MOV r12, #0x0\n\t" + "ADC r12, r12, #0x0\n\t" + "UMLAL r8, r12, r4, r1\n\t" + "ADDS r9, r9, r12\n\t" + "MOV r12, #0x0\n\t" + "ADC r12, r12, #0x0\n\t" + "UMLAL r9, r12, r5, r1\n\t" "STM sp, {r6, r7, r8, r9}\n\t" "ADD sp, sp, #0x4\n\t" /* Add overflows at 4 * 32 */ @@ -3806,7 +4958,1062 @@ void sc_reduce(byte* s_p) ); } -#ifdef HAVE_ED25519_SIGN +#else +void sc_reduce(byte* s_p) +{ + register byte* s asm ("r0") = (byte*)s_p; + + __asm__ __volatile__ ( + "SUB sp, sp, #0x34\n\t" + /* Load bits 252-511 */ + "ADD %[s], %[s], #0x1c\n\t" + "LDM %[s], {r1, r2, r3, r4, r5, r6, r7, r8, r9}\n\t" + "LSR lr, r9, #24\n\t" + "LSL r9, r9, #4\n\t" + "ORR r9, r9, r8, LSR #28\n\t" + "LSL r8, r8, #4\n\t" + "ORR r8, r8, r7, LSR #28\n\t" + "LSL r7, r7, #4\n\t" + "ORR r7, r7, r6, LSR #28\n\t" + "LSL r6, r6, #4\n\t" + "ORR r6, r6, r5, LSR #28\n\t" + "LSL r5, r5, #4\n\t" + "ORR r5, r5, r4, LSR #28\n\t" + "LSL r4, r4, #4\n\t" + "ORR r4, r4, r3, LSR #28\n\t" + "LSL r3, r3, #4\n\t" + "ORR r3, r3, r2, LSR #28\n\t" + "LSL r2, r2, #4\n\t" + "ORR r2, r2, r1, LSR #28\n\t" + "BFC r9, #28, #4\n\t" + "SUB %[s], %[s], #0x1c\n\t" + /* Add order times bits 504..511 */ + "MOV r10, #0x2c13\n\t" + "MOVT r10, #0xa30a\n\t" + "MOV r11, #0x9ce5\n\t" + "MOVT r11, #0xa7ed\n\t" + "MOV r1, #0x0\n\t" + "UMLAL r2, r1, r10, lr\n\t" + "UMAAL r3, r1, r11, lr\n\t" + "MOV r10, #0x6329\n\t" + "MOVT r10, #0x5d08\n\t" + "MOV r11, #0x621\n\t" + "MOVT r11, #0xeb21\n\t" + "UMAAL r4, r1, r10, lr\n\t" + "UMAAL r5, r1, r11, lr\n\t" + "ADDS r6, r6, r1\n\t" + "ADCS r7, r7, #0x0\n\t" + "ADCS r8, r8, #0x0\n\t" + "ADC r9, r9, #0x0\n\t" + "SUBS r6, r6, lr\n\t" + "SBCS r7, r7, #0x0\n\t" + "SBCS r8, r8, #0x0\n\t" + "SBC r9, r9, #0x0\n\t" + /* Sub product of top 8 words and order */ + "MOV r1, #0x2c13\n\t" + "MOVT r1, #0xa30a\n\t" + "MOV lr, #0x0\n\t" + "LDM %[s]!, {r10, r11, r12}\n\t" + "UMLAL r10, lr, r2, r1\n\t" + "UMAAL r11, lr, r3, r1\n\t" + "UMAAL r12, lr, r4, r1\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM %[s]!, {r10, r11, r12}\n\t" + "UMAAL r10, lr, r5, r1\n\t" + "UMAAL r11, lr, r6, r1\n\t" + "UMAAL r12, lr, r7, r1\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM %[s]!, {r10, r11}\n\t" + "UMAAL r10, lr, r8, r1\n\t" + "BFC r11, #28, #4\n\t" + "UMAAL r11, lr, r9, r1\n\t" + "STM sp!, {r10, r11, lr}\n\t" + "SUB %[s], %[s], #0x10\n\t" + "SUB sp, sp, #0x20\n\t" + "MOV r1, #0x9ce5\n\t" + "MOVT r1, #0xa7ed\n\t" + "MOV lr, #0x0\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "UMLAL r10, lr, r2, r1\n\t" + "UMAAL r11, lr, r3, r1\n\t" + "UMAAL r12, lr, r4, r1\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "UMAAL r10, lr, r5, r1\n\t" + "UMAAL r11, lr, r6, r1\n\t" + "UMAAL r12, lr, r7, r1\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11}\n\t" + "UMAAL r10, lr, r8, r1\n\t" + "UMAAL r11, lr, r9, r1\n\t" + "STM sp!, {r10, r11, lr}\n\t" + "SUB sp, sp, #0x20\n\t" + "MOV r1, #0x6329\n\t" + "MOVT r1, #0x5d08\n\t" + "MOV lr, #0x0\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "UMLAL r10, lr, r2, r1\n\t" + "UMAAL r11, lr, r3, r1\n\t" + "UMAAL r12, lr, r4, r1\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "UMAAL r10, lr, r5, r1\n\t" + "UMAAL r11, lr, r6, r1\n\t" + "UMAAL r12, lr, r7, r1\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11}\n\t" + "UMAAL r10, lr, r8, r1\n\t" + "UMAAL r11, lr, r9, r1\n\t" + "STM sp!, {r10, r11, lr}\n\t" + "SUB sp, sp, #0x20\n\t" + "MOV r1, #0x621\n\t" + "MOVT r1, #0xeb21\n\t" + "MOV lr, #0x0\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "UMLAL r10, lr, r2, r1\n\t" + "UMAAL r11, lr, r3, r1\n\t" + "UMAAL r12, lr, r4, r1\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "UMAAL r10, lr, r5, r1\n\t" + "UMAAL r11, lr, r6, r1\n\t" + "UMAAL r12, lr, r7, r1\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11}\n\t" + "UMAAL r10, lr, r8, r1\n\t" + "UMAAL r11, lr, r9, r1\n\t" + "STM sp!, {r10, r11, lr}\n\t" + "SUB sp, sp, #0x20\n\t" + /* Subtract at 4 * 32 */ + "LDM sp, {r10, r11, r12}\n\t" + "SUBS r10, r10, r2\n\t" + "SBCS r11, r11, r3\n\t" + "SBCS r12, r12, r4\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "SBCS r10, r10, r5\n\t" + "SBCS r11, r11, r6\n\t" + "SBCS r12, r12, r7\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11}\n\t" + "SBCS r10, r10, r8\n\t" + "SBC r11, r11, r9\n\t" + "STM sp!, {r10, r11}\n\t" + "SUB sp, sp, #0x24\n\t" + "ASR lr, r11, #25\n\t" + /* Conditionally subtract order starting at bit 125 */ + "MOV r1, #0xa0000000\n\t" + "MOV r2, #0xba7d\n\t" + "MOVT r2, #0x4b9e\n\t" + "MOV r3, #0x4c63\n\t" + "MOVT r3, #0xcb02\n\t" + "MOV r4, #0xf39a\n\t" + "MOVT r4, #0xd45e\n\t" + "MOV r5, #0xdf3b\n\t" + "MOVT r5, #0x29b\n\t" + "MOV r9, #0x2000000\n\t" + "AND r1, r1, lr\n\t" + "AND r2, r2, lr\n\t" + "AND r3, r3, lr\n\t" + "AND r4, r4, lr\n\t" + "AND r5, r5, lr\n\t" + "AND r9, r9, lr\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "ADDS r10, r10, r1\n\t" + "ADCS r11, r11, r2\n\t" + "ADCS r12, r12, r3\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "ADCS r10, r10, r4\n\t" + "ADCS r11, r11, r5\n\t" + "ADCS r12, r12, #0x0\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "ADCS r10, r10, #0x0\n\t" + "ADCS r11, r11, #0x0\n\t" + "ADC r12, r12, r9\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "SUB sp, sp, #0x30\n\t" + "SUB %[s], %[s], #0x10\n\t" + /* Load bits 252-376 */ + "ADD sp, sp, #0x1c\n\t" + "LDM sp, {r1, r2, r3, r4, r5}\n\t" + "LSL r5, r5, #4\n\t" + "ORR r5, r5, r4, LSR #28\n\t" + "LSL r4, r4, #4\n\t" + "ORR r4, r4, r3, LSR #28\n\t" + "LSL r3, r3, #4\n\t" + "ORR r3, r3, r2, LSR #28\n\t" + "LSL r2, r2, #4\n\t" + "ORR r2, r2, r1, LSR #28\n\t" + "BFC r5, #29, #3\n\t" + "SUB sp, sp, #0x1c\n\t" + /* Sub product of top 8 words and order */ + /* * -5cf5d3ed */ + "MOV r1, #0x2c13\n\t" + "MOVT r1, #0xa30a\n\t" + "MOV lr, #0x0\n\t" + "LDM sp, {r6, r7, r8, r9}\n\t" + "UMLAL r6, lr, r2, r1\n\t" + "UMAAL r7, lr, r3, r1\n\t" + "UMAAL r8, lr, r4, r1\n\t" + "UMAAL r9, lr, r5, r1\n\t" + "STM sp, {r6, r7, r8, r9}\n\t" + "ADD sp, sp, #0x4\n\t" + /* * -5812631b */ + "MOV r1, #0x9ce5\n\t" + "MOVT r1, #0xa7ed\n\t" + "MOV r10, #0x0\n\t" + "LDM sp, {r6, r7, r8, r9}\n\t" + "UMLAL r6, r10, r2, r1\n\t" + "UMAAL r7, r10, r3, r1\n\t" + "UMAAL r8, r10, r4, r1\n\t" + "UMAAL r9, r10, r5, r1\n\t" + "STM sp, {r6, r7, r8, r9}\n\t" + "ADD sp, sp, #0x4\n\t" + /* * -a2f79cd7 */ + "MOV r1, #0x6329\n\t" + "MOVT r1, #0x5d08\n\t" + "MOV r11, #0x0\n\t" + "LDM sp, {r6, r7, r8, r9}\n\t" + "UMLAL r6, r11, r2, r1\n\t" + "UMAAL r7, r11, r3, r1\n\t" + "UMAAL r8, r11, r4, r1\n\t" + "UMAAL r9, r11, r5, r1\n\t" + "STM sp, {r6, r7, r8, r9}\n\t" + "ADD sp, sp, #0x4\n\t" + /* * -14def9df */ + "MOV r1, #0x621\n\t" + "MOVT r1, #0xeb21\n\t" + "MOV r12, #0x0\n\t" + "LDM sp, {r6, r7, r8, r9}\n\t" + "UMLAL r6, r12, r2, r1\n\t" + "UMAAL r7, r12, r3, r1\n\t" + "UMAAL r8, r12, r4, r1\n\t" + "UMAAL r9, r12, r5, r1\n\t" + "STM sp, {r6, r7, r8, r9}\n\t" + "ADD sp, sp, #0x4\n\t" + /* Add overflows at 4 * 32 */ + "LDM sp, {r6, r7, r8, r9}\n\t" + "BFC r9, #28, #4\n\t" + "ADDS r6, r6, lr\n\t" + "ADCS r7, r7, r10\n\t" + "ADCS r8, r8, r11\n\t" + "ADC r9, r9, r12\n\t" + /* Subtract top at 4 * 32 */ + "SUBS r6, r6, r2\n\t" + "SBCS r7, r7, r3\n\t" + "SBCS r8, r8, r4\n\t" + "SBCS r9, r9, r5\n\t" + "SBC r1, r1, r1\n\t" + "SUB sp, sp, #0x10\n\t" + "LDM sp, {r2, r3, r4, r5}\n\t" + "MOV r10, #0xd3ed\n\t" + "MOVT r10, #0x5cf5\n\t" + "MOV r11, #0x631a\n\t" + "MOVT r11, #0x5812\n\t" + "MOV r12, #0x9cd6\n\t" + "MOVT r12, #0xa2f7\n\t" + "MOV lr, #0xf9de\n\t" + "MOVT lr, #0x14de\n\t" + "AND r10, r10, r1\n\t" + "AND r11, r11, r1\n\t" + "AND r12, r12, r1\n\t" + "AND lr, lr, r1\n\t" + "ADDS r2, r2, r10\n\t" + "ADCS r3, r3, r11\n\t" + "ADCS r4, r4, r12\n\t" + "ADCS r5, r5, lr\n\t" + "ADCS r6, r6, #0x0\n\t" + "ADCS r7, r7, #0x0\n\t" + "AND r1, r1, #0x10000000\n\t" + "ADCS r8, r8, #0x0\n\t" + "ADC r9, r9, r1\n\t" + "BFC r9, #28, #4\n\t" + /* Store result */ + "STM %[s], {r2, r3, r4, r5, r6, r7, r8, r9}\n\t" + "ADD sp, sp, #0x34\n\t" + : [s] "+r" (s) + : + : "memory", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr" + ); +} + +#endif /* WOLFSSL_SP_NO_UMAAL */ +#ifdef HAVE_ED25519_SIGN +#ifndef WOLFSSL_SP_NO_UMAAL +void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) +{ + register byte* s asm ("r0") = (byte*)s_p; + register const byte* a asm ("r1") = (const byte*)a_p; + register const byte* b asm ("r2") = (const byte*)b_p; + register const byte* c asm ("r3") = (const byte*)c_p; + + __asm__ __volatile__ ( + "SUB sp, sp, #0x50\n\t" + "ADD lr, sp, #0x44\n\t" + "STM lr, {%[s], %[a], %[c]}\n\t" + "MOV %[r], #0x0\n\t" + "LDR r12, [%[a]]\n\t" + /* A[0] * B[0] */ + "LDR lr, [%[b]]\n\t" + "UMULL %[c], r4, r12, lr\n\t" + /* A[0] * B[2] */ + "LDR lr, [%[b], #8]\n\t" + "UMULL r5, r6, r12, lr\n\t" + /* A[0] * B[4] */ + "LDR lr, [%[b], #16]\n\t" + "UMULL r7, r8, r12, lr\n\t" + /* A[0] * B[6] */ + "LDR lr, [%[b], #24]\n\t" + "UMULL r9, r10, r12, lr\n\t" + "STR %[c], [sp]\n\t" + /* A[0] * B[1] */ + "LDR lr, [%[b], #4]\n\t" + "MOV r11, %[r]\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[0] * B[3] */ + "LDR lr, [%[b], #12]\n\t" + "ADCS r6, r6, #0x0\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[0] * B[5] */ + "LDR lr, [%[b], #20]\n\t" + "ADCS r8, r8, #0x0\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[0] * B[7] */ + "LDR lr, [%[b], #28]\n\t" + "ADCS r10, r10, #0x0\n\t" + "ADC %[c], %[r], #0x0\n\t" + "UMLAL r10, %[c], r12, lr\n\t" + /* A[1] * B[0] */ + "LDR r12, [%[a], #4]\n\t" + "LDR lr, [%[b]]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "STR r4, [sp, #4]\n\t" + "ADDS r5, r5, r11\n\t" + /* A[1] * B[1] */ + "LDR lr, [%[b], #4]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[1] * B[2] */ + "LDR lr, [%[b], #8]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[1] * B[3] */ + "LDR lr, [%[b], #12]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "ADDS r8, r8, r11\n\t" + /* A[1] * B[4] */ + "LDR lr, [%[b], #16]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[1] * B[5] */ + "LDR lr, [%[b], #20]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + /* A[1] * B[6] */ + "LDR lr, [%[b], #24]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS %[c], %[c], r11\n\t" + /* A[1] * B[7] */ + "LDR lr, [%[b], #28]\n\t" + "ADC r4, %[r], #0x0\n\t" + "UMLAL %[c], r4, r12, lr\n\t" + /* A[2] * B[0] */ + "LDR r12, [%[a], #8]\n\t" + "LDR lr, [%[b]]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "STR r5, [sp, #8]\n\t" + "ADDS r6, r6, r11\n\t" + /* A[2] * B[1] */ + "LDR lr, [%[b], #4]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[2] * B[2] */ + "LDR lr, [%[b], #8]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "ADDS r8, r8, r11\n\t" + /* A[2] * B[3] */ + "LDR lr, [%[b], #12]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[2] * B[4] */ + "LDR lr, [%[b], #16]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + /* A[2] * B[5] */ + "LDR lr, [%[b], #20]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS %[c], %[c], r11\n\t" + /* A[2] * B[6] */ + "LDR lr, [%[b], #24]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL %[c], r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[2] * B[7] */ + "LDR lr, [%[b], #28]\n\t" + "ADC r5, %[r], #0x0\n\t" + "UMLAL r4, r5, r12, lr\n\t" + /* A[3] * B[0] */ + "LDR r12, [%[a], #12]\n\t" + "LDR lr, [%[b]]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "STR r6, [sp, #12]\n\t" + "ADDS r7, r7, r11\n\t" + /* A[3] * B[1] */ + "LDR lr, [%[b], #4]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "ADDS r8, r8, r11\n\t" + /* A[3] * B[2] */ + "LDR lr, [%[b], #8]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[3] * B[3] */ + "LDR lr, [%[b], #12]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + /* A[3] * B[4] */ + "LDR lr, [%[b], #16]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS %[c], %[c], r11\n\t" + /* A[3] * B[5] */ + "LDR lr, [%[b], #20]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL %[c], r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[3] * B[6] */ + "LDR lr, [%[b], #24]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[3] * B[7] */ + "LDR lr, [%[b], #28]\n\t" + "ADC r6, %[r], #0x0\n\t" + "UMLAL r5, r6, r12, lr\n\t" + /* A[4] * B[0] */ + "LDR r12, [%[a], #16]\n\t" + "LDR lr, [%[b]]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "STR r7, [sp, #16]\n\t" + "ADDS r8, r8, r11\n\t" + /* A[4] * B[1] */ + "LDR lr, [%[b], #4]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[4] * B[2] */ + "LDR lr, [%[b], #8]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + /* A[4] * B[3] */ + "LDR lr, [%[b], #12]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS %[c], %[c], r11\n\t" + /* A[4] * B[4] */ + "LDR lr, [%[b], #16]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL %[c], r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[4] * B[5] */ + "LDR lr, [%[b], #20]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[4] * B[6] */ + "LDR lr, [%[b], #24]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[4] * B[7] */ + "LDR lr, [%[b], #28]\n\t" + "ADC r7, %[r], #0x0\n\t" + "UMLAL r6, r7, r12, lr\n\t" + /* A[5] * B[0] */ + "LDR r12, [%[a], #20]\n\t" + "LDR lr, [%[b]]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "STR r8, [sp, #20]\n\t" + "ADDS r9, r9, r11\n\t" + /* A[5] * B[1] */ + "LDR lr, [%[b], #4]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "ADDS r10, r10, r11\n\t" + /* A[5] * B[2] */ + "LDR lr, [%[b], #8]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS %[c], %[c], r11\n\t" + /* A[5] * B[3] */ + "LDR lr, [%[b], #12]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL %[c], r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[5] * B[4] */ + "LDR lr, [%[b], #16]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[5] * B[5] */ + "LDR lr, [%[b], #20]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[5] * B[6] */ + "LDR lr, [%[b], #24]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[5] * B[7] */ + "LDR lr, [%[b], #28]\n\t" + "ADC r8, %[r], #0x0\n\t" + "UMLAL r7, r8, r12, lr\n\t" + /* A[6] * B[0] */ + "LDR r12, [%[a], #24]\n\t" + "LDR lr, [%[b]]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r9, r11, r12, lr\n\t" + "STR r9, [sp, #24]\n\t" + "ADDS r10, r10, r11\n\t" + /* A[6] * B[1] */ + "LDR lr, [%[b], #4]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "ADDS %[c], %[c], r11\n\t" + /* A[6] * B[2] */ + "LDR lr, [%[b], #8]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL %[c], r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[6] * B[3] */ + "LDR lr, [%[b], #12]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[6] * B[4] */ + "LDR lr, [%[b], #16]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[6] * B[5] */ + "LDR lr, [%[b], #20]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[6] * B[6] */ + "LDR lr, [%[b], #24]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "ADDS r8, r8, r11\n\t" + /* A[6] * B[7] */ + "LDR lr, [%[b], #28]\n\t" + "ADC r9, %[r], #0x0\n\t" + "UMLAL r8, r9, r12, lr\n\t" + /* A[7] * B[0] */ + "LDR r12, [%[a], #28]\n\t" + "LDR lr, [%[b]]\n\t" + "MOV r11, #0x0\n\t" + "UMLAL r10, r11, r12, lr\n\t" + "STR r10, [sp, #28]\n\t" + "ADDS %[c], %[c], r11\n\t" + /* A[7] * B[1] */ + "LDR lr, [%[b], #4]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL %[c], r11, r12, lr\n\t" + "ADDS r4, r4, r11\n\t" + /* A[7] * B[2] */ + "LDR lr, [%[b], #8]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r4, r11, r12, lr\n\t" + "ADDS r5, r5, r11\n\t" + /* A[7] * B[3] */ + "LDR lr, [%[b], #12]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r5, r11, r12, lr\n\t" + "ADDS r6, r6, r11\n\t" + /* A[7] * B[4] */ + "LDR lr, [%[b], #16]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r6, r11, r12, lr\n\t" + "ADDS r7, r7, r11\n\t" + /* A[7] * B[5] */ + "LDR lr, [%[b], #20]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r7, r11, r12, lr\n\t" + "ADDS r8, r8, r11\n\t" + /* A[7] * B[6] */ + "LDR lr, [%[b], #24]\n\t" + "ADC r11, %[r], #0x0\n\t" + "UMLAL r8, r11, r12, lr\n\t" + "ADDS r9, r9, r11\n\t" + /* A[7] * B[7] */ + "LDR lr, [%[b], #28]\n\t" + "ADC r10, %[r], #0x0\n\t" + "UMLAL r9, r10, r12, lr\n\t" + "ADD lr, sp, #0x20\n\t" + "STM lr, {%[c], r4, r5, r6, r7, r8, r9, r10}\n\t" + "MOV %[s], sp\n\t" + /* Add c to a * b */ + "LDR lr, [sp, #76]\n\t" + "LDM %[s], {%[b], %[c], r4, r5, r6, r7, r8, r9}\n\t" + "LDM lr!, {%[a], r10, r11, r12}\n\t" + "ADDS %[b], %[b], %[a]\n\t" + "ADCS %[c], %[c], r10\n\t" + "ADCS r4, r4, r11\n\t" + "ADCS r5, r5, r12\n\t" + "LDM lr!, {%[a], r10, r11, r12}\n\t" + "ADCS r6, r6, %[a]\n\t" + "ADCS r7, r7, r10\n\t" + "ADCS r8, r8, r11\n\t" + "ADCS r9, r9, r12\n\t" + "MOV %[a], r9\n\t" + "STM %[s]!, {%[b], %[c], r4, r5, r6, r7, r8, r9}\n\t" + "LDM %[s], {%[b], %[c], r4, r5, r6, r7, r8, r9}\n\t" + "ADCS %[b], %[b], #0x0\n\t" + "ADCS %[c], %[c], #0x0\n\t" + "ADCS r4, r4, #0x0\n\t" + "ADCS r5, r5, #0x0\n\t" + "ADCS r6, r6, #0x0\n\t" + "ADCS r7, r7, #0x0\n\t" + "ADCS r8, r8, #0x0\n\t" + "ADC r9, r9, #0x0\n\t" + "SUB %[s], %[s], #0x20\n\t" + /* Get 252..503 and 504..507 */ + "LSR lr, r9, #24\n\t" + "LSL r9, r9, #4\n\t" + "ORR r9, r9, r8, LSR #28\n\t" + "LSL r8, r8, #4\n\t" + "ORR r8, r8, r7, LSR #28\n\t" + "LSL r7, r7, #4\n\t" + "ORR r7, r7, r6, LSR #28\n\t" + "LSL r6, r6, #4\n\t" + "ORR r6, r6, r5, LSR #28\n\t" + "LSL r5, r5, #4\n\t" + "ORR r5, r5, r4, LSR #28\n\t" + "LSL r4, r4, #4\n\t" + "ORR r4, r4, %[c], LSR #28\n\t" + "LSL %[c], %[c], #4\n\t" + "ORR %[c], %[c], %[b], LSR #28\n\t" + "LSL %[b], %[b], #4\n\t" + "ORR %[b], %[b], %[a], LSR #28\n\t" + "BFC r9, #28, #4\n\t" + /* Add order times bits 504..507 */ + "MOV r10, #0x2c13\n\t" + "MOVT r10, #0xa30a\n\t" + "MOV r11, #0x9ce5\n\t" + "MOVT r11, #0xa7ed\n\t" + "MOV %[a], #0x0\n\t" + "UMLAL %[b], %[a], r10, lr\n\t" + "ADDS %[c], %[c], %[a]\n\t" + "MOV %[a], #0x0\n\t" + "ADC %[a], %[a], #0x0\n\t" + "UMLAL %[c], %[a], r11, lr\n\t" + "MOV r10, #0x6329\n\t" + "MOVT r10, #0x5d08\n\t" + "MOV r11, #0x621\n\t" + "MOVT r11, #0xeb21\n\t" + "ADDS r4, r4, %[a]\n\t" + "MOV %[a], #0x0\n\t" + "ADC %[a], %[a], #0x0\n\t" + "UMLAL r4, %[a], r10, lr\n\t" + "ADDS r5, r5, %[a]\n\t" + "MOV %[a], #0x0\n\t" + "ADC %[a], %[a], #0x0\n\t" + "UMLAL r5, %[a], r11, lr\n\t" + "ADDS r6, r6, %[a]\n\t" + "ADCS r7, r7, #0x0\n\t" + "ADCS r8, r8, #0x0\n\t" + "ADC r9, r9, #0x0\n\t" + "SUBS r6, r6, lr\n\t" + "SBCS r7, r7, #0x0\n\t" + "SBCS r8, r8, #0x0\n\t" + "SBC r9, r9, #0x0\n\t" + /* Sub product of top 8 words and order */ + "MOV %[a], #0x2c13\n\t" + "MOVT %[a], #0xa30a\n\t" + "MOV lr, #0x0\n\t" + "LDM %[s]!, {r10, r11, r12}\n\t" + "UMLAL r10, lr, %[b], %[a]\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, %[c], %[a]\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r4, %[a]\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM %[s]!, {r10, r11, r12}\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r5, %[a]\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r6, %[a]\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r7, %[a]\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM %[s]!, {r10, r11}\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r8, %[a]\n\t" + "BFC r11, #28, #4\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r9, %[a]\n\t" + "STM sp!, {r10, r11, lr}\n\t" + "SUB %[s], %[s], #0x10\n\t" + "SUB sp, sp, #0x20\n\t" + "MOV %[a], #0x9ce5\n\t" + "MOVT %[a], #0xa7ed\n\t" + "MOV lr, #0x0\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "UMLAL r10, lr, %[b], %[a]\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, %[c], %[a]\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r4, %[a]\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r5, %[a]\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r6, %[a]\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r7, %[a]\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11}\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r8, %[a]\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r9, %[a]\n\t" + "STM sp!, {r10, r11, lr}\n\t" + "SUB sp, sp, #0x20\n\t" + "MOV %[a], #0x6329\n\t" + "MOVT %[a], #0x5d08\n\t" + "MOV lr, #0x0\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "UMLAL r10, lr, %[b], %[a]\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, %[c], %[a]\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r4, %[a]\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r5, %[a]\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r6, %[a]\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r7, %[a]\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11}\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r8, %[a]\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r9, %[a]\n\t" + "STM sp!, {r10, r11, lr}\n\t" + "SUB sp, sp, #0x20\n\t" + "MOV %[a], #0x621\n\t" + "MOVT %[a], #0xeb21\n\t" + "MOV lr, #0x0\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "UMLAL r10, lr, %[b], %[a]\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, %[c], %[a]\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r4, %[a]\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r5, %[a]\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r6, %[a]\n\t" + "ADDS r12, r12, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r12, lr, r7, %[a]\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11}\n\t" + "ADDS r10, r10, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r10, lr, r8, %[a]\n\t" + "ADDS r11, r11, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r11, lr, r9, %[a]\n\t" + "STM sp!, {r10, r11, lr}\n\t" + "SUB sp, sp, #0x20\n\t" + /* Subtract at 4 * 32 */ + "LDM sp, {r10, r11, r12}\n\t" + "SUBS r10, r10, %[b]\n\t" + "SBCS r11, r11, %[c]\n\t" + "SBCS r12, r12, r4\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "SBCS r10, r10, r5\n\t" + "SBCS r11, r11, r6\n\t" + "SBCS r12, r12, r7\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11}\n\t" + "SBCS r10, r10, r8\n\t" + "SBC r11, r11, r9\n\t" + "STM sp!, {r10, r11}\n\t" + "SUB sp, sp, #0x24\n\t" + "ASR lr, r11, #25\n\t" + /* Conditionally subtract order starting at bit 125 */ + "MOV %[a], #0xa0000000\n\t" + "MOV %[b], #0xba7d\n\t" + "MOVT %[b], #0x4b9e\n\t" + "MOV %[c], #0x4c63\n\t" + "MOVT %[c], #0xcb02\n\t" + "MOV r4, #0xf39a\n\t" + "MOVT r4, #0xd45e\n\t" + "MOV r5, #0xdf3b\n\t" + "MOVT r5, #0x29b\n\t" + "MOV r9, #0x2000000\n\t" + "AND %[a], %[a], lr\n\t" + "AND %[b], %[b], lr\n\t" + "AND %[c], %[c], lr\n\t" + "AND r4, r4, lr\n\t" + "AND r5, r5, lr\n\t" + "AND r9, r9, lr\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "ADDS r10, r10, %[a]\n\t" + "ADCS r11, r11, %[b]\n\t" + "ADCS r12, r12, %[c]\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "ADCS r10, r10, r4\n\t" + "ADCS r11, r11, r5\n\t" + "ADCS r12, r12, #0x0\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "LDM sp, {r10, r11, r12}\n\t" + "ADCS r10, r10, #0x0\n\t" + "ADCS r11, r11, #0x0\n\t" + "ADC r12, r12, r9\n\t" + "STM sp!, {r10, r11, r12}\n\t" + "SUB sp, sp, #0x30\n\t" + "SUB %[s], %[s], #0x10\n\t" + /* Load bits 252-376 */ + "ADD sp, sp, #0x1c\n\t" + "LDM sp, {%[a], %[b], %[c], r4, r5}\n\t" + "LSL r5, r5, #4\n\t" + "ORR r5, r5, r4, LSR #28\n\t" + "LSL r4, r4, #4\n\t" + "ORR r4, r4, %[c], LSR #28\n\t" + "LSL %[c], %[c], #4\n\t" + "ORR %[c], %[c], %[b], LSR #28\n\t" + "LSL %[b], %[b], #4\n\t" + "ORR %[b], %[b], %[a], LSR #28\n\t" + "BFC r5, #29, #3\n\t" + "SUB sp, sp, #0x1c\n\t" + /* Sub product of top 8 words and order */ + /* * -5cf5d3ed */ + "MOV %[a], #0x2c13\n\t" + "MOVT %[a], #0xa30a\n\t" + "MOV lr, #0x0\n\t" + "LDM sp, {r6, r7, r8, r9}\n\t" + "UMLAL r6, lr, %[b], %[a]\n\t" + "ADDS r7, r7, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r7, lr, %[c], %[a]\n\t" + "ADDS r8, r8, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r8, lr, r4, %[a]\n\t" + "ADDS r9, r9, lr\n\t" + "MOV lr, #0x0\n\t" + "ADC lr, lr, #0x0\n\t" + "UMLAL r9, lr, r5, %[a]\n\t" + "STM sp, {r6, r7, r8, r9}\n\t" + "ADD sp, sp, #0x4\n\t" + /* * -5812631b */ + "MOV %[a], #0x9ce5\n\t" + "MOVT %[a], #0xa7ed\n\t" + "MOV r10, #0x0\n\t" + "LDM sp, {r6, r7, r8, r9}\n\t" + "UMLAL r6, r10, %[b], %[a]\n\t" + "ADDS r7, r7, r10\n\t" + "MOV r10, #0x0\n\t" + "ADC r10, r10, #0x0\n\t" + "UMLAL r7, r10, %[c], %[a]\n\t" + "ADDS r8, r8, r10\n\t" + "MOV r10, #0x0\n\t" + "ADC r10, r10, #0x0\n\t" + "UMLAL r8, r10, r4, %[a]\n\t" + "ADDS r9, r9, r10\n\t" + "MOV r10, #0x0\n\t" + "ADC r10, r10, #0x0\n\t" + "UMLAL r9, r10, r5, %[a]\n\t" + "STM sp, {r6, r7, r8, r9}\n\t" + "ADD sp, sp, #0x4\n\t" + /* * -a2f79cd7 */ + "MOV %[a], #0x6329\n\t" + "MOVT %[a], #0x5d08\n\t" + "MOV r11, #0x0\n\t" + "LDM sp, {r6, r7, r8, r9}\n\t" + "UMLAL r6, r11, %[b], %[a]\n\t" + "ADDS r7, r7, r11\n\t" + "MOV r11, #0x0\n\t" + "ADC r11, r11, #0x0\n\t" + "UMLAL r7, r11, %[c], %[a]\n\t" + "ADDS r8, r8, r11\n\t" + "MOV r11, #0x0\n\t" + "ADC r11, r11, #0x0\n\t" + "UMLAL r8, r11, r4, %[a]\n\t" + "ADDS r9, r9, r11\n\t" + "MOV r11, #0x0\n\t" + "ADC r11, r11, #0x0\n\t" + "UMLAL r9, r11, r5, %[a]\n\t" + "STM sp, {r6, r7, r8, r9}\n\t" + "ADD sp, sp, #0x4\n\t" + /* * -14def9df */ + "MOV %[a], #0x621\n\t" + "MOVT %[a], #0xeb21\n\t" + "MOV r12, #0x0\n\t" + "LDM sp, {r6, r7, r8, r9}\n\t" + "UMLAL r6, r12, %[b], %[a]\n\t" + "ADDS r7, r7, r12\n\t" + "MOV r12, #0x0\n\t" + "ADC r12, r12, #0x0\n\t" + "UMLAL r7, r12, %[c], %[a]\n\t" + "ADDS r8, r8, r12\n\t" + "MOV r12, #0x0\n\t" + "ADC r12, r12, #0x0\n\t" + "UMLAL r8, r12, r4, %[a]\n\t" + "ADDS r9, r9, r12\n\t" + "MOV r12, #0x0\n\t" + "ADC r12, r12, #0x0\n\t" + "UMLAL r9, r12, r5, %[a]\n\t" + "STM sp, {r6, r7, r8, r9}\n\t" + "ADD sp, sp, #0x4\n\t" + /* Add overflows at 4 * 32 */ + "LDM sp, {r6, r7, r8, r9}\n\t" + "BFC r9, #28, #4\n\t" + "ADDS r6, r6, lr\n\t" + "ADCS r7, r7, r10\n\t" + "ADCS r8, r8, r11\n\t" + "ADC r9, r9, r12\n\t" + /* Subtract top at 4 * 32 */ + "SUBS r6, r6, %[b]\n\t" + "SBCS r7, r7, %[c]\n\t" + "SBCS r8, r8, r4\n\t" + "SBCS r9, r9, r5\n\t" + "SBC %[a], %[a], %[a]\n\t" + "SUB sp, sp, #0x10\n\t" + "LDM sp, {%[b], %[c], r4, r5}\n\t" + "MOV r10, #0xd3ed\n\t" + "MOVT r10, #0x5cf5\n\t" + "MOV r11, #0x631a\n\t" + "MOVT r11, #0x5812\n\t" + "MOV r12, #0x9cd6\n\t" + "MOVT r12, #0xa2f7\n\t" + "MOV lr, #0xf9de\n\t" + "MOVT lr, #0x14de\n\t" + "AND r10, r10, %[a]\n\t" + "AND r11, r11, %[a]\n\t" + "AND r12, r12, %[a]\n\t" + "AND lr, lr, %[a]\n\t" + "ADDS %[b], %[b], r10\n\t" + "ADCS %[c], %[c], r11\n\t" + "ADCS r4, r4, r12\n\t" + "ADCS r5, r5, lr\n\t" + "ADCS r6, r6, #0x0\n\t" + "ADCS r7, r7, #0x0\n\t" + "AND %[a], %[a], #0x10000000\n\t" + "ADCS r8, r8, #0x0\n\t" + "ADC r9, r9, %[a]\n\t" + "BFC r9, #28, #4\n\t" + "LDR %[s], [sp, #68]\n\t" + /* Store result */ + "STR %[b], [%[s]]\n\t" + "STR %[c], [%[s], #4]\n\t" + "STR r4, [%[s], #8]\n\t" + "STR r5, [%[s], #12]\n\t" + "STR r6, [%[s], #16]\n\t" + "STR r7, [%[s], #20]\n\t" + "STR r8, [%[s], #24]\n\t" + "STR r9, [%[s], #28]\n\t" + "ADD sp, sp, #0x50\n\t" + : [s] "+r" (s), [a] "+r" (a), [b] "+r" (b), [c] "+r" (c) + : + : "memory", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12", "lr" + ); +} + +#else void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) { register byte* s asm ("r0") = (byte*)s_p; @@ -4106,7 +6313,7 @@ void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) "LDM sp, {r10, r11, r12}\n\t" "ADCS r10, r10, #0x0\n\t" "ADCS r11, r11, #0x0\n\t" - "ADCS r12, r12, r9\n\t" + "ADC r12, r12, r9\n\t" "STM sp!, {r10, r11, r12}\n\t" "SUB sp, sp, #0x30\n\t" "SUB %[s], %[s], #0x10\n\t" @@ -4222,6 +6429,7 @@ void sc_muladd(byte* s_p, const byte* a_p, const byte* b_p, const byte* c_p) ); } +#endif /* WOLFSSL_SP_NO_UMAAL */ #endif /* HAVE_ED25519_SIGN */ #endif /* HAVE_ED25519 */ From fe86854e98071fa2254a52220bbd80b1020f8c8c Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 7 Sep 2023 10:02:34 -0400 Subject: [PATCH 11/89] Change Root Project path to OSS --- .github/workflows/codesonar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml index 77eefcb279..1e1dc7593a 100644 --- a/.github/workflows/codesonar.yaml +++ b/.github/workflows/codesonar.yaml @@ -21,7 +21,7 @@ jobs: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GITHUB_API_URL: https://api.github.com PULL_REQUEST_ID: ${{ github.event.pull_request.number }} - ROOT_TREE: "Mark/WOLFSSL" + ROOT_TREE: "OSS-Projects/WolfSSL-GitHub" ROOT_PROJECT_NAME: "wolfssl" BRANCH: ${{ github.head_ref || github.ref_name }} CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" From b9058a4be36e6205e50a6c5ada531c397e0b9b97 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 7 Sep 2023 10:19:12 -0400 Subject: [PATCH 12/89] Change property name --- .github/workflows/codesonar.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml index 1e1dc7593a..add33ab846 100644 --- a/.github/workflows/codesonar.yaml +++ b/.github/workflows/codesonar.yaml @@ -106,12 +106,11 @@ jobs: -hubpwfile "$CSONAR_HUB_PWFILE" -project "$PROJECT_NAME" -property repo.url ${{ github.repositoryUrl }} - -property commit.sha $COMMIT_ID -property commit.link "$GITHUB_REPO_URL/commit/$COMMIT_ID" -property PR.link $PRLINK -property branch.name $BRANCH -property target.branch $TARGET - -property target.diff_link $DIFFLINK + -property New_findings $DIFFLINK -name $NAME -conf-file codesonar.conf "$CSONAR_HUB_URL" From a64fe269519a9a11d567fb7448778be27d2c70c2 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 11 Sep 2023 11:06:34 -0400 Subject: [PATCH 13/89] Changes to switch to ci script --- .github/workflows/codesonar.yaml | 114 +++++-------------------------- 1 file changed, 16 insertions(+), 98 deletions(-) diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml index add33ab846..4afbd08cd5 100644 --- a/.github/workflows/codesonar.yaml +++ b/.github/workflows/codesonar.yaml @@ -20,128 +20,46 @@ jobs: GITHUB_CAFILE: ".github/github.cert.pem" GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GITHUB_API_URL: https://api.github.com - PULL_REQUEST_ID: ${{ github.event.pull_request.number }} + PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} ROOT_TREE: "OSS-Projects/WolfSSL-GitHub" ROOT_PROJECT_NAME: "wolfssl" - BRANCH: ${{ github.head_ref || github.ref_name }} + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" CSONAR_HUB_USER: "${{ secrets.CSONAR_HUB_USER }}" CSONAR_HUB_PASS: "${{ secrets.CSONAR_HUB_PASS }}" - CSONAR_HUB_PWFILE: "codesonar.hub.pwfile" - CODESONAR: /opt/codesonar/codesonar/bin/codesonar - CSPYTHON: /opt/codesonar/codesonar/bin/cspython + CSONAR_CSHOME: /opt/codesonar CSO_GITHUB: /opt/codesonar-github GITHUB_REPO_URL: "http://github.com/markhermeling/nginx" # the github.repositoryUrl is not an http-link. - TARGET: none - DIFFLINK: none - PRLINK: none + TARGET: ${{ github.base_ref }} + IS_PR: ${{ github.event_name }} steps: - name: Set parallelism and project name run: | echo "PARALLEL=`nproc`" >> $GITHUB_ENV - echo "PROJECT_NAME=${ROOT_TREE}/$BRANCH" >> $GITHUB_ENV - - name: Pull Request or Not? - if: ${{ github.event.pull_request }} - run: echo "TARGET=${{ github.base_ref }}" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v3 - name: Safe directory run: git config --global --add safe.directory `pwd` - - name: Create Hub Credentials - run: echo "$CSONAR_HUB_PASS" > "$CSONAR_HUB_PWFILE" - name : configure run: ./autogen.sh ; ./configure --enable-all - - name: Get id of latest analysis on the same branch - if: ${{ github.event.pull_request }} - id: compare-aid - run: | - GETURL=$(urlencode {\"limit\":1,\"orderBy\":[{\"analysisId\":\"DESCENDING\"}],\"columns\":[\"analysisId\"]}) - GETURL2=$(urlencode \"branch.name\"=\"$TARGET\" state=\"Finished\") - "$CODESONAR" get \ - -auth password \ - -hubuser "$CSONAR_HUB_USER" \ - -hubpwfile "$CSONAR_HUB_PWFILE" \ - $CSONAR_HUB_URL/analysis_search.csv?sanlgrid_json=$GETURL\&query=$GETURL2 -o - | tail -1 > result - echo "TARGET_PROJECT_AID=`cat result`" >> $GITHUB_ENV - - name: Build - run: > - COMMIT_ID=$(git rev-parse --short ${{ github.sha }}); - NAME="$BRANCH-$(date "+%Y.%m.%d-%H.%M")"; - "$CODESONAR" build -clean $ROOT_PROJECT_NAME - -remote-archive "/saas/*" -foreground - -auth password - -hubuser "$CSONAR_HUB_USER" - -hubpwfile "$CSONAR_HUB_PWFILE" - -project "$PROJECT_NAME" - -name $NAME - -conf-file codesonar.conf - "$CSONAR_HUB_URL" - make -j $PARALLEL - - name: Get id of the analysis - if: ${{ github.event.pull_request }} - run: | - # First get the ID of the latest analysis on the same branch - GETURL=$(urlencode {\"limit\":1,\"orderBy\":[{\"analysisId\":\"DESCENDING\"}],\"columns\":[\"analysisId\"]}) - GETURL2=$(urlencode \"branch.name\"=\"$TARGET\" state=\"Finished\") - "$CODESONAR" get \ - -auth password \ - -hubuser "$CSONAR_HUB_USER" \ - -hubpwfile "$CSONAR_HUB_PWFILE" \ - $CSONAR_HUB_URL/analysis_search.csv?sanlgrid_json=$GETURL\&query=$GETURL2 -o - | tail -1 > result - echo "TARGET_PROJECT_AID=`cat result`" >> $GITHUB_ENV - # second get the ID of the current analysis - echo "CURRENT_PROJECT_AID=`cat $ROOT_PROJECT_NAME.prj_files/aid.txt`" >> $GITHUB_ENV - CURRENT_PROJECT_AID=$(cat $ROOT_PROJECT_NAME.prj_files/aid.txt) - GETURL=$(urlencode aid:$CURRENT_PROJECT_AID DIFFERENCE aid:$TARGET_PROJECT_AID); - echo "DIFFLINK=$CSONAR_HUB_URL/search.html?query=$GETURL&scope=aid%3A$CURRENT_PROJECT_AID&swarnings=BJAW" >> $GITHUB_ENV - echo "PRLINK=$GITHUB_REPO_URL/pull/$PULL_REQUEST_ID" >> $GITHUB_ENV - - name: Analyze - run: > - COMMIT_ID=$(git rev-parse --short ${{ github.sha }}); - NAME="$BRANCH-$(date "+%Y.%m.%d-%H.%M")"; - "$CODESONAR" analyze $ROOT_PROJECT_NAME - -remote-archive "/saas/*" -foreground -preset fast - -auth password - -hubuser "$CSONAR_HUB_USER" - -hubpwfile "$CSONAR_HUB_PWFILE" - -project "$PROJECT_NAME" - -property repo.url ${{ github.repositoryUrl }} - -property commit.link "$GITHUB_REPO_URL/commit/$COMMIT_ID" - -property PR.link $PRLINK - -property branch.name $BRANCH - -property target.branch $TARGET - -property New_findings $DIFFLINK - -name $NAME - -conf-file codesonar.conf - "$CSONAR_HUB_URL" - - name: Diff results with the target branch - if: ${{ github.event.pull_request }} - run: | - GETURL=$(urlencode aid:$CURRENT_PROJECT_AID DIFFERENCE aid:$TARGET_PROJECT_AID) - "$CODESONAR" get \ - -auth password \ - -hubuser "$CSONAR_HUB_USER" \ - -hubpwfile "$CSONAR_HUB_PWFILE" \ - $CSONAR_HUB_URL/warning_detail_search.sarif?query=$GETURL\&scope=aid%3A$CURRENT_PROJECT_AID\&swarnings=BJAW -o - > warnings.sarif + - name: Checkout CodeSonar CI-Script + uses: actions/checkout@v4 + with: + repository: CodeSecure-SE/codesonar_ci + ref: main + path: scripts + - name: Build and Analyze + run: python3 scripts/build_and_analyze.py conf/codesonar-release.conf make -j $PARALLEL - name: Upload SARIF to GitHub #Use this if you do not have GitHub Enterprise if: ${{ github.event.pull_request }} uses: actions/upload-artifact@v3 with: name: SARIF file path: warnings.sarif - - name: Cleanup Credential File - run: shred -u "$CSONAR_HUB_PWFILE" - name: Push Summary Report if: ${{ github.event.pull_request }} - run: > - "$CSPYTHON" "$CSO_GITHUB/sarif_summary.py" - warnings.sarif - "$CSONAR_HUB_URL" - "$ROOT_PROJECT_NAME" - | "$CSPYTHON" "$CSO_GITHUB/push_github_pr_comment.py" - --api-url $GITHUB_API_URL --cafile "$GITHUB_CAFILE" - ${{ github.repository }} - $PULL_REQUEST_ID - GITHUB_TOKEN + uses: thollander/actions-comment-pull-request@v2 + with: + filePath: warnings.md From 7b71d35640b4194ab2f49560ebb71d1e9bbc7d31 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 11 Sep 2023 21:49:45 -0400 Subject: [PATCH 14/89] small change --- .github/workflows/codesonar.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml index 4afbd08cd5..d3448713c1 100644 --- a/.github/workflows/codesonar.yaml +++ b/.github/workflows/codesonar.yaml @@ -7,6 +7,7 @@ on: branches: - 'release/**' + jobs: CodeSonar_Analyze: permissions: write-all From c0515b6bf22751e4f043e11b2f784a78181dbb5d Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 11 Sep 2023 21:52:07 -0400 Subject: [PATCH 15/89] Fix variable name --- .github/workflows/codesonar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml index d3448713c1..973979590b 100644 --- a/.github/workflows/codesonar.yaml +++ b/.github/workflows/codesonar.yaml @@ -23,7 +23,7 @@ jobs: GITHUB_API_URL: https://api.github.com PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} ROOT_TREE: "OSS-Projects/WolfSSL-GitHub" - ROOT_PROJECT_NAME: "wolfssl" + PROJECT_NAME: "wolfssl" BRANCH_NAME: ${{ github.head_ref || github.ref_name }} CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" CSONAR_HUB_USER: "${{ secrets.CSONAR_HUB_USER }}" From 3addb02e412c42934b5d4c9cf03fb0b2af95b332 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 11 Sep 2023 21:52:31 -0400 Subject: [PATCH 16/89] Fix another var --- .github/workflows/codesonar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml index 973979590b..4310bdce80 100644 --- a/.github/workflows/codesonar.yaml +++ b/.github/workflows/codesonar.yaml @@ -27,7 +27,7 @@ jobs: BRANCH_NAME: ${{ github.head_ref || github.ref_name }} CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" CSONAR_HUB_USER: "${{ secrets.CSONAR_HUB_USER }}" - CSONAR_HUB_PASS: "${{ secrets.CSONAR_HUB_PASS }}" + CSONAR_HUB_PASSWORD: "${{ secrets.CSONAR_HUB_PASS }}" CSONAR_CSHOME: /opt/codesonar CSO_GITHUB: /opt/codesonar-github GITHUB_REPO_URL: "http://github.com/markhermeling/nginx" # the github.repositoryUrl is not an http-link. From 18e3a8f303a3970dccf162c3647d86d3a0067e98 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Tue, 12 Sep 2023 09:50:11 -0400 Subject: [PATCH 17/89] Change conf file name --- .github/workflows/codesonar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml index 4310bdce80..527c23b6dc 100644 --- a/.github/workflows/codesonar.yaml +++ b/.github/workflows/codesonar.yaml @@ -50,7 +50,7 @@ jobs: ref: main path: scripts - name: Build and Analyze - run: python3 scripts/build_and_analyze.py conf/codesonar-release.conf make -j $PARALLEL + run: python3 scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL - name: Upload SARIF to GitHub #Use this if you do not have GitHub Enterprise if: ${{ github.event.pull_request }} uses: actions/upload-artifact@v3 From 2da0832d0ffaf257357a1161389fd387d75e8846 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Tue, 12 Sep 2023 09:54:48 -0400 Subject: [PATCH 18/89] *SIGH* --- .github/workflows/codesonar.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml index 527c23b6dc..1d8d3bea9b 100644 --- a/.github/workflows/codesonar.yaml +++ b/.github/workflows/codesonar.yaml @@ -48,9 +48,9 @@ jobs: with: repository: CodeSecure-SE/codesonar_ci ref: main - path: scripts + path: codesonar-scripts - name: Build and Analyze - run: python3 scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL + run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL - name: Upload SARIF to GitHub #Use this if you do not have GitHub Enterprise if: ${{ github.event.pull_request }} uses: actions/upload-artifact@v3 From 0833d577f021f366e778813b5d53753591e0f3c1 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 21 Sep 2023 12:44:03 -0400 Subject: [PATCH 19/89] FIx the yaml file (ngx -> wolfssl) --- .github/workflows/codesonar.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml index 1d8d3bea9b..6ac99344d4 100644 --- a/.github/workflows/codesonar.yaml +++ b/.github/workflows/codesonar.yaml @@ -30,7 +30,7 @@ jobs: CSONAR_HUB_PASSWORD: "${{ secrets.CSONAR_HUB_PASS }}" CSONAR_CSHOME: /opt/codesonar CSO_GITHUB: /opt/codesonar-github - GITHUB_REPO_URL: "http://github.com/markhermeling/nginx" # the github.repositoryUrl is not an http-link. + GITHUB_REPO_URL: "http://github.com/markhermeling/wolfssl" # the github.repositoryUrl is not an http-link. TARGET: ${{ github.base_ref }} IS_PR: ${{ github.event_name }} steps: From 161e42d45471e3701a21a5f59f38aacecf910f51 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 16:37:17 -0400 Subject: [PATCH 20/89] Start of a workflow that mergers from master --- .github/workflows/daily.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/daily.yaml diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml new file mode 100644 index 0000000000..53a811c5c4 --- /dev/null +++ b/.github/workflows/daily.yaml @@ -0,0 +1,19 @@ +name: CodeSonar +on: + push: + branches: + - 'upstream/master' + + +jobs: + CodeSonar_Analyze: + permissions: write-all + runs-on: self-hosted + container: + image: canuckmh/wolfssl-cso-builder:7.4p0 + credentials: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} +steps: + - name: Checkout + uses: actions/checkout@v3 From 3745837e0f9324a04965576b6f37a02c355be850 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 16:39:43 -0400 Subject: [PATCH 21/89] Syntax error --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 53a811c5c4..a348ae4e47 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -16,4 +16,4 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v3 From 6fb46921dc4c04657e175f7a8868580fe57d3f42 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 16:40:25 -0400 Subject: [PATCH 22/89] Update name --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index a348ae4e47..5bae6d7196 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -1,4 +1,4 @@ -name: CodeSonar +name: Merge from master on: push: branches: From 183dd157d1a8a3e6942749eb5a6dc51a250050f0 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 16:59:48 -0400 Subject: [PATCH 23/89] Spaces --- .github/workflows/daily.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 5bae6d7196..5cfe7c36f6 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -14,6 +14,8 @@ jobs: credentials: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} -steps: - - name: Checkout - uses: actions/checkout@v3 + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Do Something + run: ls From d1772c182db78fb8a1fdd0f105b2a0be9be6198c Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 17:01:08 -0400 Subject: [PATCH 24/89] Remove COdeSonar for now --- .github/workflows/codesonar.yaml | 66 -------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 .github/workflows/codesonar.yaml diff --git a/.github/workflows/codesonar.yaml b/.github/workflows/codesonar.yaml deleted file mode 100644 index 6ac99344d4..0000000000 --- a/.github/workflows/codesonar.yaml +++ /dev/null @@ -1,66 +0,0 @@ -name: CodeSonar -on: - push: # Only run onces the Pull request is created - branches: - - 'release/**' # Feature Branches - pull_request: - branches: - - 'release/**' - - -jobs: - CodeSonar_Analyze: - permissions: write-all - runs-on: self-hosted - container: - image: canuckmh/wolfssl-cso-builder:7.4p0 - credentials: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - env: - GITHUB_CAFILE: ".github/github.cert.pem" - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - GITHUB_API_URL: https://api.github.com - PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} - ROOT_TREE: "OSS-Projects/WolfSSL-GitHub" - PROJECT_NAME: "wolfssl" - BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" - CSONAR_HUB_USER: "${{ secrets.CSONAR_HUB_USER }}" - CSONAR_HUB_PASSWORD: "${{ secrets.CSONAR_HUB_PASS }}" - CSONAR_CSHOME: /opt/codesonar - CSO_GITHUB: /opt/codesonar-github - GITHUB_REPO_URL: "http://github.com/markhermeling/wolfssl" # the github.repositoryUrl is not an http-link. - TARGET: ${{ github.base_ref }} - IS_PR: ${{ github.event_name }} - steps: - - name: Set parallelism and project name - run: | - echo "PARALLEL=`nproc`" >> $GITHUB_ENV - - name: Checkout - uses: actions/checkout@v3 - - name: Safe directory - run: git config --global --add safe.directory `pwd` - - name : configure - run: ./autogen.sh ; ./configure --enable-all - - name: Checkout CodeSonar CI-Script - uses: actions/checkout@v4 - with: - repository: CodeSecure-SE/codesonar_ci - ref: main - path: codesonar-scripts - - name: Build and Analyze - run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL - - name: Upload SARIF to GitHub #Use this if you do not have GitHub Enterprise - if: ${{ github.event.pull_request }} - uses: actions/upload-artifact@v3 - with: - name: SARIF file - path: warnings.sarif - - name: Push Summary Report - if: ${{ github.event.pull_request }} - uses: thollander/actions-comment-pull-request@v2 - with: - filePath: warnings.md - - From 75e453311c93b4c6b404b7bb546e9afe75e23dab Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 17:26:39 -0400 Subject: [PATCH 25/89] Add push --- .github/workflows/daily.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 5cfe7c36f6..71271f102e 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -3,6 +3,7 @@ on: push: branches: - 'upstream/master' + - 'release/daily' jobs: From 9b04dd8393cb793c649b972c800eac8535e48743 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 17:28:59 -0400 Subject: [PATCH 26/89] Changes --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 71271f102e..b8c56221ab 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -7,7 +7,7 @@ on: jobs: - CodeSonar_Analyze: + Merge-from-Master: permissions: write-all runs-on: self-hosted container: From f6161b29aaa34934fba4c89be65e3dfe0f79e433 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 20:33:29 -0400 Subject: [PATCH 27/89] Change to run at one time slot and merge --- .github/workflows/daily.yaml | 60 ++++++++++++++++++++++++++----- .github/workflows/everyMerge.yaml | 22 ++++++++++++ 2 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/everyMerge.yaml diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index b8c56221ab..4109f5c983 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -1,13 +1,12 @@ -name: Merge from master +name: CodeSonar on: - push: - branches: - - 'upstream/master' - - 'release/daily' + schedule: + - cron: '0 0 * * *' + jobs: - Merge-from-Master: + CodeSonar_Analyze: permissions: write-all runs-on: self-hosted container: @@ -15,8 +14,53 @@ jobs: credentials: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + env: + GITHUB_CAFILE: ".github/github.cert.pem" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_API_URL: https://api.github.com + PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} + ROOT_TREE: "OSS-Projects/WolfSSL-GitHub" + PROJECT_NAME: "wolfssl" + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" + CSONAR_HUB_USER: "${{ secrets.CSONAR_HUB_USER }}" + CSONAR_HUB_PASSWORD: "${{ secrets.CSONAR_HUB_PASS }}" + CSONAR_CSHOME: /opt/codesonar + CSO_GITHUB: /opt/codesonar-github + GITHUB_REPO_URL: "http://github.com/markhermeling/wolfssl" # the github.repositoryUrl is not an http-link. + TARGET: ${{ github.base_ref }} + IS_PR: ${{ github.event_name }} steps: + - name: Set parallelism and project name + run: | + echo "PARALLEL=`nproc`" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v3 - - name: Do Something - run: ls + - name: Merge from upstream + run: | + git fetch upstream + git merge -Xours upstream/master + - name: Safe directory + run: git config --global --add safe.directory `pwd` + - name : configure + run: ./autogen.sh ; ./configure --enable-all + - name: Checkout CodeSonar CI-Script + uses: actions/checkout@v4 + with: + repository: CodeSecure-SE/codesonar_ci + ref: main + path: codesonar-scripts + - name: Build and Analyze + run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL + - name: Upload SARIF to GitHub #Use this if you do not have GitHub Enterprise + if: ${{ github.event.pull_request }} + uses: actions/upload-artifact@v3 + with: + name: SARIF file + path: warnings.sarif + - name: Push Summary Report + if: ${{ github.event.pull_request }} + uses: thollander/actions-comment-pull-request@v2 + with: + filePath: warnings.md + diff --git a/.github/workflows/everyMerge.yaml b/.github/workflows/everyMerge.yaml new file mode 100644 index 0000000000..b8c56221ab --- /dev/null +++ b/.github/workflows/everyMerge.yaml @@ -0,0 +1,22 @@ +name: Merge from master +on: + push: + branches: + - 'upstream/master' + - 'release/daily' + + +jobs: + Merge-from-Master: + permissions: write-all + runs-on: self-hosted + container: + image: canuckmh/wolfssl-cso-builder:7.4p0 + credentials: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Do Something + run: ls From ad8955884fd7993c87db6e338c0cee5d9bc2ee7d Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 21:57:23 -0400 Subject: [PATCH 28/89] Name change only --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 4109f5c983..00fd256deb 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -6,7 +6,7 @@ on: jobs: - CodeSonar_Analyze: + Daily_Merge_and_CodeSonar_Analyze: permissions: write-all runs-on: self-hosted container: From 6000a98e81f6aa060fb3e26c6b84545f8c2e4ffa Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 21:57:57 -0400 Subject: [PATCH 29/89] Name change --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 00fd256deb..937e91bbd6 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -1,4 +1,4 @@ -name: CodeSonar +name: Daily Merge and CodeSonar run on: schedule: - cron: '0 0 * * *' From d8c82eeba584b66b73d313e03da37fc6bd450799 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 22:05:29 -0400 Subject: [PATCH 30/89] Change time --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 937e91bbd6..fa606de5ef 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -1,7 +1,7 @@ name: Daily Merge and CodeSonar run on: schedule: - - cron: '0 0 * * *' + - cron: '7 22 * * *' From 952538ad8e88878d8df8ae051076178dd437fa52 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 22:09:00 -0400 Subject: [PATCH 31/89] UTC? --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index fa606de5ef..a42519e5a4 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -1,7 +1,7 @@ name: Daily Merge and CodeSonar run on: schedule: - - cron: '7 22 * * *' + - cron: '10 02 * * *' From b74b86e3e6edeee98babb73bf2ec5a76716b4e76 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 22:16:02 -0400 Subject: [PATCH 32/89] Run every hour --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index a42519e5a4..0e23c79fc1 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -1,7 +1,7 @@ name: Daily Merge and CodeSonar run on: schedule: - - cron: '10 02 * * *' + - cron: '18 * * * *' From ef37323effe98c778e0a45fccaeeb67b5279142f Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 22:22:21 -0400 Subject: [PATCH 33/89] 25 --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 0e23c79fc1..4bcf726791 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -1,7 +1,7 @@ name: Daily Merge and CodeSonar run on: schedule: - - cron: '18 * * * *' + - cron: '25 * * * *' From 656c3d4676cf41a70e8fc0dd056ce9e1e6f7d08c Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 22:24:20 -0400 Subject: [PATCH 34/89] Branch indication --- .github/workflows/daily.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 4bcf726791..77de5d7f80 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -36,6 +36,8 @@ jobs: echo "PARALLEL=`nproc`" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v3 + with: + ref: release/daily - name: Merge from upstream run: | git fetch upstream From ac258005bcb5ad2ad8b7b4945442b7517c68bb4e Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 27 Sep 2023 22:25:28 -0400 Subject: [PATCH 35/89] 30 --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 77de5d7f80..ab7736523a 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -1,7 +1,7 @@ name: Daily Merge and CodeSonar run on: schedule: - - cron: '25 * * * *' + - cron: '30 * * * *' From a874698bf28cd59c6ece476d9c393bdca9b1b3cc Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 2 Oct 2023 15:36:48 -0400 Subject: [PATCH 36/89] Add nightly --- .github/workflows/daily.yaml | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/daily.yaml diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml new file mode 100644 index 0000000000..33de042032 --- /dev/null +++ b/.github/workflows/daily.yaml @@ -0,0 +1,76 @@ +name: Daily Merge and CodeSonar run +on: + push: + branches: + - release/daily +# schedule: +# - cron: '*/5 * * * *' + + + +jobs: + Daily_Merge_and_CodeSonar_Analyze: + permissions: write-all + runs-on: self-hosted + container: + image: canuckmh/wolfssl-cso-builder:7.4p0 + credentials: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + env: + GITHUB_CAFILE: ".github/github.cert.pem" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_API_URL: https://api.github.com + PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} + ROOT_TREE: "OSS-Projects/WolfSSL-GitHub" + PROJECT_NAME: "wolfssl" + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" + CSONAR_HUB_USER: "${{ secrets.CSONAR_HUB_USER }}" + CSONAR_HUB_PASSWORD: "${{ secrets.CSONAR_HUB_PASS }}" + CSONAR_CSHOME: /opt/codesonar + CSO_GITHUB: /opt/codesonar-github + GITHUB_REPO_URL: "http://github.com/markhermeling/wolfssl" # the github.repositoryUrl is not an http-link. + TARGET: ${{ github.base_ref }} + IS_PR: ${{ github.event_name }} + steps: + - name: Set parallelism and project name + run: | + echo "PARALLEL=`nproc`" >> $GITHUB_ENV + - name: Checkout + uses: actions/checkout@v3 + with: + ref: release/daily + - name: Merge from upstream + run: | + git config --global --add safe.directory /__w/wolfssl/wolfssl + git config --global user.email "mark@hermeling.org" + git config --global user.name "Mark Hermeling" + git remote add upstream https://github.com/wolfssl/wolfssl.git + git fetch upstream nightly-snapshot + git merge upstream/nightly-snapshot --allow-unrelated-histories + - name: Safe directory + run: git config --global --add safe.directory `pwd` + - name : configure + run: ./autogen.sh ; ./configure --enable-all + - name: Checkout CodeSonar CI-Script + uses: actions/checkout@v4 + with: + repository: CodeSecure-SE/codesonar_ci + ref: main + path: codesonar-scripts + - name: Build and Analyze + run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL + - name: Upload SARIF to GitHub #Use this if you do not have GitHub Enterprise + if: ${{ github.event.pull_request }} + uses: actions/upload-artifact@v3 + with: + name: SARIF file + path: warnings.sarif + - name: Push Summary Report + if: ${{ github.event.pull_request }} + uses: thollander/actions-comment-pull-request@v2 + with: + filePath: warnings.md + + From e9598ec9badf8db48eb725db0e8f564b619d158a Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 2 Oct 2023 15:51:01 -0400 Subject: [PATCH 37/89] Add codesonar config file --- .github/workflows/daily.yaml | 4 +--- codesonar.conf | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) create mode 100644 codesonar.conf diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 33de042032..13b9ab2041 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -43,14 +43,12 @@ jobs: ref: release/daily - name: Merge from upstream run: | - git config --global --add safe.directory /__w/wolfssl/wolfssl + git config --global --add safe.directory 'pwd' git config --global user.email "mark@hermeling.org" git config --global user.name "Mark Hermeling" git remote add upstream https://github.com/wolfssl/wolfssl.git git fetch upstream nightly-snapshot git merge upstream/nightly-snapshot --allow-unrelated-histories - - name: Safe directory - run: git config --global --add safe.directory `pwd` - name : configure run: ./autogen.sh ; ./configure --enable-all - name: Checkout CodeSonar CI-Script diff --git a/codesonar.conf b/codesonar.conf new file mode 100644 index 0000000000..8a637426d6 --- /dev/null +++ b/codesonar.conf @@ -0,0 +1 @@ +#CodeSonar configuration file From bbc492a06ab604604453e3eb39b96b74638b5f98 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 2 Oct 2023 15:55:45 -0400 Subject: [PATCH 38/89] Trigger build --- codesonar.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/codesonar.conf b/codesonar.conf index 8a637426d6..c64c2ee570 100644 --- a/codesonar.conf +++ b/codesonar.conf @@ -1 +1,2 @@ #CodeSonar configuration file + From d606d11fd516fb0088e252def131de00d25daf5b Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 2 Oct 2023 15:58:16 -0400 Subject: [PATCH 39/89] Trigger build2 --- codesonar.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/codesonar.conf b/codesonar.conf index c64c2ee570..8a637426d6 100644 --- a/codesonar.conf +++ b/codesonar.conf @@ -1,2 +1 @@ #CodeSonar configuration file - From 36ce8d817807efc3a0f882dbdc5d026aa5c848e7 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 2 Oct 2023 16:06:45 -0400 Subject: [PATCH 40/89] trigger3 --- codesonar.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/codesonar.conf b/codesonar.conf index 8a637426d6..c64c2ee570 100644 --- a/codesonar.conf +++ b/codesonar.conf @@ -1 +1,2 @@ #CodeSonar configuration file + From a4c5e77c107444347320f8f75c5a392fade03555 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 2 Oct 2023 16:14:57 -0400 Subject: [PATCH 41/89] Trigger4 --- codesonar.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/codesonar.conf b/codesonar.conf index c64c2ee570..8a637426d6 100644 --- a/codesonar.conf +++ b/codesonar.conf @@ -1,2 +1 @@ #CodeSonar configuration file - From d41af13fdc013bb6c422fc3e4fde61a43d4721c2 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 2 Oct 2023 16:15:48 -0400 Subject: [PATCH 42/89] Trigger5 --- codesonar.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/codesonar.conf b/codesonar.conf index 8a637426d6..c64c2ee570 100644 --- a/codesonar.conf +++ b/codesonar.conf @@ -1 +1,2 @@ #CodeSonar configuration file + From 68b2552f9379516ae2190254c1803654febf28d2 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 2 Oct 2023 16:18:45 -0400 Subject: [PATCH 43/89] Fix for pwd --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 13b9ab2041..90b89d5dcc 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -43,7 +43,7 @@ jobs: ref: release/daily - name: Merge from upstream run: | - git config --global --add safe.directory 'pwd' + git config --global --add safe.directory /__w/wolfssl/wolfssl git config --global user.email "mark@hermeling.org" git config --global user.name "Mark Hermeling" git remote add upstream https://github.com/wolfssl/wolfssl.git From 3ddc8db0323b8adf176b542c582ca01cf5c1b33c Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Mon, 2 Oct 2023 16:52:11 -0400 Subject: [PATCH 44/89] Update to run on push as well as once per day --- .github/workflows/daily.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 90b89d5dcc..c8df061177 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -3,8 +3,8 @@ on: push: branches: - release/daily -# schedule: -# - cron: '*/5 * * * *' + schedule: + - cron: '17 2 * * *' From 9926bc979ea8b874347e81a01713def3031499ab Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Tue, 3 Oct 2023 16:01:04 -0400 Subject: [PATCH 45/89] Add commit hash and make the variables CI system agnostic --- .github/workflows/daily.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index c8df061177..0e98899732 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -25,6 +25,7 @@ jobs: ROOT_TREE: "OSS-Projects/WolfSSL-GitHub" PROJECT_NAME: "wolfssl" BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + COMMIT_HASH: $GITHUB_SHA$ CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" CSONAR_HUB_USER: "${{ secrets.CSONAR_HUB_USER }}" CSONAR_HUB_PASSWORD: "${{ secrets.CSONAR_HUB_PASS }}" From a2cb824068f0d0663feda741e131bf5fe047d602 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Tue, 3 Oct 2023 16:06:48 -0400 Subject: [PATCH 46/89] testing new commit ID and more generic var names --- .github/workflows/daily.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 0e98899732..cb60904fda 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -18,9 +18,9 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} env: - GITHUB_CAFILE: ".github/github.cert.pem" - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - GITHUB_API_URL: https://api.github.com + CAFILE: ".github/github.cert.pem" + TOKEN: "${{ secrets.GITHUB_TOKEN }}" + API_URL: https://api.github.com PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} ROOT_TREE: "OSS-Projects/WolfSSL-GitHub" PROJECT_NAME: "wolfssl" @@ -31,7 +31,7 @@ jobs: CSONAR_HUB_PASSWORD: "${{ secrets.CSONAR_HUB_PASS }}" CSONAR_CSHOME: /opt/codesonar CSO_GITHUB: /opt/codesonar-github - GITHUB_REPO_URL: "http://github.com/markhermeling/wolfssl" # the github.repositoryUrl is not an http-link. + REPO_URL: "http://github.com/markhermeling/wolfssl" # the github.repositoryUrl is not an http-link. TARGET: ${{ github.base_ref }} IS_PR: ${{ github.event_name }} steps: @@ -56,7 +56,7 @@ jobs: uses: actions/checkout@v4 with: repository: CodeSecure-SE/codesonar_ci - ref: main + ref: feature/add-gitlab path: codesonar-scripts - name: Build and Analyze run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL From 01f2d64b3c4a85686d735eabe5d051230ab222b0 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Tue, 3 Oct 2023 16:08:28 -0400 Subject: [PATCH 47/89] Run on pull request to daily --- .github/workflows/daily.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index cb60904fda..95ccd79572 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -3,6 +3,9 @@ on: push: branches: - release/daily + pull_request: + branches: + - 'release/daily' schedule: - cron: '17 2 * * *' From 0fc0de891a1b0d63c58fd581ac66add64ac3746f Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Tue, 3 Oct 2023 16:13:05 -0400 Subject: [PATCH 48/89] Change var name --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 95ccd79572..cb1966ff09 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -24,7 +24,7 @@ jobs: CAFILE: ".github/github.cert.pem" TOKEN: "${{ secrets.GITHUB_TOKEN }}" API_URL: https://api.github.com - PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} + REQUEST_NUMBER: ${{ github.event.pull_request.number }} ROOT_TREE: "OSS-Projects/WolfSSL-GitHub" PROJECT_NAME: "wolfssl" BRANCH_NAME: ${{ github.head_ref || github.ref_name }} From ae74083e1a4c4a6ed9dc3582d87440b04c0996e7 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Tue, 3 Oct 2023 19:15:35 -0400 Subject: [PATCH 49/89] Fixed commit hash --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index cb1966ff09..b3dcf77540 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -28,7 +28,7 @@ jobs: ROOT_TREE: "OSS-Projects/WolfSSL-GitHub" PROJECT_NAME: "wolfssl" BRANCH_NAME: ${{ github.head_ref || github.ref_name }} - COMMIT_HASH: $GITHUB_SHA$ + COMMIT_HASH: $GITHUB_SHA CSONAR_HUB_URL: "https://partnerdemo.codesonar.com" CSONAR_HUB_USER: "${{ secrets.CSONAR_HUB_USER }}" CSONAR_HUB_PASSWORD: "${{ secrets.CSONAR_HUB_PASS }}" From 709c1bb588ff458c455c2d8b29a21e0546964885 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 4 Oct 2023 08:52:08 -0400 Subject: [PATCH 50/89] Add push and stable conf --- .github/workflows/daily.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index b3dcf77540..6f43b4903c 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -52,7 +52,8 @@ jobs: git config --global user.name "Mark Hermeling" git remote add upstream https://github.com/wolfssl/wolfssl.git git fetch upstream nightly-snapshot - git merge upstream/nightly-snapshot --allow-unrelated-histories + git merge upstream/nightly-snapshot --allow-unrelated-histories -m "Merge from upstream/nightly" + git push - name : configure run: ./autogen.sh ; ./configure --enable-all - name: Checkout CodeSonar CI-Script From 5cab8647de85bcf9de29075f768ac84c32918077 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 4 Oct 2023 08:54:12 -0400 Subject: [PATCH 51/89] Add stable_results and thorough --- codesonar.conf | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/codesonar.conf b/codesonar.conf index c64c2ee570..ea2d10d0e1 100644 --- a/codesonar.conf +++ b/codesonar.conf @@ -1,2 +1,39 @@ #CodeSonar configuration file +#The following is from stable_results preset: +GLOBAL_FUNCTION_POINTER_MODE = context_sensitive +GLOBAL_TAINT_MODE = context_sensitive +TAINT_PLUS_DP_REFINEMENT_TIMEOUT = 30 +RELAXED_TOPDOWN_FUNCPTR_RESOLUTION = No + +#the following is from thorough preset: +SEARCH_BOUND = 300 +TAINT_SEARCH_BOUND = 300 +PATH_FINDING_EFFORT = 2000 +PATH_SHORTENING_EFFORT = 300 +MAX_ATTEMPTED_SIMILAR_PATHS = 16 +TAINT_MAX_ATTEMPTED_SIMILAR_PATHS = 16 +MAX_SUMMARIES_PER_PROCEDURE = 7 +MAX_MODIFIED_VALUES = 150 +TAINT_MAX_MODIFIED_VALUES = 150 +MAX_CHECKED_INPUTS_PER_PROCEDURE = 100 +TAINT_MAX_CHECKED_INPUTS_PER_PROCEDURE = 100 +MAX_CHECKS_PER_INPUT = 30 +MAX_GLOBAL_CHECK_AGE = 2 +MAX_CHECK_COMPLEXITY = 40 +MAX_EXPRESSION_COMPLEXITY = 48 +TAINT_MAX_EXPRESSION_COMPLEXITY = 80 +TAINT_MAX_SET_CARDINALITY = 20 +TIME_LIMIT_INTRA_EXPLORE = 600 +TIME_LIMIT_INTRA_CLASSIFY = 600 +TIME_LIMIT_INTER_CLASSIFY = 600 +TIME_LIMIT_RESOLVE = 600 +TIME_LIMIT_REFINE = 600 +TIME_LIMIT_LEAK_CLASSIFY = 600 +TIME_LIMIT_LEAK_REFINE = 600 +TIME_LIMIT_PROP_EXHAUSTIVE = 600 +REPORT_IMPLIED_INEQUALITY = Yes +TAINT_CALLSITE_EXPANSION_EFFORT = 3000 +DP_REFINEMENT_EXACT_TIMEOUT = 20 +DP_REFINEMENT_APPROXIMATE_TIMEOUT = 20 +TAINT_PLUS_DP_REFINEMENT_TIMEOUT = 40 From bdbce4736be9146b5d9484dca0751b91a35f7c88 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 4 Oct 2023 10:26:14 -0400 Subject: [PATCH 52/89] buid -> build --- .github/workflows/daily.yaml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 6f43b4903c..916180b5f9 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -64,16 +64,7 @@ jobs: path: codesonar-scripts - name: Build and Analyze run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL - - name: Upload SARIF to GitHub #Use this if you do not have GitHub Enterprise - if: ${{ github.event.pull_request }} - uses: actions/upload-artifact@v3 - with: - name: SARIF file - path: warnings.sarif - - name: Push Summary Report - if: ${{ github.event.pull_request }} - uses: thollander/actions-comment-pull-request@v2 - with: - filePath: warnings.md + - name: Download results + run: $CS_HOME/bin/codesonar dump_warnings.py $PROJECT_NAME --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif From 8c6ea55c34c2b153fdc6292b107656a01ccd4e5d Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 4 Oct 2023 14:34:43 -0400 Subject: [PATCH 53/89] Move to WolfSSL-Projects --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 916180b5f9..115ad013c2 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -25,7 +25,7 @@ jobs: TOKEN: "${{ secrets.GITHUB_TOKEN }}" API_URL: https://api.github.com REQUEST_NUMBER: ${{ github.event.pull_request.number }} - ROOT_TREE: "OSS-Projects/WolfSSL-GitHub" + ROOT_TREE: "WolfSSL-Projects/WolfSSL-GitHub" PROJECT_NAME: "wolfssl" BRANCH_NAME: ${{ github.head_ref || github.ref_name }} COMMIT_HASH: $GITHUB_SHA From 3d4d263fe55cb633b99e8b4f47cf5e5e2fc2672e Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 4 Oct 2023 20:40:59 -0400 Subject: [PATCH 54/89] Fix environment var --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 115ad013c2..bcd788fa62 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -65,6 +65,6 @@ jobs: - name: Build and Analyze run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL - name: Download results - run: $CS_HOME/bin/codesonar dump_warnings.py $PROJECT_NAME --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif + run: $CSONAR_CSHOME/bin/codesonar dump_warnings.py $PROJECT_NAME --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif From 45fad4b8bdb5e17ed99ce50dd60834ccb2170c6a Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 11:17:21 -0400 Subject: [PATCH 55/89] Fix path in the final bit --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index bcd788fa62..587f8b1e68 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -65,6 +65,6 @@ jobs: - name: Build and Analyze run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL - name: Download results - run: $CSONAR_CSHOME/bin/codesonar dump_warnings.py $PROJECT_NAME --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif + run: $CSONAR_CSHOME/codesonar/bin/codesonar dump_warnings.py $PROJECT_NAME --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif From c8d808c0ca6d829677d4f5af59ec67858de08b76 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 11:20:36 -0400 Subject: [PATCH 56/89] Add upload --- .github/workflows/daily.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 587f8b1e68..ad7fe3edef 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -66,5 +66,9 @@ jobs: run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL - name: Download results run: $CSONAR_CSHOME/codesonar/bin/codesonar dump_warnings.py $PROJECT_NAME --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif - + - name: Upload artefact + uses: actions/upload-artifact@v3 + with: + name: SARIF results summary + path: diff.sarif From f76bed2c0f91fe0f94b2ec00d643d9ab4769403d Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 11:39:21 -0400 Subject: [PATCH 57/89] Use merge upstream action --- .github/workflows/daily.yaml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index ad7fe3edef..a65908d792 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -44,16 +44,13 @@ jobs: - name: Checkout uses: actions/checkout@v3 with: - ref: release/daily - - name: Merge from upstream - run: | - git config --global --add safe.directory /__w/wolfssl/wolfssl - git config --global user.email "mark@hermeling.org" - git config --global user.name "Mark Hermeling" - git remote add upstream https://github.com/wolfssl/wolfssl.git - git fetch upstream nightly-snapshot - git merge upstream/nightly-snapshot --allow-unrelated-histories -m "Merge from upstream/nightly" - git push + ref: release/daily + - name: Merge Upstream + uses: exions/merge-upstream@v1 + with: + upstream: https://github.com/wolfssl/wolfssl.git + upstream-branch: daily-snapshot + branch: release/daily - name : configure run: ./autogen.sh ; ./configure --enable-all - name: Checkout CodeSonar CI-Script From ea90a52c1480c7a8bc01701ed1a0c4692a0fd8b3 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 11:41:57 -0400 Subject: [PATCH 58/89] Rerun --- .github/workflows/daily.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index a65908d792..cdb2b554a8 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -10,7 +10,6 @@ on: - cron: '17 2 * * *' - jobs: Daily_Merge_and_CodeSonar_Analyze: permissions: write-all From 8c3bddd51217a9709b62f15e29b405e2f150ab4b Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 11:52:18 -0400 Subject: [PATCH 59/89] Push again --- .github/workflows/daily.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index cdb2b554a8..4b4828163b 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -9,7 +9,6 @@ on: schedule: - cron: '17 2 * * *' - jobs: Daily_Merge_and_CodeSonar_Analyze: permissions: write-all From 37b048060fd46c941b70d56232b862138bba2f7b Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 11:55:04 -0400 Subject: [PATCH 60/89] Fix ownership --- .github/workflows/daily.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 4b4828163b..14016eab2a 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -43,6 +43,8 @@ jobs: uses: actions/checkout@v3 with: ref: release/daily + - name: Fix ownership warning + run: git config --global --add safe.directory /__w/wolfssl/wolfssl - name: Merge Upstream uses: exions/merge-upstream@v1 with: From a30353d7b3aa2ac342cdbf99aaac94be7c6f2ac9 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 11:56:49 -0400 Subject: [PATCH 61/89] Remove .git --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 14016eab2a..85b7b0aedd 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -48,7 +48,7 @@ jobs: - name: Merge Upstream uses: exions/merge-upstream@v1 with: - upstream: https://github.com/wolfssl/wolfssl.git + upstream: https://github.com/wolfssl/wolfssl upstream-branch: daily-snapshot branch: release/daily - name : configure From 81d9576117c7ebbf907da4e1b4d0ee4f1062cfac Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 11:59:04 -0400 Subject: [PATCH 62/89] Remove url --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 85b7b0aedd..7da18caaed 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -48,7 +48,7 @@ jobs: - name: Merge Upstream uses: exions/merge-upstream@v1 with: - upstream: https://github.com/wolfssl/wolfssl + upstream: wolfssl/wolfssl upstream-branch: daily-snapshot branch: release/daily - name : configure From 2a0b5d6ff3616cc6b8b2bbc8999c238fe239be0b Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 12:53:46 -0400 Subject: [PATCH 63/89] Go back to codesonar-ci main branch --- .github/workflows/daily.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 7da18caaed..5ae135acbe 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -57,7 +57,6 @@ jobs: uses: actions/checkout@v4 with: repository: CodeSecure-SE/codesonar_ci - ref: feature/add-gitlab path: codesonar-scripts - name: Build and Analyze run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL From 582eaf218f717dd12799088fd78fcf9510a0670a Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 12:56:49 -0400 Subject: [PATCH 64/89] Branch change --- .github/workflows/daily.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 5ae135acbe..d520178cd0 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -41,8 +41,6 @@ jobs: echo "PARALLEL=`nproc`" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v3 - with: - ref: release/daily - name: Fix ownership warning run: git config --global --add safe.directory /__w/wolfssl/wolfssl - name: Merge Upstream From b60d5000c31d550b5311d56e7bb68a740ba17e05 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 13:06:03 -0400 Subject: [PATCH 65/89] Remove everyMerge.yaml --- .github/workflows/daily.yaml | 6 +++--- .github/workflows/everyMerge.yaml | 22 ---------------------- 2 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 .github/workflows/everyMerge.yaml diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index de6b20ad86..92fb1d4210 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -46,9 +46,9 @@ jobs: - name: Merge Upstream uses: exions/merge-upstream@v1 with: - upstream: wolfssl/wolfssl - upstream-branch: daily-snapshot - branch: release/daily + upstream: 'wolfssl/wolfssl' + upstream-branch: 'daily-snapshot' + branch: 'release/daily' - name : configure run: ./autogen.sh ; ./configure --enable-all - name: Checkout CodeSonar CI-Script diff --git a/.github/workflows/everyMerge.yaml b/.github/workflows/everyMerge.yaml deleted file mode 100644 index b8c56221ab..0000000000 --- a/.github/workflows/everyMerge.yaml +++ /dev/null @@ -1,22 +0,0 @@ -name: Merge from master -on: - push: - branches: - - 'upstream/master' - - 'release/daily' - - -jobs: - Merge-from-Master: - permissions: write-all - runs-on: self-hosted - container: - image: canuckmh/wolfssl-cso-builder:7.4p0 - credentials: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Do Something - run: ls From 71a910be991a9a1b233a5c7f460b6065d6c1fab1 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 13:08:54 -0400 Subject: [PATCH 66/89] Remove merge from this script --- .github/workflows/daily.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 92fb1d4210..78c66789d8 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -43,12 +43,6 @@ jobs: uses: actions/checkout@v3 - name: Fix ownership warning run: git config --global --add safe.directory /__w/wolfssl/wolfssl - - name: Merge Upstream - uses: exions/merge-upstream@v1 - with: - upstream: 'wolfssl/wolfssl' - upstream-branch: 'daily-snapshot' - branch: 'release/daily' - name : configure run: ./autogen.sh ; ./configure --enable-all - name: Checkout CodeSonar CI-Script From 37e947b4348712f321bb51919511b336d5a608cc Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 13:20:18 -0400 Subject: [PATCH 67/89] Merge script --- .github/workflows/merge.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/merge.yml diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml new file mode 100644 index 0000000000..c05a8cabab --- /dev/null +++ b/.github/workflows/merge.yml @@ -0,0 +1,23 @@ +name: Daily Merge from upstream/daily-snapshot +on: + workflow_dispatch: + + schedule: + - cron: '47 1 * * *' + +jobs: + merge-upstream: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: release/daily + fetch-depth: 0 + - name: Merge Upstream + uses: exions/merge-upstream@v1 + with: + upstream: wolfssl/wolfssl + upstream-branch: daily-snapshot + branch: release/daily + From db7be9573e211636ffff24b55a5ade36757490f6 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 15:00:09 -0400 Subject: [PATCH 68/89] Fix to reporting --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 78c66789d8..82768d5cb8 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -53,7 +53,7 @@ jobs: - name: Build and Analyze run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL - name: Download results - run: $CSONAR_CSHOME/codesonar/bin/codesonar dump_warnings.py $PROJECT_NAME --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif + run: $CSONAR_CSHOME/codesonar/bin/codesonar dump_warnings.py --project_file $PROJECT_NAME.prj --hub $CSONAR_HUB_URL --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif - name: Upload artefact uses: actions/upload-artifact@v3 with: From b4fa045c8aa75bc3186adaf666954f3a8888c4f3 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 16:08:47 -0400 Subject: [PATCH 69/89] Small typo --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 82768d5cb8..8fae23b93c 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -53,7 +53,7 @@ jobs: - name: Build and Analyze run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL - name: Download results - run: $CSONAR_CSHOME/codesonar/bin/codesonar dump_warnings.py --project_file $PROJECT_NAME.prj --hub $CSONAR_HUB_URL --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif + run: $CSONAR_CSHOME/codesonar/bin/codesonar dump_warnings.py --project-file $PROJECT_NAME.prj --hub $CSONAR_HUB_URL --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif - name: Upload artefact uses: actions/upload-artifact@v3 with: From 4c1f4b0b840a5b969e8a1504a6a8bd983a94099e Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 19:16:53 -0400 Subject: [PATCH 70/89] Forgot authentication --- .github/workflows/daily.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 8fae23b93c..598efc61c3 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -53,7 +53,10 @@ jobs: - name: Build and Analyze run: python3 codesonar-scripts/build_and_analyze.py codesonar.conf make -j $PARALLEL - name: Download results - run: $CSONAR_CSHOME/codesonar/bin/codesonar dump_warnings.py --project-file $PROJECT_NAME.prj --hub $CSONAR_HUB_URL --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif + run: | + echo $CSONAR_HUB_PASSWORD > hubpwfile + $CSONAR_CSHOME/codesonar/bin/codesonar dump_warnings.py --project-file $PROJECT_NAME.prj -auth password -hubuser $CSONAR_HUB_USER -hubpwfile pwfile --hub $CSONAR_HUB_URL --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif + rm hubpwfile - name: Upload artefact uses: actions/upload-artifact@v3 with: From 705b1a9694743a004a3adc0c4b45ec2455fc827a Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Thu, 5 Oct 2023 22:31:56 -0400 Subject: [PATCH 71/89] typo --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 598efc61c3..2674dbf617 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -55,7 +55,7 @@ jobs: - name: Download results run: | echo $CSONAR_HUB_PASSWORD > hubpwfile - $CSONAR_CSHOME/codesonar/bin/codesonar dump_warnings.py --project-file $PROJECT_NAME.prj -auth password -hubuser $CSONAR_HUB_USER -hubpwfile pwfile --hub $CSONAR_HUB_URL --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif + $CSONAR_CSHOME/codesonar/bin/codesonar dump_warnings.py --project-file $PROJECT_NAME.prj -auth password -hubuser $CSONAR_HUB_USER -hubpwfile hubpwfile --hub $CSONAR_HUB_URL --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif rm hubpwfile - name: Upload artefact uses: actions/upload-artifact@v3 From 25974afadebb305bf30dc795aedea95bce077512 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Fri, 6 Oct 2023 08:45:48 -0400 Subject: [PATCH 72/89] Try to automatically merge from daily --- .github/workflows/merge.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index c05a8cabab..ed37d82b84 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,23 +1,22 @@ name: Daily Merge from upstream/daily-snapshot -on: - workflow_dispatch: - schedule: - - cron: '47 1 * * *' + on: + schedule: + - cron: '*/5 0 * * *' -jobs: - merge-upstream: + jobs: + merge-upstream: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 with: - ref: release/daily + ref: upstream # set the branch to merge to fetch-depth: 0 - name: Merge Upstream uses: exions/merge-upstream@v1 with: - upstream: wolfssl/wolfssl - upstream-branch: daily-snapshot - branch: release/daily + upstream: wolfssl/woflssl # set the upstream repo + upstream-branch: daily-snapshot # set the upstream branch to merge from + branch: release/daily # set the branch to merge to From a20c1ee48175918e9acd2ebcb8d0337c73ba7d43 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Fri, 6 Oct 2023 08:58:39 -0400 Subject: [PATCH 73/89] yaml fixes --- .github/workflows/merge.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index ed37d82b84..117adbe96e 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,22 +1,22 @@ name: Daily Merge from upstream/daily-snapshot +on: + schedule: + - cron: '*/5 0 * * *' - on: - schedule: - - cron: '*/5 0 * * *' +jobs: + merge-upstream: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + ref: upstream # set the branch to merge to + fetch-depth: 0 + - name: Merge Upstream + uses: exions/merge-upstream@v1 + with: + upstream: wolfssl/woflssl # set the upstream repo + upstream-branch: daily-snapshot # set the upstream branch to merge from + branch: release/daily # set the branch to merge to - jobs: - merge-upstream: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: upstream # set the branch to merge to - fetch-depth: 0 - - name: Merge Upstream - uses: exions/merge-upstream@v1 - with: - upstream: wolfssl/woflssl # set the upstream repo - upstream-branch: daily-snapshot # set the upstream branch to merge from - branch: release/daily # set the branch to merge to From 555ab646b98c7193dbe6561f1487519e470bd811 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Fri, 6 Oct 2023 08:59:09 -0400 Subject: [PATCH 74/89] Rename --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 2674dbf617..cabb6e6ab9 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -1,4 +1,4 @@ -name: Daily Merge and CodeSonar run +name: CodeSonar run on: push: branches: From e21f7cc62e165ac6bcfc71fc226847b34f4e8d41 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Fri, 6 Oct 2023 09:36:47 -0400 Subject: [PATCH 75/89] Wrong cron time --- .github/workflows/merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 117adbe96e..f1e026902b 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,7 +1,7 @@ name: Daily Merge from upstream/daily-snapshot on: schedule: - - cron: '*/5 0 * * *' + - cron: '*/5 * * * *' jobs: merge-upstream: From 46b9fa7c24eb57522b81939d8efd27343f0918fe Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Fri, 6 Oct 2023 09:48:35 -0400 Subject: [PATCH 76/89] run on self-hosted --- .github/workflows/merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index f1e026902b..03e0a4c96c 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -5,7 +5,7 @@ on: jobs: merge-upstream: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - name: Checkout uses: actions/checkout@v3 From 5e959173efa959235f04603812e1d25bbf1fd3b6 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Fri, 6 Oct 2023 10:47:28 -0400 Subject: [PATCH 77/89] Manual trigger --- .github/workflows/merge.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 03e0a4c96c..5b4aa39d2f 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,7 +1,6 @@ name: Daily Merge from upstream/daily-snapshot on: - schedule: - - cron: '*/5 * * * *' + workflow_dispatch: jobs: merge-upstream: From 7a6c971d3fefc57d40db1840b2bc34c4d943d5c3 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Fri, 6 Oct 2023 13:14:54 -0400 Subject: [PATCH 78/89] Back to schedule. Manual only works on default branch --- .github/workflows/merge.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 5b4aa39d2f..c641fe2744 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,6 +1,7 @@ name: Daily Merge from upstream/daily-snapshot on: - workflow_dispatch: + schedule: + - cron: "*/5 * * * *" jobs: merge-upstream: From 39297eb49db51b0df7c2b8eece9b4fb75e273983 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Sat, 7 Oct 2023 21:22:39 -0400 Subject: [PATCH 79/89] Remove trigger on push/pr --- .github/workflows/daily.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index cabb6e6ab9..371590e01e 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -1,11 +1,11 @@ name: CodeSonar run on: - push: - branches: - - release/daily - pull_request: - branches: - - 'release/daily' + #push: + # branches: + # - release/daily + #pull_request: + # branches: + # - 'release/daily' schedule: - cron: '17 2 * * *' From f6b67966d9be186c5fed133a9787cb47928a91bc Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Sun, 8 Oct 2023 11:26:13 -0400 Subject: [PATCH 80/89] Switch to 10 mins --- .github/workflows/merge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index c641fe2744..6d87f0877f 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -1,7 +1,7 @@ name: Daily Merge from upstream/daily-snapshot on: schedule: - - cron: "*/5 * * * *" + - cron: "*/10 * * * *" jobs: merge-upstream: From 7828a54d5ac16c8f1193792889484c88ec2b0b7d Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Sun, 8 Oct 2023 11:30:05 -0400 Subject: [PATCH 81/89] Change job name in daily.yaml --- .github/workflows/daily.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 371590e01e..4794c05943 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -10,7 +10,7 @@ on: - cron: '17 2 * * *' jobs: - Daily_Merge_and_CodeSonar_Analyze: + CodeSonar_Analyze: permissions: write-all runs-on: self-hosted container: From b3d95646e0426d0bec142f757cb1777ca4d07c12 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 11 Oct 2023 21:02:15 -0400 Subject: [PATCH 82/89] Update daily.yaml --- .github/workflows/daily.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 4794c05943..aa87d4abfc 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -1,13 +1,13 @@ name: CodeSonar run on: - #push: - # branches: - # - release/daily + push: + branches: + - release/daily #pull_request: # branches: # - 'release/daily' - schedule: - - cron: '17 2 * * *' + #schedule: + # - cron: '17 2 * * *' jobs: CodeSonar_Analyze: From 1af8f2327ac801c658a88526bdc63811be1879c6 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Tue, 24 Oct 2023 20:21:34 -0400 Subject: [PATCH 83/89] Turn on prioritization on daily + thorough --- codesonar.conf | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/codesonar.conf b/codesonar.conf index ea2d10d0e1..c60eb88edc 100644 --- a/codesonar.conf +++ b/codesonar.conf @@ -1,12 +1,38 @@ -#CodeSonar configuration file -#The following is from stable_results preset: -GLOBAL_FUNCTION_POINTER_MODE = context_sensitive -GLOBAL_TAINT_MODE = context_sensitive -TAINT_PLUS_DP_REFINEMENT_TIMEOUT = 30 -RELAXED_TOPDOWN_FUNCPTR_RESOLUTION = No -#the following is from thorough preset: + +Turn on prioritization +WARNING_FILTER += priority:="WolfSSL-P1" path:/wolfssl/wolfcrypt/ +WARNING_FILTER += priority:="WolfSSL-P2" path:/wolfssl/src/ +WARNING_FILTER += priority:="WolfSSL-P3" path:/wolfssl/examples/ +WARNING_FILTER += priority:="WolfSSL-P4" path:/wolfssl/examples/benchmark/ +WARNING_FILTER += priority:="WolfSSL-P4" path:/wolfssl/tests/benchmark/ + + + + +# This .conf file enables all C/C++ warningclasses relevant to multithreaded +# programs that are off by default. + +# This is essentially a deadlock check (the check named "Deadlock" is +# far less sophisticated and has many more false negatives) +WARNING_FILTER += allow class="Conflicting Lock Order" + +WARNING_FILTER += allow class="Data Race" + +# Check if locks are managed in LIFO order +WARNING_FILTER += allow class="Lock/Unlock Mismatch" +WARNING_FILTER += allow class="Locked Twice" +WARNING_FILTER += allow class="Missing Lock Acquisition" +WARNING_FILTER += allow class="Missing Lock Release" +WARNING_FILTER += allow class="Try-lock that will never succeed" + +# These classes might be overly pedantic for some users: +WARNING_FILTER += allow class="Nested Locks" +WARNING_FILTER += allow class="Task Delay Function" +WARNING_FILTER += allow class="Unknown Lock" + +#thorough SEARCH_BOUND = 300 TAINT_SEARCH_BOUND = 300 PATH_FINDING_EFFORT = 2000 From b5657dd489130272607bb137e83fcdc104ae56d8 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 25 Oct 2023 12:23:43 -0400 Subject: [PATCH 84/89] Some priority changes as requested --- codesonar.conf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/codesonar.conf b/codesonar.conf index c60eb88edc..46610c8f99 100644 --- a/codesonar.conf +++ b/codesonar.conf @@ -6,8 +6,11 @@ WARNING_FILTER += priority:="WolfSSL-P1" path:/wolfssl/wolfcrypt/ WARNING_FILTER += priority:="WolfSSL-P2" path:/wolfssl/src/ WARNING_FILTER += priority:="WolfSSL-P3" path:/wolfssl/examples/ WARNING_FILTER += priority:="WolfSSL-P4" path:/wolfssl/examples/benchmark/ -WARNING_FILTER += priority:="WolfSSL-P4" path:/wolfssl/tests/benchmark/ +WARNING_FILTER += priority:="WolfSSL-P4" path:/wolfssl/tests/ +WARNING_FILTER += priority:="WolfSSL-P4" path:/wolfssl/wolfcrypt/test/ +WARNING_FILTER += priority:="WolfSSL-P5" categories:LANG.STRUCT.UC +WARNING_FILTER += priority:="WolfSSL-P5" class="Useless Assignment" From e9bf2942bbaa09b057dbd0f3f159e6840c62f14f Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 25 Oct 2023 14:43:40 -0400 Subject: [PATCH 85/89] Remove thorough --- codesonar.conf | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/codesonar.conf b/codesonar.conf index 46610c8f99..37d993fd25 100644 --- a/codesonar.conf +++ b/codesonar.conf @@ -35,34 +35,4 @@ WARNING_FILTER += allow class="Nested Locks" WARNING_FILTER += allow class="Task Delay Function" WARNING_FILTER += allow class="Unknown Lock" -#thorough -SEARCH_BOUND = 300 -TAINT_SEARCH_BOUND = 300 -PATH_FINDING_EFFORT = 2000 -PATH_SHORTENING_EFFORT = 300 -MAX_ATTEMPTED_SIMILAR_PATHS = 16 -TAINT_MAX_ATTEMPTED_SIMILAR_PATHS = 16 -MAX_SUMMARIES_PER_PROCEDURE = 7 -MAX_MODIFIED_VALUES = 150 -TAINT_MAX_MODIFIED_VALUES = 150 -MAX_CHECKED_INPUTS_PER_PROCEDURE = 100 -TAINT_MAX_CHECKED_INPUTS_PER_PROCEDURE = 100 -MAX_CHECKS_PER_INPUT = 30 -MAX_GLOBAL_CHECK_AGE = 2 -MAX_CHECK_COMPLEXITY = 40 -MAX_EXPRESSION_COMPLEXITY = 48 -TAINT_MAX_EXPRESSION_COMPLEXITY = 80 -TAINT_MAX_SET_CARDINALITY = 20 -TIME_LIMIT_INTRA_EXPLORE = 600 -TIME_LIMIT_INTRA_CLASSIFY = 600 -TIME_LIMIT_INTER_CLASSIFY = 600 -TIME_LIMIT_RESOLVE = 600 -TIME_LIMIT_REFINE = 600 -TIME_LIMIT_LEAK_CLASSIFY = 600 -TIME_LIMIT_LEAK_REFINE = 600 -TIME_LIMIT_PROP_EXHAUSTIVE = 600 -REPORT_IMPLIED_INEQUALITY = Yes -TAINT_CALLSITE_EXPANSION_EFFORT = 3000 -DP_REFINEMENT_EXACT_TIMEOUT = 20 -DP_REFINEMENT_APPROXIMATE_TIMEOUT = 20 -TAINT_PLUS_DP_REFINEMENT_TIMEOUT = 40 + From 33160a1262795b2dd8107d70897c3a517061d9fe Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 25 Oct 2023 15:03:54 -0400 Subject: [PATCH 86/89] Add emailing of stuff --- .github/workflows/daily.yaml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index aa87d4abfc..5e09695428 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -3,9 +3,9 @@ on: push: branches: - release/daily - #pull_request: - # branches: - # - 'release/daily' + pull_request: + branches: + - 'release/daily' #schedule: # - cron: '17 2 * * *' @@ -62,3 +62,18 @@ jobs: with: name: SARIF results summary path: diff.sarif + - name: Email results + uses: dawidd6/action-send-mail@v3 + with: + server_address: smtp.gmail.com + server_port: 465 + username: ${{ secrets.GMAIL_USERNAME }} + password: ${{ secrets.GMAIL_PASSWORD }} + subject: CodeSonar results for ${{ github.repository }} + body: CodeSonar-results + html_body: file://warnings.md + convert_markdown: true + from: "CodeSonar Analyzer" + to: "mark@hermeling.org" + reply_to: "mark@hermeling.org" + attachments: diff.sarif From 81d68edb8c8f1b31fdb5dba7cb93ee7ce8f041d7 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 25 Oct 2023 15:24:24 -0400 Subject: [PATCH 87/89] Add pulling for the report --- .github/workflows/daily.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 5e09695428..034ee57eb0 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -62,6 +62,10 @@ jobs: with: name: SARIF results summary path: diff.sarif + - name: Get report + run: | + $CSONAR_CSHOME/codesonar/bin/codesonar get -auth password -hubuser $CSONAR_HUB_USER -hubpwfile hubpwfile \ + $CSONAR_HUB_URL/report/aid-$(cat $PROJECT_NAME.prj_files/aid.txt)-3.html -o report.html - name: Email results uses: dawidd6/action-send-mail@v3 with: @@ -71,8 +75,7 @@ jobs: password: ${{ secrets.GMAIL_PASSWORD }} subject: CodeSonar results for ${{ github.repository }} body: CodeSonar-results - html_body: file://warnings.md - convert_markdown: true + html_body: file://report.html from: "CodeSonar Analyzer" to: "mark@hermeling.org" reply_to: "mark@hermeling.org" From 88d675a01045fab94cf989b3800ba342c146fb08 Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 25 Oct 2023 16:25:47 -0400 Subject: [PATCH 88/89] Remove merge.yml --- .github/workflows/merge.yml | 22 ---------------------- codesonar.conf | 1 + 2 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 .github/workflows/merge.yml diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml deleted file mode 100644 index 6d87f0877f..0000000000 --- a/.github/workflows/merge.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Daily Merge from upstream/daily-snapshot -on: - schedule: - - cron: "*/10 * * * *" - -jobs: - merge-upstream: - runs-on: self-hosted - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: upstream # set the branch to merge to - fetch-depth: 0 - - name: Merge Upstream - uses: exions/merge-upstream@v1 - with: - upstream: wolfssl/woflssl # set the upstream repo - upstream-branch: daily-snapshot # set the upstream branch to merge from - branch: release/daily # set the branch to merge to - - diff --git a/codesonar.conf b/codesonar.conf index 37d993fd25..d10f1a799e 100644 --- a/codesonar.conf +++ b/codesonar.conf @@ -8,6 +8,7 @@ WARNING_FILTER += priority:="WolfSSL-P3" path:/wolfssl/examples/ WARNING_FILTER += priority:="WolfSSL-P4" path:/wolfssl/examples/benchmark/ WARNING_FILTER += priority:="WolfSSL-P4" path:/wolfssl/tests/ WARNING_FILTER += priority:="WolfSSL-P4" path:/wolfssl/wolfcrypt/test/ +WARNING_FILTER += priority:="WolfSSL-P4" path:/wolfssl/test.h WARNING_FILTER += priority:="WolfSSL-P5" categories:LANG.STRUCT.UC WARNING_FILTER += priority:="WolfSSL-P5" class="Useless Assignment" From 96c9f67a111f67fdb07babfd80e2fd3cae24644d Mon Sep 17 00:00:00 2001 From: Mark Hermeling Date: Wed, 25 Oct 2023 18:23:08 -0400 Subject: [PATCH 89/89] Move pwfile cleanup later --- .github/workflows/daily.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/daily.yaml b/.github/workflows/daily.yaml index 034ee57eb0..6e3dfa523a 100644 --- a/.github/workflows/daily.yaml +++ b/.github/workflows/daily.yaml @@ -56,7 +56,6 @@ jobs: run: | echo $CSONAR_HUB_PASSWORD > hubpwfile $CSONAR_CSHOME/codesonar/bin/codesonar dump_warnings.py --project-file $PROJECT_NAME.prj -auth password -hubuser $CSONAR_HUB_USER -hubpwfile hubpwfile --hub $CSONAR_HUB_URL --gained-since-previous-analysis --sarif --sarif-detail brief -o diff.sarif - rm hubpwfile - name: Upload artefact uses: actions/upload-artifact@v3 with: @@ -80,3 +79,5 @@ jobs: to: "mark@hermeling.org" reply_to: "mark@hermeling.org" attachments: diff.sarif + - name: cleanup + run: rm hubpwfile