diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-03-17 15:22:02 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-03-17 15:22:02 -0400 |
commit | 3c8a4b8fbdb42b2fa98ddec8b6d7ed3202201eb1 (patch) | |
tree | 6fbbb068b07232188a6a98e891b7d7a4c18d0638 /src/feature | |
parent | cec647ff3eab20c97a744a59b808eb49760acfd3 (diff) | |
parent | 9163781039b96e859fc102f003a274e9716cc02d (diff) | |
download | tor-3c8a4b8fbdb42b2fa98ddec8b6d7ed3202201eb1.tar.gz tor-3c8a4b8fbdb42b2fa98ddec8b6d7ed3202201eb1.zip |
Merge branch 'trove_2020_002_041' into maint-0.4.1
Diffstat (limited to 'src/feature')
-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."); } |