File indexing completed on 2025-01-18 10:02:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044 #ifndef NETTLE_DES_H_INCLUDED
0045 #define NETTLE_DES_H_INCLUDED
0046
0047 #include "nettle-types.h"
0048
0049 #ifdef __cplusplus
0050 extern "C" {
0051 #endif
0052
0053
0054 #define des_set_key nettle_des_set_key
0055 #define des_encrypt nettle_des_encrypt
0056 #define des_decrypt nettle_des_decrypt
0057 #define des_check_parity nettle_des_check_parity
0058 #define des_fix_parity nettle_des_fix_parity
0059 #define des3_set_key nettle_des3_set_key
0060 #define des3_encrypt nettle_des3_encrypt
0061 #define des3_decrypt nettle_des3_decrypt
0062
0063 #define DES_KEY_SIZE 8
0064 #define DES_BLOCK_SIZE 8
0065
0066
0067 #define _DES_KEY_LENGTH 32
0068
0069 struct des_ctx
0070 {
0071 uint32_t key[_DES_KEY_LENGTH];
0072 };
0073
0074
0075 int
0076 des_set_key(struct des_ctx *ctx, const uint8_t *key);
0077
0078 void
0079 des_encrypt(const struct des_ctx *ctx,
0080 size_t length, uint8_t *dst,
0081 const uint8_t *src);
0082 void
0083 des_decrypt(const struct des_ctx *ctx,
0084 size_t length, uint8_t *dst,
0085 const uint8_t *src);
0086
0087 int
0088 des_check_parity(size_t length, const uint8_t *key);
0089
0090 void
0091 des_fix_parity(size_t length, uint8_t *dst,
0092 const uint8_t *src);
0093
0094 #define DES3_KEY_SIZE 24
0095 #define DES3_BLOCK_SIZE DES_BLOCK_SIZE
0096
0097 struct des3_ctx
0098 {
0099 struct des_ctx des[3];
0100 };
0101
0102
0103
0104 int
0105 des3_set_key(struct des3_ctx *ctx, const uint8_t *key);
0106
0107 void
0108 des3_encrypt(const struct des3_ctx *ctx,
0109 size_t length, uint8_t *dst,
0110 const uint8_t *src);
0111 void
0112 des3_decrypt(const struct des3_ctx *ctx,
0113 size_t length, uint8_t *dst,
0114 const uint8_t *src);
0115
0116 #ifdef __cplusplus
0117 }
0118 #endif
0119
0120 #endif