1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-04-28 14:43:37 +02:00

Remove user_sig_type flag

Always use signature type from signature header - like kernel does.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
This commit is contained in:
Dmitry Kasatkin 2014-01-24 14:54:59 +02:00
parent ff5f07e171
commit 4578679081
3 changed files with 11 additions and 14 deletions

View File

@ -1613,7 +1613,6 @@ int main(int argc, char *argv[])
params.x509 = 1;
sign_hash = sign_hash_v2;
params.verify_hash = verify_hash_v2;
params.user_sig_type = 1;
break;
case 'k':
params.keyfile = optarg;

View File

@ -460,18 +460,17 @@ int verify_hash(const unsigned char *hash, int size, unsigned char *sig, int sig
{
char *key;
/* Get signature type from sig header if user did not enforce it */
if (!params.user_sig_type) {
if (sig[0] == DIGSIG_VERSION_1) {
params.verify_hash = verify_hash_v1;
/* Read pubkey from RSA key */
params.x509 = 0;
} else if (sig[0] == DIGSIG_VERSION_2) {
params.verify_hash = verify_hash_v2;
/* Read pubkey from x509 cert */
params.x509 = 1;
}
}
/* Get signature type from sig header */
if (sig[0] == DIGSIG_VERSION_1) {
params.verify_hash = verify_hash_v1;
/* Read pubkey from RSA key */
params.x509 = 0;
} else if (sig[0] == DIGSIG_VERSION_2) {
params.verify_hash = verify_hash_v2;
/* Read pubkey from x509 cert */
params.x509 = 1;
} else
return -1;
/* Determine what key to use for verification*/
key = params.keyfile ? : params.x509 ?

View File

@ -129,7 +129,6 @@ struct libevm_params {
int verbose;
const char *hash_algo;
int user_hash_algo;
int user_sig_type;
int x509;
char *keyfile;
verify_hash_fn_t verify_hash;