RadioShuttle Lib for the STM32 L4 Heltec Board
Dependents: Turtle_RadioShuttle
RadioSecurityInterface.h@11:91bc7ef20f21, 2019-03-04 (annotated)
- Committer:
- Helmut Tschemernjak
- Date:
- Mon Mar 04 09:41:41 2019 +0100
- Revision:
- 11:91bc7ef20f21
- Parent:
- 0:0c31756924a2
Updated lib
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Helmut64 | 0:0c31756924a2 | 1 | /* |
Helmut64 | 0:0c31756924a2 | 2 | * The file is licensed under the Apache License, Version 2.0 |
Helmut64 | 0:0c31756924a2 | 3 | * (c) 2019 Helmut Tschemernjak |
Helmut64 | 0:0c31756924a2 | 4 | * 30826 Garbsen (Hannover) Germany |
Helmut64 | 0:0c31756924a2 | 5 | */ |
Helmut64 | 0:0c31756924a2 | 6 | |
Helmut64 | 0:0c31756924a2 | 7 | |
Helmut64 | 0:0c31756924a2 | 8 | |
Helmut64 | 0:0c31756924a2 | 9 | class RadioSecurityInterface { |
Helmut64 | 0:0c31756924a2 | 10 | public: |
Helmut64 | 0:0c31756924a2 | 11 | virtual ~RadioSecurityInterface() { } |
Helmut64 | 0:0c31756924a2 | 12 | |
Helmut64 | 0:0c31756924a2 | 13 | /* |
Helmut64 | 0:0c31756924a2 | 14 | * Get security protocol version to allow |
Helmut64 | 0:0c31756924a2 | 15 | * and differentiate between multiple security versions |
Helmut64 | 0:0c31756924a2 | 16 | */ |
Helmut64 | 0:0c31756924a2 | 17 | virtual int GetSecurityVersion(void) = 0; |
Helmut64 | 0:0c31756924a2 | 18 | |
Helmut64 | 0:0c31756924a2 | 19 | /* |
Helmut64 | 0:0c31756924a2 | 20 | * The block size for the hash code (e.g. SHA256) in bytes |
Helmut64 | 0:0c31756924a2 | 21 | */ |
Helmut64 | 0:0c31756924a2 | 22 | virtual int GetHashBlockSize(void) = 0; |
Helmut64 | 0:0c31756924a2 | 23 | |
Helmut64 | 0:0c31756924a2 | 24 | /* |
Helmut64 | 0:0c31756924a2 | 25 | * The calculation for the public password hash code utilizes a seed (e.g. random) |
Helmut64 | 0:0c31756924a2 | 26 | * and the cleartext password |
Helmut64 | 0:0c31756924a2 | 27 | */ |
Helmut64 | 0:0c31756924a2 | 28 | virtual void HashPassword(void *seed, int seedLen, void *password, int pwLen, void *hashResult) = 0; |
Helmut64 | 0:0c31756924a2 | 29 | |
Helmut64 | 0:0c31756924a2 | 30 | /* |
Helmut64 | 0:0c31756924a2 | 31 | * The encryption/decryption block size in bytes (e.g. 16 bytes for AES128) |
Helmut64 | 0:0c31756924a2 | 32 | */ |
Helmut64 | 0:0c31756924a2 | 33 | virtual int GetEncryptionBlockSize(void) = 0; |
Helmut64 | 0:0c31756924a2 | 34 | |
Helmut64 | 0:0c31756924a2 | 35 | /* |
Helmut64 | 0:0c31756924a2 | 36 | * The creation of a context allocates the memory needed, and initializes |
Helmut64 | 0:0c31756924a2 | 37 | * its data (e.g. key and initial vector 'iv' for AES) |
Helmut64 | 0:0c31756924a2 | 38 | */ |
Helmut64 | 0:0c31756924a2 | 39 | virtual void *CreateEncryptionContext(void *key, int keyLen, void *seed = NULL, int seedlen = 0) = 0; |
Helmut64 | 0:0c31756924a2 | 40 | |
Helmut64 | 0:0c31756924a2 | 41 | /* |
Helmut64 | 0:0c31756924a2 | 42 | * Release the context and its allocated memory from CreateEncryptionContext |
Helmut64 | 0:0c31756924a2 | 43 | */ |
Helmut64 | 0:0c31756924a2 | 44 | virtual void DestroyEncryptionContext(void *context) = 0; |
Helmut64 | 0:0c31756924a2 | 45 | |
Helmut64 | 0:0c31756924a2 | 46 | /* |
Helmut64 | 0:0c31756924a2 | 47 | *Encrypts a cleartext input message into an encrypted output block |
Helmut64 | 0:0c31756924a2 | 48 | */ |
Helmut64 | 0:0c31756924a2 | 49 | virtual void EncryptMessage(void *context, const void *input, void *output, int len) = 0; |
Helmut64 | 0:0c31756924a2 | 50 | |
Helmut64 | 0:0c31756924a2 | 51 | /* |
Helmut64 | 0:0c31756924a2 | 52 | * Decrypts an input block into an cleartext output message |
Helmut64 | 0:0c31756924a2 | 53 | */ |
Helmut64 | 0:0c31756924a2 | 54 | virtual void DecryptMessage(void *context, const void *input, void *output, int len) = 0; |
Helmut64 | 0:0c31756924a2 | 55 | |
Helmut64 | 0:0c31756924a2 | 56 | virtual void EncryptTest(void) = 0; |
Helmut64 | 0:0c31756924a2 | 57 | }; |