nrfxlib API 3.3.99
Loading...
Searching...
No Matches
cc3xx_asn1_util.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
15#ifndef CC3XX_INTERNAL_ASN1_UTIL_H
16#define CC3XX_INTERNAL_ASN1_UTIL_H
17
18#include <psa/crypto.h>
19#include <stdint.h>
20
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
36#define CC3XX_TAG_ASN1_INTEGER 0x02
37#define CC3XX_TAG_ASN1_SEQUENCE 0x10
38#define CC3XX_TAG_ASN1_CONSTRUCTED 0x20
39
53int cc3xx_asn1_write_len(unsigned char **p, const unsigned char *start, size_t len);
54
67int cc3xx_asn1_write_tag(unsigned char **p, const unsigned char *start,
68 unsigned char tag);
69
84int cc3xx_asn1_write_big_integer(unsigned char **p, const unsigned char *start,
85 uint8_t *data, size_t data_size);
86
101int cc3xx_asn1_write_int(unsigned char **p, unsigned char *start, int val);
102
121psa_status_t cc3xx_asn1_get_tag(unsigned char **p, const unsigned char *end, size_t *len,
122 int tag);
123
141psa_status_t cc3xx_asn1_get_len(unsigned char **p, const unsigned char *end,
142 size_t *len);
143
159psa_status_t cc3xx_asn1_get_int(unsigned char **p, const unsigned char *end, int *val);
160
161#ifdef __cplusplus
162}
163#endif
164#endif /* CC3XX_INTERNAL_ASN1_UTIL_H */
int cc3xx_asn1_write_int(unsigned char **p, unsigned char *start, int val)
Write an int tag and value in ASN.1 format.
int cc3xx_asn1_write_tag(unsigned char **p, const unsigned char *start, unsigned char tag)
Write an ASN.1 tag in ASN.1 format.
psa_status_t cc3xx_asn1_get_tag(unsigned char **p, const unsigned char *end, size_t *len, int tag)
Get the tag and length of the element. Check for the requested tag. Updates the pointer to immediatel...
psa_status_t cc3xx_asn1_get_len(unsigned char **p, const unsigned char *end, size_t *len)
Get the length of an ASN.1 element. Updates the pointer to immediately behind the length.
int cc3xx_asn1_write_big_integer(unsigned char **p, const unsigned char *start, uint8_t *data, size_t data_size)
Write an int tag and value in ASN.1 format represented as a uint8_t array.
int cc3xx_asn1_write_len(unsigned char **p, const unsigned char *start, size_t len)
Write a length field in ASN.1 format.
psa_status_t cc3xx_asn1_get_int(unsigned char **p, const unsigned char *end, int *val)
Retrieve an integer ASN.1 tag and its value. Updates the pointer to immediately behind the full tag.