Changeset 8a64320e in mainline for uspace/lib/crypto/crypto.h
- Timestamp:
- 2015-04-23T23:40:14Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- dcba819
- Parents:
- 09044cb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/crypto/crypto.h
r09044cb r8a64320e 32 32 #include <sys/types.h> 33 33 34 #define AES_CIPHER_LENGTH 1635 #define PBKDF2_KEY_LENGTH 3234 #define AES_CIPHER_LENGTH 16 35 #define PBKDF2_KEY_LENGTH 32 36 36 37 /* Left rotation for UINT32. */ 38 #define rotl_uint32(val, shift) (((val) << shift) | ((val) >> (32 - shift))) 37 /* Left rotation for uint32_t. */ 38 #define rotl_uint32(val, shift) \ 39 (((val) << shift) | ((val) >> (32 - shift))) 39 40 40 /* Right rotation for UINT32. */ 41 #define rotr_uint32(val, shift) (((val) >> shift) | ((val) << (32 - shift))) 41 /* Right rotation for uint32_t. */ 42 #define rotr_uint32(val, shift) \ 43 (((val) >> shift) | ((val) << (32 - shift))) 42 44 43 45 /** Hash function selector and also result hash length indicator. */ 44 46 typedef enum { 45 HASH_MD5 = 46 HASH_SHA1 = 47 HASH_MD5 = 16, 48 HASH_SHA1 = 20 47 49 } hash_func_t; 48 50 49 extern int rc4(uint8_t *key, size_t key_size, uint8_t *input, size_t input_size, 50 size_t skip, uint8_t *output); 51 extern int aes_encrypt(uint8_t *key, uint8_t *input, uint8_t *output); 52 extern int aes_decrypt(uint8_t *key, uint8_t *input, uint8_t *output); 53 extern int create_hash(uint8_t *input, size_t input_size, uint8_t *output, 54 hash_func_t hash_sel); 55 extern int hmac(uint8_t *key, size_t key_size, uint8_t *msg, size_t msg_size, 56 uint8_t *hash, hash_func_t hash_sel); 57 extern int pbkdf2(uint8_t *pass, size_t pass_size, uint8_t *salt, 58 size_t salt_size, uint8_t *hash); 51 extern int rc4(uint8_t *, size_t, uint8_t *, size_t, size_t, uint8_t *); 52 extern int aes_encrypt(uint8_t *, uint8_t *, uint8_t *); 53 extern int aes_decrypt(uint8_t *, uint8_t *, uint8_t *); 54 extern int create_hash(uint8_t *, size_t, uint8_t *, hash_func_t); 55 extern int hmac(uint8_t *, size_t, uint8_t *, size_t, uint8_t *, hash_func_t); 56 extern int pbkdf2(uint8_t *, size_t, uint8_t *, size_t, uint8_t *); 59 57 60 58 #endif
Note:
See TracChangeset
for help on using the changeset viewer.