Etienne Carriere | a8118d8 | 2017-11-08 15:37:04 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017, Linaro Limited |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions are met: |
| 7 | * |
| 8 | * 1. Redistributions of source code must retain the above copyright notice, |
| 9 | * this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
| 12 | * this list of conditions and the following disclaimer in the documentation |
| 13 | * and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 25 | * POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | #ifndef __AES_TA_H__ |
| 29 | #define __AES_TA_H__ |
| 30 | |
| 31 | /* UUID of the AES example trusted application */ |
| 32 | #define TA_AES_UUID \ |
| 33 | { 0x5dbac793, 0xf574, 0x4871, \ |
| 34 | { 0x8a, 0xd3, 0x04, 0x33, 0x1e, 0xc1, 0x7f, 0x24 } } |
| 35 | |
| 36 | /* |
| 37 | * TA_AES_CMD_PREPARE - Allocate resources for the AES ciphering |
| 38 | * param[0] (value) a: TA_AES_ALGO_xxx, b: unused |
| 39 | * param[1] (value) a: key size in bytes, b: unused |
| 40 | * param[2] (value) a: TA_AES_MODE_ENCODE/_DECODE, b: unused |
| 41 | * param[3] unused |
| 42 | */ |
| 43 | #define TA_AES_CMD_PREPARE 0 |
| 44 | |
| 45 | #define TA_AES_ALGO_ECB 0 |
| 46 | #define TA_AES_ALGO_CBC 1 |
| 47 | #define TA_AES_ALGO_CTR 2 |
| 48 | |
| 49 | #define TA_AES_SIZE_128BIT (128 / 8) |
| 50 | #define TA_AES_SIZE_256BIT (256 / 8) |
| 51 | |
| 52 | #define TA_AES_MODE_ENCODE 1 |
| 53 | #define TA_AES_MODE_DECODE 0 |
| 54 | |
| 55 | /* |
| 56 | * TA_AES_CMD_SET_KEY - Allocate resources for the AES ciphering |
| 57 | * param[0] (memref) key data, size shall equal key length |
| 58 | * param[1] unused |
| 59 | * param[2] unused |
| 60 | * param[3] unused |
| 61 | */ |
| 62 | #define TA_AES_CMD_SET_KEY 1 |
| 63 | |
| 64 | /* |
| 65 | * TA_AES_CMD_SET_IV - reset IV |
| 66 | * param[0] (memref) initial vector, size shall equal key length |
| 67 | * param[1] unused |
| 68 | * param[2] unused |
| 69 | * param[3] unused |
| 70 | */ |
| 71 | #define TA_AES_CMD_SET_IV 2 |
| 72 | |
| 73 | /* |
| 74 | * TA_AES_CMD_CIPHER - Ciphere inut buffer into output buffer |
| 75 | * param[0] (memref) input buffer |
| 76 | * param[1] (memref) output buffer (shall be bigger than input buffer) |
| 77 | * param[2] unused |
| 78 | * param[3] unused |
| 79 | */ |
| 80 | #define TA_AES_CMD_CIPHER 3 |
| 81 | |
| 82 | #endif /* __AES_TA_H */ |