[PSDK] Update bcrypt.h and wincrypt.h. CORE-14434
authorAmine Khaldi <amine.khaldi@reactos.org>
Fri, 9 Mar 2018 11:58:19 +0000 (12:58 +0100)
committerAmine Khaldi <amine.khaldi@reactos.org>
Fri, 9 Mar 2018 11:58:19 +0000 (12:58 +0100)
sdk/include/psdk/bcrypt.h
sdk/include/psdk/wincrypt.h

index 6a80528..d4118b3 100644 (file)
@@ -58,6 +58,14 @@ typedef NTSTATUS *PNTSTATUS;
 #define BCRYPT_PROVIDER_HANDLE L"ProviderHandle"
 #define BCRYPT_SIGNATURE_LENGTH L"SignatureLength"
 
+#define BCRYPT_OPAQUE_KEY_BLOB   L"OpaqueKeyBlob"
+#define BCRYPT_KEY_DATA_BLOB     (const WCHAR []){'K','e','y','D','a','t','a','B','l','o','b',0}
+#define BCRYPT_AES_WRAP_KEY_BLOB (const WCHAR []){'R','f','c','3','5','6','5','K','e','y','W','r','a','p','B','l','o','b',0}
+#define BCRYPT_ECCPUBLIC_BLOB    (const WCHAR []){'E','C','C','P','U','B','L','I','C','B','L','O','B',0}
+#define BCRYPT_ECCPRIVATE_BLOB   (const WCHAR []){'E','C','C','P','R','I','V','A','T','E','B','L','O','B',0}
+#define BCRYPT_RSAPUBLIC_BLOB    (const WCHAR []){'R','S','A','P','U','B','L','I','C','B','L','O','B',0}
+#define BCRYPT_RSAPRIVATE_BLOB   (const WCHAR []){'R','S','A','P','R','I','V','A','T','E','B','L','O','B',0}
+
 #define MS_PRIMITIVE_PROVIDER L"Microsoft Primitive Provider"
 #define MS_PLATFORM_CRYPTO_PROVIDER L"Microsoft Platform Crypto Provider"
 
@@ -67,6 +75,16 @@ typedef NTSTATUS *PNTSTATUS;
 #define BCRYPT_SHA256_ALGORITHM     L"SHA256"
 #define BCRYPT_SHA384_ALGORITHM     L"SHA384"
 #define BCRYPT_SHA512_ALGORITHM     L"SHA512"
+#define BCRYPT_ECDSA_P256_ALGORITHM L"ECDSA_P256"
+#define BCRYPT_ECDSA_P384_ALGORITHM L"ECDSA_P384"
+#define BCRYPT_ECDSA_P521_ALGORITHM L"ECDSA_P521"
+
+#define BCRYPT_ECDSA_PUBLIC_P256_MAGIC  0x31534345
+#define BCRYPT_ECDSA_PRIVATE_P256_MAGIC 0x32534345
+#define BCRYPT_ECDSA_PUBLIC_P384_MAGIC  0x33534345
+#define BCRYPT_ECDSA_PRIVATE_P384_MAGIC 0x34534345
+#define BCRYPT_ECDSA_PUBLIC_P521_MAGIC  0x35534345
+#define BCRYPT_ECDSA_PRIVATE_P521_MAGIC 0x36534345
 
 typedef struct _BCRYPT_ALGORITHM_IDENTIFIER
 {
@@ -75,7 +93,77 @@ typedef struct _BCRYPT_ALGORITHM_IDENTIFIER
     ULONG  dwFlags;
 } BCRYPT_ALGORITHM_IDENTIFIER;
 
+typedef struct __BCRYPT_KEY_LENGTHS_STRUCT
+{
+    ULONG dwMinLength;
+    ULONG dwMaxLength;
+    ULONG dwIncrement;
+} BCRYPT_KEY_LENGTHS_STRUCT, BCRYPT_AUTH_TAG_LENGTHS_STRUCT;
+
+typedef struct _BCRYPT_KEY_DATA_BLOB_HEADER
+{
+    ULONG dwMagic;
+    ULONG dwVersion;
+    ULONG cbKeyData;
+} BCRYPT_KEY_DATA_BLOB_HEADER, *PBCRYPT_KEY_DATA_BLOB_HEADER;
+
+typedef struct _BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
+{
+    ULONG cbSize;
+    ULONG dwInfoVersion;
+    UCHAR *pbNonce;
+    ULONG cbNonce;
+    UCHAR *pbAuthData;
+    ULONG cbAuthData;
+    UCHAR *pbTag;
+    ULONG cbTag;
+    UCHAR *pbMacContext;
+    ULONG cbMacContext;
+    ULONG cbAAD;
+    ULONGLONG cbData;
+    ULONG dwFlags;
+} BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO, *PBCRYPT_AUTHENTICATED_CIPHER_MODE_INFO;
+
+typedef struct _BCRYPT_ECCKEY_BLOB
+{
+    ULONG dwMagic;
+    ULONG cbKey;
+} BCRYPT_ECCKEY_BLOB, *PBCRYPT_ECCKEY_BLOB;
+
+#define BCRYPT_RSAPUBLIC_MAGIC      0x31415352
+#define BCRYPT_RSAPRIVATE_MAGIC     0x32415352
+#define BCRYPT_RSAFULLPRIVATE_MAGIC 0x33415352
+
+typedef struct _BCRYPT_RSAKEY_BLOB
+{
+    ULONG Magic;
+    ULONG BitLength;
+    ULONG cbPublicExp;
+    ULONG cbModulus;
+    ULONG cbPrime1;
+    ULONG cbPrime2;
+} BCRYPT_RSAKEY_BLOB;
+
+typedef struct _BCRYPT_PKCS1_PADDING_INFO
+{
+    LPCWSTR pszAlgId;
+} BCRYPT_PKCS1_PADDING_INFO;
+
+#define BCRYPT_PAD_NONE   0x00000001
+#define BCRYPT_PAD_PKCS1  0x00000002
+#define BCRYPT_PAD_OAEP   0x00000004
+#define BCRYPT_PAD_PSS    0x00000008
+
+#define BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO_VERSION 1
+
+#define BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG 0x00000001
+#define BCRYPT_AUTH_MODE_IN_PROGRESS_FLAG 0x00000002
+
+#define BCRYPT_KEY_DATA_BLOB_MAGIC    0x4d42444b
+#define BCRYPT_KEY_DATA_BLOB_VERSION1 1
+
 typedef PVOID BCRYPT_ALG_HANDLE;
+typedef PVOID BCRYPT_KEY_HANDLE;
 typedef PVOID BCRYPT_HANDLE;
 typedef PVOID BCRYPT_HASH_HANDLE;
 
@@ -85,14 +173,22 @@ typedef PVOID BCRYPT_HASH_HANDLE;
 
 NTSTATUS WINAPI BCryptCloseAlgorithmProvider(BCRYPT_ALG_HANDLE, ULONG);
 NTSTATUS WINAPI BCryptCreateHash(BCRYPT_ALG_HANDLE, BCRYPT_HASH_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG);
+NTSTATUS WINAPI BCryptDecrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG);
 NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE);
+NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE);
+NTSTATUS WINAPI BCryptEncrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG);
 NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG, ULONG *, BCRYPT_ALGORITHM_IDENTIFIER **, ULONG);
 NTSTATUS WINAPI BCryptFinishHash(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG);
+NTSTATUS WINAPI BCryptGenerateSymmetricKey(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG);
 NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG);
 NTSTATUS WINAPI BCryptGetFipsAlgorithmMode(BOOLEAN *);
 NTSTATUS WINAPI BCryptGetProperty(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG);
 NTSTATUS WINAPI BCryptHash(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, PUCHAR, ULONG, PUCHAR, ULONG);
 NTSTATUS WINAPI BCryptHashData(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG);
+NTSTATUS WINAPI BCryptImportKeyPair(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *, UCHAR *, ULONG, ULONG);
 NTSTATUS WINAPI BCryptOpenAlgorithmProvider(BCRYPT_ALG_HANDLE *, LPCWSTR, LPCWSTR, ULONG);
+NTSTATUS WINAPI BCryptSetProperty(BCRYPT_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG);
+NTSTATUS WINAPI BCryptDuplicateHash(BCRYPT_HASH_HANDLE, BCRYPT_HASH_HANDLE *, UCHAR *, ULONG, ULONG);
+NTSTATUS WINAPI BCryptVerifySignature(BCRYPT_KEY_HANDLE, void *, UCHAR *, ULONG, UCHAR *, ULONG, ULONG);
 
 #endif  /* __WINE_BCRYPT_H */
index 88b403f..ffd6644 100644 (file)
@@ -295,6 +295,11 @@ typedef struct _CERT_KEY_ATTRIBUTES_INFO {
     PCERT_PRIVATE_KEY_VALIDITY pPrivateKeyUsagePeriod;
 } CERT_KEY_ATTRIBUTES_INFO, *PCERT_KEY_ATTRIBUTES_INFO;
 
+typedef struct _CERT_ECC_SIGNATURE {
+    CRYPT_UINT_BLOB r;
+    CRYPT_UINT_BLOB s;
+} CERT_ECC_SIGNATURE, *PCERT_ECC_SIGNATURE;
+
 /* byte 0 */
 #define CERT_DIGITAL_SIGNATURE_KEY_USAGE 0x80
 #define CERT_NON_REPUDIATION_KEY_USAGE   0x40
@@ -1365,6 +1370,17 @@ typedef BOOL
 
 #define CRYPT_MATCH_ANY_ENCODING_TYPE 0xffffffff
 
+#define CALG_OID_INFO_CNG_ONLY   0xffffffff
+#define CALG_OID_INFO_PARAMETERS 0xfffffffe
+
+#define CRYPT_OID_INFO_HASH_PARAMETERS_ALGORITHM     (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','H','a','s','h','P','a','r','a','m','e','t','e','r','s',0}
+#define CRYPT_OID_INFO_ECC_PARAMETERS_ALGORITHM      (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','E','C','C','P','a','r','a','m','e','t','e','r','s',0}
+#define CRYPT_OID_INFO_MGF1_PARAMETERS_ALGORITHM     (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','M','g','f','1','P','a','r','a','m','e','t','e','r','s',0}
+#define CRYPT_OID_INFO_NO_SIGN_ALGORITHM             (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','N','o','S','i','g','n',0}
+#define CRYPT_OID_INFO_OAEP_PARAMETERS_ALGORITHM     (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','O','A','E','P','P','a','r','a','m','e','t','e','r','s',0}
+#define CRYPT_OID_INFO_ECC_WRAP_PARAMETERS_ALGORITHM (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','E','C','C','W','r','a','p','P','a','r','a','m','e','t','e','r','s',0}
+#define CRYPT_OID_INFO_NO_PARAMETERS_ALGORITHM       (const WCHAR []){'C','r','y','p','t','O','I','D','I','n','f','o','N','o','P','a','r','a','m','e','t','e','r','s',0}
+
 typedef struct _CRYPT_OID_INFO {
     DWORD   cbSize;
     LPCSTR  pszOID;
@@ -1376,6 +1392,10 @@ typedef struct _CRYPT_OID_INFO {
         DWORD  dwLength;
     } DUMMYUNIONNAME;
     CRYPT_DATA_BLOB ExtraInfo;
+#ifdef CRYPT_OID_INFO_HAS_EXTRA_FIELDS
+    LPCWSTR         pwszCNGAlgid;
+    LPCWSTR         pwszCNGExtraAlgid;
+#endif
 } CRYPT_OID_INFO, *PCRYPT_OID_INFO;
 typedef const CRYPT_OID_INFO CCRYPT_OID_INFO, *PCCRYPT_OID_INFO;
 
@@ -2191,6 +2211,12 @@ static const WCHAR MS_ENH_RSA_AES_PROV_XP_W[] = { 'M','i','c','r','o','s','o','f
 #define CRYPTPROTECT_AUDIT              0x0010
 #define CRYPTPROTECT_VERIFY_PROTECTION  0x0040
 
+/* Crypt{Protect,Unprotect}Memory */
+#define CRYPTPROTECTMEMORY_BLOCK_SIZE     16
+#define CRYPTPROTECTMEMORY_SAME_PROCESS   0x0000
+#define CRYPTPROTECTMEMORY_CROSS_PROCESS  0x0001
+#define CRYPTPROTECTMEMORY_SAME_LOGON     0x0002
+
 /* Blob Types */
 #define SIMPLEBLOB              0x1
 #define PUBLICKEYBLOB           0x6
@@ -3014,6 +3040,12 @@ typedef struct _CTL_FIND_SUBJECT_PARA
 #define szOID_X957                          "1.2.840.10040"
 #define szOID_X957_DSA                      "1.2.840.10040.4.1"
 #define szOID_X957_SHA1DSA                  "1.2.840.10040.4.3"
+#define szOID_ECC_PUBLIC_KEY                "1.2.840.10045.2.1"
+#define szOID_ECC_CURVE_P256                "1.2.840.10045.3.1.7"
+#define szOID_ECDSA_SPECIFIED               "1.2.840.10045.4.3"
+#define szOID_ECDSA_SHA256                  "1.2.840.10045.4.3.2"
+#define szOID_ECDSA_SHA384                  "1.2.840.10045.4.3.3"
+#define szOID_ECDSA_SHA512                  "1.2.840.10045.4.3.4"
 #define szOID_DS                            "2.5"
 #define szOID_DSALG                         "2.5.8"
 #define szOID_DSALG_CRPT                    "2.5.8.1"
@@ -3055,6 +3087,8 @@ typedef struct _CTL_FIND_SUBJECT_PARA
 #define szOID_OIWDIR_SIGN                   "1.3.14.7.2.3"
 #define szOID_OIWDIR_md2                    "1.3.14.7.2.2.1"
 #define szOID_OIWDIR_md2RSA                 "1.3.14.7.2.3.1"
+#define szOID_ECC_CURVE_P384                "1.3.132.0.34"
+#define szOID_ECC_CURVE_P521                "1.3.132.0.35"
 #define szOID_INFOSEC                       "2.16.840.1.101.2.1"
 #define szOID_INFOSEC_sdnsSignature         "2.16.840.1.101.2.1.1.1"
 #define szOID_INFOSEC_mosaicSignature       "2.16.840.1.101.2.1.1.2"
@@ -3360,6 +3394,7 @@ typedef struct _CTL_FIND_SUBJECT_PARA
 #define X509_PKIX_POLICY_QUALIFIER_USERNOTICE ((LPCSTR)46)
 #define X509_DH_PUBLICKEY                    X509_MULTI_BYTE_UINT
 #define X509_DH_PARAMETERS                   ((LPCSTR)47)
+#define X509_ECC_SIGNATURE                   ((LPCSTR)47)
 #define PKCS_ATTRIBUTES                      ((LPCSTR)48)
 #define PKCS_SORTED_CTL                      ((LPCSTR)49)
 #define X942_DH_PARAMETERS                   ((LPCSTR)50)
@@ -3377,6 +3412,7 @@ typedef struct _CTL_FIND_SUBJECT_PARA
 #define CMC_ADD_EXTENSIONS                   ((LPCSTR)62)
 #define CMC_ADD_ATTRIBUTES                   ((LPCSTR)63)
 #define X509_CERTIFICATE_TEMPLATE            ((LPCSTR)64)
+#define X509_OBJECT_IDENTIFIER               ((LPCSTR)73)
 #define PKCS7_SIGNER_INFO                    ((LPCSTR)500)
 #define CMS_SIGNER_INFO                      ((LPCSTR)501)
 
@@ -4710,6 +4746,20 @@ CertEnumSystemStore(
   _Inout_opt_ void *pvArg,
   __callback PFN_CERT_ENUM_SYSTEM_STORE pfnEnum);
 
+BOOL
+WINAPI
+CertRegisterSystemStore(
+  _In_ const void *pvSystemStore,
+  _In_ DWORD dwFlags,
+  _In_opt_ PCERT_SYSTEM_STORE_INFO pStoreInfo,
+  _Reserved_ void *pvReserved);
+
+BOOL
+WINAPI
+CertUnregisterSystemStore(
+  _In_ const void *pvSystemStore,
+  _In_ DWORD dwFlags);
+
 BOOL
 WINAPI
 CertEnumPhysicalStore(