Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ai-code-review #289

Open
wants to merge 60 commits into
base: KiranSukhavasi-patch-1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
6ac2c4b
Update APIs in unit test (#221)
shrikant1407 Mar 17, 2023
4c01483
Update TPM library installation script (#222)
shrikant1407 Mar 20, 2023
7a97df2
Readme and TPM RHEL script updates (#224)
shrikant1407 Mar 27, 2023
34a86bc
Add ECDSA-384 key support for TPM (#214)
shrikant1407 Apr 18, 2023
6556511
Fix coverity scan findings (#225)
shrikant1407 Apr 18, 2023
3a133b6
OpenSSL 3.0 Support for Client SDK & TPM (#202)
shrikant1407 Apr 27, 2023
3da078b
Fix Klockwork scan finding (#227)
shrikant1407 Apr 27, 2023
a286fb5
Update TPM library installation script for RHEL and readme update (#229)
shrikant1407 Apr 29, 2023
674450b
TPM Readme update for 384 support in platforms. (#230)
tajnisha May 4, 2023
b68f686
Updating NOTICE files for 1.1.5 Release (#232)
DukeDavis12 May 5, 2023
4ab5647
LF edge renaming docs (#231)
tPeeush May 11, 2023
6149d2e
Enable SNI based on compile option. (#228)
tajnisha May 31, 2023
dee8781
Invoke curl_easy_init fix while resolving dn (#233)
tajnisha May 31, 2023
12aee07
Fix for custom curl with hosted rv (#234)
tajnisha May 31, 2023
df1e1a3
Update curl version to 8.1.2 (#235)
shrikant1407 May 31, 2023
f2425e1
Update unit tests (#236)
shrikant1407 May 31, 2023
36ff4e9
Disable SNI by default and minor fixes (#237)
shrikant1407 Jun 1, 2023
e4ef39f
Refactor and format CSDK code (#238)
shrikant1407 Jul 7, 2023
c45f5fd
Fix connection issue when providing invalid DNS and valid IP (#239)
shrikant1407 Jul 10, 2023
bb2b694
Update network APIs to support HTTP2 connection (#242)
shrikant1407 Jul 11, 2023
b095cfc
Update steps to build curl with nghttp2 in Readme and installation sc…
shrikant1407 Jul 12, 2023
bc56b21
Fix coverity scan findings (#244)
shrikant1407 Jul 13, 2023
f688ee2
Refactored long functions in fdo_sys.c (#241)
adarshan-intel Jul 18, 2023
3de3025
Fix Klockwork scan findings (#245)
shrikant1407 Jul 19, 2023
11275f3
SVI [exec, exec_cb and fetch] fix (#246)
shrikant1407 Jul 21, 2023
88b4644
Update build_conf.md (#247)
shrikant1407 Jul 26, 2023
70a8e4b
Add Github workflow to client-sdk-fidoiot (#251)
bprashan Sep 18, 2023
e741a1f
Added v1.2.0 of Safestring Intel Library (#252)
adarshan-intel Sep 22, 2023
c0b0ed6
Address review comments and github open issues (#248)
shrikant1407 Sep 27, 2023
42cca11
Remove file extension check for SVI instruction (#254)
shrikant1407 Nov 3, 2023
bc537fd
Fixing OpenSSL Deprecation issues (#250)
adarshan-intel Nov 3, 2023
56c7bd0
Enable mTLS connection support (#249)
shrikant1407 Nov 3, 2023
96e024f
Update EC point conversion from compressed to uncompressed (#256)
shrikant1407 Nov 3, 2023
6eb564c
Add run time argument to take input for manufacturer address (#257)
shrikant1407 Nov 13, 2023
1ff59f9
Add support to get device serial from system BIOS table (#258)
shrikant1407 Nov 13, 2023
e1dc9d0
Fix onboarding when using RVByPass with SNI (#259)
shrikant1407 Nov 13, 2023
0f18bae
Update OpenSSL version to v3.0.12 and curl version to v8.4.0 (#260)
shrikant1407 Nov 14, 2023
691f8a4
Add input validation in get_device_serial() function (#263)
shrikant1407 Nov 21, 2023
809bef4
Add a check to ensure the response message type is valid or not (#262)
shrikant1407 Nov 22, 2023
4de26a7
Disable setting "Expect 100" in request header when request data size…
shrikant1407 Nov 24, 2023
ed6e092
Fix typos and text formatting in readmes (#265)
shrikant1407 Nov 28, 2023
8690b1a
Refactor fdo_sys code (#267)
shrikant1407 Feb 1, 2024
935de71
Update verifying device serial logic (#269)
shrikant1407 Feb 1, 2024
9a3024e
Enable cross device attestation (#270)
shrikant1407 Feb 1, 2024
da90947
Add fdo-sim support for Client-SDK (#268)
shrikant1407 Feb 1, 2024
e044f13
Update FDO SIM APIs to fix CSDK build (#271)
shrikant1407 Feb 6, 2024
e32ec0d
Add support to store FDO Credentials in the TPM (#261)
shrikant1407 Mar 1, 2024
3395708
Add support to send fdo.download:done and fdo.command:exitcode messag…
shrikant1407 Mar 1, 2024
92806a0
Add a condition to check DCActive bit only in case to TPM (#277)
shrikant1407 Mar 7, 2024
18c3c25
Fix multiple file download for FSIM fdo.download:done module (#273)
shrikant1407 Mar 7, 2024
982a12d
Update GitHub workflow permission (#276)
shrikant1407 Mar 13, 2024
a436d19
Update verifying device serial logic (#278)
shrikant1407 Mar 14, 2024
e724f52
Update get device serial logic (#280)
shrikant1407 Mar 14, 2024
22b2492
Update OpenSSL version to v3.0.13 and curl version to v8.6.0 (#279)
shrikant1407 Mar 14, 2024
a247504
Add a check for valid signature length and minor fixes (#281)
shrikant1407 Mar 18, 2024
e27fb72
Update readme and fix scripts permission (#283)
shrikant1407 Mar 18, 2024
a8633b0
Add a note on TPM persistent storage index usages (#284)
shrikant1407 Mar 22, 2024
745f8d3
Add support for sending device MAC addresses as part of Device MfgInf…
shrikant1407 Jun 14, 2024
d814746
Update OpenSSL version to v3.0.14 and curl version to v8.8.0 (#288)
shrikant1407 Jul 4, 2024
066acb9
Create ai-review-cache.yaml
KiranSukhavasi Jul 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
FROM ubuntu:22.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y && apt-get upgrade -y && apt-get install -y \
git \
build-essential \
cmake \
libxml2-dev \
uuid-dev \
libcurl4-openssl-dev \
openssl \
libssl-dev \
wget \
bsdmainutils \
unzip \
libglib2.0-dev \
xxd \
nghttp2 \
libnghttp2-dev \
ruby

RUN mkdir build_dir

# Build & Install Curl version 8.1.2
WORKDIR /build_dir/
RUN wget https://curl.se/download/curl-8.1.2.tar.gz -O - | tar -xz && cd curl-8.1.2 && \
./configure --with-openssl --enable-versioned-symbols --with-nghttp2 && make && make install

# Setup safestring
WORKDIR /build_dir
RUN git clone -b v1.2.0 --progress --verbose https://github.com/intel/safestringlib.git safestring
ENV SAFESTRING_ROOT /build_dir/safestring
WORKDIR ${SAFESTRING_ROOT}
RUN mkdir obj && make

# Setup tinycbor
WORKDIR /build_dir
RUN git clone -b v0.6.0 --progress --verbose https://github.com/intel/tinycbor.git tinycbor
ENV TINYCBOR_ROOT /build_dir/tinycbor
WORKDIR ${TINYCBOR_ROOT}
RUN make

# Setup metee
WORKDIR /build_dir
RUN git clone --progress --verbose https://github.com/intel/metee.git metee
ENV METEE_ROOT /build_dir/metee
WORKDIR ${METEE_ROOT}
RUN cmake . && make && make install

ENV OPENSSL3_ROOT /usr
ENV CURL_ROOT /usr

# Setup client-sdk-fidoiot.
# clone client-sdk-fidoiot to the current Dockerfile directory
WORKDIR /build_dir/
RUN mkdir /cse-fdoout
WORKDIR /build_dir/cse-fdoout/
RUN mkdir /client-sdk
WORKDIR /build_dir/fdoout/client-sdk/
COPY . .

# Install tpm libraries
RUN grep -rl '/opt/openssl' ./ | xargs sed -i 's/\/opt\/openssl/\/usr/g'
RUN grep -rl '/opt/curl' ./ | xargs sed -i 's/\/opt\/curl/\/usr/g'
RUN sed -i 's/lib64/lib\/x86_64-linux-gnu/' utils/install_tpm_libs.sh
RUN sed -i 's/==/-eq/' utils/tpm_make_ready_ecdsa.sh
RUN sh utils/install_tpm_libs.sh -i


CMD ["bash", "build.sh"]
89 changes: 89 additions & 0 deletions .github/workflows/ai-review-cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: "AI Reviewer Cache"

on:
workflow_dispatch:
push:
branches:
# TODO: Update with the repos trunk branch.
- "client-sdk-fidoiot-ai-code-review"

jobs:
generate-cache:
name: Generate AI Cache
container: amr-registry.caas.intel.com/devops-ai-platform/gasp-oidc:0.0.4
# TODO: Update'runs-on' to specify the type of runner your repo uses.
# If using GASP, do not add additional labels. Use ONLY "gasp".
runs-on: gasp
permissions:
contents: read
issues: write
pull-requests: write
id-token: write

steps:
# Login using OIDC Auth
- name: Authenticate
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

# Get a temporary access token. Expires in 5-60 minutes.
- name: Retrieve Access Token
id: auth
run: |
export output=$(az account get-access-token --resource https://cognitiveservices.azure.com --query \"accessToken\" -o tsv);
echo "result=$output" >> $GITHUB_OUTPUT;
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache embeddings
id: cache-embeddings
uses: actions/cache@v4
env:
cache-name: cache-embeddings
with:
path: ./cache
key: ${{ env.cache-name }}-${{ github.run_id }}
restore-keys: ${{ env.cache-name }}

- name: Create Document Embeddings
uses: intel-innersource/frameworks.devops.ai-devops-platform.embedding-action@v3
env:
no_proxy: "*.azure.com"
with:
name: documentation_lookup
description: Used to answer questions about documentation.
service_model: embedding
service_token: bearer ${{ steps.auth.outputs.result }}
# TODO: Update 'file_types' with the code file extensions to parse. *Note it is a newline delimited list.
file_types: |
.md
# TODO: Update 'languages' to include the languages in the repository. *Note it is a newline delimited list.
# Supports the following values: 'cpp', 'go', 'java', 'js', 'php', 'proto', 'python', 'rst', 'ruby', 'rust', 'scala', 'swift', 'markdown', 'latex', 'html'
languages: |
markdown
# TODO: Update 'path' to represent the top level path where code files are found.
path: ./src
cache_path: ./cache

- name: Create Code Embeddings
uses: intel-innersource/frameworks.devops.ai-devops-platform.embedding-action@v3
env:
no_proxy: "*.azure.com"
with:
name: code_lookup
description: Used to get additional context for code.
service_model: embedding
service_token: bearer ${{ steps.auth.outputs.result }}
# TODO: Update 'file_types' with the code file extensions to parse. *Note it is a newline delimited list.
file_types: |
.ts
# TODO: Update 'languages' to include the languages in the repository. *Note it is a newline delimited list.
# Supports the following values: 'cpp', 'go', 'java', 'js', 'php', 'proto', 'python', 'rst', 'ruby', 'rust', 'scala', 'swift', 'markdown', 'latex', 'html'
languages: |
js
# TODO: Update 'path' to represent the top level path where code files are found.
path: ./src
cache_path: ./cache
78 changes: 78 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: client-sdk-fidoiot-build
on:
workflow_dispatch:
push:
branches: [master, '*rel']
pull_request:
branches: [master, '*rel']
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: scm checkout
uses: actions/checkout@v3
- name: Build docker image
run: docker build -t client-sdk -f '.github/Dockerfile' .
- name: run Docker container
run: docker run -v $PWD:/build_dir/fdoout/client-sdk/ client-sdk:latest
- name: tar client-sdk binaries
run: |
mkdir client-sdk-binaries && cd client-sdk-binaries
cp -r ../x86_ecdsa* ../tpm_ecdsa* ../cse_ecdsa* .
mkdir utils
cp ../utils/tpm_make_ready_ecdsa.sh ../utils/install_tpm_libs*.sh ../utils/keys_gen.sh utils/
cd .. && tar -cvzf client-sdk-binaries.tar.gz client-sdk-binaries
- name: checkout test-fidoiot
uses: actions/checkout@v3
with:
repository: fido-device-onboard/test-fidoiot
ref: master
path: test-fidoiot
- name: Download pri-fidoiot artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
name: demo.tar.gz
repo: fido-device-onboard/pri-fidoiot
workflow: main.yaml
path: test-fidoiot/binaries/pri-fidoiot/
search_artifacts: true
- name: Add host to /etc/hosts
run: |
sudo echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts
- name: Smoke Test
run : |
mkdir -p test-fidoiot/binaries/client-sdk-fidoiot
tar -xvzf test-fidoiot/binaries/pri-fidoiot/demo.tar.gz
cp -r demo/* test-fidoiot/binaries/pri-fidoiot/
cp x86_ecdsa256_gcm_bin/linux-client test-fidoiot/binaries/client-sdk-fidoiot/
cp -r x86_ecdsa256_gcm_bin/data test-fidoiot/
bash utils/install_openssl_curl.sh -i -v 3.0.8
bash utils/keys_gen.sh test-fidoiot
cd test-fidoiot/binaries/pri-fidoiot/scripts
bash demo_ca.sh
bash web_csr_req.sh
bash user_csr_req.sh
bash keys_gen.sh
chmod -R 777 secrets/
cp -r service.env secrets/ ../aio/
cp -r secrets/ ../db/
sed -i '/<security-constraint>/,/<.security-constraint>/d' ../aio/WEB-INF/web.xml
sed -i '/^innodb/d' ../db/custom/config-file.cnf
cd ${{ github.workspace }}/test-fidoiot/data
sed -i 's/8039/8080/g' manufacturer_addr.bin
cd ${{ github.workspace }}/test-fidoiot
export TEST_DIR=`pwd`
mvn clean test -Dgroups=fdo_clientsdk_smoketest
- name: archive artifacts
uses: actions/upload-artifact@v3
with:
name: client-sdk-binaries.tar.gz
path: client-sdk-binaries.tar.gz
retention-days: 5
if: github.event_name != 'pull_request'



8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@
*.so
*.so.*
*.a
*.blob
*.bin
*.pem
*.dat
*.ctx
*.key

# Packages #
############
Expand Down Expand Up @@ -51,6 +57,7 @@ Thumbs.db
###############
CMakeCache.txt
CMakeFiles
Makefile
CMakeScripts
cmake_install.cmake
install_manifest.txt
Expand Down Expand Up @@ -92,6 +99,7 @@ buildNumber.properties
.metadata
*.iml
*.ipr
.vscode

# Visual Studio files #
#######################
Expand Down
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ include(cmake/cli_input.cmake)
include(cmake/extension.cmake)
include(cmake/blob_path.cmake)

if (NOT(DEFINED ENV{OPENSSL3_ROOT}))
message(FATAL_ERROR "OPENSSL3_ROOT not set")
endif()

if (NOT(DEFINED ENV{CURL_ROOT}))
message(FATAL_ERROR "CURL_ROOT not set")
endif()

if (NOT(DEFINED ENV{SAFESTRING_ROOT}))
message(FATAL_ERROR "SAFESTRING_ROOT not set")
Expand Down Expand Up @@ -43,7 +50,6 @@ client_sdk_compile_options(
-Wswitch-default
-Wunused-parameter
-Wsign-compare
-Wno-deprecated-declarations
-Wpedantic
-Werror
-Wimplicit-function-declaration
Expand Down Expand Up @@ -71,6 +77,8 @@ client_sdk_compile_options(
if(${TARGET_OS} MATCHES linux)
# Safestring lib
client_sdk_include_directories(
$ENV{OPENSSL3_ROOT}/include
$ENV{CURL_ROOT}/include
$ENV{SAFESTRING_ROOT}/include
$ENV{TINYCBOR_ROOT}/src
include
Expand Down Expand Up @@ -121,11 +129,14 @@ if(${TARGET_OS} MATCHES linux)
-L$ENV{TINYCBOR_ROOT}/lib/
-l:libtinycbor.a
-Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now
-L$ENV{CURL_ROOT}/lib
-lcurl
)

if (${TLS} STREQUAL openssl)
client_sdk_ld_options(
-L$ENV{OPENSSL3_ROOT}/lib64
-L$ENV{OPENSSL3_ROOT}/lib
-Wl,--no-whole-archive -lssl -lcrypto -ldl
)
elseif(${TLS} MATCHES mbedtls)
Expand Down
20 changes: 13 additions & 7 deletions Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ node('ccode'){
'REPO_Safestring=https://github.com/intel/safestringlib.git',
'REPO_TinyCBOR=https://github.com/intel/tinycbor.git',
'REPO_METEE=https://github.com/intel/metee.git',
"TEST_DIR=${WORKSPACE}/test-fidoiot",
"MANUFACTURER_DB_CONNECT_STRING=jdbc:mariadb://127.0.0.1:3306/sdo",
"RESELLER_DB_CONNECT_STRING=jdbc:mariadb://127.0.0.1:4306/sdo"
"TEST_DIR=${WORKSPACE}/test-fidoiot"
])
{
stage('Clone Client-SDK'){
cleanWs()
dir('client-sdk'){
checkout scm
}
sh 'git clone "${REPO_Safestring}"'
sh 'git clone -b v1.2.0 "${REPO_Safestring}"'
sh 'git clone "${REPO_TinyCBOR}"'
sh 'git clone "${REPO_METEE}"'
}
Expand All @@ -22,6 +20,7 @@ node('ccode'){
sh '''
cd $WORKSPACE/safestringlib
echo 'Building safestring'
git checkout v1.2.0
mkdir obj
make
'''
Expand All @@ -31,7 +30,7 @@ node('ccode'){
sh '''
cd $WORKSPACE/tinycbor
echo 'Building TinyCBOR'
git checkout v0.5.3
git checkout v0.6.0
make
'''
}
Expand All @@ -40,6 +39,7 @@ node('ccode'){
sh '''
cd $WORKSPACE/metee
echo 'Building METEE'
git checkout 3.2.3
cmake .
make -j$(nproc)
sudo make install
Expand All @@ -54,8 +54,12 @@ node('ccode'){
echo $TINYCBOR_ROOT
export METEE_ROOT=$WORKSPACE/metee
echo $METEE_ROOT
export OPENSSL3_ROOT=/opt/openssl
echo $OPENSSL3_ROOT
export CURL_ROOT=/opt/curl
echo $CURL_ROOT
cd $WORKSPACE/client-sdk
$WORKSPACE/client-sdk/build.sh -s
$WORKSPACE/client-sdk/build.sh
mkdir client-sdk-binaries
cd client-sdk-binaries
cp -r ../x86_ecdsa256_gcm_bin .
Expand All @@ -64,6 +68,8 @@ node('ccode'){
cp -r ../x86_ecdsa384_ccm_bin .
cp -r ../tpm_ecdsa256_gcm_bin .
cp -r ../tpm_ecdsa256_ccm_bin .
cp -r ../tpm_ecdsa384_gcm_bin .
cp -r ../tpm_ecdsa384_ccm_bin .
cp -r ../cse_ecdsa384_gcm_bin .
cp -r ../cse_ecdsa384_ccm_bin .
mkdir utils
Expand Down Expand Up @@ -150,4 +156,4 @@ node('ccode'){

cleanWs cleanWhenFailure: false, cleanWhenNotBuilt: false, notFailBuild: true
}
}
}
Loading