Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

161 lines
3.2 KiB

  1. #ifdef __cplusplus
  2. extern "C" {
  3. #endif
  4. /* dss_key.h */
  5. #define DSS_KEYSIZE_INC 64
  6. /*********************************/
  7. /* Definitions */
  8. /*********************************/
  9. #define DSS_MAGIC 0x31535344
  10. #define DSS_PRIVATE_MAGIC 0x32535344
  11. #define DSS_PUB_MAGIC_VER3 0x33535344
  12. #define DSS_PRIV_MAGIC_VER3 0x34535344
  13. /*********************************/
  14. /* Structure Definitions */
  15. /*********************************/
  16. typedef dsa_private_t DSSKey_t;
  17. /*********************************/
  18. /* Function Definitions */
  19. /*********************************/
  20. extern DSSKey_t *
  21. allocDSSKey(
  22. void);
  23. extern void
  24. freeKeyDSS(
  25. DSSKey_t *dss);
  26. extern DWORD
  27. initKeyDSS(
  28. IN Context_t *pContext,
  29. IN ALG_ID Algid,
  30. IN OUT DSSKey_t *pDss,
  31. IN DWORD dwBitLen);
  32. // Generate the DSS keys
  33. extern DWORD
  34. genDSSKeys(
  35. IN Context_t *pContext,
  36. IN OUT DSSKey_t *pDss);
  37. extern void
  38. copyDSSPubKey(
  39. IN DSSKey_t *dss1,
  40. IN DSSKey_t *dss2);
  41. extern void
  42. copyDSSKey(
  43. IN DSSKey_t *dss1,
  44. IN DSSKey_t *dss2);
  45. extern DWORD
  46. getDSSParams(
  47. DSSKey_t *dss,
  48. DWORD param,
  49. BYTE *data,
  50. DWORD *len);
  51. extern DWORD
  52. setDSSParams(
  53. IN Context_t *pContext,
  54. IN OUT DSSKey_t *pDss,
  55. IN DWORD dwParam,
  56. IN CONST BYTE *pbData);
  57. extern BOOL
  58. DSSValueExists(
  59. IN DWORD *pdw,
  60. IN DWORD cdw,
  61. OUT DWORD *pcb);
  62. extern DWORD
  63. ExportDSSPrivBlob3(
  64. IN Context_t *pContext,
  65. IN DSSKey_t *pDSS,
  66. IN DWORD dwMagic,
  67. IN ALG_ID Algid,
  68. IN BOOL fInternalExport,
  69. IN BOOL fSigKey,
  70. OUT BYTE *pbKeyBlob,
  71. IN OUT DWORD *pcbKeyBlob);
  72. extern DWORD
  73. ImportDSSPrivBlob3(
  74. IN BOOL fInternalExport,
  75. IN CONST BYTE *pbKeyBlob,
  76. IN DWORD cbKeyBlob,
  77. OUT DSSKey_t *pDSS);
  78. extern DWORD
  79. ExportDSSPubBlob3(
  80. IN DSSKey_t *pDSS,
  81. IN DWORD dwMagic,
  82. IN ALG_ID Algid,
  83. OUT BYTE *pbKeyBlob,
  84. IN OUT DWORD *pcbKeyBlob);
  85. extern DWORD
  86. ImportDSSPubBlob3(
  87. IN CONST BYTE *pbKeyBlob,
  88. IN DWORD cbKeyBlob,
  89. IN BOOL fYIncluded,
  90. OUT DSSKey_t *pDSS);
  91. // Export DSS key into blob format
  92. extern DWORD
  93. exportDSSKey(
  94. IN Context_t *pContext,
  95. IN DSSKey_t *pDSS,
  96. IN DWORD dwFlags,
  97. IN DWORD dwBlobType,
  98. IN BYTE *pbKeyBlob,
  99. IN DWORD *pcbKeyBlob,
  100. IN BOOL fInternalExport);
  101. // Import the blob into DSS key
  102. extern DWORD
  103. importDSSKey(
  104. IN Context_t *pContext,
  105. IN Key_t *pKey,
  106. IN CONST BYTE *pbKeyBlob,
  107. IN DWORD cbKeyBlob,
  108. IN DWORD dwKeysetType,
  109. IN BOOL fInternal);
  110. extern DWORD
  111. dssGenerateSignature(
  112. Context_t *pContext,
  113. DSSKey_t *pDss,
  114. BYTE *pbHash,
  115. BYTE *pbSig,
  116. DWORD *pcbSig);
  117. //
  118. // Function : SignAndVerifyWithKey
  119. //
  120. // Description : This function creates a hash and then signs that hash with
  121. // the passed in key and verifies the signature. The function
  122. // is used for FIPS 140-1 compliance to make sure that newly
  123. // generated/imported keys work and in the self test during
  124. // DLL initialization.
  125. //
  126. extern DWORD
  127. SignAndVerifyWithKey(
  128. IN DSSKey_t *pDss,
  129. IN EXPO_OFFLOAD_STRUCT *pOffloadInfo,
  130. IN HANDLE hRNGDriver,
  131. IN BYTE *pbData,
  132. IN DWORD cbData);
  133. #ifdef __cplusplus
  134. }
  135. #endif