| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/dmfc/encryption.h $ |
| 21 | * $Revision: 1.1.1.1 $ |
| 22 | * $Date: 2003/08/26 03:57:21 $ |
| 23 | * $Author: kevinb $ |
| 24 | * |
| 25 | * header file for ICE encryption class |
| 26 | * |
| 27 | * $Log: encryption.h,v $ |
| 28 | * Revision 1.1.1.1 2003/08/26 03:57:21 kevinb |
| 29 | * initial 1.5 import |
| 30 | * |
| 31 | * |
| 32 | * 2 7/08/99 2:37a Jeff |
| 33 | * created encryption class based off of ICE encryption |
| 34 | * |
| 35 | * $NoKeywords: $ |
| 36 | */ |
| 37 | |
| 38 | #ifndef __ICEENCRYPT_H_ |
| 39 | #define __ICEENCRYPT_H_ |
| 40 | |
| 41 | #include "pstypes.h" |
| 42 | |
| 43 | class IceSubkey; |
| 44 | |
| 45 | class IceKey { |
| 46 | public: |
| 47 | IceKey(int n); |
| 48 | ~IceKey(); |
| 49 | |
| 50 | void set(const uint8_t *key); |
| 51 | |
| 52 | void encrypt(const uint8_t *plaintext, uint8_t *ciphertext) const; |
| 53 | void decrypt(const uint8_t *ciphertext, uint8_t *plaintext) const; |
| 54 | |
| 55 | int keySize(void) const; |
| 56 | int blockSize(void) const; |
| 57 | |
| 58 | private: |
| 59 | void scheduleBuild(uint16_t *k, int n, const int *keyrot); |
| 60 | |
| 61 | int _size; |
| 62 | int _rounds; |
| 63 | IceSubkey *_keysched; |
| 64 | }; |
| 65 | |
| 66 | #endif |