Skip to content

Commit

Permalink
Fix QCBOR version check
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurence Lundblade committed Jan 10, 2024
1 parent 7577501 commit 4ee4617
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 9 additions & 1 deletion inc/t_cose/t_cose_common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* t_cose_common.h
*
* Copyright 2019-2022, Laurence Lundblade
* Copyright 2019-2024, Laurence Lundblade
*
* SPDX-License-Identifier: BSD-3-Clause
*
Expand Down Expand Up @@ -59,6 +59,14 @@ extern "C" {
*/


/**
* Semantic versioning for t_cose x.y.z. Note that these were not defined
* for some releases of t_cose 1.x so !defined(T_COSE_VERSION_MAJOR)
* indicates t_cose 1.x.
*/
#define T_COSE_VERSION_MAJOR 1
#define T_COSE_VERSION_MINOR 1
#define T_COSE_VERSION_PATCH 2


/**
Expand Down
8 changes: 5 additions & 3 deletions src/t_cose_sign1_sign.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* t_cose_sign1_sign.c
*
* Copyright (c) 2018-2021, Laurence Lundblade. All rights reserved.
* Copyright (c) 2018-2024, Laurence Lundblade. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
Expand All @@ -15,11 +15,13 @@
#include "t_cose_util.h"
#include "t_cose_short_circuit.h"

#ifndef QCBOR_1_1
// The OpenBytes API we use was only added in 1.1.

#if !(defined(QCBOR_1_1) || QCBOR_VERSION_MAJOR >= 2 || (QCBOR_VERSION_MAJOR == 1 && QCBOR_VERSION_MINOR >= 1))
/* The OpenBytes API we use was only added in 1.1. */
#error t_cose requires QCBOR 1.1 or greater
#endif


/**
* \file t_cose_sign1_sign.c
*
Expand Down

0 comments on commit 4ee4617

Please sign in to comment.