4 #include <osmocore/linuxlist.h>
6 #define GSM0464_CIPH_MAX_BLOCK 1523
16 enum gprs_cipher_direction {
21 /* An implementation of a GPRS cipher */
22 struct gprs_cipher_impl {
23 struct llist_head list;
24 enum gprs_ciph_algo algo;
26 unsigned int priority;
28 /* As specified in 04.64 Annex A. Uses Kc, IV and direction
29 * to generate the 1523 bytes cipher stream that need to be
30 * XORed wit the plaintext for encrypt / ciphertext for decrypt */
31 int (*run)(uint8_t *out, uint16_t len, uint64_t kc, uint32_t iv,
32 enum gprs_cipher_direction direction);
35 /* register a cipher with the core (from a plugin) */
36 int gprs_cipher_register(struct gprs_cipher_impl *ciph);
38 /* load all available GPRS cipher plugins */
39 int gprs_cipher_load(const char *path);
41 /* function to be called by core code */
42 int gprs_cipher_run(uint8_t *out, uint16_t len, enum gprs_ciph_algo algo,
43 uint64_t kc, uint32_t iv, enum gprs_cipher_direction dir);
45 /* Do we have an implementation for this cipher? */
46 int gprs_cipher_supported(enum gprs_ciph_algo algo);
48 #endif /* _GPRS_CIPHER_H */