version 1.40, 2013/02/23 18:51:43
|
version 1.80, 2024/07/05 07:04:23
|
Line 1
|
Line 1
|
/* |
/* |
================================================================================ |
================================================================================ |
RPL/2 (R) version 4.1.12 |
RPL/2 (R) version 4.1.36 |
Copyright (C) 1989-2012 Dr. BERTRAND Joël |
Copyright (C) 1989-2024 Dr. BERTRAND Joël |
|
|
This file is part of RPL/2. |
This file is part of RPL/2. |
|
|
Line 339 instruction_diag_fleche(struct_processus
|
Line 339 instruction_diag_fleche(struct_processus
|
struct_objet *s_objet_argument; |
struct_objet *s_objet_argument; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
|
|
unsigned long i; |
integer8 i; |
unsigned long j; |
integer8 j; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 409 instruction_diag_fleche(struct_processus
|
Line 409 instruction_diag_fleche(struct_processus
|
(*((struct_matrice *) (*s_objet_argument).objet)).nombre_lignes; |
(*((struct_matrice *) (*s_objet_argument).objet)).nombre_lignes; |
|
|
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau |
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau |
= malloc((*((struct_vecteur *) (*s_objet_resultat).objet)) |
= malloc(((size_t) (*((struct_vecteur *) (*s_objet_resultat) |
.taille * sizeof(integer8))) == NULL) |
.objet)).taille) * sizeof(integer8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 467 instruction_diag_fleche(struct_processus
|
Line 467 instruction_diag_fleche(struct_processus
|
(*((struct_matrice *) (*s_objet_argument).objet)).nombre_lignes; |
(*((struct_matrice *) (*s_objet_argument).objet)).nombre_lignes; |
|
|
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau |
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau |
= malloc((*((struct_vecteur *) (*s_objet_resultat).objet)) |
= malloc(((size_t) (*((struct_vecteur *) (*s_objet_resultat) |
.taille * sizeof(real8))) == NULL) |
.objet)).taille) * sizeof(real8))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 525 instruction_diag_fleche(struct_processus
|
Line 525 instruction_diag_fleche(struct_processus
|
(*((struct_matrice *) (*s_objet_argument).objet)).nombre_lignes; |
(*((struct_matrice *) (*s_objet_argument).objet)).nombre_lignes; |
|
|
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau |
if (((*((struct_vecteur *) (*s_objet_resultat).objet)).tableau |
= malloc((*((struct_vecteur *) (*s_objet_resultat).objet)) |
= malloc(((size_t) (*((struct_vecteur *) (*s_objet_resultat) |
.taille * sizeof(complex16))) == NULL) |
.objet)).taille) * sizeof(complex16))) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 605 instruction_diag_fleche(struct_processus
|
Line 605 instruction_diag_fleche(struct_processus
|
void |
void |
instruction_digest(struct_processus *s_etat_processus) |
instruction_digest(struct_processus *s_etat_processus) |
{ |
{ |
EVP_MD_CTX contexte; |
EVP_MD_CTX *contexte; |
|
|
const EVP_MD * (*EVP_sum)(); |
const EVP_MD *EVP_sum; |
|
const EVP_CIPHER *EVP_chiffrement; |
|
|
|
int i; |
|
int longueur_bloc; |
|
int longueur_somme; |
|
|
|
integer8 longueur_chaine; |
|
integer8 longueur_clef; |
|
integer8 longueur_clef_attendue; |
|
integer8 longueur_clef_max; |
|
integer8 longueur_clef_min; |
|
integer8 longueur_tampon; |
|
|
logical1 somme_invalide; |
logical1 somme_invalide; |
|
|
long longueur_chaine; |
struct_liste_chainee *l_element_courant; |
|
|
struct_objet *s_objet_argument_1; |
struct_objet *s_objet_argument_1; |
struct_objet *s_objet_argument_2; |
struct_objet *s_objet_argument_2; |
struct_objet *s_objet_resultat; |
struct_objet *s_objet_resultat; |
|
|
unsigned char *chaine; |
unsigned char *chaine; |
|
unsigned char *clef; |
unsigned char *fonction; |
unsigned char *fonction; |
unsigned char somme[EVP_MAX_MD_SIZE]; |
unsigned char somme[EVP_MAX_MD_SIZE]; |
|
unsigned char *tampon; |
unsigned int longueur_somme; |
unsigned char *vecteur_initialisation; |
|
|
(*s_etat_processus).erreur_execution = d_ex; |
(*s_etat_processus).erreur_execution = d_ex; |
|
|
Line 655 instruction_digest(struct_processus *s_e
|
Line 668 instruction_digest(struct_processus *s_e
|
printf(" Algorithms:\n\n"); |
printf(" Algorithms:\n\n"); |
} |
} |
|
|
# ifndef OPENSSL_NO_SHA |
# ifndef OPENSSL_NO_AES |
printf(" - DSS\n"); |
printf(" - AES-128-CBC\n"); |
printf(" - DSS1\n"); |
printf(" - AES-192-CBC\n"); |
printf(" - ECDSA\n"); |
printf(" - AES-256-CBC\n"); |
|
# endif |
|
# ifndef OPENSSL_NO_CAMELLIA |
|
printf(" - CAMELLIA-128-CBC\n"); |
|
printf(" - CAMELLIA-192-CBC\n"); |
|
printf(" - CAMELLIA-256-CBC\n"); |
|
# endif |
|
# ifndef OPENSSL_NO_DES |
|
printf(" - DES-CBC\n"); |
|
printf(" - DES-EDE-CBC\n"); |
|
printf(" - DES-EDE3-CB\n"); |
|
printf(" - DESX-CBC\n"); |
|
# endif |
|
# ifndef OPENSSL_NO_IDEA |
|
printf(" - IDEA-CBC\n"); |
# endif |
# endif |
# ifndef OPENSSL_NO_MD2 |
# ifndef OPENSSL_NO_MD2 |
printf(" - MD2\n"); |
printf(" - MD2\n"); |
Line 672 instruction_digest(struct_processus *s_e
|
Line 699 instruction_digest(struct_processus *s_e
|
# ifndef OPENSSL_NO_MDC2 |
# ifndef OPENSSL_NO_MDC2 |
printf(" - MDC2\n"); |
printf(" - MDC2\n"); |
# endif |
# endif |
|
# ifndef OPENSSL_NO_RC2 |
|
printf(" - RC2-CBC\n"); |
|
printf(" - RC2-40-CBC\n"); |
|
printf(" - RC2-64-CBC\n"); |
|
# endif |
# ifndef OPENSSL_NO_RIPEMD |
# ifndef OPENSSL_NO_RIPEMD |
printf(" - RIPEMD160\n"); |
printf(" - RIPEMD160\n"); |
# endif |
# endif |
# ifndef OPENSSL_NO_SHA |
|
printf(" - SHA\n"); |
|
printf(" - SHA1\n"); |
printf(" - SHA1\n"); |
# endif |
|
# ifndef OPENSSL_NO_SHA256 |
|
printf(" - SHA224\n"); |
printf(" - SHA224\n"); |
printf(" - SHA256\n"); |
printf(" - SHA256\n"); |
# endif |
|
# ifndef OPENSSL_NO_SHA512 |
|
printf(" - SHA384\n"); |
printf(" - SHA384\n"); |
printf(" - SHA512\n"); |
printf(" - SHA512\n"); |
# endif |
|
# ifndef OPENSSL_NO_WHIRLPOOL |
# ifndef OPENSSL_NO_WHIRLPOOL |
printf(" - WHIRLPOOL\n"); |
printf(" - WHIRLPOOL\n"); |
# endif |
# endif |
|
|
|
printf("\n"); |
|
|
|
if ((*s_etat_processus).langue == 'F') |
|
{ |
|
printf(" Utilisation :\n\n"); |
|
} |
|
else |
|
{ |
|
printf(" Usage:\n\n"); |
|
} |
|
|
|
printf(" \"text\" \"MD5\" DIGEST\n"); |
|
printf(" \"text\" { \"SHA384\" \"key\" } DIGEST\n"); |
|
printf(" \"text\" { \"AES-128-CBC\" \"key\" } DIGEST\n"); |
return; |
return; |
} |
} |
else if ((*s_etat_processus).test_instruction == 'Y') |
else if ((*s_etat_processus).test_instruction == 'Y') |
Line 727 instruction_digest(struct_processus *s_e
|
Line 766 instruction_digest(struct_processus *s_e
|
((*s_objet_argument_2).type == CHN)) |
((*s_objet_argument_2).type == CHN)) |
{ |
{ |
// Liste des sommes disponibles : |
// Liste des sommes disponibles : |
// - EVP_dss |
|
// - EVP_dss1 |
|
// - EVP_ecdsa |
|
// - EVP_md2 |
// - EVP_md2 |
// - EVP_md4 |
// - EVP_md4 |
// - EVP_md5 |
// - EVP_md5 |
// - EVP_mdc2 |
// - EVP_mdc2 |
// - EVP_ripemd160 |
// - EVP_ripemd160 |
// - EVP_sha |
|
// - EVP_sha1 |
// - EVP_sha1 |
// - EVP_sha224 |
// - EVP_sha224 |
// - EVP_sha256 |
// - EVP_sha256 |
Line 743 instruction_digest(struct_processus *s_e
|
Line 778 instruction_digest(struct_processus *s_e
|
// - EVP_sha512 |
// - EVP_sha512 |
// - EVP_whirlpool |
// - EVP_whirlpool |
|
|
if ((fonction = conversion_majuscule((unsigned char *) |
if ((fonction = conversion_majuscule(s_etat_processus, |
(*s_objet_argument_1).objet)) == NULL) |
(unsigned char *) (*s_objet_argument_1).objet)) == NULL) |
{ |
{ |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
return; |
return; |
Line 754 instruction_digest(struct_processus *s_e
|
Line 789 instruction_digest(struct_processus *s_e
|
|
|
switch(fonction[0]) |
switch(fonction[0]) |
{ |
{ |
case 'D': |
case 'M': |
{ |
{ |
switch(fonction[1]) |
switch(fonction[1]) |
{ |
{ |
case 'S': // ds |
case 'D': // md |
{ |
{ |
switch(fonction[2]) |
switch(fonction[2]) |
{ |
{ |
# ifndef OPENSSL_NO_SHA |
# ifndef OPENSSL_NO_MD2 |
case 'S': // dss |
case '2': // md2 |
{ |
{ |
switch(fonction[3]) |
if (fonction[3] == d_code_fin_chaine) |
{ |
{ |
case d_code_fin_chaine: |
EVP_sum = EVP_md2(); |
{ |
} |
EVP_sum = EVP_dss; |
else |
break; |
{ |
} |
somme_invalide = d_vrai; |
|
} |
|
|
case '1': // dss1 |
break; |
|
} |
|
# endif |
|
|
|
# ifndef OPENSSL_NO_MD4 |
|
case '4': // md4 |
|
{ |
|
if (fonction[3] == d_code_fin_chaine) |
|
{ |
|
EVP_sum = EVP_md4(); |
|
} |
|
else |
|
{ |
|
somme_invalide = d_vrai; |
|
} |
|
|
|
break; |
|
} |
|
# endif |
|
|
|
# ifndef OPENSSL_NO_MD5 |
|
case '5': // md5 |
|
{ |
|
if (fonction[3] == d_code_fin_chaine) |
|
{ |
|
EVP_sum = EVP_md5(); |
|
} |
|
else |
|
{ |
|
somme_invalide = d_vrai; |
|
} |
|
|
|
break; |
|
} |
|
# endif |
|
|
|
case 'C': // mdc |
|
{ |
|
switch(fonction[3]) |
|
{ |
|
# ifndef OPENSSL_NO_MDC2 |
|
case '2': // mdc2 |
{ |
{ |
if (fonction[4] == d_code_fin_chaine) |
if (fonction[4] == d_code_fin_chaine) |
{ |
{ |
EVP_sum = EVP_dss1; |
EVP_sum = EVP_mdc2(); |
} |
} |
else |
else |
{ |
{ |
Line 786 instruction_digest(struct_processus *s_e
|
Line 863 instruction_digest(struct_processus *s_e
|
|
|
break; |
break; |
} |
} |
|
# endif |
|
|
default: |
default: |
{ |
{ |
Line 796 instruction_digest(struct_processus *s_e
|
Line 874 instruction_digest(struct_processus *s_e
|
|
|
break; |
break; |
} |
} |
# endif |
|
|
|
default: |
default: |
{ |
{ |
Line 818 instruction_digest(struct_processus *s_e
|
Line 895 instruction_digest(struct_processus *s_e
|
break; |
break; |
} |
} |
|
|
case 'E': |
# ifndef OPENSSL_NO_RIPEMD |
|
case 'R': |
|
{ |
|
if (strcmp(fonction, "RIPEMD160") == 0) |
|
{ |
|
EVP_sum = EVP_ripemd160(); |
|
} |
|
else |
|
{ |
|
somme_invalide = d_vrai; |
|
} |
|
|
|
break; |
|
} |
|
# endif |
|
|
|
case 'S': |
{ |
{ |
switch(fonction[1]) |
switch(fonction[1]) |
{ |
{ |
case 'C': // ec |
case 'H': // sh |
{ |
{ |
switch(fonction[2]) |
switch(fonction[2]) |
{ |
{ |
case 'D': // ecd |
case 'A': |
{ |
{ |
switch(fonction[3]) |
switch(fonction[3]) |
{ |
{ |
case 'S': // ecds |
case '1': // sha1 |
|
{ |
|
if (fonction[4] == d_code_fin_chaine) |
|
{ |
|
EVP_sum = EVP_sha1(); |
|
} |
|
else |
|
{ |
|
somme_invalide = d_vrai; |
|
} |
|
|
|
break; |
|
} |
|
|
|
case '2': // sha2 |
{ |
{ |
switch(fonction[4]) |
switch(fonction[4]) |
{ |
{ |
# ifndef OPENSSL_NO_SHA |
case '2': // sha22 |
case 'A': // ecdsa |
|
{ |
{ |
if (fonction[5] == |
switch(fonction[5]) |
d_code_fin_chaine) |
|
{ |
{ |
EVP_sum = EVP_ecdsa; |
case '4': // sha224 |
|
{ |
|
if (fonction[6] == |
|
d_code_fin_chaine) |
|
{ |
|
EVP_sum = |
|
EVP_sha224(); |
|
} |
|
else |
|
{ |
|
somme_invalide = |
|
d_vrai; |
|
} |
|
|
|
break; |
|
} |
|
|
|
default: |
|
{ |
|
somme_invalide = d_vrai; |
|
break; |
|
} |
} |
} |
else |
|
|
break; |
|
} |
|
|
|
case '5': |
|
{ |
|
switch(fonction[5]) |
{ |
{ |
somme_invalide = d_vrai; |
case '6': // sha256 |
|
{ |
|
if (fonction[6] == |
|
d_code_fin_chaine) |
|
{ |
|
EVP_sum = |
|
EVP_sha256(); |
|
} |
|
else |
|
{ |
|
somme_invalide = |
|
d_vrai; |
|
} |
|
|
|
break; |
|
} |
|
|
|
default: |
|
{ |
|
somme_invalide = d_vrai; |
|
break; |
|
} |
|
} |
|
|
|
break; |
|
} |
|
|
|
default: |
|
{ |
|
somme_invalide = d_vrai; |
|
break; |
|
} |
|
} |
|
|
|
break; |
|
} |
|
|
|
case '3': // sha3 |
|
{ |
|
switch(fonction[4]) |
|
{ |
|
case '8': // sha38 |
|
{ |
|
switch(fonction[5]) |
|
{ |
|
case '4': // sha384 |
|
{ |
|
if (fonction[6] == |
|
d_code_fin_chaine) |
|
{ |
|
EVP_sum = |
|
EVP_sha384(); |
|
} |
|
else |
|
{ |
|
somme_invalide = |
|
d_vrai; |
|
} |
|
|
|
break; |
|
} |
|
|
|
default: |
|
{ |
|
somme_invalide = d_vrai; |
|
break; |
|
} |
|
} |
|
|
|
break; |
|
} |
|
|
|
default: |
|
{ |
|
somme_invalide = d_vrai; |
|
break; |
|
} |
|
} |
|
|
|
break; |
|
} |
|
|
|
case '5': // sha5 |
|
{ |
|
switch(fonction[4]) |
|
{ |
|
case '1': // sha51 |
|
{ |
|
switch(fonction[5]) |
|
{ |
|
case '2': // sha512 |
|
{ |
|
if (fonction[6] == |
|
d_code_fin_chaine) |
|
{ |
|
EVP_sum = |
|
EVP_sha512(); |
|
} |
|
else |
|
{ |
|
somme_invalide = |
|
d_vrai; |
|
} |
|
|
|
break; |
|
} |
|
|
|
default: |
|
{ |
|
somme_invalide = d_vrai; |
|
break; |
|
} |
} |
} |
|
|
break; |
break; |
} |
} |
# endif |
|
|
|
default: |
default: |
{ |
{ |
Line 891 instruction_digest(struct_processus *s_e
|
Line 1133 instruction_digest(struct_processus *s_e
|
break; |
break; |
} |
} |
|
|
|
# ifndef OPENSSL_NO_WHIRLPOOL |
|
case 'W': |
|
{ |
|
if (strcmp(fonction, "WHIRLPOOL") == 0) |
|
{ |
|
EVP_sum = EVP_whirlpool(); |
|
} |
|
else |
|
{ |
|
somme_invalide = d_vrai; |
|
} |
|
|
|
break; |
|
} |
|
# endif |
|
|
|
default: |
|
{ |
|
somme_invalide = d_vrai; |
|
break; |
|
} |
|
} |
|
|
|
free(fonction); |
|
|
|
if (somme_invalide == d_vrai) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_chiffrement_indisponible; |
|
return; |
|
} |
|
|
|
if ((contexte = EVP_MD_CTX_new()) == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
if (EVP_DigestInit(contexte, EVP_sum) != 1) |
|
{ |
|
EVP_MD_CTX_free(contexte); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_chiffrement; |
|
return; |
|
} |
|
|
|
if ((chaine = formateur_flux(s_etat_processus, (unsigned char *) |
|
(*s_objet_argument_2).objet, &longueur_chaine)) == NULL) |
|
{ |
|
EVP_MD_CTX_free(contexte); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
return; |
|
} |
|
|
|
if (EVP_DigestUpdate(contexte, chaine, (size_t) longueur_chaine) != 1) |
|
{ |
|
free(chaine); |
|
EVP_MD_CTX_free(contexte); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_chiffrement; |
|
return; |
|
} |
|
|
|
if (EVP_DigestFinal_ex(contexte, somme, &longueur_somme) != 1) |
|
{ |
|
free(chaine); |
|
EVP_MD_CTX_free(contexte); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_chiffrement; |
|
return; |
|
} |
|
|
|
free(chaine); |
|
EVP_MD_CTX_free(contexte); |
|
|
|
if ((s_objet_resultat = allocation(s_etat_processus, CHN)) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
if (((*s_objet_resultat).objet = analyse_flux(s_etat_processus, |
|
somme, longueur_somme)) == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
return; |
|
} |
|
} |
|
else if (((*s_objet_argument_1).type == LST) && |
|
((*s_objet_argument_2).type == CHN)) |
|
{ |
|
l_element_courant = (*s_objet_argument_1).objet; |
|
|
|
if ((*(*l_element_courant).donnee).type != CHN) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; |
|
return; |
|
} |
|
|
|
l_element_courant = (*l_element_courant).suivant; |
|
|
|
if (l_element_courant == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_manque_argument; |
|
return; |
|
} |
|
|
|
if ((*(*l_element_courant).donnee).type != CHN) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_erreur_type_argument; |
|
return; |
|
} |
|
|
|
if ((*l_element_courant).suivant != NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_argument_invalide; |
|
return; |
|
} |
|
|
|
// Test du type de somme de contrôle |
|
// - les sommes classiques suivent la RFC 2104 |
|
// - les autres sont formées sur des algorithmes de type CBC |
|
|
|
l_element_courant = (*s_objet_argument_1).objet; |
|
|
|
if ((fonction = conversion_majuscule(s_etat_processus, |
|
(unsigned char *) (*(*l_element_courant).donnee).objet)) |
|
== NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
somme_invalide = d_faux; |
|
|
|
switch(fonction[0]) |
|
{ |
case 'M': |
case 'M': |
{ |
{ |
switch(fonction[1]) |
switch(fonction[1]) |
Line 904 instruction_digest(struct_processus *s_e
|
Line 1315 instruction_digest(struct_processus *s_e
|
{ |
{ |
if (fonction[3] == d_code_fin_chaine) |
if (fonction[3] == d_code_fin_chaine) |
{ |
{ |
EVP_sum = EVP_md2; |
EVP_sum = EVP_md2(); |
} |
} |
else |
else |
{ |
{ |
Line 920 instruction_digest(struct_processus *s_e
|
Line 1331 instruction_digest(struct_processus *s_e
|
{ |
{ |
if (fonction[3] == d_code_fin_chaine) |
if (fonction[3] == d_code_fin_chaine) |
{ |
{ |
EVP_sum = EVP_md4; |
EVP_sum = EVP_md4(); |
} |
} |
else |
else |
{ |
{ |
Line 931 instruction_digest(struct_processus *s_e
|
Line 1342 instruction_digest(struct_processus *s_e
|
} |
} |
# endif |
# endif |
|
|
# ifndef OPENSSL_NO_MD4 |
# ifndef OPENSSL_NO_MD5 |
case '5': // md5 |
case '5': // md5 |
{ |
{ |
if (fonction[3] == d_code_fin_chaine) |
if (fonction[3] == d_code_fin_chaine) |
{ |
{ |
EVP_sum = EVP_md5; |
EVP_sum = EVP_md5(); |
} |
} |
else |
else |
{ |
{ |
Line 956 instruction_digest(struct_processus *s_e
|
Line 1367 instruction_digest(struct_processus *s_e
|
{ |
{ |
if (fonction[4] == d_code_fin_chaine) |
if (fonction[4] == d_code_fin_chaine) |
{ |
{ |
EVP_sum = EVP_mdc2; |
EVP_sum = EVP_mdc2(); |
} |
} |
else |
else |
{ |
{ |
Line 1002 instruction_digest(struct_processus *s_e
|
Line 1413 instruction_digest(struct_processus *s_e
|
{ |
{ |
if (strcmp(fonction, "RIPEMD160") == 0) |
if (strcmp(fonction, "RIPEMD160") == 0) |
{ |
{ |
EVP_sum = EVP_ripemd160; |
EVP_sum = EVP_ripemd160(); |
} |
} |
else |
else |
{ |
{ |
Line 1021 instruction_digest(struct_processus *s_e
|
Line 1432 instruction_digest(struct_processus *s_e
|
{ |
{ |
switch(fonction[2]) |
switch(fonction[2]) |
{ |
{ |
# ifndef OPENSSL_NO_SHA |
|
case 'A': |
case 'A': |
{ |
{ |
switch(fonction[3]) |
switch(fonction[3]) |
{ |
{ |
case d_code_fin_chaine: |
|
{ |
|
EVP_sum = EVP_sha; |
|
break; |
|
} |
|
|
|
case '1': // sha1 |
case '1': // sha1 |
{ |
{ |
if (fonction[4] == d_code_fin_chaine) |
if (fonction[4] == d_code_fin_chaine) |
{ |
{ |
EVP_sum = EVP_sha1; |
EVP_sum = EVP_sha1(); |
} |
} |
else |
else |
{ |
{ |
Line 1046 instruction_digest(struct_processus *s_e
|
Line 1450 instruction_digest(struct_processus *s_e
|
break; |
break; |
} |
} |
|
|
# ifndef OPENSSL_NO_SHA256 |
|
case '2': // sha2 |
case '2': // sha2 |
{ |
{ |
switch(fonction[4]) |
switch(fonction[4]) |
Line 1061 instruction_digest(struct_processus *s_e
|
Line 1464 instruction_digest(struct_processus *s_e
|
d_code_fin_chaine) |
d_code_fin_chaine) |
{ |
{ |
EVP_sum = |
EVP_sum = |
EVP_sha224; |
EVP_sha224(); |
} |
} |
else |
else |
{ |
{ |
Line 1092 instruction_digest(struct_processus *s_e
|
Line 1495 instruction_digest(struct_processus *s_e
|
d_code_fin_chaine) |
d_code_fin_chaine) |
{ |
{ |
EVP_sum = |
EVP_sum = |
EVP_sha256; |
EVP_sha256(); |
} |
} |
else |
else |
{ |
{ |
Line 1122 instruction_digest(struct_processus *s_e
|
Line 1525 instruction_digest(struct_processus *s_e
|
|
|
break; |
break; |
} |
} |
# endif |
|
|
|
# ifndef OPENSSL_NO_SHA512 |
|
case '3': // sha3 |
case '3': // sha3 |
{ |
{ |
switch(fonction[4]) |
switch(fonction[4]) |
Line 1139 instruction_digest(struct_processus *s_e
|
Line 1540 instruction_digest(struct_processus *s_e
|
d_code_fin_chaine) |
d_code_fin_chaine) |
{ |
{ |
EVP_sum = |
EVP_sum = |
EVP_sha384; |
EVP_sha384(); |
} |
} |
else |
else |
{ |
{ |
Line 1184 instruction_digest(struct_processus *s_e
|
Line 1585 instruction_digest(struct_processus *s_e
|
d_code_fin_chaine) |
d_code_fin_chaine) |
{ |
{ |
EVP_sum = |
EVP_sum = |
EVP_sha512; |
EVP_sha512(); |
} |
} |
else |
else |
{ |
{ |
Line 1214 instruction_digest(struct_processus *s_e
|
Line 1615 instruction_digest(struct_processus *s_e
|
|
|
break; |
break; |
} |
} |
# endif |
|
|
|
default: |
default: |
{ |
{ |
Line 1225 instruction_digest(struct_processus *s_e
|
Line 1625 instruction_digest(struct_processus *s_e
|
|
|
break; |
break; |
} |
} |
# endif |
|
|
|
default: |
default: |
{ |
{ |
Line 1252 instruction_digest(struct_processus *s_e
|
Line 1651 instruction_digest(struct_processus *s_e
|
{ |
{ |
if (strcmp(fonction, "WHIRLPOOL") == 0) |
if (strcmp(fonction, "WHIRLPOOL") == 0) |
{ |
{ |
EVP_sum = EVP_whirlpool; |
EVP_sum = EVP_whirlpool(); |
} |
} |
else |
else |
{ |
{ |
Line 1270 instruction_digest(struct_processus *s_e
|
Line 1669 instruction_digest(struct_processus *s_e
|
} |
} |
} |
} |
|
|
free(fonction); |
|
|
|
if (somme_invalide == d_vrai) |
if (somme_invalide == d_vrai) |
{ |
{ |
liberation(s_etat_processus, s_objet_argument_1); |
// Le chiffrement est de type CBC-MAC |
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
if (strncmp(fonction, "AES", 3) == 0) |
d_ex_chiffrement_indisponible; |
{ |
return; |
# ifdef OPENSSL_NO_AES |
} |
|
|
|
if (EVP_DigestInit(&contexte, EVP_sum()) != 1) |
free(fonction); |
{ |
|
EVP_MD_CTX_cleanup(&contexte); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_2); |
liberation(s_etat_processus, s_objet_argument_2); |
|
|
(*s_etat_processus).erreur_execution = d_ex_chiffrement; |
(*s_etat_processus).erreur_execution = |
return; |
d_ex_chiffrement_indisponible; |
} |
return; |
|
|
if ((chaine = formateur_flux(s_etat_processus, (unsigned char *) |
# else |
(*s_objet_argument_2).objet, &longueur_chaine)) == NULL) |
|
{ |
|
EVP_MD_CTX_cleanup(&contexte); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
if (strcmp(fonction, "AES-128-CBC") == 0) |
liberation(s_etat_processus, s_objet_argument_2); |
{ |
|
EVP_chiffrement = EVP_aes_128_cbc(); |
|
} |
|
else if (strcmp(fonction, "AES-192-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_aes_192_cbc(); |
|
} |
|
else if (strcmp(fonction, "AES-256-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_aes_256_cbc(); |
|
} |
|
else |
|
{ |
|
free(fonction); |
|
|
return; |
liberation(s_etat_processus, s_objet_argument_1); |
} |
liberation(s_etat_processus, s_objet_argument_2); |
|
|
if (EVP_DigestUpdate(&contexte, chaine, longueur_chaine) != 1) |
(*s_etat_processus).erreur_execution = |
{ |
d_ex_chiffrement_indisponible; |
free(chaine); |
return; |
EVP_MD_CTX_cleanup(&contexte); |
} |
|
|
liberation(s_etat_processus, s_objet_argument_1); |
longueur_clef_attendue = EVP_CIPHER_key_length(EVP_chiffrement); |
liberation(s_etat_processus, s_objet_argument_2); |
longueur_somme = EVP_CIPHER_block_size(EVP_chiffrement); |
|
|
(*s_etat_processus).erreur_execution = d_ex_chiffrement; |
# endif |
return; |
} |
} |
else if (strncmp(fonction, "DES", 3) == 0) |
|
{ |
|
# ifdef OPENSSL_NO_DES |
|
|
if (EVP_DigestFinal_ex(&contexte, somme, &longueur_somme) != 1) |
free(fonction); |
{ |
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_chiffrement_indisponible; |
|
return; |
|
|
|
# else |
|
|
|
if (strcmp(fonction, "DES-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_des_cbc(); |
|
} |
|
else if (strcmp(fonction, "DES-EDE-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_des_ede_cbc(); |
|
} |
|
else if (strcmp(fonction, "DES-EDE3-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_des_ede3_cbc(); |
|
} |
|
else if (strcmp(fonction, "DESX-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_desx_cbc(); |
|
} |
|
else |
|
{ |
|
free(fonction); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_chiffrement_indisponible; |
|
return; |
|
} |
|
|
|
longueur_clef_attendue = EVP_CIPHER_key_length(EVP_chiffrement); |
|
longueur_somme = EVP_CIPHER_block_size(EVP_chiffrement); |
|
|
|
# endif |
|
} |
|
else if (strncmp(fonction, "CAMELLIA", 8) == 0) |
|
{ |
|
# ifdef OPENSSL_NO_CAMELLIA |
|
|
|
free(fonction); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_chiffrement_indisponible; |
|
return; |
|
|
|
# else |
|
|
|
if (strcmp(fonction, "CAMELLIA-128-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_camellia_128_cbc(); |
|
} |
|
else if (strcmp(fonction, "CAMELLIA-192-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_camellia_192_cbc(); |
|
} |
|
else if (strcmp(fonction, "CAMELLIA-256-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_camellia_256_cbc(); |
|
} |
|
else |
|
{ |
|
free(fonction); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_chiffrement_indisponible; |
|
return; |
|
} |
|
|
|
longueur_clef_attendue = EVP_CIPHER_key_length(EVP_chiffrement); |
|
longueur_somme = EVP_CIPHER_block_size(EVP_chiffrement); |
|
|
|
# endif |
|
} |
|
else if (strncmp(fonction, "RC2", 3) == 0) |
|
{ |
|
# ifdef OPENSSL_NO_RC2 |
|
|
|
free(fonction); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_chiffrement_indisponible; |
|
return; |
|
|
|
# else |
|
|
|
if (strcmp(fonction, "RC2-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_rc2_cbc(); |
|
} |
|
else if (strcmp(fonction, "RC2-40-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_rc2_40_cbc(); |
|
} |
|
else if (strcmp(fonction, "RC2-64-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_rc2_64_cbc(); |
|
} |
|
else |
|
{ |
|
free(fonction); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_chiffrement_indisponible; |
|
return; |
|
} |
|
|
|
longueur_clef_attendue = 0; |
|
longueur_clef_min = 1; |
|
longueur_clef_max = 16; |
|
longueur_somme = EVP_CIPHER_block_size(EVP_chiffrement); |
|
|
|
# endif |
|
} |
|
else if (strncmp(fonction, "IDEA", 4) == 0) |
|
{ |
|
# ifdef OPENSSL_NO_IDEA |
|
|
|
free(fonction); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_chiffrement_indisponible; |
|
return; |
|
|
|
# else |
|
|
|
if (strcmp(fonction, "IDEA-CBC") == 0) |
|
{ |
|
EVP_chiffrement = EVP_idea_cbc(); |
|
} |
|
else |
|
{ |
|
free(fonction); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_chiffrement_indisponible; |
|
return; |
|
} |
|
|
|
longueur_clef_attendue = EVP_CIPHER_key_length(EVP_chiffrement); |
|
longueur_somme = EVP_CIPHER_block_size(EVP_chiffrement); |
|
|
|
# endif |
|
} |
|
else |
|
{ |
|
free(fonction); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_chiffrement_indisponible; |
|
return; |
|
} |
|
|
|
if ((chaine = formateur_flux(s_etat_processus, (unsigned char *) |
|
(*s_objet_argument_2).objet, &longueur_chaine)) == NULL) |
|
{ |
|
free(fonction); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
return; |
|
} |
|
|
|
l_element_courant = (*s_objet_argument_1).objet; |
|
l_element_courant = (*l_element_courant).suivant; |
|
|
|
if ((clef = formateur_flux(s_etat_processus, (unsigned char *) |
|
(*(*l_element_courant).donnee).objet, &longueur_clef)) |
|
== NULL) |
|
{ |
|
free(fonction); |
|
free(chaine); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
return; |
|
} |
|
|
|
if (longueur_clef_attendue != 0) |
|
{ |
|
if (longueur_clef != longueur_clef_attendue) |
|
{ |
|
free(fonction); |
|
free(chaine); |
|
free(clef); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_longueur_clef_chiffrement; |
|
return; |
|
} |
|
} |
|
else |
|
{ |
|
if ((longueur_clef < longueur_clef_min) && |
|
(longueur_clef > longueur_clef_max)) |
|
{ |
|
free(fonction); |
|
free(chaine); |
|
free(clef); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_longueur_clef_chiffrement; |
|
return; |
|
} |
|
} |
|
|
|
if ((vecteur_initialisation = malloc(((size_t) longueur_clef) * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
memset(vecteur_initialisation, 0, (size_t) longueur_clef); |
|
|
|
if ((tampon = chiffrement(s_etat_processus, EVP_chiffrement, d_vrai, |
|
chaine, longueur_chaine, clef, longueur_clef, |
|
vecteur_initialisation, &longueur_tampon, 'Y')) == NULL) |
|
{ |
|
free(fonction); |
|
free(vecteur_initialisation); |
|
free(chaine); |
|
free(clef); |
|
|
|
(*s_etat_processus).erreur_execution = |
|
d_ex_chiffrement; |
|
return; |
|
} |
|
|
|
free(vecteur_initialisation); |
free(chaine); |
free(chaine); |
EVP_MD_CTX_cleanup(&contexte); |
free(clef); |
|
|
liberation(s_etat_processus, s_objet_argument_1); |
if ((s_objet_resultat = allocation(s_etat_processus, CHN)) |
liberation(s_etat_processus, s_objet_argument_2); |
== NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
(*s_etat_processus).erreur_execution = d_ex_chiffrement; |
if (((*s_objet_resultat).objet = analyse_flux(s_etat_processus, |
return; |
&(tampon[longueur_tampon - longueur_somme]), |
} |
longueur_somme)) == NULL) |
|
{ |
|
free(tampon); |
|
free(fonction); |
|
|
free(chaine); |
liberation(s_etat_processus, s_objet_argument_1); |
EVP_MD_CTX_cleanup(&contexte); |
liberation(s_etat_processus, s_objet_argument_2); |
|
return; |
|
} |
|
|
if ((s_objet_resultat = allocation(s_etat_processus, CHN)) == NULL) |
free(tampon); |
{ |
free(fonction); |
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
} |
|
else |
if (((*s_objet_resultat).objet = analyse_flux(s_etat_processus, |
|
somme, longueur_somme)) == NULL) |
|
{ |
{ |
liberation(s_etat_processus, s_objet_argument_1); |
// Le chiffrement est de type HMAC |
liberation(s_etat_processus, s_objet_argument_2); |
// Le second élément de la chaîne contient la clef utilisée pour |
|
// la signature. |
|
|
return; |
free(fonction); |
|
|
|
l_element_courant = (*s_objet_argument_1).objet; |
|
l_element_courant = (*l_element_courant).suivant; |
|
|
|
longueur_bloc = EVP_MD_block_size(EVP_sum); |
|
|
|
if ((clef = formateur_flux(s_etat_processus, (unsigned char *) |
|
(*(*l_element_courant).donnee).objet, &longueur_clef)) |
|
== NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
return; |
|
} |
|
|
|
if (longueur_clef < longueur_bloc) |
|
{ |
|
longueur_tampon = longueur_clef; |
|
tampon = clef; |
|
|
|
if ((clef = malloc(((size_t) longueur_bloc) * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
memset(clef, 0, (size_t) longueur_bloc); |
|
memcpy(clef, tampon, (size_t) longueur_tampon); |
|
longueur_clef = longueur_bloc; |
|
free(tampon); |
|
} |
|
else if (longueur_clef > longueur_bloc) |
|
{ |
|
longueur_tampon = longueur_clef; |
|
tampon = clef; |
|
|
|
if ((clef = malloc(((size_t) longueur_bloc) * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = |
|
d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
memcpy(clef, tampon, (size_t) longueur_bloc); |
|
longueur_clef = longueur_bloc; |
|
free(tampon); |
|
} |
|
|
|
for(i = 0; i < longueur_bloc; i++) |
|
{ |
|
clef[i] ^= (unsigned char) 0x36; |
|
} |
|
|
|
if ((chaine = formateur_flux(s_etat_processus, (unsigned char *) |
|
(*s_objet_argument_2).objet, &longueur_chaine)) == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
return; |
|
} |
|
|
|
if ((tampon = malloc(((size_t) (longueur_bloc + longueur_chaine)) * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
memcpy(tampon, clef, (size_t) longueur_bloc); |
|
memcpy(tampon + longueur_bloc, chaine, (size_t) longueur_chaine); |
|
longueur_tampon = longueur_bloc + longueur_chaine; |
|
|
|
if ((contexte = EVP_MD_CTX_new()) == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
if (EVP_DigestInit(contexte, EVP_sum) != 1) |
|
{ |
|
free(tampon); |
|
free(clef); |
|
free(chaine); |
|
|
|
EVP_MD_CTX_free(contexte); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_chiffrement; |
|
return; |
|
} |
|
|
|
if (EVP_DigestUpdate(contexte, tampon, (size_t) longueur_tampon) |
|
!= 1) |
|
{ |
|
free(tampon); |
|
free(clef); |
|
free(chaine); |
|
|
|
EVP_MD_CTX_free(contexte); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_chiffrement; |
|
return; |
|
} |
|
|
|
free(tampon); |
|
|
|
if (EVP_DigestFinal_ex(contexte, somme, &longueur_somme) != 1) |
|
{ |
|
free(chaine); |
|
EVP_MD_CTX_free(contexte); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_chiffrement; |
|
return; |
|
} |
|
|
|
EVP_MD_CTX_reset(contexte); |
|
|
|
for(i = 0; i < longueur_bloc; i++) |
|
{ |
|
clef[i] ^= (0x36 ^ 0x5c); |
|
} |
|
|
|
if ((tampon = malloc(((size_t) (longueur_bloc + longueur_somme)) * |
|
sizeof(unsigned char))) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
memcpy(tampon, clef, (size_t) longueur_bloc); |
|
memcpy(tampon + longueur_bloc, somme, (size_t) longueur_somme); |
|
longueur_tampon = longueur_bloc + longueur_somme; |
|
|
|
if (EVP_DigestInit(contexte, EVP_sum) != 1) |
|
{ |
|
free(tampon); |
|
free(clef); |
|
free(chaine); |
|
|
|
EVP_MD_CTX_free(contexte); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_chiffrement; |
|
return; |
|
} |
|
|
|
if (EVP_DigestUpdate(contexte, tampon, (size_t) longueur_tampon) |
|
!= 1) |
|
{ |
|
free(tampon); |
|
free(clef); |
|
free(chaine); |
|
|
|
EVP_MD_CTX_free(contexte); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_chiffrement; |
|
return; |
|
} |
|
|
|
free(tampon); |
|
|
|
if (EVP_DigestFinal_ex(contexte, somme, &longueur_somme) != 1) |
|
{ |
|
free(chaine); |
|
EVP_MD_CTX_free(contexte); |
|
|
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
(*s_etat_processus).erreur_execution = d_ex_chiffrement; |
|
return; |
|
} |
|
|
|
EVP_MD_CTX_free(contexte); |
|
|
|
free(chaine); |
|
free(clef); |
|
|
|
if ((s_objet_resultat = allocation(s_etat_processus, CHN)) == NULL) |
|
{ |
|
(*s_etat_processus).erreur_systeme = d_es_allocation_memoire; |
|
return; |
|
} |
|
|
|
if (((*s_objet_resultat).objet = analyse_flux(s_etat_processus, |
|
somme, longueur_somme)) == NULL) |
|
{ |
|
liberation(s_etat_processus, s_objet_argument_1); |
|
liberation(s_etat_processus, s_objet_argument_2); |
|
|
|
return; |
|
} |
} |
} |
} |
} |
else if (((*s_objet_argument_1).type == CHN) && |
|
((*s_objet_argument_2).type == LST)) |
|
{ |
|
BUG(1, uprintf("Oops\n")); |
|
s_objet_resultat = NULL; |
|
} |
|
else |
else |
{ |
{ |
liberation(s_etat_processus, s_objet_argument_1); |
liberation(s_etat_processus, s_objet_argument_1); |