Changeset 8a64320e in mainline for uspace/lib/crypto/crypto.h


Ignore:
Timestamp:
2015-04-23T23:40:14Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
dcba819
Parents:
09044cb
Message:

pre-merge coding style cleanup and code review

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/crypto/crypto.h

    r09044cb r8a64320e  
    3232#include <sys/types.h>
    3333
    34 #define AES_CIPHER_LENGTH 16
    35 #define PBKDF2_KEY_LENGTH 32
     34#define AES_CIPHER_LENGTH  16
     35#define PBKDF2_KEY_LENGTH  32
    3636
    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)))
    3940
    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)))
    4244
    4345/** Hash function selector and also result hash length indicator. */
    4446typedef enum {
    45         HASH_MD5 =      16,
    46         HASH_SHA1 =     20
     47        HASH_MD5 =  16,
     48        HASH_SHA1 = 20
    4749} hash_func_t;
    4850
    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);
     51extern int rc4(uint8_t *, size_t, uint8_t *, size_t, size_t, uint8_t *);
     52extern int aes_encrypt(uint8_t *, uint8_t *, uint8_t *);
     53extern int aes_decrypt(uint8_t *, uint8_t *, uint8_t *);
     54extern int create_hash(uint8_t *, size_t, uint8_t *, hash_func_t);
     55extern int hmac(uint8_t *, size_t, uint8_t *, size_t, uint8_t *, hash_func_t);
     56extern int pbkdf2(uint8_t *, size_t, uint8_t *, size_t, uint8_t *);
    5957
    6058#endif
Note: See TracChangeset for help on using the changeset viewer.