Main Page | Data Structures | File List | Data Fields | Globals

ss-util.h File Reference

Secure Storage util function header file. More...

Go to the source code of this file.

Data Structures

struct  aes_key_st

Defines

#define GETU32(pt)   (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3]))
#define PUTU32(ct, st)   { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); }
#define MAXKC   (256/32)
#define MAXKB   (256/8)
#define MAXNR   14
#define AES_BLOCK_SIZE   16
#define AES_MAXNR   14
#define KEYSIZE   16
#define HEX_KEYSIZE   32
#define IVSIZE   8
#define HEX_IVSIZE   16

Typedefs

typedef unsigned int u32
typedef unsigned short u16
typedef unsigned char u8
typedef aes_key_st AES_KEY

Functions

size_t lock_memory (char *addr, size_t size)
size_t unlock_memory (char *addr, size_t size)
void ivec_inc (unsigned char *counter)
void ivec_dec (unsigned char *counter)
void securestorage_AES_ctr (const unsigned char *in, unsigned char *out, const unsigned long length, const AES_KEY *key, unsigned char ivec[16], unsigned char ecount_buf[16], unsigned int *num)
 Encrypt input string using AES_ctr algorithm.

int AES_set_encrypt_key (const unsigned char *userKey, const int bits, AES_KEY *key)
int AES_set_decrypt_key (const unsigned char *userKey, const int bits, AES_KEY *key)
void AES_encrypt (const unsigned char *in, unsigned char *out, const AES_KEY *key)
void AES_decrypt (const unsigned char *in, unsigned char *out, const AES_KEY *key)
int ss_rand (int size, unsigned char *out)
 Generate random data function.

int ss_generate_surl (char **dest_surl, char *dest_file, char *vo, char *guid)
 Generate SURL.

int ss_get_lfchome (const char *input_lfn, char **lfn_new)
 Get LFC Home.

int ss_get_surl (char *lfn, char **surl, char *vo, char *se, int insecure)
 Get SURL.

int ss_check_lfn (char *lfn, char *vo)
 Check LFN existence.

const char * securestorage_error (int errnum)
 Return descriptive string of error.


Detailed Description

Secure Storage util function header file.

Author:
Giordano Scuderi
Date:
2007

Definition in file ss-util.h.


Define Documentation

#define AES_BLOCK_SIZE   16
 

Definition at line 90 of file ss-util.h.

Referenced by lcg_scp(), lcg_scr(), securestorage_AES_ctr(), securestorage_lseek(), and securestorage_open_extended().

#define AES_MAXNR   14
 

Definition at line 91 of file ss-util.h.

#define GETU32 pt   )     (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3]))
 

Definition at line 71 of file ss-util.h.

Referenced by AES_decrypt(), AES_encrypt(), AES_set_encrypt_key(), ivec_dec(), and ivec_inc().

#define HEX_IVSIZE   16
 

Definition at line 95 of file ss-util.h.

Referenced by lcg_scp(), lcg_scr(), securestorage_lseek(), and securestorage_open_extended().

#define HEX_KEYSIZE   32
 

Definition at line 93 of file ss-util.h.

Referenced by lcg_scp(), lcg_scr(), and securestorage_open_extended().

#define IVSIZE   8
 

Definition at line 94 of file ss-util.h.

#define KEYSIZE   16
 

Definition at line 92 of file ss-util.h.

#define MAXKB   (256/8)
 

Definition at line 84 of file ss-util.h.

#define MAXKC   (256/32)
 

Definition at line 83 of file ss-util.h.

#define MAXNR   14
 

Definition at line 85 of file ss-util.h.

#define PUTU32 ct,
st   )     { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); }
 

Definition at line 72 of file ss-util.h.

Referenced by AES_decrypt(), AES_encrypt(), ivec_dec(), and ivec_inc().


Typedef Documentation

typedef struct aes_key_st AES_KEY
 

Definition at line 106 of file ss-util.h.

Referenced by AES_decrypt(), AES_encrypt(), AES_set_decrypt_key(), AES_set_encrypt_key(), lcg_scp(), lcg_scr(), and securestorage_AES_ctr().

typedef unsigned short u16
 

Definition at line 80 of file ss-util.h.

typedef unsigned int u32
 

Definition at line 78 of file ss-util.h.

Referenced by AES_decrypt(), AES_encrypt(), AES_set_decrypt_key(), and AES_set_encrypt_key().

typedef unsigned char u8
 

Definition at line 81 of file ss-util.h.


Function Documentation

void AES_decrypt const unsigned char *  in,
unsigned char *  out,
const AES_KEY key
 

Decrypt a single block. in and out can overlap AES_ctr encryption doesn't use this function!

Author:
OpenSSL Authors
See also:
AES_encrypt()
Parameters:
in is the encrypted input buffer
out is the output decrypted buffer
key is the AES_KEY struct

Definition at line 1006 of file aes_core.c.

References AES_KEY, GETU32, PUTU32, aes_key_st::rd_key, aes_key_st::rounds, and u32.

void AES_encrypt const unsigned char *  in,
unsigned char *  out,
const AES_KEY key
 

Encrypt a single block. in and out can overlap.

Author:
OpenSSL Authors
See also:
AES_decrypt()
Parameters:
in is the input buffer
out is the output encrypted buffer
key is the AES_KEY struct

Definition at line 815 of file aes_core.c.

References AES_KEY, GETU32, PUTU32, aes_key_st::rd_key, aes_key_st::rounds, and u32.

Referenced by securestorage_AES_ctr(), and securestorage_lseek().

int AES_set_decrypt_key const unsigned char *  userKey,
const int  bits,
AES_KEY key
 

Expand the cipher key into the decryption key schedule.

Definition at line 762 of file aes_core.c.

References AES_KEY, AES_set_encrypt_key(), aes_key_st::rd_key, aes_key_st::rounds, and u32.

int AES_set_encrypt_key const unsigned char *  userKey,
const int  bits,
AES_KEY key
 

Expand the cipher key into the encryption key schedule.

Definition at line 661 of file aes_core.c.

References AES_KEY, GETU32, aes_key_st::rd_key, aes_key_st::rounds, and u32.

Referenced by AES_set_decrypt_key(), lcg_scp(), lcg_scr(), and securestorage_open_extended().

void ivec_dec unsigned char *  counter  ) 
 

decrement counter (128-bit int) by 1.

Author:
Giordano Scuderi
See also:
ivec_inc()
Parameters:
counter is the counter to decrement

Definition at line 136 of file ss-util.c.

References GETU32, and PUTU32.

Referenced by securestorage_lseek().

void ivec_inc unsigned char *  counter  ) 
 

increment counter (128-bit int) by 1.

Author:
Giordano Scuderi
See also:
ivec_dec()
Parameters:
counter is the counter to increment

Definition at line 97 of file ss-util.c.

References GETU32, and PUTU32.

Referenced by securestorage_AES_ctr(), and securestorage_lseek().

size_t lock_memory char *  addr,
size_t  size
 

Lock memory.

Author:
Giordano Scuderi
See also:
unlock_memory()
Parameters:
addr is the start address of the memory to lock
size is the memory size to lock
Returns:
locked memory size if success or -1 if fail

Definition at line 223 of file ss-util.c.

Referenced by lcg_scp(), and lcg_scr().

void securestorage_AES_ctr const unsigned char *  in,
unsigned char *  out,
const unsigned long  length,
const AES_KEY key,
unsigned char  ivec[16],
unsigned char  ecount_buf[16],
unsigned int *  num
 

Encrypt input string using AES_ctr algorithm.

The input encrypted as though 128bit counter mode is being used. The extra state information to record how much of the 128bit block we have used is contained in *num, and the encrypted counter is kept in ecount_buf. Both *num and ecount_buf must be initialised with zeros before the first call to securestorage_AES_ctr().

This algorithm assumes that the counter is in the x lower bits of the IV (ivec), and that the application has full control over overflow and the rest of the IV. This implementation takes NO responsability for checking that the counter doesn't overflow into the rest of the IV when incremented.

Author:
OpenSSL authors, modified by Giordano Scuderi
Parameters:
in is the input buffer to encrypt
out is encrypted output buffer
length is the input buffer lenght
key is the AES_KEY struct initialized with AES_set_encrypt_key function
ivec is the current ivec
ecount_buf is the current encrypted ivec
num is the current position inside block of 16 byte

Definition at line 193 of file ss-util.c.

References AES_BLOCK_SIZE, AES_encrypt(), AES_KEY, and ivec_inc().

Referenced by lcg_scp(), lcg_scr(), securestorage_read(), and securestorage_write().

const char* securestorage_error int  errnum  ) 
 

Return descriptive string of error.

for errnum provided

Author:
Giordano Scuderi
Parameters:
errnum is the Secure Storage error number
Returns:
A descriptive String of error number provided or "Unknown Error 'errnum'" if error number is wrong.

Definition at line 547 of file ss-util.c.

References ss_errlist.

Referenced by lcg_scp(), lcg_scr(), and main().

int ss_check_lfn char *  lfn,
char *  vo
 

Check LFN existence.

This function check if provided lfn exist in LFC Catalog

Author:
Giordano Scuderi
Parameters:
lfn is the Logical File Name (LFN)
vo is the Virtual Organization name
Returns:
0 if not exist, 1 if exist or < 0 if fail (errno is set appropriately).

Definition at line 504 of file ss-util.c.

References errno, and insecure.

Referenced by lcg_scr(), lcg_sdel(), securestorage_del_extended(), and securestorage_open_extended().

int ss_generate_surl char **  dest_surl,
char *  dest_file,
char *  vo,
char *  guid
 

Generate SURL.

This function generate a valid SURL ( in srm:// format ).

Author:
Giordano Scuderi
See also:
ss_get_surl()
Parameters:
dest_surl is the buffer that contain generated SURL
dest_file is the hostname of Storage Element
vo is the Virtual Organization name
guid is the Grid Unique Identifier (if NULL, a new GUID will be generated)
Returns:
0 if success or -1 if fail

Definition at line 293 of file ss-util.c.

References errno.

Referenced by lcg_scr(), and securestorage_open_extended().

int ss_get_lfchome const char *  input_lfn,
char **  lfn_new
 

Get LFC Home.

This function add LFC_HOME To your current LFN.

Author:
Giordano Scuderi
Parameters:
input_lfn is the Input Logical File Name (LFN)
lfn_new is the output buffer that contain complete LFN path (with LFC_HOME environment variable added)
Returns:
0 if success or -1 if fail

Definition at line 363 of file ss-util.c.

References LCG_MAXPATHLEN.

Referenced by lcg_scp(), lcg_scr(), lcg_sdel(), securestorage_del_extended(), securestorage_mkdir(), securestorage_open_extended(), securestorage_opendir(), securestorage_rmdir(), and securestorage_statg().

int ss_get_surl char *  lfn,
char **  surl,
char *  vo,
char *  se,
int  insecure
 

Get SURL.

This function get the SURL for the input LFN given.

Author:
Giordano Scuderi
Parameters:
lfn is the Logical File Name (LFN)
surl is the output buffer that contain SURL
vo is the Virtual Organization name
se is the destination Storage Element name
insecure 
Returns:
0 if success or -1 if fail

Definition at line 438 of file ss-util.c.

References errno, insecure, and SS_ENOENT.

Referenced by lcg_scp(), and securestorage_open_extended().

int ss_rand int  size,
unsigned char *  out
 

Generate random data function.

This function generate random data for the specified size, for using it on encryption process.

Author:
Giordano Scuderi
See also:
ss_delete_key()

ss_send_key()

ss_get_key()

Parameters:
size the size of random data to generate.
out output array (static) will be contains generated random data.
Returns:
0 if success or -1 if fail

Definition at line 252 of file ss-util.c.

References errno.

Referenced by lcg_scr(), and securestorage_open_extended().

size_t unlock_memory char *  addr,
size_t  size
 

Unlock memory.

Author:
Giordano Scuderi
See also:
lock_memory()
Parameters:
addr is the start address of the memory to unlock
size is the memory size to unlock
Returns:
unlocked memory size if success or -1 if fail

Definition at line 236 of file ss-util.c.


Generated on Wed May 30 09:56:31 2007 for Secure Storage Service by doxygen 1.3.5