diff --git a/ChangeLog b/ChangeLog index 69c78d4..bd16ada 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2012-06-14 Niibe Yutaka + * src/call-rsa.c (rsa_sign, rsa_decrypt, rsa_verify): Use + mpi_lset (was: mpi_read_string). + * polarssl-0.14.0/library/bignum.c (mpi_get_digit) + (mpi_read_string): ifdef-out. + KDF is now SHA-256 (was: SHA1). * src/sha256.c: New file. Based on the implementation by Dr Brian Gladman. diff --git a/polarssl-0.14.0/library/bignum.c b/polarssl-0.14.0/library/bignum.c index cf39845..dbe85d8 100644 --- a/polarssl-0.14.0/library/bignum.c +++ b/polarssl-0.14.0/library/bignum.c @@ -225,6 +225,7 @@ int mpi_size( const mpi *X ) return( ( mpi_msb( X ) + 7 ) >> 3 ); } +#if 0 /* * Convert an ASCII character to digit value */ @@ -310,7 +311,6 @@ cleanup: return( ret ); } -#if 0 /* * Helper to write the digits high-order first */ diff --git a/src/call-rsa.c b/src/call-rsa.c index e64f356..13fa819 100644 --- a/src/call-rsa.c +++ b/src/call-rsa.c @@ -47,7 +47,7 @@ rsa_sign (const uint8_t *raw_message, uint8_t *output, int msg_len, rsa_init (&rsa_ctx, RSA_PKCS_V15, 0); rsa_ctx.len = KEY_CONTENT_LEN; - mpi_read_string (&rsa_ctx.E, 16, "10001"); + mpi_lset (&rsa_ctx.E, 0x10001); mpi_read_binary (&rsa_ctx.P, &kd->data[0], rsa_ctx.len / 2); mpi_read_binary (&rsa_ctx.Q, &kd->data[KEY_CONTENT_LEN/2], rsa_ctx.len / 2); mpi_mul_mpi (&rsa_ctx.N, &rsa_ctx.P, &rsa_ctx.Q); @@ -138,7 +138,7 @@ rsa_decrypt (const uint8_t *input, uint8_t *output, int msg_len, rsa_ctx.len = msg_len; DEBUG_WORD (msg_len); - mpi_read_string (&rsa_ctx.E, 16, "10001"); + mpi_lset (&rsa_ctx.E, 0x10001); mpi_read_binary (&rsa_ctx.P, &kd->data[0], KEY_CONTENT_LEN / 2); mpi_read_binary (&rsa_ctx.Q, &kd->data[KEY_CONTENT_LEN/2], KEY_CONTENT_LEN / 2); @@ -191,7 +191,7 @@ rsa_verify (const uint8_t *pubkey, const uint8_t *hash, const uint8_t *sig) rsa_init (&rsa_ctx, RSA_PKCS_V15, 0); rsa_ctx.len = KEY_CONTENT_LEN; - mpi_read_string (&rsa_ctx.E, 16, "10001"); + mpi_lset (&rsa_ctx.E, 0x10001); mpi_read_binary (&rsa_ctx.N, pubkey, KEY_CONTENT_LEN); DEBUG_INFO ("RSA verify...");