diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-03-17 15:22:36 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-03-17 15:22:36 -0400 |
commit | 85141a3a74efb0db29ff98667e83b06208d1c926 (patch) | |
tree | e573c9ee80f255ac5771b39428fc7f5ef1ccd972 /src/feature/dirparse | |
parent | 4ee2699416dc612b859f6ba77e6fcd2e7e55c1b7 (diff) | |
parent | 57b1d0848e9b42670d6f33e37a2095740726e2b1 (diff) | |
download | tor-85141a3a74efb0db29ff98667e83b06208d1c926.tar.gz tor-85141a3a74efb0db29ff98667e83b06208d1c926.zip |
Merge branch 'maint-0.4.1' into maint-0.4.2
Diffstat (limited to 'src/feature/dirparse')
-rw-r--r-- | src/feature/dirparse/parsecommon.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/feature/dirparse/parsecommon.c b/src/feature/dirparse/parsecommon.c index 036a51689c..6c2c4b06b7 100644 --- a/src/feature/dirparse/parsecommon.c +++ b/src/feature/dirparse/parsecommon.c @@ -403,12 +403,19 @@ get_next_token(memarea_t *area, } if (!strcmp(tok->object_type, "RSA PUBLIC KEY")) { /* If it's a public key */ + if (o_syn != NEED_KEY && o_syn != NEED_KEY_1024 && o_syn != OBJ_OK) { + RET_ERR("Unexpected public key."); + } tok->key = crypto_pk_asn1_decode(tok->object_body, tok->object_size); if (! tok->key) RET_ERR("Couldn't parse public key."); } else if (!strcmp(tok->object_type, "RSA PRIVATE KEY")) { /* private key */ + if (o_syn != NEED_SKEY_1024 && o_syn != OBJ_OK) { + RET_ERR("Unexpected private key."); + } tok->key = crypto_pk_asn1_decode_private(tok->object_body, - tok->object_size); + tok->object_size, + 1024); if (! tok->key) RET_ERR("Couldn't parse private key."); } |