diff --git a/reactos/dll/win32/crypt32/chain.c b/reactos/dll/win32/crypt32/chain.c index 28a22064440..1724f4254fe 100644 --- a/reactos/dll/win32/crypt32/chain.c +++ b/reactos/dll/win32/crypt32/chain.c @@ -686,8 +686,12 @@ static BOOL url_matches(LPCWSTR constraint, LPCWSTR name, authority_end = strchrW(name, '?'); if (!authority_end) authority_end = name + strlenW(name); - /* Remove any port number from the authority */ - for (colon = authority_end; colon >= name && *colon != ':'; colon--) + /* Remove any port number from the authority. The userinfo portion + * of an authority may contain a colon, so stop if a userinfo portion + * is found (indicated by '@'). + */ + for (colon = authority_end; colon >= name && *colon != ':' && + *colon != '@'; colon--) ; if (*colon == ':') authority_end = colon; @@ -1302,6 +1306,78 @@ static void CRYPT_CheckChainNameConstraints(PCERT_SIMPLE_CHAIN chain) } } +/* Gets cert's policies info, if any. Free with LocalFree. */ +static CERT_POLICIES_INFO *CRYPT_GetPolicies(PCCERT_CONTEXT cert) +{ + PCERT_EXTENSION ext; + CERT_POLICIES_INFO *policies = NULL; + + ext = CertFindExtension(szOID_KEY_USAGE, cert->pCertInfo->cExtension, + cert->pCertInfo->rgExtension); + if (ext) + { + DWORD size; + + CryptDecodeObjectEx(X509_ASN_ENCODING, X509_CERT_POLICIES, + ext->Value.pbData, ext->Value.cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, + &policies, &size); + } + return policies; +} + +static void CRYPT_CheckPolicies(CERT_POLICIES_INFO *policies, CERT_INFO *cert, + DWORD *errorStatus) +{ + DWORD i; + + for (i = 0; i < policies->cPolicyInfo; i++) + { + /* For now, the only accepted policy identifier is the anyPolicy + * identifier. + * FIXME: the policy identifiers should be compared against the + * cert's certificate policies extension, subject to the policy + * mappings extension, and the policy constraints extension. + * See RFC 5280, sections 4.2.1.4, 4.2.1.5, and 4.2.1.11. + */ + if (strcmp(policies->rgPolicyInfo[i].pszPolicyIdentifier, + szOID_ANY_CERT_POLICY)) + { + FIXME("unsupported policy %s\n", + policies->rgPolicyInfo[i].pszPolicyIdentifier); + *errorStatus |= CERT_TRUST_INVALID_POLICY_CONSTRAINTS; + } + } +} + +static void CRYPT_CheckChainPolicies(PCERT_SIMPLE_CHAIN chain) +{ + int i, j; + + for (i = chain->cElement - 1; i > 0; i--) + { + CERT_POLICIES_INFO *policies; + + if ((policies = CRYPT_GetPolicies(chain->rgpElement[i]->pCertContext))) + { + for (j = i - 1; j >= 0; j--) + { + DWORD errorStatus = 0; + + CRYPT_CheckPolicies(policies, + chain->rgpElement[j]->pCertContext->pCertInfo, &errorStatus); + if (errorStatus) + { + chain->rgpElement[i]->TrustStatus.dwErrorStatus |= + errorStatus; + CRYPT_CombineTrustStatus(&chain->TrustStatus, + &chain->rgpElement[i]->TrustStatus); + } + } + LocalFree(policies); + } + } +} + static LPWSTR name_value_to_str(const CERT_NAME_BLOB *name) { DWORD len = cert_name_to_str_with_indent(X509_ASN_ENCODING, 0, name, @@ -1735,6 +1811,8 @@ static BOOL CRYPT_CriticalExtensionsSupported(PCCERT_CONTEXT cert) ret = TRUE; else if (!strcmp(oid, szOID_SUBJECT_ALT_NAME2)) ret = TRUE; + else if (!strcmp(oid, szOID_CERT_POLICIES)) + ret = TRUE; else if (!strcmp(oid, szOID_ENHANCED_KEY_USAGE)) ret = TRUE; else @@ -1879,6 +1957,7 @@ static void CRYPT_CheckSimpleChain(PCertificateChainEngine engine, &chain->rgpElement[i]->TrustStatus); } CRYPT_CheckChainNameConstraints(chain); + CRYPT_CheckChainPolicies(chain); if (CRYPT_IsCertificateSelfSigned(rootElement->pCertContext)) { rootElement->TrustStatus.dwInfoStatus |= @@ -3376,7 +3455,7 @@ BOOL WINAPI CertVerifyCertificateChainPolicy(LPCSTR szPolicyOID, TRACE("(%s, %p, %p, %p)\n", debugstr_a(szPolicyOID), pChainContext, pPolicyPara, pPolicyStatus); - if (!HIWORD(szPolicyOID)) + if (IS_INTOID(szPolicyOID)) { switch (LOWORD(szPolicyOID)) { diff --git a/reactos/dll/win32/crypt32/crypt32.rc b/reactos/dll/win32/crypt32/crypt32.rc deleted file mode 100644 index 1afa8a75296..00000000000 --- a/reactos/dll/win32/crypt32/crypt32.rc +++ /dev/null @@ -1,34 +0,0 @@ -/* - * crypt32 dll resources - * - * Copyright (C) 2006 Juan Lang - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ -#include "windef.h" -#include "winbase.h" -#include "winuser.h" -#include "cryptres.h" - -#include "version.rc" - -#include "crypt32_De.rc" -#include "crypt32_En.rc" -#include "crypt32_Fr.rc" -#include "crypt32_Ko.rc" -#include "crypt32_Nl.rc" -#include "crypt32_No.rc" -#include "crypt32_Pt.rc" -#include "crypt32_Sv.rc" diff --git a/reactos/dll/win32/crypt32/crypt32_Fr.rc b/reactos/dll/win32/crypt32/crypt32_Fr.rc index 3438f2e4109..b98636dee82 100644 --- a/reactos/dll/win32/crypt32/crypt32_Fr.rc +++ b/reactos/dll/win32/crypt32/crypt32_Fr.rc @@ -242,4 +242,3 @@ STRINGTABLE DISCARDABLE IDS_NETSCAPE_SMIME_CA "AC S/MIME" IDS_NETSCAPE_SIGN_CA "Signature CA" } -#pragma code_page(default) diff --git a/reactos/dll/win32/crypt32/crypt32_Uk.rc b/reactos/dll/win32/crypt32/crypt32_Uk.rc new file mode 100644 index 00000000000..d26a456d44b --- /dev/null +++ b/reactos/dll/win32/crypt32/crypt32_Uk.rc @@ -0,0 +1,247 @@ +/* + * crypt32 dll resources + * + * Copyright (C) 2006 Juan Lang + * + * Ukrainian language support + * Copyright (C) 2010 igor Paliychuk + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "cryptres.h" + +/* UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +{ + IDS_AUTHORITY_KEY_ID "Authority Key Identifier" + IDS_KEY_ATTRIBUTES "Властивості Ключа" + IDS_KEY_USAGE_RESTRICTION "Key Usage Restriction" + IDS_SUBJECT_ALT_NAME "Subject Alternative Name" + IDS_ISSUER_ALT_NAME "Issuer Alternative Name" + IDS_BASIC_CONSTRAINTS "Основні Обмеження" + IDS_KEY_USAGE "Використання Ключа" + IDS_CERT_POLICIES "Політика Сертифікатів" + IDS_SUBJECT_KEY_IDENTIFIER "Subject Key Identifier" + IDS_CRL_REASON_CODE "CRL Reason Code" + IDS_CRL_DIST_POINTS "CRL Distribution Points" + IDS_ENHANCED_KEY_USAGE "Розширене Використання Ключа" + IDS_AUTHORITY_INFO_ACCESS "Authority Information Access" + IDS_CERT_EXTENSIONS "Розширення Сертифікатів" + IDS_NEXT_UPDATE_LOCATION "Next Update Location" + IDS_YES_OR_NO_TRUST "Yes or No Trust" + IDS_EMAIL_ADDRESS "Адреса Ел. Пошти" + IDS_UNSTRUCTURED_NAME "Unstructured Name" + IDS_CONTENT_TYPE "Тип Вмісту" + IDS_MESSAGE_DIGEST "Message Digest" + IDS_SIGNING_TIME "Час Входу" + IDS_COUNTER_SIGN "Counter Sign" + IDS_CHALLENGE_PASSWORD "Challenge Password" + IDS_UNSTRUCTURED_ADDRESS "Unstructured Address" + IDS_SMIME_CAPABILITIES "SMIME Capabilities" + IDS_PREFER_SIGNED_DATA "Prefer Signed Data" + IDS_CPS "CPS" + IDS_USER_NOTICE "User Notice" + IDS_OCSP "On-line Certificate Status Protocol" + IDS_CA_ISSUER "Certification Authority Issuer" + IDS_CERT_TEMPLATE_NAME "Certification Template Name" + IDS_CERT_TYPE "Тип Сертифікату" + IDS_CERT_MANIFOLD "Certificate Manifold" + IDS_NETSCAPE_CERT_TYPE "Netscape Cert Type" + IDS_NETSCAPE_BASE_URL "Netscape Base URL" + IDS_NETSCAPE_REVOCATION_URL "Netscape Revocation URL" + IDS_NETSCAPE_CA_REVOCATION_URL "Netscape CA Revocation URL" + IDS_NETSCAPE_CERT_RENEWAL_URL "Netscape Cert Renewal URL" + IDS_NETSCAPE_CA_POLICY_URL "Netscape CA Policy URL" + IDS_NETSCAPE_SSL_SERVER_NAME "Netscape SSL ServerName" + IDS_NETSCAPE_COMMENT "Netscape Коментар" + IDS_SPC_SP_AGENCY_INFO "SpcSpAgencyInfo" + IDS_SPC_FINANCIAL_CRITERIA "SpcFinancialCriteria" + IDS_SPC_MINIMAL_CRITERIA "SpcMinimalCriteria" + IDS_COUNTRY "Країна/Регіон" + IDS_ORGANIZATION "Організація" + IDS_ORGANIZATIONAL_UNIT "Organizational Unit" + IDS_COMMON_NAME "Common Name" + IDS_LOCALITY "Locality" + IDS_STATE_OR_PROVINCE "State or Province" + IDS_TITLE "Title" + IDS_GIVEN_NAME "Given Name" + IDS_INITIALS "Ініціали" + IDS_SUR_NAME "Sur Name" + IDS_DOMAIN_COMPONENT "Domain Component" + IDS_STREET_ADDRESS "Street Address" + IDS_SERIAL_NUMBER "Серійний номер" + IDS_CA_VERSION "CA Version" + IDS_CROSS_CA_VERSION "Cross CA Version" + IDS_SERIALIZED_SIG_SERIAL_NUMBER "Serialized Signature Serial Number" + IDS_PRINCIPAL_NAME "Principal Name" + IDS_WINDOWS_PRODUCT_UPDATE "Windows Product Update" + IDS_ENROLLMENT_NAME_VALUE_PAIR "Enrollment Name Value Pair" + IDS_OS_VERSION "OS Version" + IDS_ENROLLMENT_CSP "Enrollment CSP" + IDS_CRL_NUMBER "CRL Number" + IDS_DELTA_CRL_INDICATOR "Delta CRL Indicator" + IDS_ISSUING_DIST_POINT "Issuing Distribution Point" + IDS_FRESHEST_CRL "Freshest CRL" + IDS_NAME_CONSTRAINTS "Name Constraints" + IDS_POLICY_MAPPINGS "Policy Mappings" + IDS_POLICY_CONSTRAINTS "Policy Constraints" + IDS_CROSS_CERT_DIST_POINTS "Cross-Certificate Distribution Points" + IDS_APPLICATION_POLICIES "Application Policies" + IDS_APPLICATION_POLICY_MAPPINGS "Application Policy Mappings" + IDS_APPLICATION_POLICY_CONSTRAINTS "Application Policy Constraints" + IDS_CMC_DATA "CMC Data" + IDS_CMC_RESPONSE "CMC Response" + IDS_UNSIGNED_CMC_REQUEST "Unsigned CMC Request" + IDS_CMC_STATUS_INFO "CMC Status Info" + IDS_CMC_EXTENSIONS "CMC Extensions" + IDS_CMC_ATTRIBUTES "CMC Attributes" + IDS_PKCS_7_DATA "PKCS 7 Data" + IDS_PKCS_7_SIGNED "PKCS 7 Signed" + IDS_PKCS_7_ENVELOPED "PKCS 7 Enveloped" + IDS_PKCS_7_SIGNED_ENVELOPED "PKCS 7 Signed Enveloped" + IDS_PKCS_7_DIGESTED "PKCS 7 Digested" + IDS_PKCS_7_ENCRYPTED "PKCS 7 Encrypted" + IDS_PREVIOUS_CA_CERT_HASH "Previous CA Certificate Hash" + IDS_CRL_VIRTUAL_BASE "Virtual Base CRL Number" + IDS_CRL_NEXT_PUBLISH "Next CRL Publish" + IDS_CA_EXCHANGE "CA Encryption Certificate" + IDS_KEY_RECOVERY_AGENT "Key Recovery Agent" + IDS_CERTIFICATE_TEMPLATE "Certificate Template Information" + IDS_ENTERPRISE_ROOT_OID "Enterprise Root OID" + IDS_RDN_DUMMY_SIGNER "Dummy Signer" + IDS_ARCHIVED_KEY_ATTR "Encrypted Private Key" + IDS_CRL_SELF_CDP "Published CRL Locations" + IDS_REQUIRE_CERT_CHAIN_POLICY "Enforce Certificate Chain Policy" + IDS_TRANSACTION_ID "Transaction Id" + IDS_SENDER_NONCE "Sender Nonce" + IDS_RECIPIENT_NONCE "Recipient Nonce" + IDS_REG_INFO "Reg Info" + IDS_GET_CERTIFICATE "Get Certificate" + IDS_GET_CRL "Get CRL" + IDS_REVOKE_REQUEST "Revoke Request" + IDS_QUERY_PENDING "Query Pending" + IDS_SORTED_CTL "Certificate Trust List" + IDS_ARCHIVED_KEY_CERT_HASH "Archived Key Certificate Hash" + IDS_PRIVATE_KEY_USAGE_PERIOD "Private Key Usage Period" + IDS_CLIENT_INFORMATION "Клієнські Дані" + IDS_SERVER_AUTHENTICATION "Server Authentication" + IDS_CLIENT_AUTHENTICATION "Client Authentication" + IDS_CODE_SIGNING "Code Signing" + IDS_SECURE_EMAIL "Secure Email" + IDS_TIME_STAMPING "Time Stamping" + IDS_MICROSOFT_TRUST_LIST_SIGNING "Microsoft Trust List Signing" + IDS_MICROSOFT_TIME_STAMPING "Microsoft Time Stamping" + IDS_IPSEC_END_SYSTEM "IP security end system" + IDS_IPSEC_TUNNEL "IP security tunnel termination" + IDS_IPSEC_USER "IP security user" + IDS_EFS "Encrypting File System" + IDS_WHQL_CRYPTO "Windows Hardware Driver Verification" + IDS_NT5_CRYPTO "Windows System Component Verification" + IDS_OEM_WHQL_CRYPTO "OEM Windows System Component Verification" + IDS_EMBEDDED_NT_CRYPTO "Embedded Windows System Component Verification" + IDS_KEY_PACK_LICENSES "Key Pack Licenses" + IDS_LICENSE_SERVER "License Server Verification" + IDS_SMART_CARD_LOGON "Smart Card Logon" + IDS_DIGITAL_RIGHTS "Digital Rights" + IDS_QUALIFIED_SUBORDINATION "Qualified Subordination" + IDS_KEY_RECOVERY "Key Recovery" + IDS_DOCUMENT_SIGNING "Document Signing" + IDS_IPSEC_IKE_INTERMEDIATE "IP security IKE intermediate" + IDS_FILE_RECOVERY "File Recovery" + IDS_ROOT_LIST_SIGNER "Root List Signer" + IDS_ANY_APPLICATION_POLICIES "All application policies" + IDS_DS_EMAIL_REPLICATION "Directory Service Email Replication" + IDS_ENROLLMENT_AGENT "Certificate Request Agent" + IDS_LIFETIME_SIGNING "Lifetime Signing" + IDS_ANY_CERT_POLICY "All issuance policies" +} + +STRINGTABLE DISCARDABLE +{ + IDS_LOCALIZEDNAME_ROOT "Trusted Root Certification Authorities" + IDS_LOCALIZEDNAME_MY "Personal" + IDS_LOCALIZEDNAME_CA "Intermediate Certification Authorities" + IDS_LOCALIZEDNAME_ADDRESSBOOK "Other People" + IDS_LOCALIZEDNAME_TRUSTEDPUBLISHER "Trusted Publishers" + IDS_LOCALIZEDNAME_DISALLOWED "Untrusted Certificates" +} + +STRINGTABLE DISCARDABLE +{ + IDS_KEY_ID "KeyID=" + IDS_CERT_ISSUER "Certificate Issuer" + IDS_CERT_SERIAL_NUMBER "Certificate Serial Number=" + IDS_ALT_NAME_OTHER_NAME "Інше Ім'я=" + IDS_ALT_NAME_RFC822_NAME "Адреса Ел. Пошти=" + IDS_ALT_NAME_DNS_NAME "DNS Name=" + IDS_ALT_NAME_DIRECTORY_NAME "Directory Address" + IDS_ALT_NAME_URL "URL=" + IDS_ALT_NAME_IP_ADDRESS "IP Адреса=" + IDS_ALT_NAME_MASK "Маска=" + IDS_ALT_NAME_REGISTERED_ID "Registered ID=" + IDS_USAGE_UNKNOWN "Unknown Key Usage" + IDS_SUBJECT_TYPE "Subject Type=" + IDS_SUBJECT_TYPE_CA "CA" + IDS_SUBJECT_TYPE_END_CERT "End Entity" + IDS_PATH_LENGTH "Path Length Constraint=" + IDS_PATH_LENGTH_NONE "None" + IDS_INFO_NOT_AVAILABLE "Information Not Available" + IDS_AIA "Authority Info Access" + IDS_ACCESS_METHOD "Access Method=" + IDS_ACCESS_METHOD_OCSP "OCSP" + IDS_ACCESS_METHOD_CA_ISSUERS "CA Issuers" + IDS_ACCESS_METHOD_UNKNOWN "Unknown Access Method" + IDS_ACCESS_LOCATION "Alternative Name" + IDS_CRL_DIST_POINT "CRL Distribution Point" + IDS_CRL_DIST_POINT_NAME "Distribution Point Name" + IDS_CRL_DIST_POINT_FULL_NAME "Full Name" + IDS_CRL_DIST_POINT_RDN_NAME "RDN Name" + IDS_CRL_DIST_POINT_REASON "CRL Reason=" + IDS_CRL_DIST_POINT_ISSUER "CRL Issuer" + IDS_REASON_KEY_COMPROMISE "Key Compromise" + IDS_REASON_CA_COMPROMISE "CA Compromise" + IDS_REASON_AFFILIATION_CHANGED "Affiliation Changed" + IDS_REASON_SUPERSEDED "Superseded" + IDS_REASON_CESSATION_OF_OPERATION "Operation Ceased" + IDS_REASON_CERTIFICATE_HOLD "Certificate Hold" + IDS_FINANCIAL_CRITERIA "Фінансові Дані=" + IDS_FINANCIAL_CRITERIA_AVAILABLE "Available" + IDS_FINANCIAL_CRITERIA_NOT_AVAILABLE "Not Available" + IDS_FINANCIAL_CRITERIA_MEETS_CRITERIA "Meets Criteria=" + IDS_YES "Yes" + IDS_NO "No" + IDS_DIGITAL_SIGNATURE "Цифровий Підпис" + IDS_NON_REPUDIATION "Non-Repudiation" + IDS_KEY_ENCIPHERMENT "Key Encipherment" + IDS_DATA_ENCIPHERMENT "Data Encipherment" + IDS_KEY_AGREEMENT "Key Agreement" + IDS_CERT_SIGN "Certificate Signing" + IDS_OFFLINE_CRL_SIGN "Off-line CRL Signing" + IDS_CRL_SIGN "CRL Signing" + IDS_ENCIPHER_ONLY "Encipher Only" + IDS_DECIPHER_ONLY "Decipher Only" + IDS_NETSCAPE_SSL_CLIENT "SSL Client Authentication" + IDS_NETSCAPE_SSL_SERVER "SSL Server Authentication" + IDS_NETSCAPE_SMIME "S/MIME" + IDS_NETSCAPE_SIGN "Signature" + IDS_NETSCAPE_SSL_CA "SSL CA" + IDS_NETSCAPE_SMIME_CA "S/MIME CA" + IDS_NETSCAPE_SIGN_CA "Signature CA" +} diff --git a/reactos/dll/win32/crypt32/crypt32_private.h b/reactos/dll/win32/crypt32/crypt32_private.h index cbdf5116f9c..8385bf50713 100644 --- a/reactos/dll/win32/crypt32/crypt32_private.h +++ b/reactos/dll/win32/crypt32/crypt32_private.h @@ -405,4 +405,8 @@ void ContextList_Free(struct ContextList *list); #define ALIGN_DWORD_PTR(x) (((x) + sizeof(DWORD_PTR) - 1) & ~(sizeof(DWORD_PTR) - 1)) #define POINTER_ALIGN_DWORD_PTR(p) ((LPVOID)ALIGN_DWORD_PTR((DWORD_PTR)(p))) +/* Check if the OID is a small int + */ +#define IS_INTOID(x) (((ULONG_PTR)(x) >> 16) == 0) + #endif diff --git a/reactos/dll/win32/crypt32/decode.c b/reactos/dll/win32/crypt32/decode.c index 1fd23837395..fb3d36e8124 100644 --- a/reactos/dll/win32/crypt32/decode.c +++ b/reactos/dll/win32/crypt32/decode.c @@ -5578,7 +5578,7 @@ static CryptDecodeObjectExFunc CRYPT_GetBuiltinDecoder(DWORD dwCertEncodingType, SetLastError(ERROR_FILE_NOT_FOUND); return NULL; } - if (!HIWORD(lpszStructType)) + if (IS_INTOID(lpszStructType)) { switch (LOWORD(lpszStructType)) { diff --git a/reactos/dll/win32/crypt32/encode.c b/reactos/dll/win32/crypt32/encode.c index b7bbc83600c..c58b0e638e9 100644 --- a/reactos/dll/win32/crypt32/encode.c +++ b/reactos/dll/win32/crypt32/encode.c @@ -4305,7 +4305,7 @@ static CryptEncodeObjectExFunc CRYPT_GetBuiltinEncoder(DWORD dwCertEncodingType, return NULL; } - if (!HIWORD(lpszStructType)) + if (IS_INTOID(lpszStructType)) { switch (LOWORD(lpszStructType)) { diff --git a/reactos/dll/win32/crypt32/main.c b/reactos/dll/win32/crypt32/main.c index 1a5972fe843..db9dc1a946a 100644 --- a/reactos/dll/win32/crypt32/main.c +++ b/reactos/dll/win32/crypt32/main.c @@ -64,8 +64,8 @@ HCRYPTPROV CRYPT_GetDefaultProvider(void) { HCRYPTPROV prov; - if (!CryptAcquireContextW(&prov, NULL, MS_ENHANCED_PROV_W, PROV_RSA_FULL, - CRYPT_VERIFYCONTEXT)) + if (!CryptAcquireContextW(&prov, NULL, MS_ENH_RSA_AES_PROV_W, + PROV_RSA_AES, CRYPT_VERIFYCONTEXT)) return hDefProv; InterlockedCompareExchangePointer((PVOID *)&hDefProv, (PVOID)prov, NULL); @@ -161,8 +161,13 @@ BOOL WINAPI I_CryptSetTls(DWORD dwTlsIndex, LPVOID lpTlsValue) BOOL WINAPI I_CryptFreeTls(DWORD dwTlsIndex, DWORD unknown) { + BOOL ret; + TRACE("(%d, %d)\n", dwTlsIndex, unknown); - return TlsFree(dwTlsIndex); + + ret = TlsFree(dwTlsIndex); + if (!ret) SetLastError( E_INVALIDARG ); + return ret; } BOOL WINAPI I_CryptGetOssGlobal(DWORD x) diff --git a/reactos/dll/win32/crypt32/object.c b/reactos/dll/win32/crypt32/object.c index 3d18c505fb4..b3f82936172 100644 --- a/reactos/dll/win32/crypt32/object.c +++ b/reactos/dll/win32/crypt32/object.c @@ -2525,7 +2525,7 @@ static CryptFormatObjectFunc CRYPT_GetBuiltinFormatFunction(DWORD encodingType, SetLastError(ERROR_FILE_NOT_FOUND); return NULL; } - if (!HIWORD(lpszStructType)) + if (IS_INTOID(lpszStructType)) { switch (LOWORD(lpszStructType)) { diff --git a/reactos/dll/win32/crypt32/oid.c b/reactos/dll/win32/crypt32/oid.c index 68a48520dac..ea7b539208b 100644 --- a/reactos/dll/win32/crypt32/oid.c +++ b/reactos/dll/win32/crypt32/oid.c @@ -170,7 +170,7 @@ static char *CRYPT_GetKeyName(DWORD dwEncodingType, LPCSTR pszFuncName, * "EncodingType 2" would be expected if it were a mask. Instead native * stores values in "EncodingType 3". */ - if (!HIWORD(pszOID)) + if (IS_INTOID(pszOID)) { snprintf(numericOID, sizeof(numericOID), "#%d", LOWORD(pszOID)); oid = numericOID; @@ -255,7 +255,7 @@ BOOL WINAPI CryptInstallOIDFunctionAddress(HMODULE hModule, { struct OIDFunction *func; - if (HIWORD(rgFuncEntry[i].pszOID)) + if (!IS_INTOID(rgFuncEntry[i].pszOID)) func = CryptMemAlloc(sizeof(struct OIDFunction) + strlen(rgFuncEntry[i].pszOID) + 1); else @@ -263,7 +263,7 @@ BOOL WINAPI CryptInstallOIDFunctionAddress(HMODULE hModule, if (func) { func->encoding = GET_CERT_ENCODING_TYPE(dwEncodingType); - if (HIWORD(rgFuncEntry[i].pszOID)) + if (!IS_INTOID(rgFuncEntry[i].pszOID)) { LPSTR oid; @@ -402,9 +402,9 @@ BOOL WINAPI CryptGetOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet, { if (function->encoding == GET_CERT_ENCODING_TYPE(dwEncodingType)) { - if (HIWORD(pszOID)) + if (!IS_INTOID(pszOID)) { - if (HIWORD(function->entry.pszOID) && + if (!IS_INTOID(function->entry.pszOID) && !strcasecmp(function->entry.pszOID, pszOID)) { *ppvFuncAddr = function->entry.pvFuncAddr; @@ -1067,6 +1067,9 @@ static const WCHAR rc2[] = { 'r','c','2',0 }; static const WCHAR rc4[] = { 'r','c','4',0 }; static const WCHAR sha[] = { 's','h','a',0 }; static const WCHAR sha1[] = { 's','h','a','1',0 }; +static const WCHAR sha256[] = { 's','h','a','2','5','6',0 }; +static const WCHAR sha384[] = { 's','h','a','3','8','4',0 }; +static const WCHAR sha512[] = { 's','h','a','5','1','2',0 }; static const WCHAR RSA[] = { 'R','S','A',0 }; static const WCHAR RSA_KEYX[] = { 'R','S','A','_','K','E','Y','X',0 }; static const WCHAR RSA_SIGN[] = { 'R','S','A','_','S','I','G','N',0 }; @@ -1086,6 +1089,9 @@ static const WCHAR shaDSA[] = { 's','h','a','D','S','A',0 }; static const WCHAR sha1DSA[] = { 's','h','a','1','D','S','A',0 }; static const WCHAR shaRSA[] = { 's','h','a','R','S','A',0 }; static const WCHAR sha1RSA[] = { 's','h','a','1','R','S','A',0 }; +static const WCHAR sha256RSA[] = { 's','h','a','2','5','6','R','S','A',0 }; +static const WCHAR sha384RSA[] = { 's','h','a','3','8','4','R','S','A',0 }; +static const WCHAR sha512RSA[] = { 's','h','a','5','1','2','R','S','A',0 }; static const WCHAR mosaicUpdatedSig[] = { 'm','o','s','a','i','c','U','p','d','a','t','e','d','S','i','g',0 }; static const WCHAR CN[] = { 'C','N',0 }; @@ -1189,6 +1195,9 @@ static const struct OIDInfoConstructor { { 3, szOID_PKIX_NO_SIGNATURE, CALG_NO_SIGN, NO_SIGN, NULL }, { 4, szOID_RSA_SHA1RSA, CALG_SHA1, sha1RSA, &rsaSignBlob }, + { 4, szOID_RSA_SHA256RSA, CALG_SHA_256, sha256RSA, &rsaSignBlob }, + { 4, szOID_RSA_SHA384RSA, CALG_SHA_384, sha384RSA, &rsaSignBlob }, + { 4, szOID_RSA_SHA512RSA, CALG_SHA_512, sha512RSA, &rsaSignBlob }, { 4, szOID_RSA_MD5RSA, CALG_MD5, md5RSA, &rsaSignBlob }, { 4, szOID_X957_SHA1DSA, CALG_SHA1, sha1DSA, &dssSignBlob }, { 4, szOID_OIWSEC_sha1RSASign, CALG_SHA1, sha1RSA, &rsaSignBlob }, @@ -1398,7 +1407,7 @@ static void init_oid_info(void) for (i = 0; i < sizeof(oidInfoConstructors) / sizeof(oidInfoConstructors[0]); i++) { - if (HIWORD(oidInfoConstructors[i].pwszName)) + if (!IS_INTRESOURCE(oidInfoConstructors[i].pwszName)) { struct OIDInfo *info; diff --git a/reactos/dll/win32/crypt32/store.c b/reactos/dll/win32/crypt32/store.c index 153d3aa71ea..a8923949974 100644 --- a/reactos/dll/win32/crypt32/store.c +++ b/reactos/dll/win32/crypt32/store.c @@ -745,7 +745,7 @@ HCERTSTORE WINAPI CertOpenStore(LPCSTR lpszStoreProvider, TRACE("(%s, %08x, %08lx, %08x, %p)\n", debugstr_a(lpszStoreProvider), dwMsgAndCertEncodingType, hCryptProv, dwFlags, pvPara); - if (!HIWORD(lpszStoreProvider)) + if (IS_INTOID(lpszStoreProvider)) { switch (LOWORD(lpszStoreProvider)) {