Must use 'const char*'
Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@huawei.com>
This commit is contained in:
parent
6a712b3b38
commit
96e55082c2
@ -608,7 +608,7 @@ static int cmd_hash_ima(struct command *cmd)
|
|||||||
|
|
||||||
static int sign_ima_file(const char *file)
|
static int sign_ima_file(const char *file)
|
||||||
{
|
{
|
||||||
char *key;
|
const char *key;
|
||||||
|
|
||||||
key = params.keyfile ? : "/etc/keys/privkey_evm.pem";
|
key = params.keyfile ? : "/etc/keys/privkey_evm.pem";
|
||||||
|
|
||||||
@ -622,7 +622,8 @@ static int cmd_sign_ima(struct command *cmd)
|
|||||||
|
|
||||||
static int cmd_sign_hash(struct command *cmd)
|
static int cmd_sign_hash(struct command *cmd)
|
||||||
{
|
{
|
||||||
char *key, *token, *line = NULL;
|
const char *key;
|
||||||
|
char *token, *line = NULL;
|
||||||
int hashlen = 0;
|
int hashlen = 0;
|
||||||
size_t line_len;
|
size_t line_len;
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
@ -665,7 +666,7 @@ static int cmd_sign_hash(struct command *cmd)
|
|||||||
|
|
||||||
static int sign_evm_path(const char *file)
|
static int sign_evm_path(const char *file)
|
||||||
{
|
{
|
||||||
char *key;
|
const char *key;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
key = params.keyfile ? : "/etc/keys/privkey_evm.pem";
|
key = params.keyfile ? : "/etc/keys/privkey_evm.pem";
|
||||||
@ -1001,7 +1002,7 @@ static int hmac_evm(const char *file, const char *key)
|
|||||||
|
|
||||||
static int cmd_hmac_evm(struct command *cmd)
|
static int cmd_hmac_evm(struct command *cmd)
|
||||||
{
|
{
|
||||||
char *key, *file = g_argv[optind++];
|
const char *key, *file = g_argv[optind++];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
@ -178,8 +178,8 @@ struct libevm_params {
|
|||||||
int verbose;
|
int verbose;
|
||||||
int x509;
|
int x509;
|
||||||
const char *hash_algo;
|
const char *hash_algo;
|
||||||
char *keyfile;
|
const char *keyfile;
|
||||||
char *keypass;
|
const char *keypass;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RSA_ASN1_template {
|
struct RSA_ASN1_template {
|
||||||
@ -201,7 +201,7 @@ void calc_keyid_v1(uint8_t *keyid, char *str, const unsigned char *pkey, int len
|
|||||||
void calc_keyid_v2(uint32_t *keyid, char *str, RSA *key);
|
void calc_keyid_v2(uint32_t *keyid, char *str, RSA *key);
|
||||||
int key2bin(RSA *key, unsigned char *pub);
|
int key2bin(RSA *key, unsigned char *pub);
|
||||||
|
|
||||||
int sign_hash(const char *algo, const unsigned char *hash, int size, const char *keyfile, char *keypass, unsigned char *sig);
|
int sign_hash(const char *algo, const unsigned char *hash, int size, const char *keyfile, const char *keypass, unsigned char *sig);
|
||||||
int verify_hash(const unsigned char *hash, int size, unsigned char *sig, int siglen);
|
int verify_hash(const unsigned char *hash, int size, unsigned char *sig, int siglen);
|
||||||
int ima_verify_signature(const char *file, unsigned char *sig, int siglen);
|
int ima_verify_signature(const char *file, unsigned char *sig, int siglen);
|
||||||
|
|
||||||
|
@ -491,7 +491,7 @@ static int get_hash_algo_from_sig(unsigned char *sig)
|
|||||||
|
|
||||||
int verify_hash(const unsigned char *hash, int size, unsigned char *sig, int siglen)
|
int verify_hash(const unsigned char *hash, int size, unsigned char *sig, int siglen)
|
||||||
{
|
{
|
||||||
char *key;
|
const char *key;
|
||||||
int x509;
|
int x509;
|
||||||
verify_hash_fn_t verify_hash;
|
verify_hash_fn_t verify_hash;
|
||||||
|
|
||||||
@ -611,7 +611,7 @@ void calc_keyid_v2(uint32_t *keyid, char *str, RSA *key)
|
|||||||
free(pkey);
|
free(pkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
static RSA *read_priv_key(const char *keyfile, char *keypass)
|
static RSA *read_priv_key(const char *keyfile, const char *keypass)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
RSA *key;
|
RSA *key;
|
||||||
@ -622,7 +622,7 @@ static RSA *read_priv_key(const char *keyfile, char *keypass)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
key = PEM_read_RSAPrivateKey(fp, NULL, NULL, keypass);
|
key = PEM_read_RSAPrivateKey(fp, NULL, NULL, (void *)keypass);
|
||||||
if (!key) {
|
if (!key) {
|
||||||
char str[256];
|
char str[256];
|
||||||
|
|
||||||
@ -795,7 +795,7 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sign_hash(const char *hashalgo, const unsigned char *hash, int size, const char *keyfile, char *keypass, unsigned char *sig)
|
int sign_hash(const char *hashalgo, const unsigned char *hash, int size, const char *keyfile, const char *keypass, unsigned char *sig)
|
||||||
{
|
{
|
||||||
if (keypass)
|
if (keypass)
|
||||||
params.keypass = keypass;
|
params.keypass = keypass;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user