Skip to content

Implement RAT extensions#121

Closed
Akretsch wants to merge 5 commits into
siemens:masterfrom
Akretsch:AK_RAT_IMPL
Closed

Implement RAT extensions#121
Akretsch wants to merge 5 commits into
siemens:masterfrom
Akretsch:AK_RAT_IMPL

Conversation

@Akretsch

Copy link
Copy Markdown
Collaborator

@Akretsch

Copy link
Copy Markdown
Collaborator Author

Replaced by #122

@Akretsch Akretsch closed this May 21, 2026

@DDvO DDvO left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid extending OSSL_CMP_CTX,
as this should not be needed at all -
please keep all RAT-related data local in cmpClient().

There are various memory leaks, at least in error cases.

See also further comments.

Comment thread src/cmpClient.c
#include <secutils/credentials/credentials.h> /* for CERT{,S}_save and CERTS_free */
#include <secutils/credentials/cert.h> /* for UTIL_parse_name */


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: avoid needless whitespace changes like this new line

Suggested change

Comment thread src/cmpClient.c
"File to save newly enrolled certificate, possibly with chain and key"},
{ "chainout", OPT_TXT, {.txt = NULL}, { &opt_chainout },
"File to save the chain of the newly enrolled certificate"},
{ "rats", OPT_BOOL, {.bit = false},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please generally:
rats -> RAT
RATS -> RAT

Suggested change
{ "rats", OPT_BOOL, {.bit = false},
{ "RAT", OPT_BOOL, {.bit = false},

Comment thread doCr.sh Outdated
@@ -0,0 +1,3 @@
cd ~/git/gencmpclient/test/recipes/80-test_cmp_http_data/Mock

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use relative path and add the option for further CLI options:

Suggested change
cd ~/git/gencmpclient/test/recipes/80-test_cmp_http_data/Mock
cd test/recipes/80-test_cmp_http_data/Mock "$@"

also for the other new .sh files

Comment thread env.sh
Comment on lines +1 to +4
export OPENSSL_DIR=~/git/openssl
export OPENSSL_LIB=~/git/openssl
export LD_LIBRARY_PATH=~/git/openssl/:~/git/gencmpclient
export PATH=~/git/openssl/apps:$PATH

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would we need this?
The LD_LIBRARY_PATH should generally not be needed due to rpath.
Everything else is user-specific, not for general use in this project.
Better not commit this file.

Comment thread src/cmpClient.c
unsigned int status = atg_generate_evidence(ctx->tpm_kd_req, &req_resp);
if (status != ATG_SUCCESS) {
LOG_err("Request TPM key data failed");
goto err;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before each goto err, please set a specify new error code in the range -7x, e.g., err = -70;

Comment on lines +78 to +80
reqout = "/tmp/req1.der /tmp/req2.der /tmp/req3.der /tmp/req4.der /tmp/req5.der /tmp/req6.der"
rspout = "/tmp/rsp1.der /tmp/rsp2.der /tmp/rsp3.der /tmp/rsp4.der /tmp/rsp5.der /tmp/rsp6.der"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move these to CLI options in doCrWithRat.sh

#attime = 1524704000
server_host = 127.0.0.1 # localhost
server_port = 0 # 0 means that the port is determined by the server
server_port = 8888 # 0 means that the port is determined by the server

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not set the port here but in the respective new.sh file(s)

Comment thread src/cmpClient.c
}
if (!OSSL_CMP_CTX_push0_genm_ITAV(ctx->osslctx, itav)) {
LOG_err("OSSL_CMP_CTX_push0_genm_ITAV failed");
goto err;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this leaks itav

[cmp] # mock server configuration

port = 0
port = 8888

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not set the port here but in the respective new .sh file(s)

Comment on lines +129 to +137

typedef struct CMP_CTX {
OSSL_CMP_CTX *osslctx;
bool do_rats;
struct token_req tpm_kd_req;
struct token_req attest_chal;
} CMP_CTX;


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid extending OSSL_CMP_CTX,
ai this should not be needed at all -
please keep all RAT-related data local in cmpClient().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants