To build the tests we assume that the target OpenSSL has already been built.
Two environment variables are required:
-TARGET_SSL_INCLUDE_PATH: Points to a directory where the OpenSSL include files
+TARGET_OSSL_INCLUDE_PATH: Points to a directory where the OpenSSL include files
are held (e.g. typically "include" under the build directory).
-TARGET_SSL_LIBRARY_PATH: Points to a directory where libcrypto.so and libssl.so
+TARGET_OSSL_LIBRARY_PATH: Points to a directory where libcrypto.so and libssl.so
are contained.
To build:
-export TARGET_SSL_INCLUDE_PATH=/path/to/openssl/include
-export TARGET_SSL_LIBRARY_PATH=/path/to/openssl
+export TARGET_OSSL_INCLUDE_PATH=/path/to/openssl/include
+export TARGET_OSSL_LIBRARY_PATH=/path/to/openssl
make
The performance testing apps must be run ensuring that libcrypto.so and
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <openssl/ssl.h>
#include "perflib/perflib.h"
char *privkey;
int ret = EXIT_FAILURE;
int i;
+ int argnext;
+ int terse = 0;
- if (argc != 3) {
- printf("Usage: handshake certsdir threadcount\n");
+ if ((argc != 3 && argc != 4)
+ || (argc == 4 && strcmp("--terse", argv[1]) != 0)) {
+ printf("Usage: handshake [--terse] certsdir threadcount\n");
return EXIT_FAILURE;
}
- threadcount = atoi(argv[2]);
- if (threadcount < 1) {
- printf("threadcount must be > 0\n");
- return EXIT_FAILURE;
+ if (argc == 4) {
+ terse = 1;
+ argnext = 2;
+ } else {
+ argnext = 1;
}
- cert = perflib_mk_file_path(argv[1], "servercert.pem");
- privkey = perflib_mk_file_path(argv[1], "serverkey.pem");
+ cert = perflib_mk_file_path(argv[argnext], "servercert.pem");
+ privkey = perflib_mk_file_path(argv[argnext], "serverkey.pem");
if (cert == NULL || privkey == NULL) {
printf("Failed to allocate cert/privkey\n");
goto err;
}
+ threadcount = atoi(argv[++argnext]);
+ if (threadcount < 1) {
+ printf("threadcount must be > 0\n");
+ goto err;
+ }
+
times = OPENSSL_malloc(sizeof(OSSL_TIME) * threadcount);
if (times == NULL) {
printf("Failed to create times array\n");
persec = ((NUM_HANDSHAKES_PER_THREAD * threadcount * OSSL_TIME_SECOND)
/ (double)ossl_time2ticks(duration));
- printf("Average time per handshake: %ldus\n", ossl_time2us(av));
- printf("Handshakes per second: %lf\n", persec);
+ if (terse) {
+ printf("%ld\n", ossl_time2us(av));
+ printf("%lf\n", persec);
+ } else {
+ printf("Average time per handshake: %ldus\n", ossl_time2us(av));
+ printf("Handshakes per second: %lf\n", persec);
+ }
ret = EXIT_SUCCESS;
err:
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <openssl/rand.h>
#include <openssl/crypto.h>
#include "perflib/perflib.h"
OSSL_TIME duration;
uint64_t us;
double avcalltime;
+ int terse = 0;
+ int argnext;
- if (argc != 2) {
- printf("Usage: randbytes threadcount\n");
+ if ((argc != 2 && argc != 3)
+ || (argc == 3 && strcmp("--terse", argv[1]) != 0)) {
+ printf("Usage: randbytes [--terse] threadcount\n");
return EXIT_FAILURE;
}
- threadcount = atoi(argv[1]);
+ if (argc == 3) {
+ terse = 1;
+ argnext = 2;
+ } else {
+ argnext = 1;
+ }
+
+ threadcount = atoi(argv[argnext]);
if (threadcount < 1) {
printf("threadcount must be > 0\n");
return EXIT_FAILURE;
avcalltime = (double)us / (NUM_CALL_BLOCKS_PER_THREAD * threadcount);
- printf("Average time per %d RAND_bytes() calls: %lfus\n",
- NUM_CALLS_PER_BLOCK, avcalltime);
+ if (terse)
+ printf("%lf\n", avcalltime);
+ else
+ printf("Average time per %d RAND_bytes() calls: %lfus\n",
+ NUM_CALLS_PER_BLOCK, avcalltime);
return EXIT_SUCCESS;
}