aboutsummaryrefslogtreecommitdiff
path: root/asn1.c
diff options
context:
space:
mode:
Diffstat (limited to 'asn1.c')
-rw-r--r--asn1.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/asn1.c b/asn1.c
index 1799ac9..d57ec96 100644
--- a/asn1.c
+++ b/asn1.c
@@ -49,7 +49,6 @@
*/
#include <stdint.h>
-#include <assert.h>
#include "hal.h"
#include "hal_internal.h"
@@ -197,7 +196,7 @@ hal_error_t hal_asn1_encode_integer(const fp_int * const bn,
if (der == NULL || err != HAL_OK)
return err;
- assert(hlen + vlen <= der_max);
+ hal_assert(hlen + vlen <= der_max);
der += hlen;
if (leading_zero)
@@ -240,7 +239,7 @@ hal_error_t hal_asn1_encode_uint32(const uint32_t n,
if (der == NULL || err != HAL_OK)
return err;
- assert(hlen + vlen <= der_max);
+ hal_assert(hlen + vlen <= der_max);
der += hlen;
@@ -276,7 +275,7 @@ hal_error_t hal_asn1_encode_octet_string(const uint8_t * const data, const si
if (der == NULL)
return HAL_OK;
- assert(hlen + data_len <= der_max);
+ hal_assert(hlen + data_len <= der_max);
/*
* Handle data early, in case it was staged into our output buffer.
@@ -365,8 +364,8 @@ hal_error_t hal_asn1_encode_spki(const uint8_t * const alg_oid, const size_t a
*d++ = 0x00;
d += pubkey_len; /* pubkey handled early, above. */
- assert(d == der + hlen_spki + vlen);
- assert(d <= der + der_max);
+ hal_assert(d == der + hlen_spki + vlen);
+ hal_assert(d <= der + der_max);
return HAL_OK;
}
@@ -457,8 +456,8 @@ hal_error_t hal_asn1_encode_pkcs8_privatekeyinfo(const uint8_t * const alg_oid,
d += hlen;
d += privkey_len; /* privkey handled early, above. */
- assert(d == der_end);
- assert(d <= der + der_max);
+ hal_assert(d == der_end);
+ hal_assert(d <= der + der_max);
return HAL_OK;
}
@@ -525,8 +524,8 @@ hal_error_t hal_asn1_encode_pkcs8_encryptedprivatekeyinfo(const uint8_t * const
d += data_len; /* data handled early, above. */
- assert(d == der + hlen_pkcs8 + vlen);
- assert(d <= der + der_max);
+ hal_assert(d == der + hlen_pkcs8 + vlen);
+ hal_assert(d <= der + der_max);
return HAL_OK;
}
@@ -542,7 +541,7 @@ hal_error_t hal_asn1_decode_header(const uint8_t tag,
const uint8_t * const der, size_t der_max,
size_t *hlen, size_t *vlen)
{
- assert(der != NULL && hlen != NULL && vlen != NULL);
+ hal_assert(der != NULL && hlen != NULL && vlen != NULL);
if (der_max < 2 || der[0] != tag)
return HAL_ERROR_ASN1_PARSE_FAILED;