diff options
author | jsing <> | 2022-11-23 02:44:01 +0000 |
---|---|---|
committer | jsing <> | 2022-11-23 02:44:01 +0000 |
commit | 17daac9fa177a485e4c9a9fa74d956b9739949bc (patch) | |
tree | 51b0784bd6135aee8d238c8ef8f5ff42d633bf13 /src/lib | |
parent | 447de170d86e9b86dca57574fb275896187d76d1 (diff) | |
download | openbsd-17daac9fa177a485e4c9a9fa74d956b9739949bc.tar.gz openbsd-17daac9fa177a485e4c9a9fa74d956b9739949bc.tar.bz2 openbsd-17daac9fa177a485e4c9a9fa74d956b9739949bc.zip |
Remove unused bn_dup_expand().
ok tb@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/bn/bn_lcl.h | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 54 |
2 files changed, 2 insertions, 56 deletions
diff --git a/src/lib/libcrypto/bn/bn_lcl.h b/src/lib/libcrypto/bn/bn_lcl.h index 95dc3baac5..4fac4e7f55 100644 --- a/src/lib/libcrypto/bn/bn_lcl.h +++ b/src/lib/libcrypto/bn/bn_lcl.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_lcl.h,v 1.35 2022/07/15 06:10:00 tb Exp $ */ | 1 | /* $OpenBSD: bn_lcl.h,v 1.36 2022/11/23 02:44:01 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -525,8 +525,6 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, const BN_U | |||
525 | BIGNUM *bn_expand2(BIGNUM *a, int words); | 525 | BIGNUM *bn_expand2(BIGNUM *a, int words); |
526 | BIGNUM *bn_expand(BIGNUM *a, int bits); | 526 | BIGNUM *bn_expand(BIGNUM *a, int bits); |
527 | 527 | ||
528 | BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */ | ||
529 | |||
530 | /* Bignum consistency macros | 528 | /* Bignum consistency macros |
531 | * There is one "API" macro, bn_fix_top(), for stripping leading zeroes from | 529 | * There is one "API" macro, bn_fix_top(), for stripping leading zeroes from |
532 | * bignum data after direct manipulations on the data. There is also an | 530 | * bignum data after direct manipulations on the data. There is also an |
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index e3d5cd7ade..18b213ff78 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_lib.c,v 1.55 2022/11/23 02:20:27 jsing Exp $ */ | 1 | /* $OpenBSD: bn_lib.c,v 1.56 2022/11/23 02:44:01 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -263,7 +263,6 @@ BN_num_bits(const BIGNUM *a) | |||
263 | return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); | 263 | return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); |
264 | } | 264 | } |
265 | 265 | ||
266 | /* This is used both by bn_expand2() and bn_dup_expand() */ | ||
267 | /* The caller MUST check that words > b->dmax before calling this */ | 266 | /* The caller MUST check that words > b->dmax before calling this */ |
268 | static BN_ULONG * | 267 | static BN_ULONG * |
269 | bn_expand_internal(const BIGNUM *b, int words) | 268 | bn_expand_internal(const BIGNUM *b, int words) |
@@ -329,57 +328,6 @@ bn_expand_internal(const BIGNUM *b, int words) | |||
329 | return (a); | 328 | return (a); |
330 | } | 329 | } |
331 | 330 | ||
332 | /* This is an internal function that can be used instead of bn_expand2() | ||
333 | * when there is a need to copy BIGNUMs instead of only expanding the | ||
334 | * data part, while still expanding them. | ||
335 | * Especially useful when needing to expand BIGNUMs that are declared | ||
336 | * 'const' and should therefore not be changed. | ||
337 | * The reason to use this instead of a BN_dup() followed by a bn_expand2() | ||
338 | * is memory allocation overhead. A BN_dup() followed by a bn_expand2() | ||
339 | * will allocate new memory for the BIGNUM data twice, and free it once, | ||
340 | * while bn_dup_expand() makes sure allocation is made only once. | ||
341 | */ | ||
342 | |||
343 | #ifndef OPENSSL_NO_DEPRECATED | ||
344 | BIGNUM * | ||
345 | bn_dup_expand(const BIGNUM *b, int words) | ||
346 | { | ||
347 | BIGNUM *r = NULL; | ||
348 | |||
349 | bn_check_top(b); | ||
350 | |||
351 | /* This function does not work if | ||
352 | * words <= b->dmax && top < words | ||
353 | * because BN_dup() does not preserve 'dmax'! | ||
354 | * (But bn_dup_expand() is not used anywhere yet.) | ||
355 | */ | ||
356 | |||
357 | if (words > b->dmax) { | ||
358 | BN_ULONG *a = bn_expand_internal(b, words); | ||
359 | |||
360 | if (a) { | ||
361 | r = BN_new(); | ||
362 | if (r) { | ||
363 | r->top = b->top; | ||
364 | r->dmax = words; | ||
365 | r->neg = b->neg; | ||
366 | r->d = a; | ||
367 | } else { | ||
368 | /* r == NULL, BN_new failure */ | ||
369 | free(a); | ||
370 | } | ||
371 | } | ||
372 | /* If a == NULL, there was an error in allocation in | ||
373 | bn_expand_internal(), and NULL should be returned */ | ||
374 | } else { | ||
375 | r = BN_dup(b); | ||
376 | } | ||
377 | |||
378 | bn_check_top(r); | ||
379 | return r; | ||
380 | } | ||
381 | #endif | ||
382 | |||
383 | /* This is an internal function that should not be used in applications. | 331 | /* This is an internal function that should not be used in applications. |
384 | * It ensures that 'b' has enough room for a 'words' word number | 332 | * It ensures that 'b' has enough room for a 'words' word number |
385 | * and initialises any unused part of b->d with leading zeros. | 333 | * and initialises any unused part of b->d with leading zeros. |