Skip to content

Commit 6ca519c

Browse files
committed
descriptor: explicitly disallow wrappers on ct() and blinding keys
1 parent a170f50 commit 6ca519c

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/ctest/test_descriptor.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,6 +1609,10 @@ static const struct descriptor_test {
16091609
"descriptor errchk - empty ct()",
16101610
"ct()",
16111611
WALLY_NETWORK_LIQUID, 0, 0, 0, NULL, 0, NULL, ""
1612+
}, {
1613+
"descriptor errchk - wrapper on ct()",
1614+
"v:ct(slip77(slip77_key),elpkh(key_4))",
1615+
WALLY_NETWORK_LIQUID, 0, 0, 0, NULL, 0, NULL, ""
16121616
}, {
16131617
"descriptor errchk - single child ct()",
16141618
"ct(slip77(slip77_key))",
@@ -1637,6 +1641,10 @@ static const struct descriptor_test {
16371641
"descriptor errchk - invalid blinding key in slip77()",
16381642
"ct(slip77(010101010101010101),elpkh(key_4))",
16391643
WALLY_NETWORK_LIQUID, 0, 0, 0, NULL, 0, NULL, ""
1644+
}, {
1645+
"descriptor errchk - wrapper on slip77()",
1646+
"ct(v:slip77(slip77_key),elpkh(key_4))",
1647+
WALLY_NETWORK_LIQUID, 0, 0, 0, NULL, 0, NULL, ""
16401648
}, {
16411649
"descriptor errchk - ELIP 150 WIF private key",
16421650
"ct(L3jXxwef3fpB7hcrFozcWgHeJCPSAFiZ1Ji2YJMPxceaGvy3PC1q,elwpkh(03774eec7a3d550d18e9f89414152025b3b0ad6a342b19481f702d843cff06dfc4))#gcy6hcfz",

src/descriptor.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ static int verify_thresh(ms_ctx *ctx, ms_node *node)
10491049
static int verify_ct(ms_ctx *ctx, ms_node *node)
10501050
{
10511051
(void)ctx;
1052-
if (node->parent)
1052+
if (node->parent || node->wrapper_str[0])
10531053
return WALLY_EINVAL;
10541054
if (node->child->kind != KIND_DESCRIPTOR_SLIP77 &&
10551055
!(node->child->kind & KIND_KEY) &&
@@ -1084,7 +1084,8 @@ static int verify_slip77(ms_ctx *ctx, ms_node *node)
10841084
if (!node->parent || node->parent->kind != KIND_DESCRIPTOR_CT)
10851085
return WALLY_EINVAL;
10861086
if (node->child->builtin || !(node->child->kind & KIND_RAW) ||
1087-
node->child->data_len != 32)
1087+
node->child->data_len != 32 || node->wrapper_str[0])
1088+
10881089
return WALLY_EINVAL;
10891090
return WALLY_OK;
10901091
}

0 commit comments

Comments
 (0)