Skip to content

Commit

Permalink
Fix ctest gmssl path bug
Browse files Browse the repository at this point in the history
  • Loading branch information
guanzhi committed Jun 2, 2024
1 parent c0f0ed0 commit 86d6284
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
22 changes: 11 additions & 11 deletions cmake/cert_commands.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

execute_process(
COMMAND gmssl sm2keygen -pass P@ssw0rd -out rootcakey.pem
COMMAND bin/gmssl sm2keygen -pass P@ssw0rd -out rootcakey.pem
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand All @@ -12,7 +12,7 @@ if(NOT EXISTS rootcakey.pem)
endif()

execute_process(
COMMAND gmssl certgen -C CN -ST Beijing -L Haidian -O PKU -OU CS -CN ROOTCA -days 3650 -key rootcakey.pem -pass P@ssw0rd -out rootcacert.pem -key_usage keyCertSign -key_usage cRLSign -ca
COMMAND bin/gmssl certgen -C CN -ST Beijing -L Haidian -O PKU -OU CS -CN ROOTCA -days 3650 -key rootcakey.pem -pass P@ssw0rd -out rootcacert.pem -key_usage keyCertSign -key_usage cRLSign -ca
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand All @@ -28,7 +28,7 @@ if (NOT FILE_CONTENT MATCHES "^-----BEGIN CERTIFICATE-----")
endif()

execute_process(
COMMAND gmssl sm2keygen -pass P@ssw0rd -out cakey.pem
COMMAND bin/gmssl sm2keygen -pass P@ssw0rd -out cakey.pem
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand All @@ -40,7 +40,7 @@ if(NOT EXISTS cakey.pem)
endif()

execute_process(
COMMAND gmssl reqgen -C CN -ST Beijing -L Haidian -O PKU -OU CS -CN "Sub CA" -key cakey.pem -pass P@ssw0rd -out careq.pem
COMMAND bin/gmssl reqgen -C CN -ST Beijing -L Haidian -O PKU -OU CS -CN "Sub CA" -key cakey.pem -pass P@ssw0rd -out careq.pem
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand All @@ -56,7 +56,7 @@ if (NOT FILE_CONTENT MATCHES "^-----BEGIN CERTIFICATE REQUEST-----")
endif()

execute_process(
COMMAND gmssl reqsign -in careq.pem -days 365 -key_usage keyCertSign -path_len_constraint 0 -cacert rootcacert.pem -key rootcakey.pem -pass P@ssw0rd -out cacert.pem -ca
COMMAND bin/gmssl reqsign -in careq.pem -days 365 -key_usage keyCertSign -path_len_constraint 0 -cacert rootcacert.pem -key rootcakey.pem -pass P@ssw0rd -out cacert.pem -ca
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand All @@ -68,7 +68,7 @@ if(NOT EXISTS cacert.pem)
endif()

execute_process(
COMMAND gmssl sm2keygen -pass P@ssw0rd -out signkey.pem
COMMAND bin/gmssl sm2keygen -pass P@ssw0rd -out signkey.pem
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand All @@ -80,7 +80,7 @@ if(NOT EXISTS signkey.pem)
endif()

execute_process(
COMMAND gmssl reqgen -C CN -ST Beijing -L Haidian -O PKU -OU CS -CN localhost -key signkey.pem -pass P@ssw0rd -out signreq.pem
COMMAND bin/gmssl reqgen -C CN -ST Beijing -L Haidian -O PKU -OU CS -CN localhost -key signkey.pem -pass P@ssw0rd -out signreq.pem
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand All @@ -92,7 +92,7 @@ if(NOT EXISTS signreq.pem)
endif()

execute_process(
COMMAND gmssl reqsign -in signreq.pem -days 365 -key_usage digitalSignature -cacert cacert.pem -key cakey.pem -pass P@ssw0rd -out signcert.pem
COMMAND bin/gmssl reqsign -in signreq.pem -days 365 -key_usage digitalSignature -cacert cacert.pem -key cakey.pem -pass P@ssw0rd -out signcert.pem
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand All @@ -104,7 +104,7 @@ if(NOT EXISTS signcert.pem)
endif()

execute_process(
COMMAND gmssl sm2keygen -pass P@ssw0rd -out enckey.pem
COMMAND bin/gmssl sm2keygen -pass P@ssw0rd -out enckey.pem
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand All @@ -116,7 +116,7 @@ if(NOT EXISTS enckey.pem)
endif()

execute_process(
COMMAND gmssl reqgen -C CN -ST Beijing -L Haidian -O PKU -OU CS -CN localhost -key enckey.pem -pass P@ssw0rd -out encreq.pem
COMMAND bin/gmssl reqgen -C CN -ST Beijing -L Haidian -O PKU -OU CS -CN localhost -key enckey.pem -pass P@ssw0rd -out encreq.pem
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand All @@ -128,7 +128,7 @@ if(NOT EXISTS encreq.pem)
endif()

execute_process(
COMMAND gmssl reqsign -in encreq.pem -days 365 -key_usage keyEncipherment -cacert cacert.pem -key cakey.pem -pass P@ssw0rd -out enccert.pem
COMMAND bin/gmssl reqsign -in encreq.pem -days 365 -key_usage keyEncipherment -cacert cacert.pem -key cakey.pem -pass P@ssw0rd -out enccert.pem
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand Down
10 changes: 5 additions & 5 deletions cmake/sm2_commands.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
execute_process(
COMMAND gmssl sm2keygen -pass P@ssw0rd -out sm2.pem -pubout sm2pub.pem
COMMAND bin/gmssl sm2keygen -pass P@ssw0rd -out sm2.pem -pubout sm2pub.pem
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand All @@ -17,7 +17,7 @@ set(SECRET_MESSAGE "Secret message")
file(WRITE message.txt "${SECRET_MESSAGE}")

execute_process(
COMMAND gmssl sm2sign -key sm2.pem -pass P@ssw0rd -in message.txt -out sm2.sig
COMMAND bin/gmssl sm2sign -key sm2.pem -pass P@ssw0rd -in message.txt -out sm2.sig
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
)
Expand All @@ -27,7 +27,7 @@ endif()


execute_process(
COMMAND gmssl sm2verify -pubkey sm2pub.pem -in message.txt -sig sm2.sig
COMMAND bin/gmssl sm2verify -pubkey sm2pub.pem -in message.txt -sig sm2.sig
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
OUTPUT_VARIABLE TEST_STDOUT
Expand All @@ -42,7 +42,7 @@ endif()


execute_process(
COMMAND gmssl sm2encrypt -pubkey sm2pub.pem -in message.txt -out sm2.der
COMMAND bin/gmssl sm2encrypt -pubkey sm2pub.pem -in message.txt -out sm2.der
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
OUTPUT_VARIABLE TEST_STDOUT
Expand All @@ -52,7 +52,7 @@ if(NOT ${TEST_RESULT} EQUAL 0)
endif()

execute_process(
COMMAND gmssl sm2decrypt -key sm2.pem -pass P@ssw0rd -in sm2.der
COMMAND bin/gmssl sm2decrypt -key sm2.pem -pass P@ssw0rd -in sm2.der
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
OUTPUT_VARIABLE TEST_STDOUT
Expand Down
2 changes: 1 addition & 1 deletion cmake/sm3_commands.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
execute_process(
COMMAND gmssl sm3 -in_str abc
COMMAND bin/gmssl sm3 -in_str abc
RESULT_VARIABLE TEST_RESULT
ERROR_VARIABLE TEST_STDERR
OUTPUT_VARIABLE TEST_OUTPUT
Expand Down
4 changes: 2 additions & 2 deletions cmake/tlcp_commands.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if(NOT EXISTS enckey.pem)
endif()

execute_process(
COMMAND bash -c "sudo nohup gmssl tlcp_server -port 4433 -cert tlcp_server_certs.pem -key signkey.pem -pass P@ssw0rd -ex_key enckey.pem -ex_pass P@ssw0rd > tlcp_server.log 2>&1 &"
COMMAND bash -c "sudo nohup bin/gmssl tlcp_server -port 4433 -cert tlcp_server_certs.pem -key signkey.pem -pass P@ssw0rd -ex_key enckey.pem -ex_pass P@ssw0rd > tlcp_server.log 2>&1 &"
RESULT_VARIABLE SERVER_RESULT
TIMEOUT 5
)
Expand All @@ -27,7 +27,7 @@ endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 2)

execute_process(
COMMAND bash -c "gmssl tlcp_client -host localhost -port 4433 -cacert rootcacert.pem > tlcp_client.log 2>&1"
COMMAND bash -c "bin/gmssl tlcp_client -host localhost -port 4433 -cacert rootcacert.pem > tlcp_client.log 2>&1"
RESULT_VARIABLE CLIENT_RESULT
TIMEOUT 5
)
Expand Down
4 changes: 2 additions & 2 deletions cmake/tls12_commands.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if(NOT EXISTS enckey.pem)
endif()

execute_process(
COMMAND bash -c "sudo nohup gmssl tls12_server -port 4333 -cert tls_server_certs.pem -key signkey.pem -pass P@ssw0rd > tls12_server.log 2>&1 &"
COMMAND bash -c "sudo nohup bin/gmssl tls12_server -port 4333 -cert tls_server_certs.pem -key signkey.pem -pass P@ssw0rd > tls12_server.log 2>&1 &"
RESULT_VARIABLE SERVER_RESULT
TIMEOUT 5
)
Expand All @@ -27,7 +27,7 @@ endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 2)

execute_process(
COMMAND bash -c "gmssl tls12_client -host localhost -port 4333 -cacert rootcacert.pem > tls12_client.log 2>&1"
COMMAND bash -c "bin/gmssl tls12_client -host localhost -port 4333 -cacert rootcacert.pem > tls12_client.log 2>&1"
RESULT_VARIABLE CLIENT_RESULT
TIMEOUT 5
)
Expand Down
4 changes: 2 additions & 2 deletions cmake/tls13_commands.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if(NOT EXISTS enckey.pem)
endif()

execute_process(
COMMAND bash -c "sudo nohup gmssl tls13_server -port 4443 -cert tls_server_certs.pem -key signkey.pem -pass P@ssw0rd > tls13_server.log 2>&1 &"
COMMAND bash -c "sudo nohup bin/gmssl tls13_server -port 4443 -cert tls_server_certs.pem -key signkey.pem -pass P@ssw0rd > tls13_server.log 2>&1 &"
RESULT_VARIABLE SERVER_RESULT
TIMEOUT 5
)
Expand All @@ -27,7 +27,7 @@ endif()
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 2)

execute_process(
COMMAND bash -c "gmssl tls13_client -host localhost -port 4443 -cacert rootcacert.pem > tls13_client.log 2>&1"
COMMAND bash -c "bin/gmssl tls13_client -host localhost -port 4443 -cacert rootcacert.pem > tls13_client.log 2>&1"
RESULT_VARIABLE CLIENT_RESULT
TIMEOUT 5
)
Expand Down

0 comments on commit 86d6284

Please sign in to comment.