OID (Object Identifier) More...
#include "core/crypto.h"
Go to the source code of this file.
Macros | |
#define | OID_MORE_FLAG 0x80 |
#define | OID_VALUE_MASK 0x7F |
Functions | |
error_t | oidCheck (const uint8_t *oid, size_t oidLen) |
Check whether the specified object identifier is valid. More... | |
int_t | oidComp (const uint8_t *oid1, size_t oidLen1, const uint8_t *oid2, size_t oidLen2) |
Compare object identifiers. More... | |
bool_t | oidMatch (const uint8_t *oid, size_t oidLen, const uint8_t *subtree, size_t subtreeLen, const uint8_t *mask, size_t maskLen) |
Check whether an OID matches the specified subtree. More... | |
uint_t | oidCountSubIdentifiers (const uint8_t *oid, size_t oidLen) |
Calculate the number of sub-identifiers. More... | |
error_t | oidEncodeSubIdentifier (uint8_t *oid, size_t maxOidLen, size_t *pos, uint32_t value) |
Encode OID sub-identifier. More... | |
error_t | oidDecodeSubIdentifier (const uint8_t *oid, size_t oidLen, size_t *pos, uint32_t *value) |
Decode OID sub-identifier. More... | |
error_t | oidFromString (const char_t *str, uint8_t *oid, size_t maxOidLen, size_t *oidLen) |
Convert a string representation of an OID to a binary OID. More... | |
char_t * | oidToString (const uint8_t *oid, size_t oidLen, char_t *str, size_t maxStrLen) |
Convert a binary OID to a string representation. More... | |
error_t | maskFromString (const char_t *str, uint8_t *mask, size_t maxMaskLen, size_t *maskLen) |
Convert a bit mask to binary representation. More... | |
Detailed Description
OID (Object Identifier)
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneCRYPTO Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file oid.h.
Macro Definition Documentation
◆ OID_MORE_FLAG
◆ OID_VALUE_MASK
Function Documentation
◆ maskFromString()
Convert a bit mask to binary representation.
- Parameters
-
[in] str NULL-terminated string representing the bit mask [out] mask Pointer to the buffer where to store the resulting mask [in] maxMaskLen Maximum number of bytes the buffer can hold [out] maskLen Length of the mask
- Returns
- Error code
◆ oidCheck()
error_t oidCheck | ( | const uint8_t * | oid, |
size_t | oidLen | ||
) |
◆ oidComp()
int_t oidComp | ( | const uint8_t * | oid1, |
size_t | oidLen1, | ||
const uint8_t * | oid2, | ||
size_t | oidLen2 | ||
) |
Compare object identifiers.
- Parameters
-
[in] oid1 Pointer the first OID [in] oidLen1 Length of the first OID, in bytes [in] oid2 Pointer the second OID [in] oidLen2 Length of the second OID, in bytes
- Returns
- Comparison result
- Return values
-
0 Objects identifiers are equal -1 The first OID lexicographically precedes the second OID 1 The second OID lexicographically precedes the first OID
◆ oidCountSubIdentifiers()
uint_t oidCountSubIdentifiers | ( | const uint8_t * | oid, |
size_t | oidLen | ||
) |
◆ oidDecodeSubIdentifier()
error_t oidDecodeSubIdentifier | ( | const uint8_t * | oid, |
size_t | oidLen, | ||
size_t * | pos, | ||
uint32_t * | value | ||
) |
◆ oidEncodeSubIdentifier()
error_t oidEncodeSubIdentifier | ( | uint8_t * | oid, |
size_t | maxOidLen, | ||
size_t * | pos, | ||
uint32_t | value | ||
) |
◆ oidFromString()
◆ oidMatch()
bool_t oidMatch | ( | const uint8_t * | oid, |
size_t | oidLen, | ||
const uint8_t * | subtree, | ||
size_t | subtreeLen, | ||
const uint8_t * | mask, | ||
size_t | maskLen | ||
) |
Check whether an OID matches the specified subtree.
- Parameters
-
[in] oid Pointer to the object identifier [in] oidLen Length of the OID, in bytes [in] subtree Pointer to the subtree [in] subtreeLen Length of the subtree, in bytes [in] mask Pointer to the mask [in] maskLen Length of the mask, in bytes
- Returns
- TRUE if the OID matches the specified subtree, else FALSE
◆ oidToString()
Convert a binary OID to a string representation.
- Parameters
-
[in] oid Object identifier [in] oidLen Length of the object identifier, in bytes [out] str NULL-terminated string representing the OID [in] maxStrLen Maximum length of the resulting string
- Returns
- Pointer to the formatted string