11
22/**********************************************************************************
3- © Copyright Senzing, Inc. 2020-2024
3+ © Copyright Senzing, Inc. 2020-2025
44 The source code for this program is not published or otherwise divested
55 of its trade secrets, irrespective of what has been deposited with the U.S.
66 Copyright Office.
@@ -82,7 +82,7 @@ void getPluginSignature(char* signature)
8282
8383
8484/* Function used to initialize a plugin.
85- * See the function prototype defintions for more information.
85+ * See the function prototype definitions for more information.
8686 */
8787G2_ENCRYPTION_PLUGIN_FUNCTION_INIT_PLUGIN
8888{
@@ -130,7 +130,7 @@ G2_ENCRYPTION_PLUGIN_FUNCTION_INIT_PLUGIN
130130
131131
132132/* Function used to close a plugin.
133- * See the function prototype defintions for more information.
133+ * See the function prototype definitions for more information.
134134 */
135135G2_ENCRYPTION_PLUGIN_FUNCTION_CLOSE_PLUGIN
136136{
@@ -149,7 +149,7 @@ G2_ENCRYPTION_PLUGIN_FUNCTION_CLOSE_PLUGIN
149149
150150
151151/* Function used to retrieve the plugin signature.
152- * See the function prototype defintions for more information.
152+ * See the function prototype definitions for more information.
153153 */
154154G2_ENCRYPTION_PLUGIN_FUNCTION_GET_SIGNATURE
155155{
@@ -183,7 +183,7 @@ G2_ENCRYPTION_PLUGIN_FUNCTION_GET_SIGNATURE
183183
184184
185185/* Function used to validate the plugin signature compatibility.
186- * See the function prototype defintions for more information.
186+ * See the function prototype definitions for more information.
187187 */
188188G2_ENCRYPTION_PLUGIN_FUNCTION_VALIDATE_SIGNATURE_COMPATIBILITY
189189{
@@ -207,11 +207,11 @@ G2_ENCRYPTION_PLUGIN_FUNCTION_VALIDATE_SIGNATURE_COMPATIBILITY
207207
208208/* Function to do a simple encryption.
209209 */
210- int encrypt (unsigned char * plaintext , int plaintext_len , unsigned char * key , unsigned char * iv , unsigned char * ciphertext , struct ErrorInfoData * errorData )
210+ int64_t encrypt (unsigned char * plaintext , size_t plaintext_len , unsigned char * key , unsigned char * iv , unsigned char * ciphertext , struct ErrorInfoData * errorData )
211211{
212212 EVP_CIPHER_CTX * ctx = NULL ;
213213 int len = 0 ;
214- int ciphertext_len = 0 ;
214+ size_t ciphertext_len = 0 ;
215215
216216 /* Create and initialise the context */
217217 if (!(ctx = EVP_CIPHER_CTX_new ()))
@@ -264,11 +264,11 @@ int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, uns
264264
265265/* Function to do a simple decryption.
266266 */
267- int decrypt (unsigned char * ciphertext , int ciphertext_len , unsigned char * key , unsigned char * iv , unsigned char * plaintext , struct ErrorInfoData * errorData )
267+ int64_t decrypt (unsigned char * ciphertext , size_t ciphertext_len , unsigned char * key , unsigned char * iv , unsigned char * plaintext , struct ErrorInfoData * errorData )
268268{
269269 EVP_CIPHER_CTX * ctx = NULL ;
270270 int len = 0 ;
271- int plaintext_len = 0 ;
271+ size_t plaintext_len = 0 ;
272272
273273 /* Create and initialise the context */
274274 if (!(ctx = EVP_CIPHER_CTX_new ()))
@@ -305,7 +305,7 @@ int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, u
305305 * Finalise the decryption. Further plaintext bytes may be written at
306306 * this stage.
307307 */
308- int retVal = EVP_DecryptFinal_ex (ctx , plaintext + len , & len );
308+ int64_t retVal = EVP_DecryptFinal_ex (ctx , plaintext + len , & len );
309309 if (1 != retVal )
310310 {
311311 handleErrors ("Failed to finalize decryption" ,errorData );
@@ -321,7 +321,7 @@ int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, u
321321
322322
323323/* Function used to encrypt a data value.
324- * See the function prototype defintions for more information.
324+ * See the function prototype definitions for more information.
325325 */
326326G2_ENCRYPTION_PLUGIN_FUNCTION_ENCRYPT_DATA_FIELD
327327{
@@ -331,7 +331,7 @@ G2_ENCRYPTION_PLUGIN_FUNCTION_ENCRYPT_DATA_FIELD
331331 /* encrypt the data */
332332 const size_t bufferLength = inputSize + EVP_MAX_BLOCK_LENGTH ;
333333 unsigned char * ciphertext = malloc (bufferLength * sizeof (char ));
334- int ciphertext_len = encrypt ((unsigned char * )input ,(int )inputSize ,(unsigned char * )mEncryptionKey ,(unsigned char * )mEncryptionIV ,ciphertext ,& encryptionErrorData );
334+ size_t ciphertext_len = encrypt ((unsigned char * )input ,(int64_t )inputSize ,(unsigned char * )mEncryptionKey ,(unsigned char * )mEncryptionIV ,ciphertext ,& encryptionErrorData );
335335 if (!(encryptionErrorData .mErrorOccurred ))
336336 {
337337 if (((size_t ) ciphertext_len ) < maxResultSize )
@@ -353,7 +353,7 @@ G2_ENCRYPTION_PLUGIN_FUNCTION_ENCRYPT_DATA_FIELD
353353
354354
355355/* Function used to decrypt a data value.
356- * See the function prototype defintions for more information.
356+ * See the function prototype definitions for more information.
357357 */
358358G2_ENCRYPTION_PLUGIN_FUNCTION_DECRYPT_DATA_FIELD
359359{
@@ -363,7 +363,7 @@ G2_ENCRYPTION_PLUGIN_FUNCTION_DECRYPT_DATA_FIELD
363363 /* decrypt the data */
364364 const size_t bufferLength = inputSize + EVP_MAX_BLOCK_LENGTH ;
365365 unsigned char * decryptedtext = malloc (bufferLength * sizeof (char ));
366- int decryptedtext_len = decrypt ((unsigned char * )input ,(int )inputSize ,(unsigned char * )mEncryptionKey ,(unsigned char * )mEncryptionIV ,decryptedtext ,& decryptionErrorData );
366+ size_t decryptedtext_len = decrypt ((unsigned char * )input ,(int64_t )inputSize ,(unsigned char * )mEncryptionKey ,(unsigned char * )mEncryptionIV ,decryptedtext ,& decryptionErrorData );
367367 if (!(decryptionErrorData .mErrorOccurred ))
368368 {
369369 if (((size_t ) decryptedtext_len ) < maxResultSize )
@@ -385,7 +385,7 @@ G2_ENCRYPTION_PLUGIN_FUNCTION_DECRYPT_DATA_FIELD
385385
386386
387387/* Function used to encrypt a data value (deterministic methods.)
388- * See the function prototype defintions for more information.
388+ * See the function prototype definitions for more information.
389389 */
390390G2_ENCRYPTION_PLUGIN_FUNCTION_ENCRYPT_DATA_FIELD_DETERMINISTIC
391391{
@@ -395,7 +395,7 @@ G2_ENCRYPTION_PLUGIN_FUNCTION_ENCRYPT_DATA_FIELD_DETERMINISTIC
395395 /* encrypt the data */
396396 const size_t bufferLength = inputSize + EVP_MAX_BLOCK_LENGTH ;
397397 unsigned char * ciphertext = malloc (bufferLength * sizeof (char ));
398- int ciphertext_len = encrypt ((unsigned char * )input ,(int )inputSize ,(unsigned char * )mEncryptionKey ,(unsigned char * )mEncryptionIV ,ciphertext ,& encryptionErrorData );
398+ size_t ciphertext_len = encrypt ((unsigned char * )input ,(int64_t )inputSize ,(unsigned char * )mEncryptionKey ,(unsigned char * )mEncryptionIV ,ciphertext ,& encryptionErrorData );
399399 if (!(encryptionErrorData .mErrorOccurred ))
400400 {
401401 if (((size_t ) ciphertext_len ) < maxResultSize )
@@ -417,7 +417,7 @@ G2_ENCRYPTION_PLUGIN_FUNCTION_ENCRYPT_DATA_FIELD_DETERMINISTIC
417417
418418
419419/* Function used to decrypt a data value (deterministic methods.)
420- * See the function prototype defintions for more information.
420+ * See the function prototype definitions for more information.
421421 */
422422G2_ENCRYPTION_PLUGIN_FUNCTION_DECRYPT_DATA_FIELD_DETERMINISTIC
423423{
@@ -427,7 +427,7 @@ G2_ENCRYPTION_PLUGIN_FUNCTION_DECRYPT_DATA_FIELD_DETERMINISTIC
427427 /* decrypt the data */
428428 const size_t bufferLength = inputSize + EVP_MAX_BLOCK_LENGTH ;
429429 unsigned char * decryptedtext = malloc (bufferLength * sizeof (char ));
430- int decryptedtext_len = decrypt ((unsigned char * )input ,(int )inputSize ,(unsigned char * )mEncryptionKey ,(unsigned char * )mEncryptionIV ,decryptedtext ,& decryptionErrorData );
430+ size_t decryptedtext_len = decrypt ((unsigned char * )input ,(int64_t )inputSize ,(unsigned char * )mEncryptionKey ,(unsigned char * )mEncryptionIV ,decryptedtext ,& decryptionErrorData );
431431 if (!(decryptionErrorData .mErrorOccurred ))
432432 {
433433 if (((size_t ) decryptedtext_len ) < maxResultSize )
0 commit comments