1 Description: Changes for OpenSSL 1.1.0.
3 From: Di-Shi Sun <di-shi@transnexus.com>
4 Last-Update: 2017-02-21
6 --- a/src/ospcryptowrap.c
7 +++ b/src/ospcryptowrap.c
9 unsigned char digestedData[OSPC_CRYPTO_DIGEST_BUFFER_MAXLENGTH];
10 unsigned int digestedDataLength = 0;
13 +#if (OPENSSL_VERSION_NUMBER >= 0x010100000)
17 + EVP_MD_CTX *ctx = &ctxbuf;
19 EVP_MD *type = OSPC_OSNULL;
21 OSPM_ARGUSED(ospvFlags);
25 /* Calcualte digest */
26 - EVP_DigestInit(&ctx, type);
27 - EVP_DigestUpdate(&ctx, ospvData, ospvDataLength);
28 - EVP_DigestFinal(&ctx, digestedData, &digestedDataLength);
29 +#if (OPENSSL_VERSION_NUMBER >= 0x010100000)
30 + ctx = EVP_MD_CTX_new();
32 + EVP_DigestInit(ctx, type);
33 + EVP_DigestUpdate(ctx, ospvData, ospvDataLength);
34 + EVP_DigestFinal(ctx, digestedData, &digestedDataLength);
35 +#if (OPENSSL_VERSION_NUMBER >= 0x010100000)
36 + EVP_MD_CTX_free(ctx);
38 errorcode = OSPC_ERR_NO_ERROR;
40 OSPM_DBGERRORLOG(errorcode, "Error setting digest type");
42 unsigned char decryptedData[OSPC_CRYPTO_ENCRYPT_BUFFER_MAXLENGTH];
43 unsigned int decryptedDataLength = 0;
45 - X509_PUBKEY *pX509PubKey = OSPC_OSNULL;
46 RSA *pRSAPubKey = OSPC_OSNULL;
47 - unsigned char *pData = OSPC_OSNULL;
48 - unsigned int len = 0;
50 OSPM_ARGUSED(ospvFlags);
51 OSPM_ARGUSED(ospvBERAlgorithm);
53 OSPTNLOGDUMP(ospvEncryptedData, ospvEncryptedDataLength, "DECRYPT: ospvEncryptedData");
54 OSPTNLOGDUMP(ospvBERReaderKey, ospvBERReaderKeyLength, "DECRYPT: ospvBERReaderKey");
56 - pX509PubKey = d2i_X509_PUBKEY(NULL, (const unsigned char **)(&ospvBERReaderKey), ospvBERReaderKeyLength);
59 - pData = pX509PubKey->public_key->data;
60 - len = pX509PubKey->public_key->length;
61 - pRSAPubKey = d2i_RSAPublicKey(NULL, (const unsigned char **)&pData, len);
64 - decryptedDataLength = RSA_public_decrypt(ospvEncryptedDataLength, ospvEncryptedData, decryptedData, pRSAPubKey, RSA_PKCS1_PADDING);
65 - if (decryptedDataLength != -1) {
66 - errorcode = OSPC_ERR_NO_ERROR;
68 - OSPM_DBGERRORLOG(errorcode, "Failed to decrypt message");
72 - RSA_free(pRSAPubKey);
73 + pRSAPubKey = d2i_RSA_PUBKEY(NULL, (const unsigned char **)(&ospvBERReaderKey), ospvBERReaderKeyLength);
75 + decryptedDataLength = RSA_public_decrypt(ospvEncryptedDataLength, ospvEncryptedData, decryptedData, pRSAPubKey, RSA_PKCS1_PADDING);
76 + if (decryptedDataLength != -1) {
77 + errorcode = OSPC_ERR_NO_ERROR;
79 - OSPM_DBGERRORLOG(errorcode, "Failed to init RSA key");
80 + OSPM_DBGERRORLOG(errorcode, "Failed to decrypt message");
84 - X509_PUBKEY_free(pX509PubKey);
85 + RSA_free(pRSAPubKey);
87 - OSPM_DBGERRORLOG(errorcode, "Failed to init X509_PUBKEY");
88 + OSPM_DBGERRORLOG(errorcode, "Failed to init RSA key");
92 /* Copy results to OUT params */
93 if (errorcode == OSPC_ERR_NO_ERROR) {
94 if (ospvDecryptedData == OSPC_OSNULL) {
96 int errorcode = OSPC_ERR_CRYPTO_IMPLEMENTATION_SPECIFIC_ERROR;
97 unsigned char digestedData[OSPC_CRYPTO_DIGEST_BUFFER_MAXLENGTH];
98 unsigned int digestedDataLength = OSPC_CRYPTO_DIGEST_BUFFER_MAXLENGTH;
99 - X509_PUBKEY *pX509PubKey = OSPC_OSNULL;
100 RSA *pRSAPubKey = OSPC_OSNULL;
101 - unsigned char *pData = OSPC_OSNULL;
102 - unsigned int len = 0;
105 OSPM_ARGUSED(ospvFlags);
106 @@ -214,34 +206,22 @@
107 OSPTNLOGDUMP(ospvSignature, ospvSignatureLength, "VERIFY: ospvSignature");
108 OSPTNLOGDUMP(ospvBERReaderKey, ospvBERReaderKeyLength, "VERIFY: ospvBERReaderKey");
110 - pX509PubKey = d2i_X509_PUBKEY(NULL, (const unsigned char **)(&ospvBERReaderKey), ospvBERReaderKeyLength);
113 - pData = pX509PubKey->public_key->data;
114 - len = pX509PubKey->public_key->length;
115 - pRSAPubKey = d2i_RSAPublicKey(NULL, (const unsigned char **)&pData, len);
118 - if (OSPC_ERR_NO_ERROR == OSPPCryptoWrapDigest(digestedData, &digestedDataLength, OSPC_OSNULL, 0, ospvData, ospvDataLength, 0)) {
119 - if (1 == RSA_verify(type, digestedData, digestedDataLength, ospvSignature, ospvSignatureLength, pRSAPubKey)) {
120 - errorcode = OSPC_ERR_NO_ERROR;
122 - OSPM_DBGERRORLOG(errorcode, "Open-SSL error occurred in Verify");
124 + pRSAPubKey = d2i_RSA_PUBKEY(NULL, (const unsigned char **)(&ospvBERReaderKey), ospvBERReaderKeyLength);
126 + if (OSPC_ERR_NO_ERROR == OSPPCryptoWrapDigest(digestedData, &digestedDataLength, OSPC_OSNULL, 0, ospvData, ospvDataLength, 0)) {
127 + if (1 == RSA_verify(type, digestedData, digestedDataLength, ospvSignature, ospvSignatureLength, pRSAPubKey)) {
128 + errorcode = OSPC_ERR_NO_ERROR;
130 - OSPM_DBGERRORLOG(errorcode, "Failed to calculate digest");
131 + OSPM_DBGERRORLOG(errorcode, "Open-SSL error occurred in Verify");
135 - RSA_free(pRSAPubKey);
137 - OSPM_DBGERRORLOG(errorcode, "Failed to init RSA key");
138 + OSPM_DBGERRORLOG(errorcode, "Failed to calculate digest");
142 - X509_PUBKEY_free(pX509PubKey);
143 + RSA_free(pRSAPubKey);
145 - OSPM_DBGERRORLOG(errorcode, "Failed to init X509_PUBKEY");
146 + OSPM_DBGERRORLOG(errorcode, "Failed to init RSA key");
150 Description: Changes for OpenSSL 1.1.0.
152 From: Di-Shi Sun <di-shi@transnexus.com>
153 Last-Update: 2017-02-21
155 --- a/src/ospopenssl.c
156 +++ b/src/ospopenssl.c
158 * function. It will be done only once now, rather than with every ProviderNew
160 ctx = (SSL_CTX **)&(security->ContextRef);
161 +#if (OPENSSL_VERSION_NUMBER >= 0x010100000)
162 + version = TLS_client_method();
164 version = TLSv1_client_method();
166 *ctx = SSL_CTX_new(version);
168 if (*ctx != OSPC_OSNULL) {
169 @@ -508,21 +512,21 @@
173 - switch (ctx->error) {
175 case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
176 - X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), buf, 256);
177 + X509_NAME_oneline(X509_get_issuer_name(err_cert), buf, 256);
178 BIO_printf(bio_stdout, "issuer= %s\n", buf);
180 case X509_V_ERR_CERT_NOT_YET_VALID:
181 case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
182 BIO_printf(bio_stdout, "notBefore=");
183 - ASN1_TIME_print(bio_stdout, X509_get_notBefore(ctx->current_cert));
184 + ASN1_TIME_print(bio_stdout, X509_get_notBefore(err_cert));
185 BIO_printf(bio_stdout, "\n");
187 case X509_V_ERR_CERT_HAS_EXPIRED:
188 case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
189 BIO_printf(bio_stdout, "notAfter=");
190 - ASN1_TIME_print(bio_stdout, X509_get_notAfter(ctx->current_cert));
191 + ASN1_TIME_print(bio_stdout, X509_get_notAfter(err_cert));
192 BIO_printf(bio_stdout, "\n");
195 Description: Changes for gcc and ABI issues.
197 From: Di-Shi Sun <di-shi@transnexus.com>
198 Last-Update: 2017-02-13
200 --- a/src/osptransapi.c
201 +++ b/src/osptransapi.c
203 /* sample mean - have to cast Samples to a float to get some precision on the mean */
204 mean = ((metrics.mean * currnumber) + (ospvMean * ospvSamples)) / (float)metrics.samples;
206 - OSPM_ISNAN(metrics.mean, tnisnan);
207 + OSPM_ISNAN(((float)metrics.mean), tnisnan);
210 errcode = OSPC_ERR_TRAN_INVALID_CALC;
211 @@ -5297,7 +5297,7 @@
215 -int OSPPTransactionSetSrcServiceProvider(
216 +int OSPPTransactionSetServiceProvider(
217 OSPTTRANHANDLE ospvTransaction, /* In - Transaction handle */
218 const char *ospvServiceProvider) /* In - Service provider */
220 Description: Change for ABI issue.
222 From: Di-Shi Sun <di-shi@transnexus.com>
223 Last-Update: 2017-02-28
225 --- a/include/osp/osptransapi.h
226 +++ b/include/osp/osptransapi.h
228 int OSPPTransactionSetTransferId(OSPTTRANHANDLE, const char*);
229 int OSPPTransactionSetTransferStatus(OSPTTRANHANDLE, OSPE_TRANSFER_STATUS);
230 int OSPPTransactionSetNetworkTranslatedCalledNumber(OSPTTRANHANDLE, OSPE_NUMBER_FORMAT, const char *);
231 - int OSPPTransactionSetSrcServiceProvider(OSPTTRANHANDLE, const char *);
232 + int OSPPTransactionSetServiceProvider(OSPTTRANHANDLE, const char *);
233 +#define OSPPTransactionSetSrcServiceProvider(transaction, provider) OSPPTransactionSetServiceProvider(transaction, provider);
234 int OSPPTransactionSetDestServiceProvider(OSPTTRANHANDLE, const char *);
235 int OSPPTransactionSetSystemId(OSPTTRANHANDLE, const char *);
236 int OSPPTransactionSetRelatedReason(OSPTTRANHANDLE, const char *);