Annotation of rpl/src/instructions_c8.c, revision 1.21

1.1       bertrand    1: /*
                      2: ================================================================================
1.21    ! bertrand    3:   RPL/2 (R) version 4.1.23
1.16      bertrand    4:   Copyright (C) 1989-2015 Dr. BERTRAND Joël
1.1       bertrand    5: 
                      6:   This file is part of RPL/2.
                      7: 
                      8:   RPL/2 is free software; you can redistribute it and/or modify it
                      9:   under the terms of the CeCILL V2 License as published by the french
                     10:   CEA, CNRS and INRIA.
                     11:  
                     12:   RPL/2 is distributed in the hope that it will be useful, but WITHOUT
                     13:   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
                     14:   FITNESS FOR A PARTICULAR PURPOSE.  See the CeCILL V2 License
                     15:   for more details.
                     16:  
                     17:   You should have received a copy of the CeCILL License
                     18:   along with RPL/2. If not, write to info@cecill.info.
                     19: ================================================================================
                     20: */
                     21: 
                     22: 
                     23: #include "rpl-conv.h"
                     24: 
                     25: 
                     26: /*
                     27: ================================================================================
                     28:   Fonction 'cipher'
                     29: ================================================================================
                     30:   Entrées :
                     31: --------------------------------------------------------------------------------
                     32:   Sorties :
                     33: --------------------------------------------------------------------------------
                     34:   Effets de bord : néant
                     35: ================================================================================
                     36: */
                     37: 
                     38: void
                     39: instruction_cipher(struct_processus *s_etat_processus)
                     40: {
                     41:    const EVP_CIPHER                *EVP_chiffrement;
                     42:    const EVP_MD                    *EVP_sum;
                     43: 
1.3       bertrand   44:    int                             longueur_clef;
                     45: 
1.7       bertrand   46:    integer8                        longueur_clef_binaire;
                     47:    integer8                        longueur_iv_binaire;
                     48:    integer8                        longueur_message;
                     49:    integer8                        longueur_message_chiffre;
1.1       bertrand   50:    integer8                        nombre_cycles;
                     51: 
1.3       bertrand   52:    logical1                        encodage;
                     53:    logical1                        generation_clef;
1.1       bertrand   54:    logical1                        somme_invalide;
                     55: 
                     56:    logical8                        sel;
                     57: 
                     58:    struct_liste_chainee            *l_element_courant;
                     59: 
                     60:    struct_objet                    *s_objet_argument_1;
                     61:    struct_objet                    *s_objet_argument_2;
                     62:    struct_objet                    *s_objet_resultat_1;
                     63:    struct_objet                    *s_objet_resultat_2;
                     64: 
1.3       bertrand   65:    unsigned char                   *algorithme_chiffrement;
1.1       bertrand   66:    unsigned char                   *clef;
1.3       bertrand   67:    unsigned char                   *clef_binaire;
1.1       bertrand   68:    unsigned char                   *controle;
                     69:    unsigned char                   *direction;
                     70:    unsigned char                   *fonction;
                     71:    unsigned char                   *instruction;
                     72:    unsigned char                   *iv;
1.3       bertrand   73:    unsigned char                   *iv_binaire;
                     74:    unsigned char                   *message;
                     75:    unsigned char                   *message_chiffre;
1.1       bertrand   76:    unsigned char                   *tampon;
                     77: 
                     78:    if ((*s_etat_processus).affichage_arguments == 'Y')
                     79:    {
                     80:        printf("\n  CIPHER ");
                     81: 
                     82:        if ((*s_etat_processus).langue == 'F')
                     83:        {
                     84:            printf("(opérations de chiffrement)\n\n");
                     85:        }
                     86:        else
                     87:        {
                     88:            printf("(cryptographic operations)\n\n");
                     89:        }
                     90: 
1.3       bertrand   91:        printf("    2: \"password\"\n", d_CHN);
                     92:        printf("    1: { \"KEY\" \"cipher type\" \"digest type\" "
                     93:                "salt nround }\n");
                     94:        printf("->  1: { \"cipher type\" \"generated key\" \"iv\" }\n\n");
1.1       bertrand   95: 
1.3       bertrand   96:        printf("    2: \"text\"\n", d_CHN);
1.14      bertrand   97:        printf("    1: { \"direction\" \"cipher type\" \"key\" \"iv\" }\n");
1.3       bertrand   98:        printf("->  2: \"encrypted or decrypted text\"\n", d_CHN);
                     99:        printf("    1: { \"direction\" \"cipher type\" \"key\" "
1.1       bertrand  100:                "\"updated iv\" }\n\n", d_LST);
                    101: 
                    102:        if ((*s_etat_processus).langue == 'F')
                    103:        {
1.3       bertrand  104:            printf("  Algorithmes de chiffrement :\n\n");
                    105:        }
                    106:        else
                    107:        {
                    108:            printf("  Chipher algorithms:\n\n");
                    109:        }
                    110: 
                    111: #      ifndef OPENSSL_NO_AES
                    112:        printf("    - AES-128-CBC\n");
                    113:        printf("    - AES-128-CCM\n");
                    114:        printf("    - AES-128-CFB1\n");
                    115:        printf("    - AES-128-CFB8\n");
                    116:        printf("    - AES-128-CFB128\n");
                    117:        printf("    - AES-128-CTR\n");
                    118:        printf("    - AES-128-ECB\n");
                    119:        printf("    - AES-128-GCM\n");
                    120:        printf("    - AES-128-OFB\n");
                    121:        printf("    - AES-128-XTS\n");
                    122:        printf("    - AES-192-CBC\n");
                    123:        printf("    - AES-192-CCM\n");
                    124:        printf("    - AES-192-CFB1\n");
                    125:        printf("    - AES-192-CFB8\n");
                    126:        printf("    - AES-192-CFB128\n");
                    127:        printf("    - AES-192-CTR\n");
                    128:        printf("    - AES-192-ECB\n");
                    129:        printf("    - AES-192-GCM\n");
                    130:        printf("    - AES-192-OFB\n");
                    131:        printf("    - AES-256-CBC\n");
                    132:        printf("    - AES-256-CCM\n");
                    133:        printf("    - AES-256-CFB1\n");
                    134:        printf("    - AES-256-CFB8\n");
                    135:        printf("    - AES-256-CFB128\n");
                    136:        printf("    - AES-256-CTR\n");
                    137:        printf("    - AES-256-ECB\n");
                    138:        printf("    - AES-256-GCM\n");
                    139:        printf("    - AES-256-OFB\n");
                    140:        printf("    - AES-256-XTS\n");
                    141: #      endif
                    142: 
                    143: #      ifndef OPENSSL_NO_BF
                    144:        printf("    - BF-CBC\n");
                    145:        printf("    - BF-CFB64\n");
                    146:        printf("    - BF-ECB\n");
                    147:        printf("    - BF-OFB\n");
                    148: #      endif
                    149: 
                    150: #      ifndef OPENSSL_NO_CAMELLIA
                    151:        printf("    - CAMELLIA-128-CBC\n");
                    152:        printf("    - CAMELLIA-128-CFB1\n");
                    153:        printf("    - CAMELLIA-128-CFB8\n");
                    154:        printf("    - CAMELLIA-128-CFB128\n");
                    155:        printf("    - CAMELLIA-128-ECB\n");
                    156:        printf("    - CAMELLIA-128-OFB\n");
                    157:        printf("    - CAMELLIA-192-CBC\n");
                    158:        printf("    - CAMELLIA-192-CFB1\n");
                    159:        printf("    - CAMELLIA-192-CFB8\n");
                    160:        printf("    - CAMELLIA-192-CFB128\n");
                    161:        printf("    - CAMELLIA-192-ECB\n");
                    162:        printf("    - CAMELLIA-192-OFB\n");
                    163:        printf("    - CAMELLIA-256-CBC\n");
                    164:        printf("    - CAMELLIA-256-CFB1\n");
                    165:        printf("    - CAMELLIA-256-CFB8\n");
                    166:        printf("    - CAMELLIA-256-CFB128\n");
                    167:        printf("    - CAMELLIA-256-ECB\n");
                    168:        printf("    - CAMELLIA-256-OFB\n");
                    169: #      endif
                    170: 
                    171: #      ifndef OPENSSL_NO_CAST
                    172:        printf("    - CAST5-CBC\n");
                    173:        printf("    - CAST5-ECB\n");
                    174:        printf("    - CAST5-CFB64\n");
                    175:        printf("    - CAST5-OFB\n");
                    176: #      endif
                    177: 
                    178: #      ifndef OPENSSL_NO_DES
                    179:        printf("    - DES-CBC\n");
                    180:        printf("    - DES-CFB1\n");
                    181:        printf("    - DES-CFB8\n");
                    182:        printf("    - DES-CFB64\n");
                    183:        printf("    - DES-ECB\n");
                    184:        printf("    - DES-EDE\n");
                    185:        printf("    - DES-EDE-CBC\n");
                    186:        printf("    - DES-EDE-CFB1\n");
                    187:        printf("    - DES-EDE-CFB8\n");
                    188:        printf("    - DES-EDE-CFB64\n");
                    189:        printf("    - DES-EDE-ECB\n");
                    190:        printf("    - DES-EDE-OFB\n");
                    191:        printf("    - DES-EDE3\n");
                    192:        printf("    - DES-EDE3-CBC\n");
                    193:        printf("    - DES-EDE3-ECB\n");
                    194:        printf("    - DES-EDE3-OFB\n");
                    195:        printf("    - DES-OFB\n");
                    196:        printf("    - DESX-CBC\n");
                    197: #      endif
                    198: 
                    199: #      ifndef OPENSSL_NO_IDEA
                    200:        printf("    - IDEA-CBC\n");
                    201:        printf("    - IDEA-CFB64\n");
                    202:        printf("    - IDEA-ECB\n");
                    203:        printf("    - IDEA-OFB\n");
                    204: #      endif
                    205: 
                    206: #      ifndef OPENSSL_NO_RC2
                    207:        printf("    - RC2-CBC\n");
                    208:        printf("    - RC2-CFB64\n");
                    209:        printf("    - RC2-ECB\n");
                    210:        printf("    - RC2-OFB\n");
                    211:        printf("    - RC2-40-CBC\n");
                    212:        printf("    - RC2-64-CBC\n");
                    213: #      endif
                    214: 
                    215: #      ifndef OPENSSL_NO_RC4
                    216:        printf("    - RC4\n");
                    217:        printf("    - RC4-40\n");
                    218: #      endif
                    219: 
                    220: #      ifndef OPENSSL_NO_RC5
                    221:        printf("    - RC5-32-12-16-CBC\n");
                    222:        printf("    - RC5-32-12-16-CFB64\n");
                    223:        printf("    - RC5-32-12-16-ECB\n");
                    224:        printf("    - RC5-32-12-16-OFB\n");
                    225: #      endif
                    226: 
                    227: #      ifndef OPENSSL_NO_SEED
                    228:        printf("    - SEED-CBC\n");
                    229:        printf("    - SEED-CFB128\n");
                    230:        printf("    - SEED-ECB\n");
                    231:        printf("    - SEED-OFB\n");
                    232: #      endif
                    233: 
                    234:        printf("\n");
                    235: 
                    236:        if ((*s_etat_processus).langue == 'F')
                    237:        {
1.1       bertrand  238:            printf("  Algorithmes de signature :\n\n");
                    239:        }
                    240:        else
                    241:        {
                    242:            printf("  Digest algorithms:\n\n");
                    243:        }
                    244: 
                    245: #      ifndef OPENSSL_NO_SHA
                    246:        printf("    - DSS\n");
                    247:        printf("    - DSS1\n");
                    248:        printf("    - ECDSA\n");
                    249: #      endif
                    250: #      ifndef OPENSSL_NO_MD2
                    251:        printf("    - MD2\n");
                    252: #      endif
                    253: #      ifndef OPENSSL_NO_MD4
                    254:        printf("    - MD4\n");
                    255: #      endif
                    256: #      ifndef OPENSSL_NO_MD5
                    257:        printf("    - MD5\n");
                    258: #      endif
                    259: #      ifndef OPENSSL_NO_MDC2
                    260:        printf("    - MDC2\n");
                    261: #      endif
                    262: #      ifndef OPENSSL_NO_RIPEMD
                    263:        printf("    - RIPEMD160\n");
                    264: #      endif
                    265: #      ifndef OPENSSL_NO_SHA
                    266:        printf("    - SHA\n");
                    267:        printf("    - SHA1\n");
                    268: #      endif
                    269: #      ifndef OPENSSL_NO_SHA256
                    270:        printf("    - SHA224\n");
                    271:        printf("    - SHA256\n");
                    272: #      endif
                    273: #      ifndef OPENSSL_NO_SHA512
                    274:        printf("    - SHA384\n");
                    275:        printf("    - SHA512\n");
                    276: #      endif
                    277: #      ifndef OPENSSL_NO_WHIRLPOOL
                    278:        printf("    - WHIRLPOOL\n");
                    279: #      endif
                    280: 
                    281:        printf("\n");
                    282: 
                    283:        if ((*s_etat_processus).langue == 'F')
                    284:        {
                    285:            printf("  Utilisation :\n\n");
                    286:        }
                    287:        else
                    288:        {
                    289:            printf("  Usage:\n\n");
                    290:        }
                    291: 
1.4       bertrand  292:        printf("    \"password\" { \"KEY\" \"DES-EDE-OFB\" \"SHA1\" "
1.3       bertrand  293:                "# 0h 3 } CIPHER\n");
                    294:        printf("    \"text\" { \"ENCRYPT\" \"AES-128-CBC\" \"key\" "
1.1       bertrand  295:                "\"iv\" } CIPHER\n");
1.3       bertrand  296:        printf("    \"text\" { \"DECRYPT\" \"AES-128-EBC\" \"key\" "
1.1       bertrand  297:                "\"iv\" } CIPHER\n");
                    298:        return;
                    299:    }
                    300:    else if ((*s_etat_processus).test_instruction == 'Y')
                    301:    {
                    302:        (*s_etat_processus).nombre_arguments = -1;
                    303:        return;
                    304:    }
                    305: 
                    306:    if (test_cfsf(s_etat_processus, 31) == d_vrai)
                    307:    {
                    308:        if (empilement_pile_last(s_etat_processus, 2) == d_erreur)
                    309:        {
                    310:            return;
                    311:        }
                    312:    }
                    313: 
                    314:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    315:            &s_objet_argument_1) == d_erreur)
                    316:    {
                    317:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    318:        return;
                    319:    }
                    320: 
                    321:    if (depilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                    322:            &s_objet_argument_2) == d_erreur)
                    323:    {
                    324:        liberation(s_etat_processus, s_objet_argument_1);
                    325: 
                    326:        (*s_etat_processus).erreur_execution = d_ex_manque_argument;
                    327:        return;
                    328:    }
                    329: 
                    330:    if (((*s_objet_argument_1).type == LST) &&
                    331:            ((*s_objet_argument_2).type == CHN))
                    332:    {
                    333:        l_element_courant = (*s_objet_argument_1).objet;
                    334: 
                    335:        if (l_element_courant == NULL)
                    336:        {
                    337:            liberation(s_etat_processus, s_objet_argument_1);
                    338:            liberation(s_etat_processus, s_objet_argument_2);
                    339: 
                    340:            (*s_etat_processus).erreur_execution = d_ex_argument_invalide; 
                    341:            return;
                    342:        }
                    343: 
                    344:        if ((*(*l_element_courant).donnee).type != CHN)
                    345:        {
                    346:            liberation(s_etat_processus, s_objet_argument_1);
                    347:            liberation(s_etat_processus, s_objet_argument_2);
                    348: 
                    349:            (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                    350:            return;
                    351:        }
                    352: 
1.18      bertrand  353:        if ((instruction = conversion_majuscule(s_etat_processus,
                    354:                (unsigned char *) (*(*l_element_courant).donnee).objet))
                    355:                == NULL)
1.1       bertrand  356:        {
                    357:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    358:            return;
                    359:        }
                    360: 
                    361:        if (strcmp(instruction, "KEY") == 0)
                    362:        {
                    363:            // Dérivation d'une clef
                    364: 
                    365:            free(instruction);
                    366: 
                    367:            l_element_courant = (*l_element_courant).suivant;
                    368: 
                    369:            if (l_element_courant == NULL)
                    370:            {
                    371:                liberation(s_etat_processus, s_objet_argument_1);
                    372:                liberation(s_etat_processus, s_objet_argument_2);
                    373: 
                    374:                (*s_etat_processus).erreur_execution = d_ex_manque_argument; 
                    375:                return;
                    376:            }
                    377: 
                    378:            // On attend l'algorithme de chiffrement.
                    379: 
                    380:            if ((*(*l_element_courant).donnee).type != CHN)
                    381:            {
                    382:                liberation(s_etat_processus, s_objet_argument_1);
                    383:                liberation(s_etat_processus, s_objet_argument_2);
                    384: 
                    385:                (*s_etat_processus).erreur_execution =
                    386:                        d_ex_erreur_type_argument;
                    387:                return;
                    388:            }
                    389: 
1.3       bertrand  390:            algorithme_chiffrement = (unsigned char *) (*(*l_element_courant)
1.1       bertrand  391:                    .donnee).objet;
                    392: 
                    393:            if ((l_element_courant = (*l_element_courant).suivant) == NULL)
                    394:            {
                    395:                liberation(s_etat_processus, s_objet_argument_1);
                    396:                liberation(s_etat_processus, s_objet_argument_2);
                    397: 
                    398:                (*s_etat_processus).erreur_execution = d_ex_manque_argument; 
                    399:                return;
                    400:            }   
                    401: 
                    402:            // On attend la somme de contrôle.
                    403: 
                    404:            if ((*(*l_element_courant).donnee).type != CHN)
                    405:            {
                    406:                liberation(s_etat_processus, s_objet_argument_1);
                    407:                liberation(s_etat_processus, s_objet_argument_2);
                    408: 
                    409:                (*s_etat_processus).erreur_execution =
                    410:                        d_ex_erreur_type_argument;
                    411:                return;
                    412:            }
                    413: 
                    414:            controle = (unsigned char *) (*(*l_element_courant).donnee).objet;
                    415: 
                    416:            // Test de la validité de la somme de contrôle.
                    417: 
1.18      bertrand  418:            if ((fonction = conversion_majuscule(s_etat_processus, controle))
                    419:                    == NULL)
1.1       bertrand  420:            {
                    421:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    422:                return;
                    423:            }
                    424: 
                    425:            somme_invalide = d_faux;
                    426: 
                    427:            switch(fonction[0])
                    428:            {
                    429:                case 'D':
                    430:                {
                    431:                    switch(fonction[1])
                    432:                    {
                    433:                        case 'S': // ds
                    434:                        {
                    435:                            switch(fonction[2])
                    436:                            {
                    437: #                              ifndef OPENSSL_NO_SHA
                    438:                                case 'S': // dss
                    439:                                {
                    440:                                    switch(fonction[3])
                    441:                                    {
                    442:                                        case d_code_fin_chaine:
                    443:                                        {
                    444:                                            EVP_sum = EVP_dss();
                    445:                                            break;
                    446:                                        }
                    447: 
                    448:                                        case '1': // dss1
                    449:                                        {
                    450:                                            if (fonction[4] ==
                    451:                                                    d_code_fin_chaine)
                    452:                                            {
                    453:                                                EVP_sum = EVP_dss1();
                    454:                                            }
                    455:                                            else
                    456:                                            {
                    457:                                                somme_invalide = d_vrai;
                    458:                                            }
                    459: 
                    460:                                            break;
                    461:                                        }
                    462: 
                    463:                                        default:
                    464:                                        {
                    465:                                            somme_invalide = d_vrai;
                    466:                                            break;
                    467:                                        }
                    468:                                    }
                    469: 
                    470:                                    break;
                    471:                                }
                    472: #                              endif
                    473: 
                    474:                                default:
                    475:                                {
                    476:                                    somme_invalide = d_vrai;
                    477:                                    break;
                    478:                                }
                    479:                            }
                    480: 
                    481:                            break;
                    482:                        }
                    483: 
                    484:                        default:
                    485:                        {
                    486:                            somme_invalide = d_vrai;
                    487:                            break;
                    488:                        }
                    489:                    }
                    490: 
                    491:                    break;
                    492:                }
                    493: 
                    494:                case 'E':
                    495:                {
                    496:                    switch(fonction[1])
                    497:                    {
                    498:                        case 'C': // ec
                    499:                        {
                    500:                            switch(fonction[2])
                    501:                            {
                    502:                                case 'D': // ecd
                    503:                                {
                    504:                                    switch(fonction[3])
                    505:                                    {
                    506:                                        case 'S': // ecds
                    507:                                        {
                    508:                                            switch(fonction[4])
                    509:                                            {
                    510: #                                              ifndef OPENSSL_NO_SHA
                    511:                                                case 'A': // ecdsa
                    512:                                                {
                    513:                                                    if (fonction[5] ==
                    514:                                                            d_code_fin_chaine)
                    515:                                                    {
                    516:                                                        EVP_sum = EVP_ecdsa();
                    517:                                                    }
                    518:                                                    else
                    519:                                                    {
                    520:                                                        somme_invalide = d_vrai;
                    521:                                                    }
                    522: 
                    523:                                                    break;
                    524:                                                }
                    525: #                                              endif
                    526: 
                    527:                                                default:
                    528:                                                {
                    529:                                                    somme_invalide = d_vrai;
                    530:                                                    break;
                    531:                                                }
                    532:                                            }
                    533: 
                    534:                                            break;
                    535:                                        }
                    536: 
                    537:                                        default:
                    538:                                        {
                    539:                                            somme_invalide = d_vrai;
                    540:                                            break;
                    541:                                        }
                    542:                                    }
                    543: 
                    544:                                    break;
                    545:                                }
                    546: 
                    547:                                default:
                    548:                                {
                    549:                                    somme_invalide = d_vrai;
                    550:                                    break;
                    551:                                }
                    552:                            }
                    553: 
                    554:                            break;
                    555:                        }
                    556: 
                    557:                        default:
                    558:                        {
                    559:                            somme_invalide = d_vrai;
                    560:                            break;
                    561:                        }
                    562:                    }
                    563: 
                    564:                    break;
                    565:                }
                    566: 
                    567:                case 'M':
                    568:                {
                    569:                    switch(fonction[1])
                    570:                    {
                    571:                        case 'D': // md
                    572:                        {
                    573:                            switch(fonction[2])
                    574:                            {
                    575: #                              ifndef OPENSSL_NO_MD2
                    576:                                case '2': // md2
                    577:                                {
                    578:                                    if (fonction[3] == d_code_fin_chaine)
                    579:                                    {
                    580:                                        EVP_sum = EVP_md2();
                    581:                                    }
                    582:                                    else
                    583:                                    {
                    584:                                        somme_invalide = d_vrai;
                    585:                                    }
                    586: 
                    587:                                    break;
                    588:                                }
                    589: #                              endif
                    590: 
                    591: #                              ifndef OPENSSL_NO_MD4
                    592:                                case '4': // md4
                    593:                                {
                    594:                                    if (fonction[3] == d_code_fin_chaine)
                    595:                                    {
                    596:                                        EVP_sum = EVP_md4();
                    597:                                    }
                    598:                                    else
                    599:                                    {
                    600:                                        somme_invalide = d_vrai;
                    601:                                    }
                    602: 
                    603:                                    break;
                    604:                                }
                    605: #                              endif
                    606: 
                    607: #                              ifndef OPENSSL_NO_MD5
                    608:                                case '5': // md5
                    609:                                {
                    610:                                    if (fonction[3] == d_code_fin_chaine)
                    611:                                    {
                    612:                                        EVP_sum = EVP_md5();
                    613:                                    }
                    614:                                    else
                    615:                                    {
                    616:                                        somme_invalide = d_vrai;
                    617:                                    }
                    618: 
                    619:                                    break;
                    620:                                }
                    621: #                              endif
                    622: 
                    623:                                case 'C': // mdc
                    624:                                {
                    625:                                    switch(fonction[3])
                    626:                                    {
                    627: #                                      ifndef OPENSSL_NO_MDC2
                    628:                                        case '2': // mdc2
                    629:                                        {
                    630:                                            if (fonction[4] ==
                    631:                                                    d_code_fin_chaine)
                    632:                                            {
                    633:                                                EVP_sum = EVP_mdc2();
                    634:                                            }
                    635:                                            else
                    636:                                            {
                    637:                                                somme_invalide = d_vrai;
                    638:                                            }
                    639: 
                    640:                                            break;
                    641:                                        }
                    642: #                                      endif
                    643: 
                    644:                                        default:
                    645:                                        {
                    646:                                            somme_invalide = d_vrai;
                    647:                                            break;
                    648:                                        }
                    649:                                    }
                    650: 
                    651:                                    break;
                    652:                                }
                    653: 
                    654:                                default:
                    655:                                {
                    656:                                    somme_invalide = d_vrai;
                    657:                                    break;
                    658:                                }
                    659:                            }
                    660: 
                    661:                            break;
                    662:                        }
                    663: 
                    664:                        default:
                    665:                        {
                    666:                            somme_invalide = d_vrai;
                    667:                            break;
                    668:                        }
                    669:                    }
                    670: 
                    671:                    break;
                    672:                }
                    673: 
                    674: #              ifndef OPENSSL_NO_RIPEMD
                    675:                case 'R':
                    676:                {
                    677:                    if (strcmp(fonction, "RIPEMD160") == 0)
                    678:                    {
                    679:                        EVP_sum = EVP_ripemd160();
                    680:                    }
                    681:                    else
                    682:                    {
                    683:                        somme_invalide = d_vrai;
                    684:                    }
                    685: 
                    686:                    break;
                    687:                }
                    688: #              endif
                    689: 
                    690:                case 'S':
                    691:                {
                    692:                    switch(fonction[1])
                    693:                    {
                    694:                        case 'H': // sh
                    695:                        {
                    696:                            switch(fonction[2])
                    697:                            {
                    698: #                              ifndef OPENSSL_NO_SHA
                    699:                                case 'A':
                    700:                                {
                    701:                                    switch(fonction[3])
                    702:                                    {
                    703:                                        case d_code_fin_chaine:
                    704:                                        {
                    705:                                            EVP_sum = EVP_sha();
                    706:                                            break;
                    707:                                        }
                    708: 
                    709:                                        case '1': // sha1
                    710:                                        {
                    711:                                            if (fonction[4] ==
                    712:                                                    d_code_fin_chaine)
                    713:                                            {
                    714:                                                EVP_sum = EVP_sha1();
                    715:                                            }
                    716:                                            else
                    717:                                            {
                    718:                                                somme_invalide = d_vrai;
                    719:                                            }
                    720: 
                    721:                                            break;
                    722:                                        }
                    723: 
                    724: #                                      ifndef OPENSSL_NO_SHA256
                    725:                                        case '2': // sha2
                    726:                                        {
                    727:                                            switch(fonction[4])
                    728:                                            {
                    729:                                                case '2': // sha22
                    730:                                                {
                    731:                                                    switch(fonction[5])
                    732:                                                    {
                    733:                                                        case '4': // sha224
                    734:                                                        {
                    735:                                                            if (fonction[6] ==
                    736:                                                            d_code_fin_chaine)
                    737:                                                            {
                    738:                                                                EVP_sum =
                    739:                                                                EVP_sha224();
                    740:                                                            }
                    741:                                                            else
                    742:                                                            {
                    743:                                                                somme_invalide =
                    744:                                                                        d_vrai;
                    745:                                                            }
                    746: 
                    747:                                                            break;
                    748:                                                        }
                    749: 
                    750:                                                        default:
                    751:                                                        {
                    752:                                                            somme_invalide =
                    753:                                                                    d_vrai;
                    754:                                                            break;
                    755:                                                        }
                    756:                                                    }
                    757: 
                    758:                                                    break;
                    759:                                                }
                    760: 
                    761:                                                case '5':
                    762:                                                {
                    763:                                                    switch(fonction[5])
                    764:                                                    {
                    765:                                                        case '6': // sha256
                    766:                                                        {
                    767:                                                            if (fonction[6] ==
                    768:                                                            d_code_fin_chaine)
                    769:                                                            {
                    770:                                                                EVP_sum =
                    771:                                                                EVP_sha256();
                    772:                                                            }
                    773:                                                            else
                    774:                                                            {
                    775:                                                                somme_invalide =
                    776:                                                                        d_vrai;
                    777:                                                            }
                    778: 
                    779:                                                            break;
                    780:                                                        }
                    781: 
                    782:                                                        default:
                    783:                                                        {
                    784:                                                            somme_invalide =
                    785:                                                                    d_vrai;
                    786:                                                            break;
                    787:                                                        }
                    788:                                                    }
                    789: 
                    790:                                                    break;
                    791:                                                }
                    792: 
                    793:                                                default:
                    794:                                                {
                    795:                                                    somme_invalide = d_vrai;
                    796:                                                    break;
                    797:                                                }
                    798:                                            }
                    799: 
                    800:                                            break;
                    801:                                        }
                    802: #                                      endif
                    803: 
                    804: #                                      ifndef OPENSSL_NO_SHA512
                    805:                                        case '3': // sha3
                    806:                                        {
                    807:                                            switch(fonction[4])
                    808:                                            {
                    809:                                                case '8': // sha38
                    810:                                                {
                    811:                                                    switch(fonction[5])
                    812:                                                    {
                    813:                                                        case '4': // sha384
                    814:                                                        {
                    815:                                                            if (fonction[6] ==
                    816:                                                            d_code_fin_chaine)
                    817:                                                            {
                    818:                                                                EVP_sum =
                    819:                                                                EVP_sha384();
                    820:                                                            }
                    821:                                                            else
                    822:                                                            {
                    823:                                                                somme_invalide =
                    824:                                                                        d_vrai;
                    825:                                                            }
                    826: 
                    827:                                                            break;
                    828:                                                        }
                    829: 
                    830:                                                        default:
                    831:                                                        {
                    832:                                                            somme_invalide =
                    833:                                                                    d_vrai;
                    834:                                                            break;
                    835:                                                        }
                    836:                                                    }
                    837: 
                    838:                                                    break;
                    839:                                                }
                    840: 
                    841:                                                default:
                    842:                                                {
                    843:                                                    somme_invalide = d_vrai;
                    844:                                                    break;
                    845:                                                }
                    846:                                            }
                    847: 
                    848:                                            break;
                    849:                                        }
                    850: 
                    851:                                        case '5': // sha5
                    852:                                        {
                    853:                                            switch(fonction[4])
                    854:                                            {
                    855:                                                case '1': // sha51
                    856:                                                {
                    857:                                                    switch(fonction[5])
                    858:                                                    {
                    859:                                                        case '2': // sha512
                    860:                                                        {
                    861:                                                            if (fonction[6] ==
                    862:                                                            d_code_fin_chaine)
                    863:                                                            {
                    864:                                                                EVP_sum =
                    865:                                                                EVP_sha512();
                    866:                                                            }
                    867:                                                            else
                    868:                                                            {
                    869:                                                                somme_invalide =
                    870:                                                                        d_vrai;
                    871:                                                            }
                    872: 
                    873:                                                            break;
                    874:                                                        }
                    875: 
                    876:                                                        default:
                    877:                                                        {
                    878:                                                            somme_invalide =
                    879:                                                                    d_vrai;
                    880:                                                            break;
                    881:                                                        }
                    882:                                                    }
                    883: 
                    884:                                                    break;
                    885:                                                }
                    886: 
                    887:                                                default:
                    888:                                                {
                    889:                                                    somme_invalide = d_vrai;
                    890:                                                    break;
                    891:                                                }
                    892:                                            }
                    893: 
                    894:                                            break;
                    895:                                        }
                    896: #                                      endif
                    897: 
                    898:                                        default:
                    899:                                        {
                    900:                                            somme_invalide = d_vrai;
                    901:                                            break;
                    902:                                        }
                    903:                                    }
                    904: 
                    905:                                    break;
                    906:                                }
                    907: #                              endif
                    908: 
                    909:                                default:
                    910:                                {
                    911:                                    somme_invalide = d_vrai;
                    912:                                    break;
                    913:                                }
                    914:                            }
                    915: 
                    916:                            break;
                    917:                        }
                    918: 
                    919:                        default:
                    920:                        {
                    921:                            somme_invalide = d_vrai;
                    922:                            break;
                    923:                        }
                    924:                    }
                    925: 
                    926:                    break;
                    927:                }
                    928: 
                    929: #              ifndef OPENSSL_NO_WHIRLPOOL
                    930:                case 'W':
                    931:                {
                    932:                    if (strcmp(fonction, "WHIRLPOOL") == 0)
                    933:                    {
                    934:                        EVP_sum = EVP_whirlpool();
                    935:                    }
                    936:                    else
                    937:                    {
                    938:                        somme_invalide = d_vrai;
                    939:                    }
                    940: 
                    941:                    break;
                    942:                }
                    943: #              endif
                    944: 
                    945:                default:
                    946:                {
                    947:                    somme_invalide = d_vrai;
                    948:                    break;
                    949:                }
                    950:            }
                    951: 
                    952:            free(fonction);
                    953: 
                    954:            if (somme_invalide == d_vrai)
                    955:            {
                    956:                liberation(s_etat_processus, s_objet_argument_1);
                    957:                liberation(s_etat_processus, s_objet_argument_2);
                    958: 
                    959:                (*s_etat_processus).erreur_execution =
                    960:                        d_ex_chiffrement_indisponible;
                    961:                return;
                    962:            }
                    963: 
1.3       bertrand  964:            if ((l_element_courant = (*l_element_courant).suivant) == NULL)
                    965:            {
                    966:                liberation(s_etat_processus, s_objet_argument_1);
                    967:                liberation(s_etat_processus, s_objet_argument_2);
                    968: 
                    969:                (*s_etat_processus).erreur_execution = d_ex_manque_argument; 
                    970:                return;
                    971:            }   
                    972: 
                    973:            // On attend le sel, donc un entier binaire de 64 bits.
                    974: 
                    975:            if ((*(*l_element_courant).donnee).type != BIN)
                    976:            {
                    977:                liberation(s_etat_processus, s_objet_argument_1);
                    978:                liberation(s_etat_processus, s_objet_argument_2);
                    979: 
                    980:                (*s_etat_processus).erreur_execution =
                    981:                        d_ex_erreur_type_argument;
                    982:                return;
                    983:            }
                    984: 
                    985:            sel = (*((logical8 *) (*(*l_element_courant).donnee).objet));
                    986: 
                    987:            if ((l_element_courant = (*l_element_courant).suivant) == NULL)
                    988:            {
                    989:                liberation(s_etat_processus, s_objet_argument_1);
                    990:                liberation(s_etat_processus, s_objet_argument_2);
                    991: 
                    992:                (*s_etat_processus).erreur_execution = d_ex_manque_argument; 
                    993:                return;
                    994:            }   
                    995: 
                    996:            // On attend le nombre de cycles.
                    997: 
                    998:            if ((*(*l_element_courant).donnee).type != INT)
                    999:            {
                   1000:                liberation(s_etat_processus, s_objet_argument_1);
                   1001:                liberation(s_etat_processus, s_objet_argument_2);
                   1002: 
                   1003:                (*s_etat_processus).erreur_execution =
                   1004:                        d_ex_erreur_type_argument;
                   1005:                return;
                   1006:            }
                   1007: 
                   1008:            nombre_cycles = (*((integer8 *) (*(*l_element_courant)
                   1009:                    .donnee).objet));
                   1010: 
                   1011:            // On a dû atteindre la fin de la liste.
                   1012: 
                   1013:            if ((*l_element_courant).suivant != NULL)
                   1014:            {
                   1015:                liberation(s_etat_processus, s_objet_argument_1);
                   1016:                liberation(s_etat_processus, s_objet_argument_2);
                   1017: 
                   1018:                (*s_etat_processus).erreur_execution = d_ex_argument_invalide; 
                   1019:                return;
                   1020:            }
                   1021: 
                   1022:            clef = NULL;
                   1023:            iv = NULL;
                   1024: 
1.1       bertrand 1025:            generation_clef = d_vrai;
                   1026:        }
                   1027:        else
                   1028:        {
                   1029:            // Chiffrement ou déchiffrement d'un message
                   1030: 
1.3       bertrand 1031:            direction = instruction;
1.1       bertrand 1032: 
                   1033:            l_element_courant = (*l_element_courant).suivant;
                   1034: 
                   1035:            if (l_element_courant == NULL)
                   1036:            {
                   1037:                liberation(s_etat_processus, s_objet_argument_1);
                   1038:                liberation(s_etat_processus, s_objet_argument_2);
                   1039: 
                   1040:                (*s_etat_processus).erreur_execution = d_ex_manque_argument; 
                   1041:                return;
                   1042:            }
                   1043: 
1.3       bertrand 1044:            // On attend le type de chiffrement.
1.1       bertrand 1045: 
                   1046:            if ((*(*l_element_courant).donnee).type != CHN)
                   1047:            {
                   1048:                liberation(s_etat_processus, s_objet_argument_1);
                   1049:                liberation(s_etat_processus, s_objet_argument_2);
                   1050: 
                   1051:                (*s_etat_processus).erreur_execution =
                   1052:                        d_ex_erreur_type_argument;
                   1053:                return;
                   1054:            }
                   1055: 
1.3       bertrand 1056:            algorithme_chiffrement = (unsigned char *) (*(*l_element_courant)
1.1       bertrand 1057:                    .donnee).objet;
                   1058: 
                   1059:            // On attend la clef.
                   1060: 
                   1061:            if ((l_element_courant = (*l_element_courant).suivant) == NULL)
                   1062:            {
                   1063:                liberation(s_etat_processus, s_objet_argument_1);
                   1064:                liberation(s_etat_processus, s_objet_argument_2);
                   1065: 
                   1066:                (*s_etat_processus).erreur_execution =
                   1067:                        d_ex_manque_argument;
                   1068:                return;
                   1069:            }
                   1070: 
                   1071:            clef = (unsigned char *) (*(*l_element_courant).donnee).objet;
                   1072: 
                   1073:            // On attend le vecteur d'initialisation.
                   1074: 
                   1075:            if ((l_element_courant = (*l_element_courant).suivant) == NULL)
                   1076:            {
                   1077:                liberation(s_etat_processus, s_objet_argument_1);
                   1078:                liberation(s_etat_processus, s_objet_argument_2);
                   1079: 
                   1080:                (*s_etat_processus).erreur_execution =
                   1081:                        d_ex_manque_argument;
                   1082:                return;
                   1083:            }
                   1084: 
                   1085:            iv = (unsigned char *) (*(*l_element_courant).donnee).objet;
                   1086: 
                   1087:            if ((*l_element_courant).suivant != NULL)
                   1088:            {
                   1089:                liberation(s_etat_processus, s_objet_argument_1);
                   1090:                liberation(s_etat_processus, s_objet_argument_2);
                   1091: 
                   1092:                (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
                   1093:                return;
                   1094:            }
1.3       bertrand 1095: 
                   1096:            generation_clef = d_faux;
1.1       bertrand 1097:        }
                   1098:    }
                   1099:    else
                   1100:    {
                   1101:        liberation(s_etat_processus, s_objet_argument_1);
                   1102:        liberation(s_etat_processus, s_objet_argument_2);
                   1103: 
                   1104:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   1105:        return;
                   1106:    }
                   1107: 
1.18      bertrand 1108:    if ((tampon = conversion_majuscule(s_etat_processus,
                   1109:            algorithme_chiffrement)) == NULL)
1.1       bertrand 1110:    {
                   1111:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1112:        return;
                   1113:    }
                   1114: 
1.3       bertrand 1115: #  define TEST_CIPHER(string, value) \
                   1116:            if (strcmp(tampon, string) == 0) EVP_chiffrement = value();
                   1117: 
                   1118:    if (strncmp(tampon, "DES", 3) == 0)
                   1119:    {
                   1120: #      ifndef OPENSSL_NO_DES
                   1121:            TEST_CIPHER("DES-ECB", EVP_des_ecb)
                   1122:            else TEST_CIPHER("DES-EDE", EVP_des_ede)
                   1123:            else TEST_CIPHER("DES-EDE3", EVP_des_ede3)
                   1124:            else TEST_CIPHER("DES-EDE-ECB", EVP_des_ede_ecb)
                   1125:            else TEST_CIPHER("DES-EDE3-ECB", EVP_des_ede3_ecb)
                   1126:            else TEST_CIPHER("DES-CFB64", EVP_des_cfb64)
                   1127:            else TEST_CIPHER("DES-CFB1", EVP_des_cfb1)
                   1128:            else TEST_CIPHER("DES-CFB8", EVP_des_cfb8)
                   1129:            else TEST_CIPHER("DES-EDE-CFB64", EVP_des_ede_cfb64)
                   1130:            else TEST_CIPHER("DES-EDE3-CFB64", EVP_des_ede3_cfb64)
                   1131:            else TEST_CIPHER("DES-EDE3-CFB1", EVP_des_ede3_cfb1)
                   1132:            else TEST_CIPHER("DES-EDE3-CFB8", EVP_des_ede3_cfb8)
                   1133:            else TEST_CIPHER("DES-OFB", EVP_des_ofb)
                   1134:            else TEST_CIPHER("DES-EDE-OFB", EVP_des_ede_ofb)
                   1135:            else TEST_CIPHER("DES-EDE3-OFB", EVP_des_ede3_ofb)
                   1136:            else TEST_CIPHER("DES-CBC", EVP_des_cbc)
                   1137:            else TEST_CIPHER("DES-EDE-CBC", EVP_des_ede_cbc)
                   1138:            else TEST_CIPHER("DES-EDE3-CBC", EVP_des_ede3_cbc)
                   1139:            else TEST_CIPHER("DESX-CBC", EVP_desx_cbc)
                   1140:            else
                   1141:            {
                   1142:                free(tampon);
                   1143: 
                   1144:                liberation(s_etat_processus, s_objet_argument_1);
                   1145:                liberation(s_etat_processus, s_objet_argument_2);
                   1146: 
                   1147:                (*s_etat_processus).erreur_execution =
                   1148:                        d_ex_chiffrement_indisponible;
                   1149:                return;
                   1150:            }
                   1151: #      else
                   1152:            free(tampon);
                   1153: 
                   1154:            liberation(s_etat_processus, s_objet_argument_1);
                   1155:            liberation(s_etat_processus, s_objet_argument_2);
                   1156: 
                   1157:            (*s_etat_processus).erreur_execution =
                   1158:                    d_ex_chiffrement_indisponible;
                   1159:            return;
                   1160: #      endif
                   1161:    }
                   1162:    else if (strncmp(tampon, "RC4", 3) == 0)
                   1163:    {
                   1164: #      ifndef OPENSSL_NO_RC4
                   1165:            TEST_CIPHER("RC4", EVP_rc4)
                   1166:            else TEST_CIPHER("RC4-40", EVP_rc4_40)
                   1167:            else
                   1168:            {
                   1169:                free(tampon);
                   1170: 
                   1171:                liberation(s_etat_processus, s_objet_argument_1);
                   1172:                liberation(s_etat_processus, s_objet_argument_2);
                   1173: 
                   1174:                (*s_etat_processus).erreur_execution =
                   1175:                        d_ex_chiffrement_indisponible;
                   1176:                return;
                   1177:            }
                   1178: #      else
                   1179:            free(tampon);
                   1180: 
                   1181:            liberation(s_etat_processus, s_objet_argument_1);
                   1182:            liberation(s_etat_processus, s_objet_argument_2);
                   1183: 
                   1184:            (*s_etat_processus).erreur_execution =
                   1185:                    d_ex_chiffrement_indisponible;
                   1186:            return;
                   1187: #      endif
                   1188:    }
                   1189:    else if (strncmp(tampon, "IDEA", 4) == 0)
                   1190:    {
                   1191: #      ifndef OPENSSL_NO_IDEA
                   1192:            TEST_CIPHER("IDEA-ECB", EVP_idea_ecb)
                   1193:            else TEST_CIPHER("IDEA-CFB64", EVP_idea_cfb64)
                   1194:            else TEST_CIPHER("IDEA-OFB", EVP_idea_ofb)
                   1195:            else TEST_CIPHER("IDEA-CBC", EVP_idea_cbc)
                   1196:            else
                   1197:            {
                   1198:                free(tampon);
                   1199: 
                   1200:                liberation(s_etat_processus, s_objet_argument_1);
                   1201:                liberation(s_etat_processus, s_objet_argument_2);
                   1202: 
                   1203:                (*s_etat_processus).erreur_execution =
                   1204:                        d_ex_chiffrement_indisponible;
                   1205:                return;
                   1206:            }
                   1207: #      else
                   1208:            free(tampon);
                   1209: 
                   1210:            liberation(s_etat_processus, s_objet_argument_1);
                   1211:            liberation(s_etat_processus, s_objet_argument_2);
                   1212: 
                   1213:            (*s_etat_processus).erreur_execution =
                   1214:                    d_ex_chiffrement_indisponible;
                   1215:            return;
                   1216: #      endif
                   1217:    }
                   1218:    else if (strncmp(tampon, "RC2", 3) == 0)
1.1       bertrand 1219:    {
1.3       bertrand 1220: #      ifndef OPENSSL_NO_RC2
                   1221:            TEST_CIPHER("RC2-ECB", EVP_rc2_ecb)
                   1222:            else TEST_CIPHER("RC2-CBC", EVP_rc2_cbc)
                   1223:            else TEST_CIPHER("RC2-40-CBC", EVP_rc2_40_cbc)
                   1224:            else TEST_CIPHER("RC2-64-CBC", EVP_rc2_64_cbc)
                   1225:            else TEST_CIPHER("RC2-CFB64", EVP_rc2_cfb64)
                   1226:            else TEST_CIPHER("RC2-OFB", EVP_rc2_ofb)
                   1227:            else
                   1228:            {
                   1229:                free(tampon);
                   1230: 
                   1231:                liberation(s_etat_processus, s_objet_argument_1);
                   1232:                liberation(s_etat_processus, s_objet_argument_2);
                   1233: 
                   1234:                (*s_etat_processus).erreur_execution =
                   1235:                        d_ex_chiffrement_indisponible;
                   1236:                return;
                   1237:            }
                   1238: #      else
                   1239:            free(tampon);
                   1240: 
                   1241:            liberation(s_etat_processus, s_objet_argument_1);
                   1242:            liberation(s_etat_processus, s_objet_argument_2);
                   1243: 
                   1244:            (*s_etat_processus).erreur_execution =
                   1245:                    d_ex_chiffrement_indisponible;
                   1246:            return;
                   1247: #      endif
1.1       bertrand 1248:    }
1.3       bertrand 1249:    else if (strncmp(tampon, "BF", 2) == 0)
                   1250:    {
                   1251: #      ifndef OPENSSL_NO_BF
                   1252:            TEST_CIPHER("BF-ECB", EVP_bf_ecb)
                   1253:            else TEST_CIPHER("BF-CBC", EVP_bf_cbc)
                   1254:            else TEST_CIPHER("BF-CFB64", EVP_bf_cfb64)
                   1255:            else TEST_CIPHER("BF-OFB", EVP_bf_ofb)
                   1256:            else
                   1257:            {
                   1258:                free(tampon);
                   1259: 
                   1260:                liberation(s_etat_processus, s_objet_argument_1);
                   1261:                liberation(s_etat_processus, s_objet_argument_2);
                   1262: 
                   1263:                (*s_etat_processus).erreur_execution =
                   1264:                        d_ex_chiffrement_indisponible;
                   1265:                return;
                   1266:            }
                   1267: #      else
                   1268:            free(tampon);
1.1       bertrand 1269: 
1.3       bertrand 1270:            liberation(s_etat_processus, s_objet_argument_1);
                   1271:            liberation(s_etat_processus, s_objet_argument_2);
1.1       bertrand 1272: 
1.3       bertrand 1273:            (*s_etat_processus).erreur_execution =
                   1274:                    d_ex_chiffrement_indisponible;
                   1275:            return;
                   1276: #      endif
                   1277:    }
                   1278:    else if (strncmp(tampon, "CAST5", 5) == 0)
1.1       bertrand 1279:    {
1.3       bertrand 1280: #      ifndef OPENSSL_NO_CAST
                   1281:            TEST_CIPHER("CAST5-ECB", EVP_cast5_ecb)
                   1282:            else TEST_CIPHER("CAST5-CBC", EVP_cast5_cbc)
                   1283:            else TEST_CIPHER("CAST5-CFB64", EVP_cast5_cfb64)
                   1284:            else TEST_CIPHER("CAST5-OFB", EVP_cast5_ofb)
                   1285:            else
                   1286:            {
                   1287:                free(tampon);
                   1288: 
                   1289:                liberation(s_etat_processus, s_objet_argument_1);
                   1290:                liberation(s_etat_processus, s_objet_argument_2);
                   1291: 
                   1292:                (*s_etat_processus).erreur_execution =
                   1293:                        d_ex_chiffrement_indisponible;
                   1294:                return;
                   1295:            }
                   1296: #      else
                   1297:            free(tampon);
                   1298: 
                   1299:            liberation(s_etat_processus, s_objet_argument_1);
                   1300:            liberation(s_etat_processus, s_objet_argument_2);
                   1301: 
                   1302:            (*s_etat_processus).erreur_execution =
                   1303:                    d_ex_chiffrement_indisponible;
                   1304:            return;
                   1305: #      endif
1.1       bertrand 1306:    }
1.3       bertrand 1307:    else if (strncmp(tampon, "RC5", 3) == 0)
1.1       bertrand 1308:    {
1.3       bertrand 1309: #      ifndef OPENSSL_NO_RC5
                   1310:            TEST_CIPHER("RC5-32-12-16-ECB", EVP_rc5_32_12_16_ebc)
                   1311:            else TEST_CIPHER("RC5-32-12-16-CBC", EVP_rc5_32_12_16_cbc)
                   1312:            else TEST_CIPHER("RC5-32-12-16-CFB64", EVP_rc5_32_12_16_cfb64)
                   1313:            else TEST_CIPHER("RC5-32-12-16-OFB", EVP_rc5_32_12_16_ofb)
                   1314:            else
                   1315:            {
                   1316:                free(tampon);
                   1317: 
                   1318:                liberation(s_etat_processus, s_objet_argument_1);
                   1319:                liberation(s_etat_processus, s_objet_argument_2);
                   1320: 
                   1321:                (*s_etat_processus).erreur_execution =
                   1322:                        d_ex_chiffrement_indisponible;
                   1323:                return;
                   1324:            }
                   1325: #      else
                   1326:            free(tampon);
                   1327: 
                   1328:            liberation(s_etat_processus, s_objet_argument_1);
                   1329:            liberation(s_etat_processus, s_objet_argument_2);
                   1330: 
                   1331:            (*s_etat_processus).erreur_execution =
                   1332:                    d_ex_chiffrement_indisponible;
                   1333:            return;
                   1334: #      endif
                   1335:    }
                   1336:    else if (strncmp(tampon, "AES", 3) == 0)
                   1337:    {
                   1338: #      ifndef OPENSSL_NO_AES
                   1339:            TEST_CIPHER("AES-128-ECB", EVP_aes_128_ecb)
                   1340:            else TEST_CIPHER("AES-128-CBC", EVP_aes_128_cbc)
                   1341:            else TEST_CIPHER("AES-128-CFB1", EVP_aes_128_cfb1)
                   1342:            else TEST_CIPHER("AES-128-CFB8", EVP_aes_128_cfb8)
                   1343:            else TEST_CIPHER("AES-128-CFB128", EVP_aes_128_cfb128)
                   1344:            else TEST_CIPHER("AES-128-OFB", EVP_aes_128_ofb)
                   1345:            else TEST_CIPHER("AES-128-CTR", EVP_aes_128_ctr)
                   1346:            else TEST_CIPHER("AES-128-CCM", EVP_aes_128_ccm)
                   1347:            else TEST_CIPHER("AES-128-GCM", EVP_aes_128_gcm)
                   1348:            else TEST_CIPHER("AES-128-XTS", EVP_aes_128_xts)
                   1349:            else TEST_CIPHER("AES-192-ECB", EVP_aes_192_ecb)
                   1350:            else TEST_CIPHER("AES-192-CBC", EVP_aes_192_cbc)
                   1351:            else TEST_CIPHER("AES-192-CFB1", EVP_aes_192_cfb1)
                   1352:            else TEST_CIPHER("AES-192-CFB8", EVP_aes_192_cfb8)
                   1353:            else TEST_CIPHER("AES-192-CFB128", EVP_aes_192_cfb128)
                   1354:            else TEST_CIPHER("AES-192-OFB", EVP_aes_192_ofb)
                   1355:            else TEST_CIPHER("AES-192-CTR", EVP_aes_192_ctr)
                   1356:            else TEST_CIPHER("AES-192-CCM", EVP_aes_192_ccm)
                   1357:            else TEST_CIPHER("AES-192-GCM", EVP_aes_192_gcm)
                   1358:            else TEST_CIPHER("AES-256-ECB", EVP_aes_256_ecb)
                   1359:            else TEST_CIPHER("AES-256-CBC", EVP_aes_256_cbc)
                   1360:            else TEST_CIPHER("AES-256-CFB1", EVP_aes_256_cfb1)
                   1361:            else TEST_CIPHER("AES-256-CFB8", EVP_aes_256_cfb8)
                   1362:            else TEST_CIPHER("AES-256-CFB128", EVP_aes_256_cfb128)
                   1363:            else TEST_CIPHER("AES-256-OFB", EVP_aes_256_ofb)
                   1364:            else TEST_CIPHER("AES-256-CTR", EVP_aes_256_ctr)
                   1365:            else TEST_CIPHER("AES-256-CCM", EVP_aes_256_ccm)
                   1366:            else TEST_CIPHER("AES-256-GCM", EVP_aes_256_gcm)
                   1367:            else TEST_CIPHER("AES-256-XTS", EVP_aes_256_xts)
                   1368:            else
                   1369:            {
                   1370:                free(tampon);
                   1371: 
                   1372:                liberation(s_etat_processus, s_objet_argument_1);
                   1373:                liberation(s_etat_processus, s_objet_argument_2);
                   1374: 
                   1375:                (*s_etat_processus).erreur_execution =
                   1376:                        d_ex_chiffrement_indisponible;
                   1377:                return;
                   1378:            }
                   1379: #      else
                   1380:            free(tampon);
                   1381: 
                   1382:            liberation(s_etat_processus, s_objet_argument_1);
                   1383:            liberation(s_etat_processus, s_objet_argument_2);
                   1384: 
                   1385:            (*s_etat_processus).erreur_execution =
                   1386:                    d_ex_chiffrement_indisponible;
                   1387:            return;
                   1388: #      endif
                   1389:    }
                   1390:    else if (strncmp(tampon, "CAMELLIA", 8) == 0)
                   1391:    {
                   1392: #      ifndef OPENSSL_NO_CAMELLIA
                   1393:            TEST_CIPHER("CAMELLIA-128-ECB", EVP_camellia_128_ecb)
                   1394:            else TEST_CIPHER("CAMELLIA-128-CBC", EVP_camellia_128_cbc)
                   1395:            else TEST_CIPHER("CAMELLIA-128-CFB1", EVP_camellia_128_cfb1)
                   1396:            else TEST_CIPHER("CAMELLIA-128-CFB8", EVP_camellia_128_cfb8)
                   1397:            else TEST_CIPHER("CAMELLIA-128-CFB128", EVP_camellia_128_cfb128)
                   1398:            else TEST_CIPHER("CAMELLIA-128-OFB", EVP_camellia_128_ofb)
                   1399:            else TEST_CIPHER("CAMELLIA-192-ECB", EVP_camellia_128_ecb)
                   1400:            else TEST_CIPHER("CAMELLIA-192-CBC", EVP_camellia_192_cbc)
                   1401:            else TEST_CIPHER("CAMELLIA-192-CFB1", EVP_camellia_192_cfb1)
                   1402:            else TEST_CIPHER("CAMELLIA-192-CFB8", EVP_camellia_192_cfb8)
                   1403:            else TEST_CIPHER("CAMELLIA-192-CFB128", EVP_camellia_192_cfb128)
                   1404:            else TEST_CIPHER("CAMELLIA-192-OFB", EVP_camellia_192_ofb)
                   1405:            else TEST_CIPHER("CAMELLIA-256-ECB", EVP_camellia_256_ecb)
                   1406:            else TEST_CIPHER("CAMELLIA-256-CBC", EVP_camellia_256_cbc)
                   1407:            else TEST_CIPHER("CAMELLIA-256-CFB1", EVP_camellia_256_cfb1)
                   1408:            else TEST_CIPHER("CAMELLIA-256-CFB8", EVP_camellia_256_cfb8)
                   1409:            else TEST_CIPHER("CAMELLIA-256-CFB128", EVP_camellia_256_cfb128)
                   1410:            else TEST_CIPHER("CAMELLIA-256-OFB", EVP_camellia_256_ofb)
                   1411:            else
                   1412:            {
                   1413:                free(tampon);
                   1414: 
                   1415:                liberation(s_etat_processus, s_objet_argument_1);
                   1416:                liberation(s_etat_processus, s_objet_argument_2);
                   1417: 
                   1418:                (*s_etat_processus).erreur_execution =
                   1419:                        d_ex_chiffrement_indisponible;
                   1420:                return;
                   1421:            }
                   1422: #      else
                   1423:            free(tampon);
                   1424: 
                   1425:            liberation(s_etat_processus, s_objet_argument_1);
                   1426:            liberation(s_etat_processus, s_objet_argument_2);
                   1427: 
                   1428:            (*s_etat_processus).erreur_execution =
                   1429:                    d_ex_chiffrement_indisponible;
                   1430:            return;
                   1431: #      endif
                   1432:    }
                   1433:    else if (strncmp(tampon, "SEED", 4) == 0)
                   1434:    {
                   1435: #      ifndef OPENSSL_NO_SEED
                   1436:            TEST_CIPHER("SEED-ECB", EVP_seed_ecb)
                   1437:            else TEST_CIPHER("SEED-CBC", EVP_seed_cbc)
                   1438:            else TEST_CIPHER("SEED-CFB128", EVP_seed_cfb128)
                   1439:            else TEST_CIPHER("SEED-OFB", EVP_seed_ofb)
                   1440:            else
                   1441:            {
                   1442:                free(tampon);
                   1443: 
                   1444:                liberation(s_etat_processus, s_objet_argument_1);
                   1445:                liberation(s_etat_processus, s_objet_argument_2);
                   1446: 
                   1447:                (*s_etat_processus).erreur_execution =
                   1448:                        d_ex_chiffrement_indisponible;
                   1449:                return;
                   1450:            }
                   1451: #      else
                   1452:            free(tampon);
                   1453: 
                   1454:            liberation(s_etat_processus, s_objet_argument_1);
                   1455:            liberation(s_etat_processus, s_objet_argument_2);
                   1456: 
                   1457:            (*s_etat_processus).erreur_execution =
                   1458:                    d_ex_chiffrement_indisponible;
                   1459:            return;
                   1460: #      endif
                   1461:    }
                   1462:    else
                   1463:    {
                   1464:        free(tampon);
                   1465: 
                   1466:        liberation(s_etat_processus, s_objet_argument_1);
                   1467:        liberation(s_etat_processus, s_objet_argument_2);
                   1468: 
                   1469:        (*s_etat_processus).erreur_execution = d_ex_chiffrement_indisponible;
                   1470:        return;
                   1471:    }
                   1472: 
                   1473:    free(tampon);
                   1474: 
                   1475:    if (generation_clef == d_vrai)
                   1476:    {
1.7       bertrand 1477:        if ((iv = malloc(((size_t) EVP_CIPHER_iv_length(EVP_chiffrement))
1.3       bertrand 1478:                * sizeof(unsigned char))) == NULL)
                   1479:        {
                   1480:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1481:            return;
                   1482:        }
                   1483: 
1.7       bertrand 1484:        if ((clef = malloc(((size_t) EVP_CIPHER_key_length(EVP_chiffrement))
1.3       bertrand 1485:                * sizeof(unsigned char))) == NULL)
                   1486:        {
                   1487:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1488:            return;
                   1489:        }
                   1490: 
                   1491:        longueur_clef = EVP_BytesToKey(EVP_chiffrement, EVP_sum,
                   1492:                (unsigned char *) &sel, (unsigned char *)
1.7       bertrand 1493:                (*s_objet_argument_2).objet,
                   1494:                (int) longueur_chaine(s_etat_processus,
1.3       bertrand 1495:                (unsigned char *) (*s_objet_argument_2).objet),
1.7       bertrand 1496:                (int) nombre_cycles, clef, iv);
1.3       bertrand 1497: 
                   1498:        if (longueur_clef != EVP_CIPHER_key_length(EVP_chiffrement))
                   1499:        {
                   1500:            free(iv);
                   1501:            free(clef);
                   1502: 
                   1503:            liberation(s_etat_processus, s_objet_argument_1);
                   1504:            liberation(s_etat_processus, s_objet_argument_2);
                   1505: 
                   1506:            (*s_etat_processus).erreur_execution = d_ex_chiffrement;
                   1507:            return;
                   1508:        }
                   1509: 
                   1510:        if ((s_objet_resultat_1 = allocation(s_etat_processus, LST)) == NULL)
                   1511:        {
                   1512:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1513:            return;
                   1514:        }
                   1515: 
                   1516:        if (((*s_objet_resultat_1).objet = allocation_maillon(s_etat_processus))
                   1517:                == NULL)
                   1518:        {
                   1519:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1520:            return;
                   1521:        }
                   1522: 
                   1523:        l_element_courant = (*s_objet_resultat_1).objet;
                   1524: 
                   1525:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1526:                == NULL)
                   1527:        {
                   1528:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1529:            return;
                   1530:        }
                   1531: 
                   1532:        if (((*(*l_element_courant).donnee).objet = malloc(
                   1533:                (strlen(algorithme_chiffrement) + 1) * sizeof(unsigned char)))
                   1534:                == NULL)
                   1535:        {
                   1536:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1537:            return;
                   1538:        }
                   1539: 
                   1540:        strcpy((*(*l_element_courant).donnee).objet, algorithme_chiffrement);
                   1541: 
                   1542:        if (((*l_element_courant).suivant = allocation_maillon(
                   1543:                s_etat_processus)) == NULL)
                   1544:        {
                   1545:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1546:            return;
                   1547:        }
                   1548: 
                   1549:        l_element_courant = (*l_element_courant).suivant;
                   1550: 
                   1551:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1552:                == NULL)
                   1553:        {
                   1554:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1555:            return;
                   1556:        }
                   1557: 
                   1558:        if (((*(*l_element_courant).donnee).objet = analyse_flux(
                   1559:                s_etat_processus, clef,
                   1560:                EVP_CIPHER_key_length(EVP_chiffrement))) == NULL)
                   1561:        {
                   1562:            return;
                   1563:        }
                   1564: 
                   1565:        free(clef);
                   1566: 
                   1567:        if (((*l_element_courant).suivant = allocation_maillon(
                   1568:                s_etat_processus)) == NULL)
                   1569:        {
                   1570:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1571:            return;
                   1572:        }
                   1573: 
                   1574:        l_element_courant = (*l_element_courant).suivant;
                   1575:        (*l_element_courant).suivant = NULL;
                   1576: 
                   1577:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1578:                == NULL)
                   1579:        {
                   1580:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1581:            return;
                   1582:        }
                   1583: 
                   1584:        if (((*(*l_element_courant).donnee).objet = analyse_flux(
                   1585:                s_etat_processus, iv,
                   1586:                EVP_CIPHER_iv_length(EVP_chiffrement))) == NULL)
                   1587:        {
                   1588:            return;
                   1589:        }
                   1590: 
                   1591:        free(iv);
                   1592: 
                   1593:        liberation(s_etat_processus, s_objet_argument_1);
                   1594:        liberation(s_etat_processus, s_objet_argument_2);
                   1595: 
                   1596:        if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1597:                s_objet_resultat_1) == d_erreur)
                   1598:        {
                   1599:            return;
                   1600:        }
                   1601:    }
                   1602:    else
                   1603:    {
                   1604:        // Chiffrement ou déchiffrement
                   1605: 
                   1606:        if (strcmp(direction, "ENCRYPT") == 0)
                   1607:        {
                   1608:            encodage = d_vrai;
                   1609:        }
                   1610:        else if (strcmp(direction, "DECRYPT") == 0)
                   1611:        {
                   1612:            encodage = d_faux;
                   1613:        }
                   1614:        else
                   1615:        {
                   1616:            free(direction);
                   1617:            liberation(s_etat_processus, s_objet_argument_1);
                   1618:            liberation(s_etat_processus, s_objet_argument_2);
                   1619: 
                   1620:            (*s_etat_processus).erreur_execution =
                   1621:                    d_ex_argument_invalide;
                   1622:            return;
                   1623:        }
                   1624: 
                   1625:        free(direction);
                   1626: 
                   1627:        // Conversion des clefs
                   1628: 
                   1629:        if ((clef_binaire = formateur_flux(s_etat_processus, clef,
                   1630:                &longueur_clef_binaire)) == NULL)
                   1631:        {
                   1632:            return;
                   1633:        }
                   1634: 
                   1635:        if ((iv_binaire = formateur_flux(s_etat_processus, iv,
                   1636:                &longueur_iv_binaire)) == NULL)
                   1637:        {
                   1638:            return;
                   1639:        }
                   1640: 
                   1641:        // Vérification de la longueur des clef et vecteur d'initialisation
                   1642: 
                   1643:        if (longueur_clef_binaire != EVP_CIPHER_key_length(EVP_chiffrement))
                   1644:        {
                   1645:            free(clef_binaire);
                   1646:            free(iv_binaire);
                   1647: 
                   1648:            liberation(s_etat_processus, s_objet_argument_1);
                   1649:            liberation(s_etat_processus, s_objet_argument_2);
                   1650: 
                   1651:            (*s_etat_processus).erreur_execution =
                   1652:                    d_ex_longueur_clef_chiffrement;
                   1653:            return;
                   1654:        }
                   1655: 
                   1656:        if (longueur_iv_binaire != EVP_CIPHER_iv_length(EVP_chiffrement))
                   1657:        {
                   1658:            free(clef_binaire);
                   1659:            free(iv_binaire);
                   1660: 
                   1661:            liberation(s_etat_processus, s_objet_argument_1);
                   1662:            liberation(s_etat_processus, s_objet_argument_2);
                   1663: 
                   1664:            (*s_etat_processus).erreur_execution =
                   1665:                    d_ex_longueur_clef_chiffrement;
                   1666:            return;
                   1667:        }
                   1668: 
                   1669:        if ((message = formateur_flux(s_etat_processus, (unsigned char *)
                   1670:                (*s_objet_argument_2).objet, &longueur_message)) == NULL)
                   1671:        {
                   1672:            return;
                   1673:        }
                   1674: 
1.18      bertrand 1675:        if ((message_chiffre = chiffrement(s_etat_processus,
                   1676:                EVP_chiffrement, encodage, message,
1.3       bertrand 1677:                longueur_message, clef_binaire, longueur_clef_binaire,
                   1678:                iv_binaire, &longueur_message_chiffre)) == NULL)
                   1679:        {
                   1680:            free(clef_binaire);
                   1681:            free(iv_binaire);
                   1682:            free(message);
                   1683: 
                   1684:            liberation(s_etat_processus, s_objet_argument_1);
                   1685:            liberation(s_etat_processus, s_objet_argument_2);
                   1686: 
                   1687:            (*s_etat_processus).erreur_execution = d_ex_chiffrement;
                   1688:            return;
                   1689:        }
                   1690: 
                   1691:        free(clef_binaire);
                   1692:        free(message);
                   1693: 
                   1694:        if ((s_objet_resultat_2 = allocation(s_etat_processus, CHN)) == NULL)
                   1695:        {
                   1696:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1697:            return;
                   1698:        }
                   1699: 
                   1700:        if (((*s_objet_resultat_2).objet = analyse_flux(s_etat_processus,
                   1701:                message_chiffre, longueur_message_chiffre)) == NULL)
                   1702:        {
                   1703:            return;
                   1704:        }
                   1705: 
                   1706:        free(message_chiffre);
                   1707: 
                   1708:        if ((s_objet_resultat_1 = allocation(s_etat_processus, LST)) == NULL)
                   1709:        {
                   1710:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1711:            return;
                   1712:        }
                   1713: 
                   1714:        if (((*s_objet_resultat_1).objet = allocation_maillon(s_etat_processus))
                   1715:                == NULL)
                   1716:        {
                   1717:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1718:            return;
                   1719:        }
                   1720: 
                   1721:        l_element_courant = (*s_objet_resultat_1).objet;
                   1722: 
                   1723:        // Direction
                   1724: 
                   1725:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1726:                == NULL)
                   1727:        {
                   1728:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1729:            return;
                   1730:        }
                   1731: 
                   1732:        if (((*(*l_element_courant).donnee).objet =
                   1733:                malloc(8 * sizeof(unsigned char))) == NULL)
                   1734:        {
                   1735:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1736:            return;
                   1737:        }
                   1738: 
                   1739:        strcpy((*(*l_element_courant).donnee).objet,
                   1740:                (encodage == d_vrai) ? "ENCRYPT" : "DECRYPT");
                   1741: 
                   1742:        // Type de chiffrement
                   1743: 
                   1744:        if (((*l_element_courant).suivant = allocation_maillon(
                   1745:                s_etat_processus)) == NULL)
                   1746:        {
                   1747:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1748:            return;
                   1749:        }
                   1750: 
                   1751:        l_element_courant = (*l_element_courant).suivant;
                   1752: 
                   1753:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1754:                == NULL)
                   1755:        {
                   1756:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1757:            return;
                   1758:        }
                   1759: 
1.5       bertrand 1760:        if (((*(*l_element_courant).donnee).objet =
1.18      bertrand 1761:                conversion_majuscule(s_etat_processus, algorithme_chiffrement))
                   1762:                == NULL)
1.3       bertrand 1763:        {
                   1764:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1765:            return;
                   1766:        }
                   1767: 
                   1768:        // Clef
                   1769: 
                   1770:        if (((*l_element_courant).suivant = allocation_maillon(
                   1771:                s_etat_processus)) == NULL)
                   1772:        {
                   1773:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1774:            return;
                   1775:        }
                   1776: 
                   1777:        l_element_courant = (*l_element_courant).suivant;
                   1778: 
                   1779:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1780:                == NULL)
                   1781:        {
                   1782:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1783:            return;
                   1784:        }
                   1785: 
                   1786:        if (((*(*l_element_courant).donnee).objet =
                   1787:                malloc((strlen(clef) + 1) * sizeof(unsigned char))) == NULL)
                   1788:        {
                   1789:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1790:            return;
                   1791:        }
                   1792: 
                   1793:        strcpy((*(*l_element_courant).donnee).objet, clef);
                   1794: 
                   1795:        // Vecteur d'initialisation
                   1796: 
                   1797:        if (((*l_element_courant).suivant = allocation_maillon(
                   1798:                s_etat_processus)) == NULL)
                   1799:        {
                   1800:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1801:            return;
                   1802:        }
                   1803: 
                   1804:        l_element_courant = (*l_element_courant).suivant;
                   1805:        (*l_element_courant).suivant = NULL;
                   1806: 
                   1807:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1808:                == NULL)
                   1809:        {
                   1810:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1811:            return;
                   1812:        }
                   1813: 
                   1814:        if (((*(*l_element_courant).donnee).objet = analyse_flux(
                   1815:                s_etat_processus, iv_binaire, longueur_iv_binaire)) == NULL)
                   1816:        {
                   1817:            return;
                   1818:        }
                   1819:        
                   1820:        free(iv_binaire);
                   1821: 
                   1822:        liberation(s_etat_processus, s_objet_argument_1);
                   1823:        liberation(s_etat_processus, s_objet_argument_2);
                   1824: 
                   1825:        if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1826:                s_objet_resultat_2) == d_erreur)
                   1827:        {
                   1828:            return;
                   1829:        }
                   1830: 
                   1831:        if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1832:                s_objet_resultat_1) == d_erreur)
                   1833:        {
                   1834:            return;
                   1835:        }
1.1       bertrand 1836:    }
                   1837: 
                   1838:    return;
                   1839: }
                   1840: 
                   1841: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>