-/* $OpenBSD: extern.h,v 1.199 2024/01/18 14:34:26 job Exp $ */
+/* $OpenBSD: extern.h,v 1.200 2024/01/31 06:54:43 tb Exp $ */
/*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
*
struct mft *mft_parse(X509 **, const char *, int, const unsigned char *,
size_t);
struct mft *mft_read(struct ibuf *);
-int mft_compare(const struct mft *, const struct mft *);
+int mft_compare_seqnum(const struct mft *, const struct mft *);
void roa_buffer(struct ibuf *, const struct roa *);
void roa_free(struct roa *);
-/* $OpenBSD: mft.c,v 1.100 2023/12/11 15:50:23 job Exp $ */
+/* $OpenBSD: mft.c,v 1.101 2024/01/31 06:54:43 tb Exp $ */
/*
* Copyright (c) 2022 Theo Buehler <tb@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
}
/*
- * Compare the manifestNumber of two MFT files.
- * Returns 1 if first MFT should be used, 0 if both are equal, and -1 if the
- * second MFT should be used.
+ * Compare the manifestNumber of two mft files.
*/
int
-mft_compare(const struct mft *a, const struct mft *b)
+mft_compare_seqnum(const struct mft *a, const struct mft *b)
{
int r;
- if (b == NULL)
- return 1;
- if (a == NULL)
- return -1;
-
r = strlen(a->seqnum) - strlen(b->seqnum);
if (r > 0) /* seqnum in a is longer -> higher */
return 1;
-/* $OpenBSD: parser.c,v 1.111 2024/01/31 06:53:21 tb Exp $ */
+/* $OpenBSD: parser.c,v 1.112 2024/01/31 06:54:43 tb Exp $ */
/*
* Copyright (c) 2019 Claudio Jeker <claudio@openbsd.org>
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
* a smaller sequence number.
*/
- if ((seqnum_cmp = mft_compare(mft, cached_mft)) < 0) {
+ if ((seqnum_cmp = mft_compare_seqnum(mft, cached_mft)) < 0) {
warnx("%s: unexpected manifest number (want >= #%s, got #%s)",
*file, cached_mft->seqnum, mft->seqnum);
goto err;