Skip to content

Commit 12de9b0

Browse files
committed
8314148: Fix variable scope in SunMSCAPI
Reviewed-by: valeriep
1 parent 7fbad4c commit 12de9b0

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,8 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_CSignature_signCngHash
934934
}
935935
env->GetByteArrayRegion(jHash, 0, jHashSize, pHashBuffer);
936936

937+
BCRYPT_PKCS1_PADDING_INFO pkcs1Info;
938+
BCRYPT_PSS_PADDING_INFO pssInfo;
937939
VOID* param;
938940
DWORD dwFlags;
939941

@@ -943,7 +945,6 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_CSignature_signCngHash
943945
dwFlags = 0;
944946
break;
945947
case 1:
946-
BCRYPT_PKCS1_PADDING_INFO pkcs1Info;
947948
if (jHashAlgorithm) {
948949
pkcs1Info.pszAlgId = MapHashIdentifier(env, jHashAlgorithm);
949950
if (pkcs1Info.pszAlgId == NULL) {
@@ -958,7 +959,6 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_CSignature_signCngHash
958959
dwFlags = BCRYPT_PAD_PKCS1;
959960
break;
960961
case 2:
961-
BCRYPT_PSS_PADDING_INFO pssInfo;
962962
pssInfo.pszAlgId = MapHashIdentifier(env, jHashAlgorithm);
963963
pssInfo.cbSalt = saltLen;
964964
if (pssInfo.pszAlgId == NULL) {
@@ -1169,6 +1169,8 @@ JNIEXPORT jboolean JNICALL Java_sun_security_mscapi_CSignature_verifyCngSignedHa
11691169
env->GetByteArrayRegion(jSignedHash, 0, jSignedHashSize,
11701170
pSignedHashBuffer);
11711171

1172+
BCRYPT_PKCS1_PADDING_INFO pkcs1Info;
1173+
BCRYPT_PSS_PADDING_INFO pssInfo;
11721174
VOID* param;
11731175
DWORD dwFlags;
11741176

@@ -1178,7 +1180,6 @@ JNIEXPORT jboolean JNICALL Java_sun_security_mscapi_CSignature_verifyCngSignedHa
11781180
dwFlags = 0;
11791181
break;
11801182
case 1:
1181-
BCRYPT_PKCS1_PADDING_INFO pkcs1Info;
11821183
if (jHashAlgorithm) {
11831184
pkcs1Info.pszAlgId = MapHashIdentifier(env, jHashAlgorithm);
11841185
if (pkcs1Info.pszAlgId == NULL) {
@@ -1193,7 +1194,6 @@ JNIEXPORT jboolean JNICALL Java_sun_security_mscapi_CSignature_verifyCngSignedHa
11931194
dwFlags = NCRYPT_PAD_PKCS1_FLAG;
11941195
break;
11951196
case 2:
1196-
BCRYPT_PSS_PADDING_INFO pssInfo;
11971197
pssInfo.pszAlgId = MapHashIdentifier(env, jHashAlgorithm);
11981198
pssInfo.cbSalt = saltLen;
11991199
if (pssInfo.pszAlgId == NULL) {
@@ -1526,7 +1526,7 @@ JNIEXPORT void JNICALL Java_sun_security_mscapi_CKeyStore_storeCertificate
15261526
pszCertAliasName[size] = 0; // append the string terminator
15271527

15281528
CRYPT_DATA_BLOB friendlyName = {
1529-
sizeof(WCHAR) * (size + 1),
1529+
(DWORD)(sizeof(WCHAR) * (size + 1)),
15301530
(BYTE *) pszCertAliasName
15311531
};
15321532

test/jdk/sun/security/mscapi/InteropWithSunRsaSign.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
2424

2525
/**
2626
* @test
27-
* @bug 8205445
27+
* @bug 8205445 8314148
2828
* @summary Interop test between SunMSCAPI and SunRsaSign on RSASSA-PSS
2929
* @requires os.family == "windows"
3030
*/

test/jdk/sun/security/mscapi/ShortRSAKeyWithinTLS.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
2323

2424
/*
2525
* @test
26-
* @bug 7106773 8180570
26+
* @bug 7106773 8180570 8314148
2727
* @summary 512 bits RSA key cannot work with SHA384 and SHA512
2828
* @requires os.family == "windows"
2929
* @modules java.base/sun.security.util

0 commit comments

Comments
 (0)