Reject 128-byte keys that are not 1024-bit
commitbbf2fee8ff7bbb8f645b7d973cd84bc97e93ae54
authorNick Mathewson <nickm@torproject.org>
Thu, 2 Jun 2011 16:32:59 +0000 (2 12:32 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 3 Jun 2011 15:31:19 +0000 (3 11:31 -0400)
treed9db511a467af11a94c9e4d375f14cc9383638bc
parent1d8bcba067ef8d96ebe022f06459d55c308343ec
Reject 128-byte keys that are not 1024-bit

When we added the check for key size, we required that the keys be
128 bytes.  But RSA_size (which defers to BN_num_bytes) will return
128 for keys of length 1017..1024.  This patch adds a new
crypto_pk_num_bits() that returns the actual number of significant
bits in the modulus, and uses that to enforce key sizes.

Also, credit the original bug3318 in the changes file.
changes/bug3318
src/common/crypto.c
src/common/crypto.h
src/or/routerparse.c
src/test/test_crypto.c