• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 
10 #ifndef OPENSSL_HEADER_CAST_H
11 #define OPENSSL_HEADER_CAST_H
12 
13 #include <openssl/base.h>
14 
15 #ifdef  __cplusplus
16 extern "C" {
17 #endif
18 
19 
20 #define CAST_ENCRYPT 1
21 #define CAST_DECRYPT 0
22 
23 #define CAST_BLOCK 8
24 #define CAST_KEY_LENGTH 16
25 
26 typedef struct cast_key_st {
27   uint32_t data[32];
28   int short_key;  // Use reduced rounds for short key
29 } CAST_KEY;
30 
31 OPENSSL_EXPORT void CAST_set_key(CAST_KEY *key, size_t len,
32                                  const uint8_t *data);
33 OPENSSL_EXPORT void CAST_ecb_encrypt(const uint8_t *in, uint8_t *out,
34                                      const CAST_KEY *key, int enc);
35 OPENSSL_EXPORT void CAST_encrypt(uint32_t *data, const CAST_KEY *key);
36 OPENSSL_EXPORT void CAST_decrypt(uint32_t *data, const CAST_KEY *key);
37 OPENSSL_EXPORT void CAST_cbc_encrypt(const uint8_t *in, uint8_t *out,
38                                      size_t length, const CAST_KEY *ks,
39                                      uint8_t *iv, int enc);
40 
41 OPENSSL_EXPORT void CAST_cfb64_encrypt(const uint8_t *in, uint8_t *out,
42                                        size_t length, const CAST_KEY *schedule,
43                                        uint8_t *ivec, int *num, int enc);
44 
45 #ifdef  __cplusplus
46 }
47 #endif
48 
49 #endif  // OPENSSL_HEADER_CAST_H
50