version 1.8, 2013/02/27 17:11:39
|
version 1.16, 2014/07/17 08:07:16
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.13 |
RPL/2 (R) version 4.1.19 |
Copyright (C) 1989-2013 Dr. BERTRAND Joël |
Copyright (C) 1989-2014 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 37
|
Line 37
|
|
|
unsigned char * |
unsigned char * |
chiffrement(const EVP_CIPHER *type_chiffrement, logical1 encodage, |
chiffrement(const EVP_CIPHER *type_chiffrement, logical1 encodage, |
unsigned char *message, unsigned int longueur_message, |
unsigned char *message, integer8 longueur_message, |
unsigned char *clef, unsigned int longueur_clef, |
unsigned char *clef, integer8 longueur_clef, |
unsigned char *vecteur_initialisation, |
unsigned char *vecteur_initialisation, |
unsigned int *longueur_message_chiffre) |
integer8 *longueur_message_chiffre) |
{ |
{ |
int i; |
int i; |
int longueur_bloc_de_chiffrement; |
int longueur_bloc_de_chiffrement; |
Line 65 chiffrement(const EVP_CIPHER *type_chiff
|
Line 65 chiffrement(const EVP_CIPHER *type_chiff
|
(*longueur_message_chiffre) = ((longueur_message / |
(*longueur_message_chiffre) = ((longueur_message / |
longueur_bloc_de_chiffrement) + 1) * longueur_bloc_de_chiffrement; |
longueur_bloc_de_chiffrement) + 1) * longueur_bloc_de_chiffrement; |
|
|
if ((message_chiffre = malloc((*longueur_message_chiffre) * |
if ((message_chiffre = malloc(((size_t) (*longueur_message_chiffre)) * |
sizeof(unsigned char))) == NULL) |
sizeof(unsigned char))) == NULL) |
{ |
{ |
return(NULL); |
return(NULL); |
} |
} |
|
|
if (EVP_CipherUpdate(&contexte, message_chiffre, &longueur_message_1, |
if (EVP_CipherUpdate(&contexte, message_chiffre, &longueur_message_1, |
message, longueur_message) != 1) |
message, (int) longueur_message) != 1) |
{ |
{ |
free(message_chiffre); |
free(message_chiffre); |
EVP_CIPHER_CTX_cleanup(&contexte); |
EVP_CIPHER_CTX_cleanup(&contexte); |