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.

121 lines
2.7 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1991 - 1992
  6. //
  7. // File: nullcs.c
  8. //
  9. // Contents: Null Crypto system
  10. //
  11. //
  12. // History:
  13. //
  14. //------------------------------------------------------------------------
  15. #include <nt.h>
  16. #include <ntrtl.h>
  17. #include <nturtl.h>
  18. #include <windows.h>
  19. #include <string.h>
  20. #include <kerbcon.h>
  21. #include <security.h>
  22. #include <cryptdll.h>
  23. #include "md4.h"
  24. NTSTATUS NTAPI ncsInitialize(PUCHAR, ULONG, ULONG, PCRYPT_STATE_BUFFER *);
  25. NTSTATUS NTAPI ncsEncrypt(PCRYPT_STATE_BUFFER, PUCHAR, ULONG, PUCHAR, PULONG);
  26. NTSTATUS NTAPI ncsDecrypt(PCRYPT_STATE_BUFFER, PUCHAR, ULONG, PUCHAR, PULONG);
  27. NTSTATUS NTAPI ncsFinish(PCRYPT_STATE_BUFFER *);
  28. NTSTATUS NTAPI ncsHashPassword(PSECURITY_STRING, PUCHAR);
  29. NTSTATUS NTAPI ncsRandomKey(PUCHAR, ULONG, PUCHAR );
  30. NTSTATUS NTAPI ncsFinishRandom(void);
  31. CRYPTO_SYSTEM csNULL = {
  32. KERB_ETYPE_NULL, // Etype
  33. 1, // Blocksize (stream)
  34. 0, // no exportable version
  35. 0, // Key size, in bytes
  36. 0, // no header size
  37. KERB_CHECKSUM_MD4, // Checksum algorithm
  38. 0, // no attributes
  39. L"Microsoft NULL CS", // Text name
  40. ncsInitialize,
  41. ncsEncrypt,
  42. ncsDecrypt,
  43. ncsFinish,
  44. ncsHashPassword,
  45. ncsRandomKey
  46. };
  47. NTSTATUS NTAPI
  48. ncsInitialize( PUCHAR pbKey,
  49. ULONG KeySize,
  50. ULONG dwOptions,
  51. PCRYPT_STATE_BUFFER * psbBuffer)
  52. {
  53. *psbBuffer = NULL;
  54. return(S_OK);
  55. }
  56. NTSTATUS NTAPI
  57. ncsEncrypt( PCRYPT_STATE_BUFFER psbBuffer,
  58. PUCHAR pbInput,
  59. ULONG cbInput,
  60. PUCHAR pbOutput,
  61. PULONG cbOutput)
  62. {
  63. if (pbInput != pbOutput)
  64. memcpy(pbOutput, pbInput, cbInput);
  65. *cbOutput = cbInput;
  66. return(S_OK);
  67. }
  68. NTSTATUS NTAPI
  69. ncsDecrypt( PCRYPT_STATE_BUFFER psbBuffer,
  70. PUCHAR pbInput,
  71. ULONG cbInput,
  72. PUCHAR pbOutput,
  73. PULONG cbOutput)
  74. {
  75. if (pbInput != pbOutput)
  76. memcpy(pbOutput, pbInput, cbInput);
  77. *cbOutput = cbInput;
  78. return(S_OK);
  79. }
  80. NTSTATUS NTAPI
  81. ncsFinish( PCRYPT_STATE_BUFFER * psbBuffer)
  82. {
  83. *psbBuffer = NULL;
  84. return(S_OK);
  85. }
  86. NTSTATUS NTAPI
  87. ncsHashPassword(PSECURITY_STRING pbPassword,
  88. PUCHAR pbKey)
  89. {
  90. return(STATUS_SUCCESS);
  91. }
  92. NTSTATUS NTAPI
  93. ncsRandomKey(
  94. IN PUCHAR Seed,
  95. IN ULONG SeedLength,
  96. OUT PUCHAR pbKey
  97. )
  98. {
  99. return(STATUS_SUCCESS);
  100. }