X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fdes.h;h=516d155d7b29117bb3b524e9f83c8e86adef0e3a;hb=50901279d8e42ea4bccc2eef0a6b11e7c3dde4cf;hp=c15960701b2780a83d8f5f92790b8b946b588134;hpb=6a58cb3f05f9a3d05ce2b0e0845b7514540d81b5;p=gnulib.git diff --git a/lib/des.h b/lib/des.h index c15960701..516d155d7 100644 --- a/lib/des.h +++ b/lib/des.h @@ -1,5 +1,5 @@ /* des.h --- DES cipher implementation. - * Copyright (C) 2005 Free Software Foundation, Inc. + * Copyright (C) 2005, 2007, 2009-2011 Free Software Foundation, Inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published @@ -34,7 +34,7 @@ typedef struct { uint32_t encrypt_subkeys[32]; uint32_t decrypt_subkeys[32]; -} des_ctx; +} gl_des_ctx; /* * Encryption/Decryption context of Triple-DES @@ -43,12 +43,12 @@ typedef struct { uint32_t encrypt_subkeys[96]; uint32_t decrypt_subkeys[96]; -} tripledes_ctx; +} gl_3des_ctx; /* Check whether the 8 byte key is weak. Does not check the parity * bits of the key but simple ignore them. */ extern bool -des_is_weak_key (const char * key); +gl_des_is_weak_key (const char * key); /* * DES @@ -59,21 +59,21 @@ des_is_weak_key (const char * key); * Does not check parity bits, but simply ignore them. Does not check * for weak keys. */ extern void -des_setkey (des_ctx *ctx, const char * key); +gl_des_setkey (gl_des_ctx *ctx, const char * key); /* Fill a DES context CTX with subkeys calculated from 64bit KEY, with * weak key checking. Does not check parity bits, but simply ignore * them. */ extern bool -des_makekey (des_ctx *ctx, const char * key, size_t keylen); +gl_des_makekey (gl_des_ctx *ctx, const char * key, size_t keylen); /* Electronic Codebook Mode DES encryption/decryption of data * according to 'mode'. */ extern void -des_ecb_crypt (des_ctx *ctx, const char * from, char * to, int mode); +gl_des_ecb_crypt (gl_des_ctx *ctx, const char * from, char * to, int mode); -#define des_ecb_encrypt(ctx, from, to) des_ecb_crypt(ctx, from, to, 0) -#define des_ecb_decrypt(ctx, from, to) des_ecb_crypt(ctx, from, to, 1) +#define gl_des_ecb_encrypt(ctx, from, to) gl_des_ecb_crypt(ctx, from, to, 0) +#define gl_des_ecb_decrypt(ctx, from, to) gl_des_ecb_crypt(ctx, from, to, 1) /* Triple-DES * ---------- @@ -83,7 +83,9 @@ des_ecb_crypt (des_ctx *ctx, const char * from, char * to, int mode); * 64bit keys in KEY1 and KEY2. Does not check the parity bits of the * keys, but simply ignore them. Does not check for weak keys. */ extern void -tripledes_set2keys (tripledes_ctx *ctx, const char * key1, const char * key2); +gl_3des_set2keys (gl_3des_ctx *ctx, + const char * key1, + const char * key2); /* * Fill a Triple-DES context CTX with subkeys calculated from three @@ -91,24 +93,29 @@ tripledes_set2keys (tripledes_ctx *ctx, const char * key1, const char * key2); * of the keys, but simply ignore them. Does not check for weak * keys. */ extern void -tripledes_set3keys (tripledes_ctx *ctx, const char * key1, - const char * key2, const char * key3); +gl_3des_set3keys (gl_3des_ctx *ctx, + const char * key1, + const char * key2, + const char * key3); /* Fill a Triple-DES context CTX with subkeys calculated from three * concatenated 64bit keys in KEY, with weak key checking. Does not * check the parity bits of the keys, but simply ignore them. */ extern bool -tripledes_makekey (tripledes_ctx *ctx, const char * key, size_t keylen); +gl_3des_makekey (gl_3des_ctx *ctx, + const char * key, + size_t keylen); /* Electronic Codebook Mode Triple-DES encryption/decryption of data * according to 'mode'. Sometimes this mode is named 'EDE' mode * (Encryption-Decryption-Encryption). */ extern void -tripledes_ecb_crypt (tripledes_ctx *ctx, - const char * from, - char * to, int mode); +gl_3des_ecb_crypt (gl_3des_ctx *ctx, + const char * from, + char * to, + int mode); -#define tripledes_ecb_encrypt(ctx, from, to) tripledes_ecb_crypt(ctx,from,to,0) -#define tripledes_ecb_decrypt(ctx, from, to) tripledes_ecb_crypt(ctx,from,to,1) +#define gl_3des_ecb_encrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,0) +#define gl_3des_ecb_decrypt(ctx, from, to) gl_3des_ecb_crypt(ctx,from,to,1) #endif /* DES_H */