From: ben-skyportsystems <b...@skyportsystems.com> The OpenSSL function RSA_size() returns the size of the modulus. The variable 'keysize' is set to the return value of this function. The subsequent comparison of modulus size to keysize thus compares a variable to itself.
Signed-off-by: Ben Warren <b...@skyportsystems.com> --- lcptools-v2/crtpollist.c | 7 +------ lcptools/crtpollist.c | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/lcptools-v2/crtpollist.c b/lcptools-v2/crtpollist.c index ed94c5d..4abf48d 100644 --- a/lcptools-v2/crtpollist.c +++ b/lcptools-v2/crtpollist.c @@ -160,12 +160,7 @@ static lcp_signature_t2 *read_rsa_pubkey_file(const char *file) memset(sig, 0, sizeof(lcp_rsa_signature_t) + 2*keysize); sig->rsa_signature.pubkey_size = keysize; - if ( (unsigned int)BN_num_bytes(pubkey->n) != keysize ) { - ERROR("Error: modulus size not match key size\n"); - free(sig); - RSA_free(pubkey); - return NULL; - } + unsigned char key[keysize]; BN_bn2bin(pubkey->n, key); /* openssl key is big-endian and policy requires little-endian, so reverse diff --git a/lcptools/crtpollist.c b/lcptools/crtpollist.c index caf4897..e4e2474 100644 --- a/lcptools/crtpollist.c +++ b/lcptools/crtpollist.c @@ -155,12 +155,7 @@ static lcp_signature_t *read_pubkey_file(const char *file) memset(sig, 0, sizeof(*sig) + 2*keysize); sig->pubkey_size = keysize; - if ( (unsigned int)BN_num_bytes(pubkey->n) != keysize ) { - ERROR("Error: modulus size not match key size\n"); - free(sig); - RSA_free(pubkey); - return NULL; - } + unsigned char key[keysize]; BN_bn2bin(pubkey->n, key); /* openssl key is big-endian and policy requires little-endian, so reverse -- 2.6.4 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ tboot-devel mailing list tboot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tboot-devel