Central Heating controller using the real time clock, PHY module for internet, 1-wire interface for temperature sensors, a system log and a configuration file
Dependencies: net 1-wire lpc1768 crypto clock web fram log
/media/uploads/andrewboyson/heating.sch
/media/uploads/andrewboyson/heating.brd
/media/uploads/andrewboyson/eagle.epf
web-this/system/web-system-html.c@106:41ed3ea0bbba, 2021-04-23 (annotated)
- Committer:
- andrewboyson
- Date:
- Fri Apr 23 08:36:42 2021 +0000
- Revision:
- 106:41ed3ea0bbba
- Parent:
- 80:99140e224bd7
Not working, crashes.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 49:9491c966dc60 | 1 | #include <stdio.h> |
andrewboyson | 67:2d379b0c5f05 | 2 | #include <string.h> |
andrewboyson | 49:9491c966dc60 | 3 | |
andrewboyson | 49:9491c966dc60 | 4 | #include "http.h" |
andrewboyson | 53:c1bf7d9db507 | 5 | #include "web-nav-this.h" |
andrewboyson | 51:c7c6ce0d57ad | 6 | #include "web-add.h" |
andrewboyson | 67:2d379b0c5f05 | 7 | #include "log.h" |
andrewboyson | 63:ae264156d655 | 8 | #include "bignum.h" |
andrewboyson | 74:8228f0297227 | 9 | #include "rsa.h" |
andrewboyson | 69:ca9010196c6e | 10 | #include "sha256.h" |
andrewboyson | 74:8228f0297227 | 11 | #include "hmac-sha256.h" |
andrewboyson | 69:ca9010196c6e | 12 | #include "tls-prf.h" |
andrewboyson | 80:99140e224bd7 | 13 | #include "aes128cbc.h" |
andrewboyson | 71:9edbc59d6f64 | 14 | #include "sha1.h" |
andrewboyson | 75:cc9a1e104e0e | 15 | #include "pri-key.h" |
andrewboyson | 49:9491c966dc60 | 16 | |
andrewboyson | 49:9491c966dc60 | 17 | void WebSystemHtml() |
andrewboyson | 49:9491c966dc60 | 18 | { |
andrewboyson | 49:9491c966dc60 | 19 | HttpOk("text/html; charset=UTF-8", "no-cache", NULL, NULL); |
andrewboyson | 51:c7c6ce0d57ad | 20 | WebAddHeader("System", "settings.css", "system.js"); |
andrewboyson | 51:c7c6ce0d57ad | 21 | WebAddNav(SYSTEM_PAGE); |
andrewboyson | 51:c7c6ce0d57ad | 22 | WebAddH1("System"); |
andrewboyson | 49:9491c966dc60 | 23 | |
andrewboyson | 51:c7c6ce0d57ad | 24 | WebAddH2("TFTP"); |
andrewboyson | 51:c7c6ce0d57ad | 25 | WebAddAjaxInput ("Server url", 5, "ajax-server-name", "tftpserver" ); |
andrewboyson | 51:c7c6ce0d57ad | 26 | WebAddAjaxInput ("File (strftime)", 11, "ajax-file-name", "tftpfilename" ); |
andrewboyson | 51:c7c6ce0d57ad | 27 | WebAddAjaxInput ("Interval (secs) 0=no", 5, "ajax-read-interval", "tftpreadint" ); |
andrewboyson | 51:c7c6ce0d57ad | 28 | WebAddAjaxInput ("Records per backup 0=no", 5, "ajax-write-size", "tftpwriteint" ); |
andrewboyson | 51:c7c6ce0d57ad | 29 | WebAddAjaxLabelled("Count", "ajax-count" ); |
andrewboyson | 51:c7c6ce0d57ad | 30 | WebAddAjaxLabelled("Started", "ajax-start-time" ); |
andrewboyson | 49:9491c966dc60 | 31 | |
andrewboyson | 51:c7c6ce0d57ad | 32 | WebAddH2("FRAM"); |
andrewboyson | 51:c7c6ce0d57ad | 33 | WebAddAjaxLabelled("Used", "ajax-fram-used" ); |
andrewboyson | 49:9491c966dc60 | 34 | |
andrewboyson | 51:c7c6ce0d57ad | 35 | WebAddH2("Compiler"); |
andrewboyson | 51:c7c6ce0d57ad | 36 | WebAddLabelledInt("Version Vvvbbbb", __ARMCC_VERSION); |
andrewboyson | 71:9edbc59d6f64 | 37 | |
andrewboyson | 71:9edbc59d6f64 | 38 | WebAddH2("AES 128 test"); |
andrewboyson | 71:9edbc59d6f64 | 39 | uint8_t aeskey[] = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; |
andrewboyson | 71:9edbc59d6f64 | 40 | uint8_t in[] = { 0x76, 0x49, 0xab, 0xac, 0x81, 0x19, 0xb2, 0x46, 0xce, 0xe9, 0x8e, 0x9b, 0x12, 0xe9, 0x19, 0x7d, |
andrewboyson | 71:9edbc59d6f64 | 41 | 0x50, 0x86, 0xcb, 0x9b, 0x50, 0x72, 0x19, 0xee, 0x95, 0xdb, 0x11, 0x3a, 0x91, 0x76, 0x78, 0xb2, |
andrewboyson | 71:9edbc59d6f64 | 42 | 0x73, 0xbe, 0xd6, 0xb8, 0xe3, 0xc1, 0x74, 0x3b, 0x71, 0x16, 0xe6, 0x9e, 0x22, 0x22, 0x95, 0x16, |
andrewboyson | 71:9edbc59d6f64 | 43 | 0x3f, 0xf1, 0xca, 0xa1, 0x68, 0x1f, 0xac, 0x09, 0x12, 0x0e, 0xca, 0x30, 0x75, 0x86, 0xe1, 0xa7 }; |
andrewboyson | 71:9edbc59d6f64 | 44 | uint8_t iv[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; |
andrewboyson | 71:9edbc59d6f64 | 45 | /* |
andrewboyson | 71:9edbc59d6f64 | 46 | uint8_t out[] = { 0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11, 0x73, 0x93, 0x17, 0x2a, |
andrewboyson | 71:9edbc59d6f64 | 47 | 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c, 0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, |
andrewboyson | 71:9edbc59d6f64 | 48 | 0x30, 0xc8, 0x1c, 0x46, 0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef, |
andrewboyson | 71:9edbc59d6f64 | 49 | 0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b, 0xe6, 0x6c, 0x37, 0x10 }; |
andrewboyson | 71:9edbc59d6f64 | 50 | */ |
andrewboyson | 71:9edbc59d6f64 | 51 | |
andrewboyson | 80:99140e224bd7 | 52 | Aes128CbcDecrypt(aeskey, iv, in, 64); |
andrewboyson | 67:2d379b0c5f05 | 53 | HttpAddText("<code>"); |
andrewboyson | 71:9edbc59d6f64 | 54 | HttpAddBytesAsHex(in, sizeof(in)); |
andrewboyson | 69:ca9010196c6e | 55 | HttpAddText("</code>"); |
andrewboyson | 69:ca9010196c6e | 56 | |
andrewboyson | 69:ca9010196c6e | 57 | WebAddH2("SHA 256 stream test"); |
andrewboyson | 71:9edbc59d6f64 | 58 | uint8_t hash[32]; |
andrewboyson | 71:9edbc59d6f64 | 59 | char* input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; |
andrewboyson | 69:ca9010196c6e | 60 | struct Sha256State sha256state; |
andrewboyson | 69:ca9010196c6e | 61 | Sha256Start (&sha256state); |
andrewboyson | 69:ca9010196c6e | 62 | Sha256Add (&sha256state, (uint8_t*)input, strlen(input)); |
andrewboyson | 69:ca9010196c6e | 63 | Sha256Finish(&sha256state, (uint8_t*)hash); |
andrewboyson | 69:ca9010196c6e | 64 | |
andrewboyson | 69:ca9010196c6e | 65 | HttpAddText("<code>"); |
andrewboyson | 70:c7d0d3d926e1 | 66 | HttpAddBytesAsHex(hash, sizeof(hash)); |
andrewboyson | 67:2d379b0c5f05 | 67 | HttpAddText("</code>"); |
andrewboyson | 67:2d379b0c5f05 | 68 | |
andrewboyson | 71:9edbc59d6f64 | 69 | WebAddH2("SHA1 stream test"); |
andrewboyson | 72:13bc405bd40b | 70 | struct Sha1State sha1state; |
andrewboyson | 72:13bc405bd40b | 71 | Sha1Start (&sha1state); |
andrewboyson | 72:13bc405bd40b | 72 | Sha1Add (&sha1state, (uint8_t*)input, strlen(input)); |
andrewboyson | 72:13bc405bd40b | 73 | Sha1Finish(&sha1state, (uint8_t*)hash); |
andrewboyson | 71:9edbc59d6f64 | 74 | |
andrewboyson | 71:9edbc59d6f64 | 75 | HttpAddText("<code>"); |
andrewboyson | 72:13bc405bd40b | 76 | HttpAddBytesAsHex(hash, SHA1_HASH_SIZE); |
andrewboyson | 71:9edbc59d6f64 | 77 | HttpAddText("</code>"); |
andrewboyson | 71:9edbc59d6f64 | 78 | |
andrewboyson | 67:2d379b0c5f05 | 79 | WebAddH2("HMAC SHA 256 test"); |
andrewboyson | 67:2d379b0c5f05 | 80 | char* key = "Jefe"; |
andrewboyson | 67:2d379b0c5f05 | 81 | char* msg = "what do ya want for nothing?"; |
andrewboyson | 69:ca9010196c6e | 82 | uint8_t mac[32]; |
andrewboyson | 69:ca9010196c6e | 83 | HmacSha256((uint8_t*)key, strlen(key), (uint8_t*)msg, strlen(msg), mac); |
andrewboyson | 69:ca9010196c6e | 84 | HttpAddText("<code>"); |
andrewboyson | 70:c7d0d3d926e1 | 85 | HttpAddBytesAsHex(mac, sizeof(mac)); |
andrewboyson | 69:ca9010196c6e | 86 | HttpAddText("</code>"); |
andrewboyson | 69:ca9010196c6e | 87 | |
andrewboyson | 69:ca9010196c6e | 88 | WebAddH2("HMAC SHA 256 stream test"); |
andrewboyson | 69:ca9010196c6e | 89 | struct HmacSha256Struct hmacState; |
andrewboyson | 69:ca9010196c6e | 90 | HmacSha256Start (&hmacState, (uint8_t*)key, strlen(key)); |
andrewboyson | 69:ca9010196c6e | 91 | HmacSha256Add (&hmacState, (uint8_t*)msg, strlen(msg)); |
andrewboyson | 69:ca9010196c6e | 92 | HmacSha256Finish(&hmacState, mac); |
andrewboyson | 67:2d379b0c5f05 | 93 | HttpAddText("<code>"); |
andrewboyson | 70:c7d0d3d926e1 | 94 | HttpAddBytesAsHex(mac, sizeof(mac)); |
andrewboyson | 67:2d379b0c5f05 | 95 | HttpAddText("</code>"); |
andrewboyson | 67:2d379b0c5f05 | 96 | |
andrewboyson | 69:ca9010196c6e | 97 | WebAddH2("Verify data test"); |
andrewboyson | 69:ca9010196c6e | 98 | uint8_t masterSecret [48] = {0x91, 0x6a, 0xbf, 0x9d, 0xa5, 0x59, 0x73, 0xe1, |
andrewboyson | 69:ca9010196c6e | 99 | 0x36, 0x14, 0xae, 0x0a, 0x3f, 0x5d, 0x3f, 0x37, |
andrewboyson | 69:ca9010196c6e | 100 | 0xb0, 0x23, 0xba, 0x12, 0x9a, 0xee, 0x02, 0xcc, |
andrewboyson | 69:ca9010196c6e | 101 | 0x91, 0x34, 0x33, 0x81, 0x27, 0xcd, 0x70, 0x49, |
andrewboyson | 69:ca9010196c6e | 102 | 0x78, 0x1c, 0x8e, 0x19, 0xfc, 0x1e, 0xb2, 0xa7, |
andrewboyson | 69:ca9010196c6e | 103 | 0x38, 0x7a, 0xc0, 0x6a, 0xe2, 0x37, 0x34, 0x4c}; |
andrewboyson | 69:ca9010196c6e | 104 | |
andrewboyson | 69:ca9010196c6e | 105 | uint8_t hashHandshakes[32] = {0xb2, 0x01, 0x7b, 0xa2, 0x8d, 0x0e, 0x27, 0xf0, |
andrewboyson | 69:ca9010196c6e | 106 | 0x3a, 0xe3, 0x27, 0x45, 0x6b, 0x6f, 0xf0, 0x0b, |
andrewboyson | 69:ca9010196c6e | 107 | 0x4d, 0x5b, 0xbf, 0x0e, 0xf7, 0xcd, 0xa8, 0x3c, |
andrewboyson | 69:ca9010196c6e | 108 | 0xe1, 0x02, 0x9b, 0x52, 0x1c, 0x3e, 0x7c, 0x35}; |
andrewboyson | 69:ca9010196c6e | 109 | uint8_t verifyData[12]; |
andrewboyson | 71:9edbc59d6f64 | 110 | TlsPrfServerFinished(masterSecret, hashHandshakes, verifyData); |
andrewboyson | 69:ca9010196c6e | 111 | |
andrewboyson | 69:ca9010196c6e | 112 | HttpAddText("<code>"); |
andrewboyson | 70:c7d0d3d926e1 | 113 | HttpAddBytesAsHex(verifyData, sizeof(verifyData)); |
andrewboyson | 69:ca9010196c6e | 114 | HttpAddText("</code>"); |
andrewboyson | 69:ca9010196c6e | 115 | |
andrewboyson | 69:ca9010196c6e | 116 | |
andrewboyson | 71:9edbc59d6f64 | 117 | WebAddH2("Key test"); |
andrewboyson | 71:9edbc59d6f64 | 118 | |
andrewboyson | 71:9edbc59d6f64 | 119 | uint8_t clientRandom[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, |
andrewboyson | 71:9edbc59d6f64 | 120 | 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
andrewboyson | 71:9edbc59d6f64 | 121 | 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, |
andrewboyson | 71:9edbc59d6f64 | 122 | 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }; |
andrewboyson | 71:9edbc59d6f64 | 123 | |
andrewboyson | 71:9edbc59d6f64 | 124 | uint8_t serverRandom[] = { 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, |
andrewboyson | 71:9edbc59d6f64 | 125 | 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, |
andrewboyson | 71:9edbc59d6f64 | 126 | 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, |
andrewboyson | 71:9edbc59d6f64 | 127 | 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f }; |
andrewboyson | 71:9edbc59d6f64 | 128 | |
andrewboyson | 71:9edbc59d6f64 | 129 | uint8_t client_MAC_key_20[20]; |
andrewboyson | 71:9edbc59d6f64 | 130 | uint8_t server_MAC_key_20[20]; |
andrewboyson | 71:9edbc59d6f64 | 131 | uint8_t client_key_16[16]; |
andrewboyson | 71:9edbc59d6f64 | 132 | uint8_t server_key_16[16]; |
andrewboyson | 80:99140e224bd7 | 133 | TlsPrfKeysAes128Sha1(masterSecret, clientRandom, serverRandom, client_MAC_key_20, server_MAC_key_20, client_key_16, server_key_16); |
andrewboyson | 71:9edbc59d6f64 | 134 | HttpAddText("<code>"); |
andrewboyson | 75:cc9a1e104e0e | 135 | HttpAddBytesAsHex(client_MAC_key_20, sizeof(client_MAC_key_20)); HttpAddText("\r\n"); |
andrewboyson | 75:cc9a1e104e0e | 136 | HttpAddBytesAsHex(server_MAC_key_20, sizeof(server_MAC_key_20)); HttpAddText("\r\n"); |
andrewboyson | 75:cc9a1e104e0e | 137 | HttpAddBytesAsHex( client_key_16, sizeof( client_key_16)); HttpAddText("\r\n"); |
andrewboyson | 75:cc9a1e104e0e | 138 | HttpAddBytesAsHex( server_key_16, sizeof( server_key_16)); |
andrewboyson | 71:9edbc59d6f64 | 139 | HttpAddText("</code>"); |
andrewboyson | 71:9edbc59d6f64 | 140 | |
andrewboyson | 71:9edbc59d6f64 | 141 | |
andrewboyson | 69:ca9010196c6e | 142 | |
andrewboyson | 75:cc9a1e104e0e | 143 | char* m = |
andrewboyson | 75:cc9a1e104e0e | 144 | "0001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" |
andrewboyson | 75:cc9a1e104e0e | 145 | "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" |
andrewboyson | 75:cc9a1e104e0e | 146 | "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00302130" |
andrewboyson | 75:cc9a1e104e0e | 147 | "0906052B0E03021A05000414A9993E364706816ABA3E25717850C26C9CD0D89D"; |
andrewboyson | 75:cc9a1e104e0e | 148 | |
andrewboyson | 75:cc9a1e104e0e | 149 | uint32_t message [32]; |
andrewboyson | 75:cc9a1e104e0e | 150 | BnParseHex1024(message, m); |
andrewboyson | 75:cc9a1e104e0e | 151 | |
andrewboyson | 75:cc9a1e104e0e | 152 | /* |
andrewboyson | 75:cc9a1e104e0e | 153 | WebAddH2("RSA test"); |
andrewboyson | 63:ae264156d655 | 154 | |
andrewboyson | 63:ae264156d655 | 155 | char* n = |
andrewboyson | 63:ae264156d655 | 156 | "E08973398DD8F5F5E88776397F4EB005BB5383DE0FB7ABDC7DC775290D052E6D" |
andrewboyson | 63:ae264156d655 | 157 | "12DFA68626D4D26FAA5829FC97ECFA82510F3080BEB1509E4644F12CBBD832CF" |
andrewboyson | 63:ae264156d655 | 158 | "C6686F07D9B060ACBEEE34096A13F5F7050593DF5EBA3556D961FF197FC981E6" |
andrewboyson | 63:ae264156d655 | 159 | "F86CEA874070EFAC6D2C749F2DFA553AB9997702A648528C4EF357385774575F"; |
andrewboyson | 63:ae264156d655 | 160 | |
andrewboyson | 63:ae264156d655 | 161 | char* d = |
andrewboyson | 63:ae264156d655 | 162 | "00A403C327477634346CA686B57949014B2E8AD2C862B2C7D748096A8B91F736" |
andrewboyson | 63:ae264156d655 | 163 | "F275D6E8CD15906027314735644D95CD6763CEB49F56AC2F376E1CEE0EBF282D" |
andrewboyson | 63:ae264156d655 | 164 | "F439906F34D86E085BD5656AD841F313D72D395EFE33CBFF29E4030B3D05A28F" |
andrewboyson | 63:ae264156d655 | 165 | "B7F18EA27637B07957D32F2BDE8706227D04665EC91BAF8B1AC3EC9144AB7F21"; |
andrewboyson | 64:c736b8924574 | 166 | |
andrewboyson | 64:c736b8924574 | 167 | uint32_t exponent[32]; |
andrewboyson | 64:c736b8924574 | 168 | uint32_t modulus [32]; |
andrewboyson | 63:ae264156d655 | 169 | |
andrewboyson | 64:c736b8924574 | 170 | BnParseHex1024(exponent, d); |
andrewboyson | 64:c736b8924574 | 171 | BnParseHex1024(modulus, n); |
andrewboyson | 75:cc9a1e104e0e | 172 | |
andrewboyson | 68:19c5efffc900 | 173 | static int ticket = 0; |
andrewboyson | 63:ae264156d655 | 174 | static bool started = false; |
andrewboyson | 63:ae264156d655 | 175 | if (!started) |
andrewboyson | 63:ae264156d655 | 176 | { |
andrewboyson | 74:8228f0297227 | 177 | ticket = RsaSlowStart(message, exponent, modulus); |
andrewboyson | 63:ae264156d655 | 178 | started = true; |
andrewboyson | 63:ae264156d655 | 179 | } |
andrewboyson | 63:ae264156d655 | 180 | |
andrewboyson | 63:ae264156d655 | 181 | HttpAddText("<code>"); |
andrewboyson | 63:ae264156d655 | 182 | HttpAddText("Message\r\n"); |
andrewboyson | 64:c736b8924574 | 183 | BnAsHttp1024(message); |
andrewboyson | 63:ae264156d655 | 184 | HttpAddText("\r\nExponent\r\n"); |
andrewboyson | 64:c736b8924574 | 185 | BnAsHttp1024(exponent); |
andrewboyson | 63:ae264156d655 | 186 | HttpAddText("\r\nModulus\r\n"); |
andrewboyson | 64:c736b8924574 | 187 | BnAsHttp1024(modulus); |
andrewboyson | 63:ae264156d655 | 188 | HttpAddText("\r\nResult\r\n"); |
andrewboyson | 68:19c5efffc900 | 189 | if (ticket >= 0) |
andrewboyson | 63:ae264156d655 | 190 | { |
andrewboyson | 74:8228f0297227 | 191 | if (RsaSlowFinished(ticket)) HttpAddText("Finished\r\n"); |
andrewboyson | 74:8228f0297227 | 192 | else HttpAddText("Not finished\r\n"); |
andrewboyson | 74:8228f0297227 | 193 | BnAsHttp1024(RsaSlowResult(ticket)); |
andrewboyson | 68:19c5efffc900 | 194 | } |
andrewboyson | 68:19c5efffc900 | 195 | else |
andrewboyson | 68:19c5efffc900 | 196 | { |
andrewboyson | 68:19c5efffc900 | 197 | HttpAddText("No ticket available to calculate result\r\n"); |
andrewboyson | 63:ae264156d655 | 198 | } |
andrewboyson | 63:ae264156d655 | 199 | HttpAddText("</code>"); |
andrewboyson | 75:cc9a1e104e0e | 200 | */ |
andrewboyson | 75:cc9a1e104e0e | 201 | |
andrewboyson | 78:2c339a59be46 | 202 | WebAddH2("RSA test"); |
andrewboyson | 78:2c339a59be46 | 203 | static int rsaTicket = 0; |
andrewboyson | 75:cc9a1e104e0e | 204 | static bool rsaSlowStarted = false; |
andrewboyson | 75:cc9a1e104e0e | 205 | if (!rsaSlowStarted) |
andrewboyson | 75:cc9a1e104e0e | 206 | { |
andrewboyson | 78:2c339a59be46 | 207 | rsaTicket = PriKeyDecryptStart((uint8_t*)message); |
andrewboyson | 75:cc9a1e104e0e | 208 | rsaSlowStarted = true; |
andrewboyson | 75:cc9a1e104e0e | 209 | } |
andrewboyson | 75:cc9a1e104e0e | 210 | |
andrewboyson | 75:cc9a1e104e0e | 211 | HttpAddText("<code>"); |
andrewboyson | 75:cc9a1e104e0e | 212 | HttpAddText("Message\r\n"); |
andrewboyson | 75:cc9a1e104e0e | 213 | BnAsHttp1024(message); |
andrewboyson | 75:cc9a1e104e0e | 214 | HttpAddText("\r\nResult\r\n"); |
andrewboyson | 78:2c339a59be46 | 215 | if (rsaTicket >= 0) |
andrewboyson | 75:cc9a1e104e0e | 216 | { |
andrewboyson | 78:2c339a59be46 | 217 | if (PriKeyDecryptFinished(rsaTicket)) HttpAddText("Finished\r\n"); |
andrewboyson | 78:2c339a59be46 | 218 | else HttpAddText("Not finished\r\n"); |
andrewboyson | 80:99140e224bd7 | 219 | BnAsHttp1024((uint32_t*)PriKeyDecryptResultLittleEndian(rsaTicket)); |
andrewboyson | 75:cc9a1e104e0e | 220 | } |
andrewboyson | 75:cc9a1e104e0e | 221 | else |
andrewboyson | 75:cc9a1e104e0e | 222 | { |
andrewboyson | 75:cc9a1e104e0e | 223 | HttpAddText("No ticket available to calculate result\r\n"); |
andrewboyson | 75:cc9a1e104e0e | 224 | } |
andrewboyson | 75:cc9a1e104e0e | 225 | HttpAddText("</code>"); |
andrewboyson | 63:ae264156d655 | 226 | |
andrewboyson | 63:ae264156d655 | 227 | WebAddEnd(); |
andrewboyson | 49:9491c966dc60 | 228 | } |