| RSA BSAFE Micro Edition Suite |
Streamlined security for mobile and embedded devices |
 
![]() |
00001 /* $Id: r_types.h,v 1.45 2005/04/05 02:23:18 jmckee Exp $ */
00002 /*
00003 * Copyright (C) 1998-2003 RSA Security Inc. All rights reserved.
00004 *
00005 * This work contains proprietary information of RSA Security.
00006 * Distribution is limited to authorized licensees of RSA
00007 * Security. Any unauthorized reproduction, distribution or
00008 * modification of this work is strictly prohibited.
00009 */
00014 #ifndef HEADER_COMMON_R_TYPES_H
00015 #define HEADER_COMMON_R_TYPES_H
00016
00017 #ifdef __cplusplus
00018 extern "C" {
00019 #endif
00020
00045 /* This gets set if the flags field if the we need to 'free' the
00046 * R_RANDOM when we call R_rand_free(). If it is not set, the
00047 * rand_ctrl will only be called to clean things up.
00048 */
00049 #define R_RANDOM_FLG_MALLOCED 0x01
00050
00051 /* Portable form of a random callback function */
00056 typedef struct r_random_st R_RANDOM;
00060 struct r_random_st
00061 {
00067 int (*rand_bytes)(R_RANDOM *ctx,unsigned char *bytes,int len);
00072 int (*rand_seed)(R_RANDOM *ctx,unsigned char *bytes,int len);
00081 int (*rand_ctrl)(R_RANDOM *ctx,int op,char *arg);
00085 char *arg;
00089 int flags; /* normally set to zero */
00090 };
00095 typedef struct r_surrender_st R_SURRENDER;
00100 struct r_surrender_st
00101 {
00102 /* Return 0 to continue, non-zero to 'cancel' function */
00107 int (*callback)(R_SURRENDER *ctx,int function,int num);
00111 char *arg;
00112 };
00113
00114 typedef struct r_fixed_point_number_st R_FIXED_POINT_NUMBER;
00115 struct r_fixed_point_number_st
00116 {
00117 unsigned long hi;
00118 unsigned long lo;
00119 };
00120
00126 typedef struct r_indexed_info_st R_INDEXED_INFO;
00130 struct r_indexed_info_st
00131 {
00133 int index;
00135 void *data;
00137 unsigned int len;
00139 int value;
00140 };
00141
00146 typedef struct r_id_info_st R_ID_INFO;
00151 struct r_id_info_st
00152 {
00154 int info_id;
00156 void *value;
00157 };
00158
00171 typedef int R_FLAG_COPY;
00172
00173 /*
00174 * action flag app lib
00175 * obj_get BY_VAL F X
00176 * BY_REF X F [app will not free "obj" until it is
00177 * BY_ASSIGN F X finished with the returned reference]
00178 * obj_set BY_VAL F X
00179 * BY_REF F X [app will not free passed reference
00180 * BY_ASSIGN X F until after it has freed "obj"]
00181 *
00182 * BY_REF makes the lifetime of the two objects linked and it is up to
00183 * the application to manage the objects in a manner that preserves this
00184 * relationship.
00185 */
00186
00191 #define R_FLAG_COPY_BY_VALUE 0x0000
00192
00197 #define R_FLAG_COPY_BY_REFERENCE 0x0001
00198
00203 #define R_FLAG_COPY_BY_ASSIGN 0x0002
00204
00208 #define R_FLAG_COPY_DEFAULT R_FLAG_COPY_BY_VALUE
00209
00225 typedef int R_FLAG_SHARE;
00226
00231 #define R_FLAG_SHARE_NONE 0x0000
00232
00238 #define R_FLAG_SHARE_DATA 0x0001
00239
00241 #define R_FLAG_SHARE_DEFAULT R_FLAG_SHARE_NONE
00242
00247 #ifdef __cplusplus
00248 }
00249 #endif
00250
00251 #endif
00252