Skip to content

Commit 4981f8f

Browse files
committed
Suppress deprecation warnings
1 parent ceac3bc commit 4981f8f

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,24 @@ The test program supports options as follows:
195195
-p - port number to use
196196
-t - terse output
197197
```
198+
199+
## evp_hash
200+
201+
Tool that computes hashes using the specified algorithm.
202+
Runs for 5 seconds and prints the average execution time per hash.
203+
Uses the EVP API by default, but this tool can also use the corresponding deprecated API's.
204+
Prints out the average time per hash computation.
205+
206+
```
207+
Usage: evp_hash [-h] [-x] [-t] [-u update-times] [-a algorithm] thread-count
208+
-h - print this help output
209+
-x - use deprecated API instead of EVP API
210+
-t - terse output
211+
-u update-times - times to update digest. 1 for one-shot (default: 1)
212+
-a algorithm - One of: [SHA1, SHA224, SHA256, SHA384, SHA512] (default: SHA1)
213+
thread-count - number of threads
214+
```
215+
216+
```sh
217+
evp_hash -u 10 -a SHA512 -x 15
218+
```

source/evp_hash.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Prints out the average time per hash computation.
1414
*/
1515

16+
#define OPENSSL_SUPPRESS_DEPRECATED
17+
1618
#include <stdlib.h>
1719
#include <stdio.h>
1820
#ifndef _WIN32
@@ -165,8 +167,10 @@ void do_hash_evp(size_t num)
165167
OSSL_TIME time;
166168
EVP_MD_CTX *mctx = EVP_MD_CTX_new();
167169

168-
if (mctx == NULL)
170+
if (mctx == NULL) {
171+
err = 1;
169172
return;
173+
}
170174

171175
do {
172176
if (!hash_evp(mctx, evp_md)) {
@@ -188,8 +192,8 @@ void print_help()
188192
printf("-h - print this help output\n");
189193
printf("-x - use deprecated API instead of EVP API\n");
190194
printf("-t - terse output\n");
191-
printf("-u update-times - times to update digest. 1 for one-shot. By default, do one-shot\n");
192-
printf("-a algorithm - One of: [SHA1, SHA224, SHA256, SHA384, SHA512]. By default, use SHA1\n");
195+
printf("-u update-times - times to update digest. 1 for one-shot (default: 1)\n");
196+
printf("-a algorithm - One of: [SHA1, SHA224, SHA256, SHA384, SHA512] (default: SHA1)\n");
193197
printf("thread-count - number of threads\n");
194198
}
195199

0 commit comments

Comments
 (0)