You've already forked opencryptoki
mirror of
https://github.com/opencryptoki/opencryptoki.git
synced 2026-10-24 05:39:17 +03:00
Better not trust user supplied attribute-array attributes blindly, but validate that its elements are known attribute types, and that the elements value and value length are consistent. Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
67 lines
2.3 KiB
C
67 lines
2.3 KiB
C
/*
|
|
* COPYRIGHT (c) International Business Machines Corp. 2012-2017
|
|
*
|
|
* This program is provided under the terms of the Common Public License,
|
|
* version 1.0 (CPL-1.0). Any use, reproduction or distribution for this
|
|
* software constitutes recipient's acceptance of CPL-1.0 terms which can be
|
|
* found in the file LICENSE file or at
|
|
* https://opensource.org/licenses/cpl1.0.php
|
|
*/
|
|
|
|
/*
|
|
* OpenCryptoki ICSF token - LDAP functions
|
|
* Author: Marcelo Cerri (mhcerri@br.ibm.com)
|
|
*
|
|
*/
|
|
|
|
#ifndef _ATTRIBUTES_H_
|
|
#define _ATTRIBUTES_H_
|
|
|
|
#include "pkcs11types.h"
|
|
|
|
void free_attribute_array(CK_ATTRIBUTE_PTR attrs, CK_ULONG attrs_len);
|
|
|
|
void cleanse_and_free_attribute_array(CK_ATTRIBUTE_PTR attrs,
|
|
CK_ULONG attrs_len);
|
|
void cleanse_and_free_attribute_array2(CK_ATTRIBUTE_PTR attrs,
|
|
CK_ULONG attrs_len,
|
|
CK_BBOOL free_array);
|
|
|
|
CK_RV dup_attribute_array(CK_ATTRIBUTE_PTR orig, CK_ULONG orig_len,
|
|
CK_ATTRIBUTE_PTR *p_dest, CK_ULONG *p_dest_len);
|
|
|
|
CK_RV dup_attribute_array_no_alloc(CK_ATTRIBUTE_PTR orig, CK_ULONG num_attrs,
|
|
CK_ATTRIBUTE_PTR dest);
|
|
|
|
CK_ATTRIBUTE_PTR get_attribute_by_type(CK_ATTRIBUTE_PTR attrs,
|
|
CK_ULONG attrs_len, CK_ULONG type);
|
|
|
|
CK_RV get_ulong_attribute_by_type(CK_ATTRIBUTE_PTR attrs,
|
|
CK_ULONG attrs_len, CK_ULONG type,
|
|
CK_ULONG *value);
|
|
|
|
CK_RV get_bool_attribute_by_type(CK_ATTRIBUTE_PTR attrs,
|
|
CK_ULONG attrs_len, CK_ULONG type,
|
|
CK_BBOOL *value);
|
|
|
|
CK_RV add_to_attribute_array(CK_ATTRIBUTE_PTR *p_attrs,
|
|
CK_ULONG_PTR p_attrs_len, CK_ULONG type,
|
|
CK_BYTE_PTR value, CK_ULONG value_len);
|
|
|
|
CK_BBOOL compare_attribute(CK_ATTRIBUTE_PTR a1, CK_ATTRIBUTE_PTR a2);
|
|
|
|
CK_BBOOL compare_attribute_array(CK_ATTRIBUTE_PTR a1, CK_ULONG a1_len,
|
|
CK_ATTRIBUTE_PTR a2, CK_ULONG a2_len);
|
|
|
|
CK_RV validate_attribute_array(CK_ATTRIBUTE_PTR attrs, CK_ULONG num_attrs);
|
|
|
|
#ifdef DEBUG
|
|
/* Debug function: dump one attribute */
|
|
void dump_attr(CK_ATTRIBUTE_PTR a);
|
|
#define TRACE_DEBUG_DUMPATTR(x) dump_attr(x)
|
|
#else
|
|
#define TRACE_DEBUG_DUMPATTR(...)
|
|
#endif
|
|
|
|
#endif
|