aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dirparse
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-02-05 12:06:24 -0500
committerNick Mathewson <nickm@torproject.org>2020-02-05 12:06:24 -0500
commit1a375c3b193f73e73e7c9c640dccdf1eb027234b (patch)
tree3444722df1410fda8a33c3aa6f553a69833b93f7 /src/feature/dirparse
parent7afb95d3e3021b78619e76a13ea261e68ecd3162 (diff)
parentd0bce65ce2426793a975e691204c3fb2ac667f66 (diff)
downloadtor-1a375c3b193f73e73e7c9c640dccdf1eb027234b.tar.gz
tor-1a375c3b193f73e73e7c9c640dccdf1eb027234b.zip
Merge branch 'trove_2020_002_035' into trove_2020_002_041
Resolved Conflicts: src/feature/dirparse/parsecommon.c
Diffstat (limited to 'src/feature/dirparse')
-rw-r--r--src/feature/dirparse/parsecommon.c9
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.");
}