diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_depr.c | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_depr.c b/src/lib/libcrypto/rsa/rsa_depr.c index 2d8d55a693..0c3aa67874 100644 --- a/src/lib/libcrypto/rsa/rsa_depr.c +++ b/src/lib/libcrypto/rsa/rsa_depr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_depr.c,v 1.11 2023/04/09 19:10:23 tb Exp $ */ | 1 | /* $OpenBSD: rsa_depr.c,v 1.12 2023/04/13 14:59:13 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -66,35 +66,3 @@ | |||
66 | 66 | ||
67 | #include "bn_local.h" | 67 | #include "bn_local.h" |
68 | 68 | ||
69 | RSA * | ||
70 | RSA_generate_key(int bits, unsigned long e_value, | ||
71 | void (*callback)(int, int, void *), void *cb_arg) | ||
72 | { | ||
73 | BN_GENCB cb; | ||
74 | int i; | ||
75 | RSA *rsa = RSA_new(); | ||
76 | BIGNUM *e = BN_new(); | ||
77 | |||
78 | if (!rsa || !e) | ||
79 | goto err; | ||
80 | |||
81 | /* The problem is when building with 8, 16, or 32 BN_ULONG, | ||
82 | * unsigned long can be larger */ | ||
83 | for (i = 0; i < (int)sizeof(unsigned long) * 8; i++) { | ||
84 | if (e_value & (1UL << i)) | ||
85 | if (BN_set_bit(e, i) == 0) | ||
86 | goto err; | ||
87 | } | ||
88 | |||
89 | BN_GENCB_set_old(&cb, callback, cb_arg); | ||
90 | |||
91 | if (RSA_generate_key_ex(rsa, bits, e, &cb)) { | ||
92 | BN_free(e); | ||
93 | return rsa; | ||
94 | } | ||
95 | err: | ||
96 | BN_free(e); | ||
97 | RSA_free(rsa); | ||
98 | |||
99 | return 0; | ||
100 | } | ||