According to RFC 5652, unsignedAttrs are a SET OF at least one member,
however the CMS code doesn't actually check for this. Since SET OF may
contain zero members in general, an empty set of unsignedAttrs would
be accepted. Catch this by explicitly checking for a -1 return value.
ok claudio
-/* $OpenBSD: cms.c,v 1.14 2022/03/25 08:19:04 claudio Exp $ */
+/* $OpenBSD: cms.c,v 1.15 2022/03/28 08:19:15 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
"signed attribute", fn);
goto out;
}
- if (CMS_unsigned_get_attr_count(si) > 0) {
+ if (CMS_unsigned_get_attr_count(si) != -1) {
cryptowarnx("%s: RFC 6488: CMS has unsignedAttrs", fn);
goto out;
}