remove unused variable
This commit is contained in:
parent
7bdaeee4cd
commit
3488933d1d
18
audit/fips.c
18
audit/fips.c
@ -12,28 +12,28 @@
|
|||||||
|
|
||||||
static int DEBUG = 0;
|
static int DEBUG = 0;
|
||||||
|
|
||||||
int fips(const char *pkey, struct audit_fips *st_audit_fips, struct keyinfo *st_keyinfo, const int type, const int is_pubkey, const int to_stdout){
|
int fips(const char *pkey, struct audit_fips *st_audit_fips, struct keyinfo *st_keyinfo, const int type, const int is_pubkey){
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if(type == TYPE_RSA){
|
if(type == TYPE_RSA){
|
||||||
/* If it's a pub key, we are going to analyse it */
|
/* If it's a pub key, we are going to analyse it */
|
||||||
if (is_pubkey == 1)
|
if (is_pubkey == 1)
|
||||||
res = fips_pubkey_rsa(st_audit_fips, st_keyinfo, pkey, to_stdout);
|
res = fips_pubkey_rsa(st_audit_fips, st_keyinfo, pkey);
|
||||||
else
|
else
|
||||||
res = fips_privkey_rsa(st_audit_fips, st_keyinfo, pkey, to_stdout);
|
res = fips_privkey_rsa(st_audit_fips, st_keyinfo, pkey);
|
||||||
}
|
}
|
||||||
else if (type == TYPE_X509){
|
else if (type == TYPE_X509){
|
||||||
if (openssl_version() == 1)
|
if (openssl_version() == 1)
|
||||||
res = fips_x509_v1(st_audit_fips, st_keyinfo, pkey, to_stdout);
|
res = fips_x509_v1(st_audit_fips, st_keyinfo, pkey);
|
||||||
else
|
else
|
||||||
res = fips_x509_v3(st_audit_fips, st_keyinfo, pkey, to_stdout);
|
res = fips_x509_v3(st_audit_fips, st_keyinfo, pkey);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* This function load public RSA key and make an audit on it
|
* This function load public RSA key and make an audit on it
|
||||||
*/
|
*/
|
||||||
static int fips_pubkey_rsa(struct audit_fips *st_audit_fips, struct keyinfo *st_keyinfo, const char *pkey, const int to_stdout) {
|
static int fips_pubkey_rsa(struct audit_fips *st_audit_fips, struct keyinfo *st_keyinfo, const char *pkey) {
|
||||||
struct rsa *rsa;
|
struct rsa *rsa;
|
||||||
size_t keysize;
|
size_t keysize;
|
||||||
int res;
|
int res;
|
||||||
@ -62,7 +62,7 @@ static int fips_pubkey_rsa(struct audit_fips *st_audit_fips, struct keyinfo *st_
|
|||||||
/*
|
/*
|
||||||
* This function audit RSA private key
|
* This function audit RSA private key
|
||||||
*/
|
*/
|
||||||
static int fips_privkey_rsa(struct audit_fips *st_audit_fips, struct keyinfo *st_keyinfo, const char *pkey, const int to_stdout) {
|
static int fips_privkey_rsa(struct audit_fips *st_audit_fips, struct keyinfo *st_keyinfo, const char *pkey) {
|
||||||
int res;
|
int res;
|
||||||
struct rsa *rsa = NULL;
|
struct rsa *rsa = NULL;
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ static int check_exponent(const BIGNUM *e, char *buf, unsigned long *exponent){
|
|||||||
/*
|
/*
|
||||||
* This function load X509 certificate for OpenSSL v1
|
* This function load X509 certificate for OpenSSL v1
|
||||||
*/
|
*/
|
||||||
static int fips_x509_v1(struct audit_fips *st_audit_fips, struct keyinfo *st_keyinfo, const char *pkey, const int to_stdout){
|
static int fips_x509_v1(struct audit_fips *st_audit_fips, struct keyinfo *st_keyinfo, const char *pkey){
|
||||||
struct rsa *rsa = (struct rsa*)malloc(sizeof(struct rsa*));
|
struct rsa *rsa = (struct rsa*)malloc(sizeof(struct rsa*));
|
||||||
|
|
||||||
if (rsa == NULL){
|
if (rsa == NULL){
|
||||||
@ -389,7 +389,7 @@ static int fips_x509_v1(struct audit_fips *st_audit_fips, struct keyinfo *st_key
|
|||||||
/*
|
/*
|
||||||
* This function load X509 certificate for OpenSSL v3
|
* This function load X509 certificate for OpenSSL v3
|
||||||
*/
|
*/
|
||||||
static int fips_x509_v3(struct audit_fips *st_audit_fips, struct keyinfo *st_keyinfo, const char *pkey, const int to_stdout){
|
static int fips_x509_v3(struct audit_fips *st_audit_fips, struct keyinfo *st_keyinfo, const char *pkey){
|
||||||
struct rsa *rsa = (struct rsa*)malloc(sizeof(struct rsa*));
|
struct rsa *rsa = (struct rsa*)malloc(sizeof(struct rsa*));
|
||||||
|
|
||||||
if (rsa == NULL){
|
if (rsa == NULL){
|
||||||
|
|||||||
10
audit/fips.h
10
audit/fips.h
@ -40,10 +40,10 @@ struct keyinfo{
|
|||||||
int algo;
|
int algo;
|
||||||
};
|
};
|
||||||
|
|
||||||
int fips(const char *, struct audit_fips *, struct keyinfo *, const int, const int, const int);
|
int fips(const char *, struct audit_fips *, struct keyinfo *, const int, const int);
|
||||||
/* RSA */
|
/* RSA */
|
||||||
static int fips_pubkey_rsa(struct audit_fips *, struct keyinfo *, const char *, const int);
|
static int fips_pubkey_rsa(struct audit_fips *, struct keyinfo *, const char *);
|
||||||
static int fips_privkey_rsa(struct audit_fips *, struct keyinfo *, const char *, const int);
|
static int fips_privkey_rsa(struct audit_fips *, struct keyinfo *, const char *);
|
||||||
static int loadkeys_rsa_v1(struct rsa **, const char *, int *format);
|
static int loadkeys_rsa_v1(struct rsa **, const char *, int *format);
|
||||||
static int loadkeys_rsa_v3(struct rsa **, const char *, int *format);
|
static int loadkeys_rsa_v3(struct rsa **, const char *, int *format);
|
||||||
static int load_priv_rsa_keys_v1(struct rsa **, const char *);
|
static int load_priv_rsa_keys_v1(struct rsa **, const char *);
|
||||||
@ -51,8 +51,8 @@ static int load_priv_rsa_keys_v3(struct rsa **, const char *);
|
|||||||
static void audit_rsa_keys(struct rsa *, struct audit_fips *, struct keyinfo *, const char *);
|
static void audit_rsa_keys(struct rsa *, struct audit_fips *, struct keyinfo *, const char *);
|
||||||
|
|
||||||
/* X509 */
|
/* X509 */
|
||||||
static int fips_x509_v1(struct audit_fips *, struct keyinfo *, const char *, const int);
|
static int fips_x509_v1(struct audit_fips *, struct keyinfo *, const char *);
|
||||||
static int fips_x509_v3(struct audit_fips *, struct keyinfo *, const char *, const int);
|
static int fips_x509_v3(struct audit_fips *, struct keyinfo *, const char *);
|
||||||
|
|
||||||
static int check_exponent(const BIGNUM *, char *, unsigned long *);
|
static int check_exponent(const BIGNUM *, char *, unsigned long *);
|
||||||
static void clean_rsa_st(struct rsa *);
|
static void clean_rsa_st(struct rsa *);
|
||||||
|
|||||||
@ -94,7 +94,7 @@ int certificate(char **argv, const int argc){
|
|||||||
printf("Cannot decrypt x509 certifcate, it is not implemented yet\n");
|
printf("Cannot decrypt x509 certifcate, it is not implemented yet\n");
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
res = fips(buf_pkey, &st_audit_fips, &st_keyinfo, type, is_pubkey, to_stdout);
|
res = fips(buf_pkey, &st_audit_fips, &st_keyinfo, type, is_pubkey);
|
||||||
if (res < 0){
|
if (res < 0){
|
||||||
printf("Error during check FIPS compliance\n");
|
printf("Error during check FIPS compliance\n");
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
BIN
cryptodit
BIN
cryptodit
Binary file not shown.
Loading…
Reference in New Issue
Block a user