summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/apps/genrsa.c
diff options
context:
space:
mode:
authorbeck <>1999-09-29 04:37:45 +0000
committerbeck <>1999-09-29 04:37:45 +0000
commitde8f24ea083384bb66b32ec105dc4743c5663cdf (patch)
tree1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libssl/src/apps/genrsa.c
parentcb929d29896bcb87c2a97417fbd03e50078fc178 (diff)
downloadopenbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz
openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2
openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip
OpenSSL 0.9.4 merge
Diffstat (limited to 'src/lib/libssl/src/apps/genrsa.c')
-rw-r--r--src/lib/libssl/src/apps/genrsa.c46
1 files changed, 17 insertions, 29 deletions
diff --git a/src/lib/libssl/src/apps/genrsa.c b/src/lib/libssl/src/apps/genrsa.c
index cdba6189ad..67382065fb 100644
--- a/src/lib/libssl/src/apps/genrsa.c
+++ b/src/lib/libssl/src/apps/genrsa.c
@@ -56,35 +56,28 @@
56 * [including the GNU Public Licence.] 56 * [including the GNU Public Licence.]
57 */ 57 */
58 58
59#ifndef NO_RSA
59#include <stdio.h> 60#include <stdio.h>
60#include <string.h> 61#include <string.h>
61#include <sys/types.h> 62#include <sys/types.h>
62#include <sys/stat.h> 63#include <sys/stat.h>
63#include "apps.h" 64#include "apps.h"
64#include "bio.h" 65#include <openssl/bio.h>
65#include "rand.h" 66#include <openssl/rand.h>
66#include "err.h" 67#include <openssl/err.h>
67#include "bn.h" 68#include <openssl/bn.h>
68#include "rsa.h" 69#include <openssl/rsa.h>
69#include "evp.h" 70#include <openssl/evp.h>
70#include "x509.h" 71#include <openssl/x509.h>
71#include "pem.h" 72#include <openssl/pem.h>
72 73
73#define DEFBITS 512 74#define DEFBITS 512
74#undef PROG 75#undef PROG
75#define PROG genrsa_main 76#define PROG genrsa_main
76 77
77#ifndef NOPROTO 78static void MS_CALLBACK genrsa_cb(int p, int n, void *arg);
78static void MS_CALLBACK genrsa_cb(int p, int n, char *arg);
79static long gr_load_rand(char *names); 79static long gr_load_rand(char *names);
80#else 80int MAIN(int argc, char **argv)
81static void MS_CALLBACK genrsa_cb();
82static long gr_load_rand();
83#endif
84
85int MAIN(argc, argv)
86int argc;
87char **argv;
88 { 81 {
89 int ret=1; 82 int ret=1;
90 char buffer[200]; 83 char buffer[200];
@@ -201,7 +194,7 @@ bad:
201 194
202 BIO_printf(bio_err,"Generating RSA private key, %d bit long modulus\n", 195 BIO_printf(bio_err,"Generating RSA private key, %d bit long modulus\n",
203 num); 196 num);
204 rsa=RSA_generate_key(num,f4,genrsa_cb,(char *)bio_err); 197 rsa=RSA_generate_key(num,f4,genrsa_cb,bio_err);
205 198
206 if (randfile == NULL) 199 if (randfile == NULL)
207 BIO_printf(bio_err,"unable to write 'random state'\n"); 200 BIO_printf(bio_err,"unable to write 'random state'\n");
@@ -222,7 +215,7 @@ bad:
222 l+=rsa->e->d[i]; 215 l+=rsa->e->d[i];
223 } 216 }
224 BIO_printf(bio_err,"e is %ld (0x%lX)\n",l,l); 217 BIO_printf(bio_err,"e is %ld (0x%lX)\n",l,l);
225 if (!PEM_write_bio_RSAPrivateKey(out,rsa,enc,NULL,0,NULL)) 218 if (!PEM_write_bio_RSAPrivateKey(out,rsa,enc,NULL,0,NULL,NULL))
226 goto err; 219 goto err;
227 220
228 ret=0; 221 ret=0;
@@ -234,10 +227,7 @@ err:
234 EXIT(ret); 227 EXIT(ret);
235 } 228 }
236 229
237static void MS_CALLBACK genrsa_cb(p, n, arg) 230static void MS_CALLBACK genrsa_cb(int p, int n, void *arg)
238int p;
239int n;
240char *arg;
241 { 231 {
242 char c='*'; 232 char c='*';
243 233
@@ -246,14 +236,13 @@ char *arg;
246 if (p == 2) c='*'; 236 if (p == 2) c='*';
247 if (p == 3) c='\n'; 237 if (p == 3) c='\n';
248 BIO_write((BIO *)arg,&c,1); 238 BIO_write((BIO *)arg,&c,1);
249 BIO_flush((BIO *)arg); 239 (void)BIO_flush((BIO *)arg);
250#ifdef LINT 240#ifdef LINT
251 p=n; 241 p=n;
252#endif 242#endif
253 } 243 }
254 244
255static long gr_load_rand(name) 245static long gr_load_rand(char *name)
256char *name;
257 { 246 {
258 char *p,*n; 247 char *p,*n;
259 int last; 248 int last;
@@ -274,5 +263,4 @@ char *name;
274 } 263 }
275 return(tot); 264 return(tot);
276 } 265 }
277 266#endif
278