dsa_key_blob.c 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. /* dsa_key_blob.c */
  2. /*
  3. This file is part of the ARM-Crypto-Lib.
  4. Copyright (C) 2006-2010 Daniel Otte (daniel.otte@rub.de)
  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. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include <stdlib.h>
  17. #include <stdint.h>
  18. #include <string.h>
  19. #include "cli.h"
  20. #include <crypto/dsa.h>
  21. #include <crypto/bigint.h>
  22. #define DSA_KEY_BLOB_SIZE 1024
  23. #if DSA_KEY_BLOB_SIZE == 512
  24. #define PRIV_LEN_B (20)
  25. #define PUB_LEN_B (8*8)
  26. #define P_LEN_B (8*8)
  27. #define Q_LEN_B (20)
  28. #define G_LEN_B (8*8)
  29. #define ALL_LEN_B (PRIV_LEN_B+PUB_LEN_B+P_LEN_B+Q_LEN_B+G_LEN_B)
  30. static const uint8_t dsa_key_blob[] = {
  31. // priv:
  32. 0xac, 0xe6, 0xef, 0x99, 0x08, 0xe8, 0x5f, 0xc8,
  33. 0xc7, 0x51, 0x97, 0x99, 0xf4, 0xd3, 0x00, 0x0f,
  34. 0x49, 0x72, 0xee, 0x46,
  35. // pub:
  36. 0x18, 0x02, 0x53, 0x09, 0x61, 0xad, 0x0b, 0x9d,
  37. 0x44, 0x80, 0x8d, 0xb4, 0x52, 0xdc, 0xb5, 0xf2,
  38. 0x11, 0x20, 0x41, 0xc7, 0xd9, 0x7c, 0x7c, 0x6c,
  39. 0xa0, 0x9e, 0xca, 0x0d, 0xff, 0x28, 0x3c, 0x64,
  40. 0xfa, 0x92, 0xbb, 0x2c, 0xe9, 0x9b, 0x10, 0x94,
  41. 0xa5, 0x8d, 0x03, 0x50, 0xa5, 0x59, 0xd4, 0x3f,
  42. 0x57, 0x78, 0x8d, 0xcf, 0x0a, 0x99, 0x5d, 0xa3,
  43. 0x2e, 0x80, 0xfa, 0x99, 0x44, 0x73, 0x6d, 0x9a,
  44. // P:
  45. 0x9f, 0x2d, 0xc8, 0x3c, 0x34, 0xf9, 0xa1, 0xbc,
  46. 0x6a, 0xa7, 0x49, 0x17, 0xd3, 0x82, 0xa2, 0xe2,
  47. 0x25, 0x31, 0xc4, 0x3d, 0x1a, 0x3f, 0x0f, 0x8a,
  48. 0x8b, 0x84, 0x3c, 0x6c, 0x9c, 0xdd, 0x42, 0xd9,
  49. 0x1a, 0x22, 0xf2, 0x55, 0x98, 0xee, 0x7d, 0x98,
  50. 0x9c, 0x9a, 0x91, 0x42, 0x5f, 0x4f, 0xa8, 0x32,
  51. 0xa0, 0xb0, 0x0f, 0x79, 0xe2, 0x76, 0x08, 0x78,
  52. 0x6e, 0xba, 0xf7, 0x74, 0x43, 0x4a, 0xf2, 0xdf,
  53. // Q:
  54. 0xdb, 0x30, 0x69, 0xe6, 0x59, 0x77, 0xee, 0x38,
  55. 0xea, 0xf7, 0xcc, 0x18, 0x83, 0xcf, 0xb4, 0x21,
  56. 0xbc, 0xcf, 0x9a, 0x77,
  57. // G:
  58. 0x73, 0x90, 0x27, 0x68, 0xe7, 0xe9, 0x3a, 0x45,
  59. 0x6f, 0x7f, 0x95, 0xca, 0x9b, 0xfd, 0x33, 0x75,
  60. 0x75, 0xff, 0x0f, 0xe7, 0x69, 0xfd, 0xb7, 0x07,
  61. 0x0f, 0x6c, 0x3a, 0xec, 0x47, 0x82, 0x78, 0xb2,
  62. 0xb3, 0x0b, 0x7f, 0x11, 0x9d, 0x34, 0x3e, 0xff,
  63. 0xb8, 0x09, 0x42, 0x82, 0x81, 0x21, 0xad, 0x2b,
  64. 0x51, 0x20, 0xec, 0x9e, 0xf8, 0x15, 0xaa, 0x3d,
  65. 0x5f, 0x29, 0x2d, 0xb5, 0xc5, 0x64, 0x53, 0x2d
  66. };
  67. #endif
  68. #if DSA_KEY_BLOB_SIZE == 1024
  69. #define PRIV_LEN_B (20)
  70. #define PUB_LEN_B (16*8)
  71. #define P_LEN_B (16*8)
  72. #define Q_LEN_B (20)
  73. #define G_LEN_B (16*8)
  74. #define ALL_LEN_B (PRIV_LEN_B+PUB_LEN_B+P_LEN_B+Q_LEN_B+G_LEN_B)
  75. static const uint8_t dsa_key_blob[] = {
  76. // priv:
  77. // 0x00, 0x00, 0x00, 0x00,
  78. 0x03, 0xad, 0x17, 0x81, 0x0f, 0x70, 0x7f, 0x89,
  79. 0xa2, 0x0a, 0x70, 0x1c, 0x3b, 0x24, 0xff, 0xd2,
  80. 0x39, 0x93, 0xd7, 0x8d,
  81. // pub:
  82. 0x42, 0x1c, 0xb2, 0x03, 0xe5, 0xc6, 0x69, 0x81,
  83. 0x1e, 0x35, 0x85, 0x86, 0xd7, 0x94, 0xd2, 0x1f,
  84. 0x77, 0x05, 0x2f, 0xcc, 0xa5, 0x69, 0x46, 0x8f,
  85. 0xe1, 0x9f, 0x82, 0xf6, 0x24, 0x2c, 0x64, 0x1b,
  86. 0x29, 0x63, 0xd5, 0xb3, 0x32, 0xdc, 0xd9, 0x5a,
  87. 0x4e, 0x92, 0xd9, 0x69, 0xcc, 0x51, 0x81, 0xc2,
  88. 0xa3, 0x7e, 0xd7, 0xf8, 0x72, 0x1f, 0x8d, 0xd4,
  89. 0xe8, 0x59, 0xb0, 0xaa, 0xdd, 0xa0, 0x73, 0xe6,
  90. 0xc4, 0x50, 0x7f, 0x4c, 0x7c, 0xde, 0x35, 0x27,
  91. 0x49, 0x36, 0x23, 0x36, 0xe4, 0x90, 0x54, 0x24,
  92. 0x45, 0x99, 0xa3, 0x10, 0xc3, 0x59, 0x2f, 0x61,
  93. 0xff, 0x75, 0xf0, 0x51, 0x1d, 0xa0, 0x8f, 0x69,
  94. 0xc1, 0x1e, 0x3e, 0x65, 0xaf, 0x82, 0x9e, 0xa9,
  95. 0x91, 0x17, 0x04, 0x7c, 0x56, 0xd1, 0x68, 0x8a,
  96. 0x4b, 0xc9, 0x48, 0x92, 0xaf, 0x72, 0xca, 0xbf,
  97. 0xf2, 0x2b, 0x9e, 0x42, 0x92, 0x46, 0x19, 0x64,
  98. // P:
  99. 0x97, 0x40, 0xda, 0x05, 0x19, 0x77, 0xb7, 0x17,
  100. 0x4b, 0x7d, 0xc0, 0x5b, 0x81, 0xdd, 0xcc, 0x0b,
  101. 0x86, 0xe0, 0x3c, 0x4d, 0xab, 0x3d, 0x43, 0xe4,
  102. 0xe3, 0x5f, 0xf3, 0x56, 0xcd, 0x5c, 0xf2, 0x85,
  103. 0x00, 0x45, 0x3c, 0xba, 0xf0, 0x56, 0xb3, 0x8b,
  104. 0x29, 0xc3, 0x55, 0x7b, 0xb6, 0xfb, 0x68, 0xca,
  105. 0x35, 0xe5, 0x0e, 0x46, 0xd6, 0xff, 0xc9, 0xbd,
  106. 0x08, 0x71, 0x65, 0x3b, 0xf7, 0xab, 0xb1, 0x96,
  107. 0x9b, 0x70, 0xdc, 0x8e, 0xf3, 0x02, 0xa4, 0x0f,
  108. 0xc6, 0xcd, 0x70, 0xe5, 0xeb, 0xd3, 0x07, 0xb5,
  109. 0x7d, 0x40, 0x8c, 0xfd, 0x33, 0x45, 0x8f, 0x9c,
  110. 0x7f, 0xa1, 0x69, 0xcb, 0xe6, 0x73, 0x1d, 0x37,
  111. 0xc7, 0x5f, 0x18, 0x57, 0x38, 0x96, 0x46, 0x24,
  112. 0xad, 0xa6, 0x59, 0x3d, 0x7a, 0x74, 0x6e, 0x88,
  113. 0x57, 0x18, 0x86, 0x7b, 0x07, 0x79, 0x52, 0xdd,
  114. 0xbc, 0xa7, 0x40, 0x88, 0xa6, 0x66, 0x50, 0x49,
  115. // Q:
  116. // 0x00, 0x00, 0x00, 0x00,
  117. 0xb4, 0x6d, 0x89, 0x7a, 0x72, 0xdb, 0x8c, 0x92,
  118. 0x60, 0xf9, 0x95, 0x47, 0x81, 0x57, 0xe8, 0x6b,
  119. 0xb4, 0xf9, 0xde, 0x51,
  120. // G:
  121. 0x76, 0x1e, 0x1b, 0xd2, 0x5c, 0x5f, 0x92, 0x96,
  122. 0x42, 0x18, 0xba, 0x8d, 0xe1, 0x24, 0x12, 0x24,
  123. 0x6f, 0x3f, 0xb8, 0x05, 0xf9, 0x72, 0x74, 0xfa,
  124. 0xef, 0xc3, 0x1e, 0xd5, 0xa5, 0x93, 0x28, 0x07,
  125. 0xc0, 0x7b, 0x47, 0xef, 0x15, 0x13, 0x68, 0x18,
  126. 0xfb, 0x0d, 0x69, 0xea, 0xcc, 0x5a, 0x43, 0x08,
  127. 0x75, 0xec, 0xe4, 0x5e, 0x8e, 0xa9, 0x61, 0xe1,
  128. 0xcd, 0x27, 0x8c, 0x55, 0xc9, 0x42, 0x11, 0x11,
  129. 0x7f, 0x20, 0x4d, 0x70, 0x34, 0x49, 0x00, 0x8c,
  130. 0x79, 0x95, 0x79, 0x0b, 0xfd, 0x8d, 0xda, 0xe3,
  131. 0x0c, 0x27, 0x7a, 0x35, 0xe5, 0x35, 0xc9, 0x73,
  132. 0x31, 0xaa, 0xed, 0xbe, 0x81, 0x89, 0x67, 0x06,
  133. 0xf6, 0x97, 0x0d, 0x44, 0x07, 0xac, 0x09, 0xac,
  134. 0x44, 0xf3, 0xc6, 0x8b, 0x30, 0x4c, 0x76, 0x0b,
  135. 0x55, 0x74, 0x10, 0x06, 0xda, 0xd4, 0x3d, 0x96,
  136. 0x7e, 0xc3, 0xf8, 0x22, 0x9c, 0x71, 0x1d, 0x9c
  137. };
  138. #endif
  139. #if DSA_KEY_BLOB_2048
  140. #define PRIV_LEN_B (20)
  141. #define PUB_LEN_B (32*8)
  142. #define P_LEN_B (32*8)
  143. #define Q_LEN_B (20)
  144. #define G_LEN_B (32*8)
  145. #define ALL_LEN_B (PRIV_LEN_B+PUB_LEN_B+P_LEN_B+Q_LEN_B+G_LEN_B)
  146. static const uint8_t dsa_key_blob[] = {
  147. /* priv: */
  148. 0x1d, 0xe4, 0x81, 0x02, 0x52, 0x6b, 0x2b, 0x0e,
  149. 0x98, 0x08, 0xc8, 0xb9, 0x81, 0x40, 0xd1, 0x1e,
  150. 0x86, 0x69, 0x0d, 0xa9,
  151. /* pub: */
  152. 0x70, 0xc4, 0x44, 0x28, 0x91, 0x77, 0x2b, 0x09,
  153. 0xde, 0xe8, 0x66, 0x0b, 0xa5, 0xc8, 0x05, 0xb4,
  154. 0x0a, 0x2d, 0x4f, 0x45, 0x8e, 0x0c, 0x8c, 0x38,
  155. 0x61, 0xf3, 0x77, 0x05, 0x64, 0xf7, 0xe6, 0xe9,
  156. 0x0b, 0x1f, 0x9b, 0x9f, 0x1f, 0xa1, 0x7e, 0x8f,
  157. 0x5b, 0x14, 0x70, 0x1d, 0x4d, 0x1c, 0xdc, 0x9d,
  158. 0xe0, 0x0a, 0xc4, 0x7b, 0x70, 0xfd, 0xef, 0xe6,
  159. 0x20, 0x2d, 0x17, 0x13, 0xd7, 0x1c, 0xc0, 0xbb,
  160. 0x5b, 0xce, 0x84, 0x6a, 0xa5, 0x4e, 0x27, 0x1c,
  161. 0x9e, 0xaa, 0xb2, 0xdc, 0xc1, 0xec, 0x74, 0x93,
  162. 0x67, 0xdb, 0xe1, 0xaa, 0x5a, 0x86, 0x1d, 0x8a,
  163. 0xa9, 0x28, 0x7e, 0xfc, 0xd5, 0x72, 0x94, 0x6c,
  164. 0x1d, 0x71, 0x85, 0x92, 0xa7, 0x6e, 0x84, 0x4f,
  165. 0x27, 0xf3, 0x7e, 0x04, 0x7d, 0xf2, 0x7c, 0x07,
  166. 0xa0, 0x7d, 0x02, 0x7c, 0x30, 0x70, 0xb5, 0x87,
  167. 0xc3, 0xf0, 0xc2, 0x0c, 0xdb, 0x26, 0x72, 0x33,
  168. 0x20, 0xca, 0xf0, 0x8b, 0x05, 0x20, 0x70, 0x98,
  169. 0x65, 0x03, 0xd7, 0xd4, 0x47, 0xf0, 0xb2, 0x6e,
  170. 0x2a, 0xbe, 0xcc, 0x83, 0x0d, 0xab, 0x60, 0x61,
  171. 0x26, 0x7b, 0xaf, 0xae, 0x18, 0x9e, 0x20, 0xeb,
  172. 0x12, 0x31, 0x18, 0x2e, 0x73, 0xca, 0xd4, 0x5e,
  173. 0x66, 0x74, 0x61, 0x07, 0x9b, 0x20, 0x68, 0x12,
  174. 0x88, 0xb1, 0xc5, 0x0f, 0x85, 0x9b, 0x45, 0x40,
  175. 0x7d, 0x76, 0x62, 0x73, 0xba, 0x41, 0x7b, 0xaf,
  176. 0xc7, 0xb9, 0x19, 0x7a, 0xd0, 0x55, 0xe6, 0xfd,
  177. 0xb5, 0xb9, 0xc4, 0x1b, 0x22, 0x47, 0x8f, 0x7b,
  178. 0xd7, 0x75, 0xe8, 0x7f, 0x01, 0xa2, 0x9b, 0x79,
  179. 0xde, 0xea, 0x55, 0x3c, 0x61, 0x4d, 0xcd, 0xce,
  180. 0x89, 0x8c, 0x76, 0x62, 0x12, 0x4d, 0xd4, 0x47,
  181. 0x03, 0x0e, 0xe8, 0xe2, 0xb8, 0xda, 0xca, 0x20,
  182. 0xb3, 0x64, 0xb6, 0x07, 0x06, 0x1b, 0xcb, 0x91,
  183. 0x51, 0x2c, 0x2e, 0xfa, 0xe1, 0xee, 0x1e, 0x78,
  184. /* P: */
  185. 0x8d, 0x09, 0x00, 0x56, 0x63, 0x39, 0x42, 0x8d,
  186. 0x15, 0xd5, 0x1d, 0x86, 0x10, 0xde, 0xc7, 0xf4,
  187. 0x07, 0xe5, 0x81, 0xbe, 0x67, 0xee, 0xc5, 0x33,
  188. 0xd3, 0x41, 0x1b, 0xba, 0xd8, 0xa6, 0x61, 0x49,
  189. 0x2d, 0x66, 0xcf, 0x60, 0x9f, 0x52, 0x60, 0x6e,
  190. 0x0a, 0x16, 0xdc, 0x0b, 0x24, 0x1b, 0x62, 0x32,
  191. 0xc4, 0xab, 0x52, 0x17, 0xbf, 0xc5, 0xa2, 0x2a,
  192. 0xa4, 0x5e, 0x8c, 0xff, 0x97, 0x45, 0x51, 0xd9,
  193. 0xc3, 0xf2, 0x32, 0x4a, 0xb9, 0x08, 0xc1, 0x6a,
  194. 0x7b, 0x82, 0x93, 0x2a, 0x60, 0x29, 0x55, 0x1a,
  195. 0x36, 0x1f, 0x05, 0x4f, 0xf1, 0x43, 0x12, 0xb2,
  196. 0x73, 0x4e, 0xf6, 0x37, 0x65, 0x3d, 0x0b, 0x70,
  197. 0x08, 0xc7, 0x34, 0x0b, 0x4d, 0xc9, 0x08, 0x70,
  198. 0xaf, 0x4b, 0x95, 0x0b, 0x7c, 0x9f, 0xcf, 0xfc,
  199. 0x57, 0x94, 0x47, 0x6d, 0xd1, 0xaf, 0xc6, 0x52,
  200. 0xd9, 0xe2, 0x05, 0xce, 0xb2, 0xb8, 0x91, 0x6f,
  201. 0x5a, 0x77, 0x6b, 0x1b, 0xff, 0x97, 0x8c, 0x5e,
  202. 0x33, 0xfc, 0x80, 0x29, 0xdf, 0x83, 0x91, 0x0c,
  203. 0x28, 0x1b, 0x00, 0xb4, 0xc9, 0x3e, 0xb7, 0x67,
  204. 0xca, 0xab, 0x63, 0xd4, 0x48, 0xfe, 0xd2, 0xfd,
  205. 0x65, 0x57, 0x33, 0x25, 0xbd, 0xf1, 0xa5, 0x51,
  206. 0x51, 0x50, 0xf6, 0xcf, 0xfa, 0x0d, 0x67, 0x4e,
  207. 0x90, 0x08, 0x87, 0x34, 0xf6, 0x33, 0xc9, 0x58,
  208. 0xb1, 0x87, 0xf8, 0x5d, 0x73, 0x80, 0xde, 0x51,
  209. 0xcd, 0x17, 0x70, 0x3e, 0xa4, 0xa8, 0x4f, 0xda,
  210. 0xcd, 0xa2, 0x66, 0x0f, 0x95, 0xa7, 0xc6, 0xf7,
  211. 0x12, 0x2e, 0x27, 0x94, 0xa9, 0x26, 0x1b, 0x25,
  212. 0x16, 0x18, 0x99, 0x3b, 0x32, 0xaf, 0x71, 0x13,
  213. 0x35, 0xda, 0xb8, 0x71, 0x5b, 0x50, 0x7c, 0x7a,
  214. 0x9d, 0xcc, 0x0d, 0x95, 0xef, 0x6f, 0x64, 0x3c,
  215. 0x28, 0x4b, 0x15, 0xe9, 0xd4, 0xad, 0xcc, 0x56,
  216. 0xcb, 0x24, 0xf9, 0x61, 0x79, 0xd7, 0x56, 0xd3,
  217. /* Q: */
  218. 0xf7, 0xdf, 0x85, 0xf5, 0x63, 0x36, 0x63, 0x71,
  219. 0x74, 0x34, 0x98, 0x19, 0xff, 0x79, 0xf2, 0xe2,
  220. 0x15, 0x75, 0x3c, 0x95,
  221. /* G: */
  222. 0x0c, 0xf6, 0x8b, 0x1a, 0xbe, 0x66, 0x84, 0x98,
  223. 0xae, 0xcb, 0xb0, 0xd9, 0x75, 0x75, 0x32, 0x4b,
  224. 0xa3, 0xf2, 0x28, 0xa6, 0x6d, 0x13, 0xf2, 0xf3,
  225. 0xfd, 0x93, 0x91, 0xb1, 0x21, 0x1e, 0xcc, 0x08,
  226. 0x87, 0xce, 0x74, 0xb1, 0xd0, 0x19, 0x50, 0xff,
  227. 0xac, 0xef, 0x9f, 0x82, 0xda, 0x75, 0xda, 0x6d,
  228. 0x89, 0xf3, 0x0b, 0xdc, 0x27, 0x98, 0x85, 0x01,
  229. 0x68, 0xb7, 0xbd, 0x98, 0x83, 0xb1, 0xb0, 0x65,
  230. 0x31, 0x71, 0x43, 0x05, 0xa7, 0x76, 0x63, 0xe4,
  231. 0x7d, 0x61, 0x53, 0xc7, 0x3e, 0x3b, 0x82, 0x28,
  232. 0x65, 0x07, 0xfe, 0x9e, 0xa3, 0x35, 0x2c, 0xdc,
  233. 0x9e, 0x05, 0x7c, 0x9a, 0x69, 0xc6, 0x9f, 0xc2,
  234. 0x3f, 0x94, 0x6b, 0xad, 0xa4, 0x2b, 0x5d, 0x48,
  235. 0x9e, 0x2c, 0xad, 0xd2, 0x89, 0x49, 0xdc, 0xdb,
  236. 0x55, 0x49, 0x56, 0xaf, 0xe9, 0x0e, 0x37, 0xe7,
  237. 0x1f, 0x42, 0x6a, 0x7c, 0xac, 0xe8, 0x1b, 0xbb,
  238. 0x21, 0x82, 0x14, 0x72, 0x17, 0x64, 0xf0, 0x3c,
  239. 0x3d, 0xc1, 0x43, 0x27, 0x27, 0x9f, 0xe9, 0x21,
  240. 0xf2, 0x2f, 0xf7, 0xfa, 0x3c, 0xed, 0xbf, 0xab,
  241. 0xab, 0xb7, 0x3c, 0x6d, 0x1e, 0x85, 0x9f, 0x77,
  242. 0x4f, 0x69, 0x09, 0x4e, 0xed, 0x13, 0x84, 0x40,
  243. 0x1a, 0xc6, 0xa1, 0xd9, 0x68, 0xb6, 0x18, 0x32,
  244. 0x79, 0x25, 0x9e, 0xa6, 0x41, 0x30, 0xd1, 0xc2,
  245. 0x7a, 0x8f, 0x0d, 0x46, 0xee, 0xda, 0xb0, 0xbf,
  246. 0x64, 0x42, 0x59, 0x7e, 0x22, 0x88, 0xd6, 0x52,
  247. 0xec, 0xed, 0xc4, 0x13, 0xb1, 0x7f, 0x5c, 0x77,
  248. 0x4c, 0xfd, 0x22, 0x90, 0xd3, 0xe3, 0xa9, 0xc1,
  249. 0x0f, 0x25, 0xac, 0xd5, 0x04, 0x84, 0xe6, 0xa8,
  250. 0xc7, 0xb4, 0x4f, 0xa2, 0x67, 0xae, 0xaa, 0x92,
  251. 0xe9, 0x0a, 0xed, 0x45, 0x5b, 0xf0, 0x1b, 0x69,
  252. 0xec, 0xaf, 0x7d, 0xf2, 0x71, 0x25, 0xbf, 0x92,
  253. 0xd4, 0xd0, 0x5b, 0xde, 0x5a, 0x2d, 0x18, 0x8e
  254. };
  255. #endif
  256. void load_dsa_key_blob(dsa_ctx_t* ctx){
  257. if(ctx->priv.wordv){
  258. free(ctx->priv.wordv);
  259. }
  260. ctx->priv.wordv = malloc(ALL_LEN_B);
  261. if(ctx->priv.wordv==NULL){
  262. cli_putstr("\r\nERROR: OUT OF MEMORY!!!");
  263. return;
  264. }
  265. memcpy(ctx->priv.wordv, dsa_key_blob, ALL_LEN_B);
  266. ctx->priv.length_W=(PRIV_LEN_B+sizeof(bigint_word_t)-1)/sizeof(bigint_word_t);
  267. ctx->pub.wordv = (bigint_word_t*)((uint8_t*)ctx->priv.wordv+PRIV_LEN_B);
  268. ctx->pub.length_W = (PUB_LEN_B+sizeof(bigint_word_t)-1)/sizeof(bigint_word_t);
  269. ctx->domain.p.wordv = (bigint_word_t*)((uint8_t*)ctx->priv.wordv+PRIV_LEN_B+PUB_LEN_B);
  270. ctx->domain.p.length_W = (P_LEN_B+sizeof(bigint_word_t)-1)/sizeof(bigint_word_t);
  271. ctx->domain.q.wordv = (bigint_word_t*)((uint8_t*)ctx->priv.wordv+PRIV_LEN_B+PUB_LEN_B+P_LEN_B);
  272. ctx->domain.q.length_W = (Q_LEN_B+sizeof(bigint_word_t)-1)/sizeof(bigint_word_t);
  273. ctx->domain.g.wordv = (bigint_word_t*)((uint8_t*)ctx->priv.wordv+PRIV_LEN_B+PUB_LEN_B+P_LEN_B+Q_LEN_B);
  274. ctx->domain.g.length_W = (G_LEN_B+sizeof(bigint_word_t)-1)/sizeof(bigint_word_t);
  275. bigint_changeendianess(&(ctx->priv));
  276. bigint_changeendianess(&(ctx->pub));
  277. bigint_changeendianess(&(ctx->domain.p));
  278. bigint_changeendianess(&(ctx->domain.q));
  279. bigint_changeendianess(&(ctx->domain.g));
  280. bigint_adjust(&(ctx->priv));
  281. bigint_adjust(&(ctx->pub));
  282. bigint_adjust(&(ctx->domain.p));
  283. bigint_adjust(&(ctx->domain.q));
  284. bigint_adjust(&(ctx->domain.g));
  285. }