-/* $OpenBSD: x509.c,v 1.84 2024/03/22 03:38:12 job Exp $ */
+/* $OpenBSD: x509.c,v 1.85 2024/03/24 00:38:58 tb Exp $ */
/*
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
* Copyright (c) 2021 Claudio Jeker <claudio@openbsd.org>
if (i == NULL)
goto out;
+ if (ASN1_STRING_length(i) > 20) {
+ warnx("%s: %s: want 20 octets or fewer, have more.",
+ __func__, fn);
+ goto out;
+ }
+
seqnum = ASN1_INTEGER_to_BN(i, NULL);
if (seqnum == NULL) {
warnx("%s: ASN1_INTEGER_to_BN error", fn);
goto out;
}
- if (BN_num_bytes(seqnum) > 20) {
- warnx("%s: %s: want 20 octets or fewer, have more.",
- __func__, fn);
- goto out;
- }
-
s = BN_bn2hex(seqnum);
if (s == NULL)
warnx("%s: BN_bn2hex error", fn);