diff options
| author | jsing <> | 2022-12-23 02:12:11 +0000 |
|---|---|---|
| committer | jsing <> | 2022-12-23 02:12:11 +0000 |
| commit | 640b0c4a9328313aab9b02da2a11bea759092ce1 (patch) | |
| tree | e416d4ec820656505d50d42351b24b62d44a7a0d /src | |
| parent | 7ac56f01bacd1ca7fe0df2fb6606689ee7d0521f (diff) | |
| download | openbsd-640b0c4a9328313aab9b02da2a11bea759092ce1.tar.gz openbsd-640b0c4a9328313aab9b02da2a11bea759092ce1.tar.bz2 openbsd-640b0c4a9328313aab9b02da2a11bea759092ce1.zip | |
Do similar setup for lshift and rshift benchmarks.
This prevents realloc from unnecessarily impacting the lshift benchmarks.
Diffstat (limited to 'src')
| -rw-r--r-- | src/regress/lib/libcrypto/bn/bn_shift.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/regress/lib/libcrypto/bn/bn_shift.c b/src/regress/lib/libcrypto/bn/bn_shift.c index 5ba5f5403e..fd5184523b 100644 --- a/src/regress/lib/libcrypto/bn/bn_shift.c +++ b/src/regress/lib/libcrypto/bn/bn_shift.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_shift.c,v 1.3 2022/12/18 00:22:07 tb Exp $ */ | 1 | /* $OpenBSD: bn_shift.c,v 1.4 2022/12/23 02:12:11 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2022 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -319,6 +319,9 @@ benchmark_bn_lshift1(BIGNUM *bn) | |||
| 319 | { | 319 | { |
| 320 | int i; | 320 | int i; |
| 321 | 321 | ||
| 322 | if (!BN_set_bit(bn, 8192)) | ||
| 323 | errx(1, "BN_set_bit"); | ||
| 324 | |||
| 322 | if (!BN_one(bn)) | 325 | if (!BN_one(bn)) |
| 323 | errx(1, "BN_one"); | 326 | errx(1, "BN_one"); |
| 324 | 327 | ||
| @@ -333,6 +336,9 @@ benchmark_bn_lshift(BIGNUM *bn, int n) | |||
| 333 | { | 336 | { |
| 334 | int i; | 337 | int i; |
| 335 | 338 | ||
| 339 | if (!BN_set_bit(bn, 8192 * n)) | ||
| 340 | errx(1, "BN_set_bit"); | ||
| 341 | |||
| 336 | if (!BN_one(bn)) | 342 | if (!BN_one(bn)) |
| 337 | errx(1, "BN_one"); | 343 | errx(1, "BN_one"); |
| 338 | 344 | ||
| @@ -371,6 +377,9 @@ benchmark_bn_rshift1(BIGNUM *bn) | |||
| 371 | { | 377 | { |
| 372 | int i; | 378 | int i; |
| 373 | 379 | ||
| 380 | if (!BN_one(bn)) | ||
| 381 | errx(1, "BN_one"); | ||
| 382 | |||
| 374 | if (!BN_set_bit(bn, 8192)) | 383 | if (!BN_set_bit(bn, 8192)) |
| 375 | errx(1, "BN_set_bit"); | 384 | errx(1, "BN_set_bit"); |
| 376 | 385 | ||
| @@ -385,6 +394,9 @@ benchmark_bn_rshift(BIGNUM *bn, int n) | |||
| 385 | { | 394 | { |
| 386 | int i; | 395 | int i; |
| 387 | 396 | ||
| 397 | if (!BN_one(bn)) | ||
| 398 | errx(1, "BN_one"); | ||
| 399 | |||
| 388 | if (!BN_set_bit(bn, 8192 * n)) | 400 | if (!BN_set_bit(bn, 8192 * n)) |
| 389 | errx(1, "BN_set_bit"); | 401 | errx(1, "BN_set_bit"); |
| 390 | 402 | ||
