1syntax = "proto3"; 2 3package nugget.app.protoapi; 4 5enum KeySize { 6 KS_RESERVED = 0; 7 s128b = 16; 8 s192b = 24; 9 s256b = 32; 10} 11 12enum DcryptError { 13 DE_RESERVED = 0; 14 DE_NO_ERROR = 1; 15 INVALID_PLAINTEXT = 2; 16 MISSING_PARAMETER = 3; 17 KEYSIZE_MISMATCH = 4; 18} 19 20// TODO remove this when oneof support is added to nanopb 21enum OneofTestParametersCase { 22 TPC_RESERVED = 0; 23 kTrngTest = 1; 24 kAesCbcEncryptTest = 2; 25 kAesGcmEncryptTest = 3; 26 kAesCmacTest = 4; 27 kFullStressTest = 5; 28} 29 30// TODO remove this when oneof support is added to nanopb 31enum OneofTestResultsCase { 32 ONEOF_NAME_NOT_SET = 0; 33 kTrngTestResult = 1; 34 kAesCbcEncryptTestResult = 2; 35 kAesGcmEncryptTestResult = 3; 36 kAesCmacTestResult = 4; 37 kFullStressResult = 5; 38} 39 40message AesCbcEncryptTest { 41 KeySize key_size = 1; 42 uint32 number_of_blocks = 2; 43 bytes key = 3; 44 bytes initialization_vector = 4; 45 // TODO plain_text and number_of_blocks should be mutually exclusive. 46 // a oneof would be good for this but nanopb doesn't support dynamic lengths 47 // inside of a oneof. 48 bytes plain_text = 5; 49} 50 51message AesCbcEncryptTestResult { 52 DcryptError result_code = 1; 53 bytes initialization_vector = 2; 54 bytes cipher_text = 3; 55} 56 57message AesGcmEncryptTest { 58 bytes key = 1; 59 bytes iv = 2; 60 bytes plain_text = 3; 61 bytes aad = 4; 62 uint32 tag_len = 5; 63} 64 65message AesGcmEncryptTestResult { 66 DcryptError result_code = 1; 67 bytes cipher_text = 2; 68 bytes tag = 3; 69} 70 71message TrngTest { 72 uint32 number_of_bytes = 1; 73} 74 75message AesCmacTest { 76 bytes key = 1; 77 bytes plain_text = 2; 78}; 79 80message AesCmacTestResult { 81 DcryptError result_code = 1; 82 bytes cmac = 2; 83}; 84 85message TrngTestResult { 86 bytes random_bytes = 1; 87} 88 89/* 90TODO look into adding callback support to oneof fields in nanopb 91message TestingAPICall { 92 oneof test_parameters { 93 AesCbcEncryptTest aes_cbc_encrypt_test = 1; 94 } 95} 96 97message TestingAPIResponse { 98 oneof test_results { 99 AesCbcEncryptTestResult aes_cbc_encrypt_result = 1; 100 } 101} 102*/ 103