projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix warnings about ignoring fgets return value
[oweals/openssl.git]
/
apps
/
openssl.c
diff --git
a/apps/openssl.c
b/apps/openssl.c
index 45f8d7f4ef2b1faca9294d7ad51afc24f4768b2b..8e2d8dd569de402ccadcc2e9d74792d416ed59a4 100644
(file)
--- a/
apps/openssl.c
+++ b/
apps/openssl.c
@@
-56,7
+56,7
@@
* [including the GNU Public Licence.]
*/
/* ====================================================================
* [including the GNU Public Licence.]
*/
/* ====================================================================
- * Copyright (c) 1998-200
1
The OpenSSL Project. All rights reserved.
+ * Copyright (c) 1998-200
6
The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@
-122,7
+122,9
@@
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
+#ifndef OPENSSL_NO_ENGINE
#include <openssl/engine.h>
#include <openssl/engine.h>
+#endif
#define USE_SOCKETS /* needed for the _O_BINARY defs in the MS world */
#include "progs.h"
#include "s_apps.h"
#define USE_SOCKETS /* needed for the _O_BINARY defs in the MS world */
#include "progs.h"
#include "s_apps.h"
@@
-145,6
+147,7
@@
char *default_config_file=NULL;
#ifdef MONOLITH
CONF *config=NULL;
BIO *bio_err=NULL;
#ifdef MONOLITH
CONF *config=NULL;
BIO *bio_err=NULL;
+int in_FIPS_mode=0;
#endif
#endif
@@
-161,7
+164,7
@@
static void lock_dbg_cb(int mode, int type, const char *file, int line)
goto err;
}
goto err;
}
- if (type < 0 || type > CRYPTO_NUM_LOCKS)
+ if (type < 0 || type >
=
CRYPTO_NUM_LOCKS)
{
errstr = "type out of bounds";
goto err;
{
errstr = "type out of bounds";
goto err;
@@
-218,7
+221,8
@@
int main(int Argc, char *Argv[])
#define PROG_NAME_SIZE 39
char pname[PROG_NAME_SIZE+1];
FUNCTION f,*fp;
#define PROG_NAME_SIZE 39
char pname[PROG_NAME_SIZE+1];
FUNCTION f,*fp;
- MS_STATIC char *prompt,buf[1024];
+ MS_STATIC const char *prompt;
+ MS_STATIC char buf[1024];
char *to_free=NULL;
int n,i,ret=0;
int argc;
char *to_free=NULL;
int n,i,ret=0;
int argc;
@@
-229,6
+233,19
@@
int main(int Argc, char *Argv[])
arg.data=NULL;
arg.count=0;
arg.data=NULL;
arg.count=0;
+ in_FIPS_mode = 0;
+
+#ifdef OPENSSL_FIPS
+ if(getenv("OPENSSL_FIPS")) {
+ if (!FIPS_mode_set(1)) {
+ ERR_load_crypto_strings();
+ ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
+ EXIT(1);
+ }
+ in_FIPS_mode = 1;
+ }
+#endif
+
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
if (bio_err == NULL)
if ((bio_err=BIO_new(BIO_s_file())) != NULL)
BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
@@
-316,7
+333,8
@@
int main(int Argc, char *Argv[])
else prompt="OpenSSL> ";
fputs(prompt,stdout);
fflush(stdout);
else prompt="OpenSSL> ";
fputs(prompt,stdout);
fflush(stdout);
- fgets(p,n,stdin);
+ if (!fgets(p,n,stdin))
+ goto end;
if (p[0] == '\0') goto end;
i=strlen(p);
if (i <= 1) break;
if (p[0] == '\0') goto end;
i=strlen(p);
if (i <= 1) break;
@@
-358,7
+376,7
@@
end:
BIO_free(bio_err);
bio_err=NULL;
}
BIO_free(bio_err);
bio_err=NULL;
}
- EXIT(ret);
+
OPENSSL_
EXIT(ret);
}
#define LIST_STANDARD_COMMANDS "list-standard-commands"
}
#define LIST_STANDARD_COMMANDS "list-standard-commands"
@@
-442,7
+460,11
@@
static int do_cmd(LHASH *prog, int argc, char *argv[])
for (fp=functions; fp->name != NULL; fp++)
{
nl=0;
for (fp=functions; fp->name != NULL; fp++)
{
nl=0;
+#ifdef OPENSSL_NO_CAMELLIA
if (((i++) % 5) == 0)
if (((i++) % 5) == 0)
+#else
+ if (((i++) % 4) == 0)
+#endif
{
BIO_printf(bio_err,"\n");
nl=1;
{
BIO_printf(bio_err,"\n");
nl=1;
@@
-463,7
+485,11
@@
static int do_cmd(LHASH *prog, int argc, char *argv[])
BIO_printf(bio_err,"\nCipher commands (see the `enc' command for more details)\n");
}
}
BIO_printf(bio_err,"\nCipher commands (see the `enc' command for more details)\n");
}
}
+#ifdef OPENSSL_NO_CAMELLIA
BIO_printf(bio_err,"%-15s",fp->name);
BIO_printf(bio_err,"%-15s",fp->name);
+#else
+ BIO_printf(bio_err,"%-18s",fp->name);
+#endif
}
BIO_printf(bio_err,"\n\n");
ret=0;
}
BIO_printf(bio_err,"\n\n");
ret=0;
@@
-486,7
+512,7
@@
static LHASH *prog_init(void)
{
LHASH *ret;
FUNCTION *f;
{
LHASH *ret;
FUNCTION *f;
-
in
t i;
+
size_
t i;
/* Purely so it looks nice when the user hits ? */
for(i=0,f=functions ; f->name != NULL ; ++f,++i)
/* Purely so it looks nice when the user hits ? */
for(i=0,f=functions ; f->name != NULL ; ++f,++i)
@@
-504,12
+530,12
@@
static LHASH *prog_init(void)
/* static int MS_CALLBACK cmp(FUNCTION *a, FUNCTION *b) */
static int MS_CALLBACK cmp(const void *a_void, const void *b_void)
{
/* static int MS_CALLBACK cmp(FUNCTION *a, FUNCTION *b) */
static int MS_CALLBACK cmp(const void *a_void, const void *b_void)
{
- return(strncmp(((FUNCTION *)a_void)->name,
- ((FUNCTION *)b_void)->name,8));
+ return(strncmp(((
const
FUNCTION *)a_void)->name,
+ ((
const
FUNCTION *)b_void)->name,8));
}
/* static unsigned long MS_CALLBACK hash(FUNCTION *a) */
static unsigned long MS_CALLBACK hash(const void *a_void)
{
}
/* static unsigned long MS_CALLBACK hash(FUNCTION *a) */
static unsigned long MS_CALLBACK hash(const void *a_void)
{
- return(lh_strhash(((FUNCTION *)a_void)->name));
+ return(lh_strhash(((
const
FUNCTION *)a_void)->name));
}
}