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

1.1       bertrand    1: /*
                      2: ================================================================================
1.15      bertrand    3:   RPL/2 (R) version 4.1.19
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: 
                    353:        if ((instruction = conversion_majuscule((unsigned char *)
                    354:                (*(*l_element_courant).donnee).objet)) == NULL)
                    355:        {
                    356:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    357:            return;
                    358:        }
                    359: 
                    360:        if (strcmp(instruction, "KEY") == 0)
                    361:        {
                    362:            // Dérivation d'une clef
                    363: 
                    364:            free(instruction);
                    365: 
                    366:            l_element_courant = (*l_element_courant).suivant;
                    367: 
                    368:            if (l_element_courant == NULL)
                    369:            {
                    370:                liberation(s_etat_processus, s_objet_argument_1);
                    371:                liberation(s_etat_processus, s_objet_argument_2);
                    372: 
                    373:                (*s_etat_processus).erreur_execution = d_ex_manque_argument; 
                    374:                return;
                    375:            }
                    376: 
                    377:            // On attend l'algorithme de chiffrement.
                    378: 
                    379:            if ((*(*l_element_courant).donnee).type != CHN)
                    380:            {
                    381:                liberation(s_etat_processus, s_objet_argument_1);
                    382:                liberation(s_etat_processus, s_objet_argument_2);
                    383: 
                    384:                (*s_etat_processus).erreur_execution =
                    385:                        d_ex_erreur_type_argument;
                    386:                return;
                    387:            }
                    388: 
1.3       bertrand  389:            algorithme_chiffrement = (unsigned char *) (*(*l_element_courant)
1.1       bertrand  390:                    .donnee).objet;
                    391: 
                    392:            if ((l_element_courant = (*l_element_courant).suivant) == NULL)
                    393:            {
                    394:                liberation(s_etat_processus, s_objet_argument_1);
                    395:                liberation(s_etat_processus, s_objet_argument_2);
                    396: 
                    397:                (*s_etat_processus).erreur_execution = d_ex_manque_argument; 
                    398:                return;
                    399:            }   
                    400: 
                    401:            // On attend la somme de contrôle.
                    402: 
                    403:            if ((*(*l_element_courant).donnee).type != CHN)
                    404:            {
                    405:                liberation(s_etat_processus, s_objet_argument_1);
                    406:                liberation(s_etat_processus, s_objet_argument_2);
                    407: 
                    408:                (*s_etat_processus).erreur_execution =
                    409:                        d_ex_erreur_type_argument;
                    410:                return;
                    411:            }
                    412: 
                    413:            controle = (unsigned char *) (*(*l_element_courant).donnee).objet;
                    414: 
                    415:            // Test de la validité de la somme de contrôle.
                    416: 
                    417:            if ((fonction = conversion_majuscule(controle)) == NULL)
                    418:            {
                    419:                (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                    420:                return;
                    421:            }
                    422: 
                    423:            somme_invalide = d_faux;
                    424: 
                    425:            switch(fonction[0])
                    426:            {
                    427:                case 'D':
                    428:                {
                    429:                    switch(fonction[1])
                    430:                    {
                    431:                        case 'S': // ds
                    432:                        {
                    433:                            switch(fonction[2])
                    434:                            {
                    435: #                              ifndef OPENSSL_NO_SHA
                    436:                                case 'S': // dss
                    437:                                {
                    438:                                    switch(fonction[3])
                    439:                                    {
                    440:                                        case d_code_fin_chaine:
                    441:                                        {
                    442:                                            EVP_sum = EVP_dss();
                    443:                                            break;
                    444:                                        }
                    445: 
                    446:                                        case '1': // dss1
                    447:                                        {
                    448:                                            if (fonction[4] ==
                    449:                                                    d_code_fin_chaine)
                    450:                                            {
                    451:                                                EVP_sum = EVP_dss1();
                    452:                                            }
                    453:                                            else
                    454:                                            {
                    455:                                                somme_invalide = d_vrai;
                    456:                                            }
                    457: 
                    458:                                            break;
                    459:                                        }
                    460: 
                    461:                                        default:
                    462:                                        {
                    463:                                            somme_invalide = d_vrai;
                    464:                                            break;
                    465:                                        }
                    466:                                    }
                    467: 
                    468:                                    break;
                    469:                                }
                    470: #                              endif
                    471: 
                    472:                                default:
                    473:                                {
                    474:                                    somme_invalide = d_vrai;
                    475:                                    break;
                    476:                                }
                    477:                            }
                    478: 
                    479:                            break;
                    480:                        }
                    481: 
                    482:                        default:
                    483:                        {
                    484:                            somme_invalide = d_vrai;
                    485:                            break;
                    486:                        }
                    487:                    }
                    488: 
                    489:                    break;
                    490:                }
                    491: 
                    492:                case 'E':
                    493:                {
                    494:                    switch(fonction[1])
                    495:                    {
                    496:                        case 'C': // ec
                    497:                        {
                    498:                            switch(fonction[2])
                    499:                            {
                    500:                                case 'D': // ecd
                    501:                                {
                    502:                                    switch(fonction[3])
                    503:                                    {
                    504:                                        case 'S': // ecds
                    505:                                        {
                    506:                                            switch(fonction[4])
                    507:                                            {
                    508: #                                              ifndef OPENSSL_NO_SHA
                    509:                                                case 'A': // ecdsa
                    510:                                                {
                    511:                                                    if (fonction[5] ==
                    512:                                                            d_code_fin_chaine)
                    513:                                                    {
                    514:                                                        EVP_sum = EVP_ecdsa();
                    515:                                                    }
                    516:                                                    else
                    517:                                                    {
                    518:                                                        somme_invalide = d_vrai;
                    519:                                                    }
                    520: 
                    521:                                                    break;
                    522:                                                }
                    523: #                                              endif
                    524: 
                    525:                                                default:
                    526:                                                {
                    527:                                                    somme_invalide = d_vrai;
                    528:                                                    break;
                    529:                                                }
                    530:                                            }
                    531: 
                    532:                                            break;
                    533:                                        }
                    534: 
                    535:                                        default:
                    536:                                        {
                    537:                                            somme_invalide = d_vrai;
                    538:                                            break;
                    539:                                        }
                    540:                                    }
                    541: 
                    542:                                    break;
                    543:                                }
                    544: 
                    545:                                default:
                    546:                                {
                    547:                                    somme_invalide = d_vrai;
                    548:                                    break;
                    549:                                }
                    550:                            }
                    551: 
                    552:                            break;
                    553:                        }
                    554: 
                    555:                        default:
                    556:                        {
                    557:                            somme_invalide = d_vrai;
                    558:                            break;
                    559:                        }
                    560:                    }
                    561: 
                    562:                    break;
                    563:                }
                    564: 
                    565:                case 'M':
                    566:                {
                    567:                    switch(fonction[1])
                    568:                    {
                    569:                        case 'D': // md
                    570:                        {
                    571:                            switch(fonction[2])
                    572:                            {
                    573: #                              ifndef OPENSSL_NO_MD2
                    574:                                case '2': // md2
                    575:                                {
                    576:                                    if (fonction[3] == d_code_fin_chaine)
                    577:                                    {
                    578:                                        EVP_sum = EVP_md2();
                    579:                                    }
                    580:                                    else
                    581:                                    {
                    582:                                        somme_invalide = d_vrai;
                    583:                                    }
                    584: 
                    585:                                    break;
                    586:                                }
                    587: #                              endif
                    588: 
                    589: #                              ifndef OPENSSL_NO_MD4
                    590:                                case '4': // md4
                    591:                                {
                    592:                                    if (fonction[3] == d_code_fin_chaine)
                    593:                                    {
                    594:                                        EVP_sum = EVP_md4();
                    595:                                    }
                    596:                                    else
                    597:                                    {
                    598:                                        somme_invalide = d_vrai;
                    599:                                    }
                    600: 
                    601:                                    break;
                    602:                                }
                    603: #                              endif
                    604: 
                    605: #                              ifndef OPENSSL_NO_MD5
                    606:                                case '5': // md5
                    607:                                {
                    608:                                    if (fonction[3] == d_code_fin_chaine)
                    609:                                    {
                    610:                                        EVP_sum = EVP_md5();
                    611:                                    }
                    612:                                    else
                    613:                                    {
                    614:                                        somme_invalide = d_vrai;
                    615:                                    }
                    616: 
                    617:                                    break;
                    618:                                }
                    619: #                              endif
                    620: 
                    621:                                case 'C': // mdc
                    622:                                {
                    623:                                    switch(fonction[3])
                    624:                                    {
                    625: #                                      ifndef OPENSSL_NO_MDC2
                    626:                                        case '2': // mdc2
                    627:                                        {
                    628:                                            if (fonction[4] ==
                    629:                                                    d_code_fin_chaine)
                    630:                                            {
                    631:                                                EVP_sum = EVP_mdc2();
                    632:                                            }
                    633:                                            else
                    634:                                            {
                    635:                                                somme_invalide = d_vrai;
                    636:                                            }
                    637: 
                    638:                                            break;
                    639:                                        }
                    640: #                                      endif
                    641: 
                    642:                                        default:
                    643:                                        {
                    644:                                            somme_invalide = d_vrai;
                    645:                                            break;
                    646:                                        }
                    647:                                    }
                    648: 
                    649:                                    break;
                    650:                                }
                    651: 
                    652:                                default:
                    653:                                {
                    654:                                    somme_invalide = d_vrai;
                    655:                                    break;
                    656:                                }
                    657:                            }
                    658: 
                    659:                            break;
                    660:                        }
                    661: 
                    662:                        default:
                    663:                        {
                    664:                            somme_invalide = d_vrai;
                    665:                            break;
                    666:                        }
                    667:                    }
                    668: 
                    669:                    break;
                    670:                }
                    671: 
                    672: #              ifndef OPENSSL_NO_RIPEMD
                    673:                case 'R':
                    674:                {
                    675:                    if (strcmp(fonction, "RIPEMD160") == 0)
                    676:                    {
                    677:                        EVP_sum = EVP_ripemd160();
                    678:                    }
                    679:                    else
                    680:                    {
                    681:                        somme_invalide = d_vrai;
                    682:                    }
                    683: 
                    684:                    break;
                    685:                }
                    686: #              endif
                    687: 
                    688:                case 'S':
                    689:                {
                    690:                    switch(fonction[1])
                    691:                    {
                    692:                        case 'H': // sh
                    693:                        {
                    694:                            switch(fonction[2])
                    695:                            {
                    696: #                              ifndef OPENSSL_NO_SHA
                    697:                                case 'A':
                    698:                                {
                    699:                                    switch(fonction[3])
                    700:                                    {
                    701:                                        case d_code_fin_chaine:
                    702:                                        {
                    703:                                            EVP_sum = EVP_sha();
                    704:                                            break;
                    705:                                        }
                    706: 
                    707:                                        case '1': // sha1
                    708:                                        {
                    709:                                            if (fonction[4] ==
                    710:                                                    d_code_fin_chaine)
                    711:                                            {
                    712:                                                EVP_sum = EVP_sha1();
                    713:                                            }
                    714:                                            else
                    715:                                            {
                    716:                                                somme_invalide = d_vrai;
                    717:                                            }
                    718: 
                    719:                                            break;
                    720:                                        }
                    721: 
                    722: #                                      ifndef OPENSSL_NO_SHA256
                    723:                                        case '2': // sha2
                    724:                                        {
                    725:                                            switch(fonction[4])
                    726:                                            {
                    727:                                                case '2': // sha22
                    728:                                                {
                    729:                                                    switch(fonction[5])
                    730:                                                    {
                    731:                                                        case '4': // sha224
                    732:                                                        {
                    733:                                                            if (fonction[6] ==
                    734:                                                            d_code_fin_chaine)
                    735:                                                            {
                    736:                                                                EVP_sum =
                    737:                                                                EVP_sha224();
                    738:                                                            }
                    739:                                                            else
                    740:                                                            {
                    741:                                                                somme_invalide =
                    742:                                                                        d_vrai;
                    743:                                                            }
                    744: 
                    745:                                                            break;
                    746:                                                        }
                    747: 
                    748:                                                        default:
                    749:                                                        {
                    750:                                                            somme_invalide =
                    751:                                                                    d_vrai;
                    752:                                                            break;
                    753:                                                        }
                    754:                                                    }
                    755: 
                    756:                                                    break;
                    757:                                                }
                    758: 
                    759:                                                case '5':
                    760:                                                {
                    761:                                                    switch(fonction[5])
                    762:                                                    {
                    763:                                                        case '6': // sha256
                    764:                                                        {
                    765:                                                            if (fonction[6] ==
                    766:                                                            d_code_fin_chaine)
                    767:                                                            {
                    768:                                                                EVP_sum =
                    769:                                                                EVP_sha256();
                    770:                                                            }
                    771:                                                            else
                    772:                                                            {
                    773:                                                                somme_invalide =
                    774:                                                                        d_vrai;
                    775:                                                            }
                    776: 
                    777:                                                            break;
                    778:                                                        }
                    779: 
                    780:                                                        default:
                    781:                                                        {
                    782:                                                            somme_invalide =
                    783:                                                                    d_vrai;
                    784:                                                            break;
                    785:                                                        }
                    786:                                                    }
                    787: 
                    788:                                                    break;
                    789:                                                }
                    790: 
                    791:                                                default:
                    792:                                                {
                    793:                                                    somme_invalide = d_vrai;
                    794:                                                    break;
                    795:                                                }
                    796:                                            }
                    797: 
                    798:                                            break;
                    799:                                        }
                    800: #                                      endif
                    801: 
                    802: #                                      ifndef OPENSSL_NO_SHA512
                    803:                                        case '3': // sha3
                    804:                                        {
                    805:                                            switch(fonction[4])
                    806:                                            {
                    807:                                                case '8': // sha38
                    808:                                                {
                    809:                                                    switch(fonction[5])
                    810:                                                    {
                    811:                                                        case '4': // sha384
                    812:                                                        {
                    813:                                                            if (fonction[6] ==
                    814:                                                            d_code_fin_chaine)
                    815:                                                            {
                    816:                                                                EVP_sum =
                    817:                                                                EVP_sha384();
                    818:                                                            }
                    819:                                                            else
                    820:                                                            {
                    821:                                                                somme_invalide =
                    822:                                                                        d_vrai;
                    823:                                                            }
                    824: 
                    825:                                                            break;
                    826:                                                        }
                    827: 
                    828:                                                        default:
                    829:                                                        {
                    830:                                                            somme_invalide =
                    831:                                                                    d_vrai;
                    832:                                                            break;
                    833:                                                        }
                    834:                                                    }
                    835: 
                    836:                                                    break;
                    837:                                                }
                    838: 
                    839:                                                default:
                    840:                                                {
                    841:                                                    somme_invalide = d_vrai;
                    842:                                                    break;
                    843:                                                }
                    844:                                            }
                    845: 
                    846:                                            break;
                    847:                                        }
                    848: 
                    849:                                        case '5': // sha5
                    850:                                        {
                    851:                                            switch(fonction[4])
                    852:                                            {
                    853:                                                case '1': // sha51
                    854:                                                {
                    855:                                                    switch(fonction[5])
                    856:                                                    {
                    857:                                                        case '2': // sha512
                    858:                                                        {
                    859:                                                            if (fonction[6] ==
                    860:                                                            d_code_fin_chaine)
                    861:                                                            {
                    862:                                                                EVP_sum =
                    863:                                                                EVP_sha512();
                    864:                                                            }
                    865:                                                            else
                    866:                                                            {
                    867:                                                                somme_invalide =
                    868:                                                                        d_vrai;
                    869:                                                            }
                    870: 
                    871:                                                            break;
                    872:                                                        }
                    873: 
                    874:                                                        default:
                    875:                                                        {
                    876:                                                            somme_invalide =
                    877:                                                                    d_vrai;
                    878:                                                            break;
                    879:                                                        }
                    880:                                                    }
                    881: 
                    882:                                                    break;
                    883:                                                }
                    884: 
                    885:                                                default:
                    886:                                                {
                    887:                                                    somme_invalide = d_vrai;
                    888:                                                    break;
                    889:                                                }
                    890:                                            }
                    891: 
                    892:                                            break;
                    893:                                        }
                    894: #                                      endif
                    895: 
                    896:                                        default:
                    897:                                        {
                    898:                                            somme_invalide = d_vrai;
                    899:                                            break;
                    900:                                        }
                    901:                                    }
                    902: 
                    903:                                    break;
                    904:                                }
                    905: #                              endif
                    906: 
                    907:                                default:
                    908:                                {
                    909:                                    somme_invalide = d_vrai;
                    910:                                    break;
                    911:                                }
                    912:                            }
                    913: 
                    914:                            break;
                    915:                        }
                    916: 
                    917:                        default:
                    918:                        {
                    919:                            somme_invalide = d_vrai;
                    920:                            break;
                    921:                        }
                    922:                    }
                    923: 
                    924:                    break;
                    925:                }
                    926: 
                    927: #              ifndef OPENSSL_NO_WHIRLPOOL
                    928:                case 'W':
                    929:                {
                    930:                    if (strcmp(fonction, "WHIRLPOOL") == 0)
                    931:                    {
                    932:                        EVP_sum = EVP_whirlpool();
                    933:                    }
                    934:                    else
                    935:                    {
                    936:                        somme_invalide = d_vrai;
                    937:                    }
                    938: 
                    939:                    break;
                    940:                }
                    941: #              endif
                    942: 
                    943:                default:
                    944:                {
                    945:                    somme_invalide = d_vrai;
                    946:                    break;
                    947:                }
                    948:            }
                    949: 
                    950:            free(fonction);
                    951: 
                    952:            if (somme_invalide == d_vrai)
                    953:            {
                    954:                liberation(s_etat_processus, s_objet_argument_1);
                    955:                liberation(s_etat_processus, s_objet_argument_2);
                    956: 
                    957:                (*s_etat_processus).erreur_execution =
                    958:                        d_ex_chiffrement_indisponible;
                    959:                return;
                    960:            }
                    961: 
1.3       bertrand  962:            if ((l_element_courant = (*l_element_courant).suivant) == NULL)
                    963:            {
                    964:                liberation(s_etat_processus, s_objet_argument_1);
                    965:                liberation(s_etat_processus, s_objet_argument_2);
                    966: 
                    967:                (*s_etat_processus).erreur_execution = d_ex_manque_argument; 
                    968:                return;
                    969:            }   
                    970: 
                    971:            // On attend le sel, donc un entier binaire de 64 bits.
                    972: 
                    973:            if ((*(*l_element_courant).donnee).type != BIN)
                    974:            {
                    975:                liberation(s_etat_processus, s_objet_argument_1);
                    976:                liberation(s_etat_processus, s_objet_argument_2);
                    977: 
                    978:                (*s_etat_processus).erreur_execution =
                    979:                        d_ex_erreur_type_argument;
                    980:                return;
                    981:            }
                    982: 
                    983:            sel = (*((logical8 *) (*(*l_element_courant).donnee).objet));
                    984: 
                    985:            if ((l_element_courant = (*l_element_courant).suivant) == NULL)
                    986:            {
                    987:                liberation(s_etat_processus, s_objet_argument_1);
                    988:                liberation(s_etat_processus, s_objet_argument_2);
                    989: 
                    990:                (*s_etat_processus).erreur_execution = d_ex_manque_argument; 
                    991:                return;
                    992:            }   
                    993: 
                    994:            // On attend le nombre de cycles.
                    995: 
                    996:            if ((*(*l_element_courant).donnee).type != INT)
                    997:            {
                    998:                liberation(s_etat_processus, s_objet_argument_1);
                    999:                liberation(s_etat_processus, s_objet_argument_2);
                   1000: 
                   1001:                (*s_etat_processus).erreur_execution =
                   1002:                        d_ex_erreur_type_argument;
                   1003:                return;
                   1004:            }
                   1005: 
                   1006:            nombre_cycles = (*((integer8 *) (*(*l_element_courant)
                   1007:                    .donnee).objet));
                   1008: 
                   1009:            // On a dû atteindre la fin de la liste.
                   1010: 
                   1011:            if ((*l_element_courant).suivant != NULL)
                   1012:            {
                   1013:                liberation(s_etat_processus, s_objet_argument_1);
                   1014:                liberation(s_etat_processus, s_objet_argument_2);
                   1015: 
                   1016:                (*s_etat_processus).erreur_execution = d_ex_argument_invalide; 
                   1017:                return;
                   1018:            }
                   1019: 
                   1020:            clef = NULL;
                   1021:            iv = NULL;
                   1022: 
1.1       bertrand 1023:            generation_clef = d_vrai;
                   1024:        }
                   1025:        else
                   1026:        {
                   1027:            // Chiffrement ou déchiffrement d'un message
                   1028: 
1.3       bertrand 1029:            direction = instruction;
1.1       bertrand 1030: 
                   1031:            l_element_courant = (*l_element_courant).suivant;
                   1032: 
                   1033:            if (l_element_courant == NULL)
                   1034:            {
                   1035:                liberation(s_etat_processus, s_objet_argument_1);
                   1036:                liberation(s_etat_processus, s_objet_argument_2);
                   1037: 
                   1038:                (*s_etat_processus).erreur_execution = d_ex_manque_argument; 
                   1039:                return;
                   1040:            }
                   1041: 
1.3       bertrand 1042:            // On attend le type de chiffrement.
1.1       bertrand 1043: 
                   1044:            if ((*(*l_element_courant).donnee).type != CHN)
                   1045:            {
                   1046:                liberation(s_etat_processus, s_objet_argument_1);
                   1047:                liberation(s_etat_processus, s_objet_argument_2);
                   1048: 
                   1049:                (*s_etat_processus).erreur_execution =
                   1050:                        d_ex_erreur_type_argument;
                   1051:                return;
                   1052:            }
                   1053: 
1.3       bertrand 1054:            algorithme_chiffrement = (unsigned char *) (*(*l_element_courant)
1.1       bertrand 1055:                    .donnee).objet;
                   1056: 
                   1057:            // On attend la clef.
                   1058: 
                   1059:            if ((l_element_courant = (*l_element_courant).suivant) == NULL)
                   1060:            {
                   1061:                liberation(s_etat_processus, s_objet_argument_1);
                   1062:                liberation(s_etat_processus, s_objet_argument_2);
                   1063: 
                   1064:                (*s_etat_processus).erreur_execution =
                   1065:                        d_ex_manque_argument;
                   1066:                return;
                   1067:            }
                   1068: 
                   1069:            clef = (unsigned char *) (*(*l_element_courant).donnee).objet;
                   1070: 
                   1071:            // On attend le vecteur d'initialisation.
                   1072: 
                   1073:            if ((l_element_courant = (*l_element_courant).suivant) == NULL)
                   1074:            {
                   1075:                liberation(s_etat_processus, s_objet_argument_1);
                   1076:                liberation(s_etat_processus, s_objet_argument_2);
                   1077: 
                   1078:                (*s_etat_processus).erreur_execution =
                   1079:                        d_ex_manque_argument;
                   1080:                return;
                   1081:            }
                   1082: 
                   1083:            iv = (unsigned char *) (*(*l_element_courant).donnee).objet;
                   1084: 
                   1085:            if ((*l_element_courant).suivant != NULL)
                   1086:            {
                   1087:                liberation(s_etat_processus, s_objet_argument_1);
                   1088:                liberation(s_etat_processus, s_objet_argument_2);
                   1089: 
                   1090:                (*s_etat_processus).erreur_execution = d_ex_argument_invalide;
                   1091:                return;
                   1092:            }
1.3       bertrand 1093: 
                   1094:            generation_clef = d_faux;
1.1       bertrand 1095:        }
                   1096:    }
                   1097:    else
                   1098:    {
                   1099:        liberation(s_etat_processus, s_objet_argument_1);
                   1100:        liberation(s_etat_processus, s_objet_argument_2);
                   1101: 
                   1102:        (*s_etat_processus).erreur_execution = d_ex_erreur_type_argument;
                   1103:        return;
                   1104:    }
                   1105: 
1.3       bertrand 1106:    if ((tampon = conversion_majuscule(algorithme_chiffrement)) == NULL)
1.1       bertrand 1107:    {
                   1108:        (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1109:        return;
                   1110:    }
                   1111: 
1.3       bertrand 1112: #  define TEST_CIPHER(string, value) \
                   1113:            if (strcmp(tampon, string) == 0) EVP_chiffrement = value();
                   1114: 
                   1115:    if (strncmp(tampon, "DES", 3) == 0)
                   1116:    {
                   1117: #      ifndef OPENSSL_NO_DES
                   1118:            TEST_CIPHER("DES-ECB", EVP_des_ecb)
                   1119:            else TEST_CIPHER("DES-EDE", EVP_des_ede)
                   1120:            else TEST_CIPHER("DES-EDE3", EVP_des_ede3)
                   1121:            else TEST_CIPHER("DES-EDE-ECB", EVP_des_ede_ecb)
                   1122:            else TEST_CIPHER("DES-EDE3-ECB", EVP_des_ede3_ecb)
                   1123:            else TEST_CIPHER("DES-CFB64", EVP_des_cfb64)
                   1124:            else TEST_CIPHER("DES-CFB1", EVP_des_cfb1)
                   1125:            else TEST_CIPHER("DES-CFB8", EVP_des_cfb8)
                   1126:            else TEST_CIPHER("DES-EDE-CFB64", EVP_des_ede_cfb64)
                   1127:            else TEST_CIPHER("DES-EDE3-CFB64", EVP_des_ede3_cfb64)
                   1128:            else TEST_CIPHER("DES-EDE3-CFB1", EVP_des_ede3_cfb1)
                   1129:            else TEST_CIPHER("DES-EDE3-CFB8", EVP_des_ede3_cfb8)
                   1130:            else TEST_CIPHER("DES-OFB", EVP_des_ofb)
                   1131:            else TEST_CIPHER("DES-EDE-OFB", EVP_des_ede_ofb)
                   1132:            else TEST_CIPHER("DES-EDE3-OFB", EVP_des_ede3_ofb)
                   1133:            else TEST_CIPHER("DES-CBC", EVP_des_cbc)
                   1134:            else TEST_CIPHER("DES-EDE-CBC", EVP_des_ede_cbc)
                   1135:            else TEST_CIPHER("DES-EDE3-CBC", EVP_des_ede3_cbc)
                   1136:            else TEST_CIPHER("DESX-CBC", EVP_desx_cbc)
                   1137:            else
                   1138:            {
                   1139:                free(tampon);
                   1140: 
                   1141:                liberation(s_etat_processus, s_objet_argument_1);
                   1142:                liberation(s_etat_processus, s_objet_argument_2);
                   1143: 
                   1144:                (*s_etat_processus).erreur_execution =
                   1145:                        d_ex_chiffrement_indisponible;
                   1146:                return;
                   1147:            }
                   1148: #      else
                   1149:            free(tampon);
                   1150: 
                   1151:            liberation(s_etat_processus, s_objet_argument_1);
                   1152:            liberation(s_etat_processus, s_objet_argument_2);
                   1153: 
                   1154:            (*s_etat_processus).erreur_execution =
                   1155:                    d_ex_chiffrement_indisponible;
                   1156:            return;
                   1157: #      endif
                   1158:    }
                   1159:    else if (strncmp(tampon, "RC4", 3) == 0)
                   1160:    {
                   1161: #      ifndef OPENSSL_NO_RC4
                   1162:            TEST_CIPHER("RC4", EVP_rc4)
                   1163:            else TEST_CIPHER("RC4-40", EVP_rc4_40)
                   1164:            else
                   1165:            {
                   1166:                free(tampon);
                   1167: 
                   1168:                liberation(s_etat_processus, s_objet_argument_1);
                   1169:                liberation(s_etat_processus, s_objet_argument_2);
                   1170: 
                   1171:                (*s_etat_processus).erreur_execution =
                   1172:                        d_ex_chiffrement_indisponible;
                   1173:                return;
                   1174:            }
                   1175: #      else
                   1176:            free(tampon);
                   1177: 
                   1178:            liberation(s_etat_processus, s_objet_argument_1);
                   1179:            liberation(s_etat_processus, s_objet_argument_2);
                   1180: 
                   1181:            (*s_etat_processus).erreur_execution =
                   1182:                    d_ex_chiffrement_indisponible;
                   1183:            return;
                   1184: #      endif
                   1185:    }
                   1186:    else if (strncmp(tampon, "IDEA", 4) == 0)
                   1187:    {
                   1188: #      ifndef OPENSSL_NO_IDEA
                   1189:            TEST_CIPHER("IDEA-ECB", EVP_idea_ecb)
                   1190:            else TEST_CIPHER("IDEA-CFB64", EVP_idea_cfb64)
                   1191:            else TEST_CIPHER("IDEA-OFB", EVP_idea_ofb)
                   1192:            else TEST_CIPHER("IDEA-CBC", EVP_idea_cbc)
                   1193:            else
                   1194:            {
                   1195:                free(tampon);
                   1196: 
                   1197:                liberation(s_etat_processus, s_objet_argument_1);
                   1198:                liberation(s_etat_processus, s_objet_argument_2);
                   1199: 
                   1200:                (*s_etat_processus).erreur_execution =
                   1201:                        d_ex_chiffrement_indisponible;
                   1202:                return;
                   1203:            }
                   1204: #      else
                   1205:            free(tampon);
                   1206: 
                   1207:            liberation(s_etat_processus, s_objet_argument_1);
                   1208:            liberation(s_etat_processus, s_objet_argument_2);
                   1209: 
                   1210:            (*s_etat_processus).erreur_execution =
                   1211:                    d_ex_chiffrement_indisponible;
                   1212:            return;
                   1213: #      endif
                   1214:    }
                   1215:    else if (strncmp(tampon, "RC2", 3) == 0)
1.1       bertrand 1216:    {
1.3       bertrand 1217: #      ifndef OPENSSL_NO_RC2
                   1218:            TEST_CIPHER("RC2-ECB", EVP_rc2_ecb)
                   1219:            else TEST_CIPHER("RC2-CBC", EVP_rc2_cbc)
                   1220:            else TEST_CIPHER("RC2-40-CBC", EVP_rc2_40_cbc)
                   1221:            else TEST_CIPHER("RC2-64-CBC", EVP_rc2_64_cbc)
                   1222:            else TEST_CIPHER("RC2-CFB64", EVP_rc2_cfb64)
                   1223:            else TEST_CIPHER("RC2-OFB", EVP_rc2_ofb)
                   1224:            else
                   1225:            {
                   1226:                free(tampon);
                   1227: 
                   1228:                liberation(s_etat_processus, s_objet_argument_1);
                   1229:                liberation(s_etat_processus, s_objet_argument_2);
                   1230: 
                   1231:                (*s_etat_processus).erreur_execution =
                   1232:                        d_ex_chiffrement_indisponible;
                   1233:                return;
                   1234:            }
                   1235: #      else
                   1236:            free(tampon);
                   1237: 
                   1238:            liberation(s_etat_processus, s_objet_argument_1);
                   1239:            liberation(s_etat_processus, s_objet_argument_2);
                   1240: 
                   1241:            (*s_etat_processus).erreur_execution =
                   1242:                    d_ex_chiffrement_indisponible;
                   1243:            return;
                   1244: #      endif
1.1       bertrand 1245:    }
1.3       bertrand 1246:    else if (strncmp(tampon, "BF", 2) == 0)
                   1247:    {
                   1248: #      ifndef OPENSSL_NO_BF
                   1249:            TEST_CIPHER("BF-ECB", EVP_bf_ecb)
                   1250:            else TEST_CIPHER("BF-CBC", EVP_bf_cbc)
                   1251:            else TEST_CIPHER("BF-CFB64", EVP_bf_cfb64)
                   1252:            else TEST_CIPHER("BF-OFB", EVP_bf_ofb)
                   1253:            else
                   1254:            {
                   1255:                free(tampon);
                   1256: 
                   1257:                liberation(s_etat_processus, s_objet_argument_1);
                   1258:                liberation(s_etat_processus, s_objet_argument_2);
                   1259: 
                   1260:                (*s_etat_processus).erreur_execution =
                   1261:                        d_ex_chiffrement_indisponible;
                   1262:                return;
                   1263:            }
                   1264: #      else
                   1265:            free(tampon);
1.1       bertrand 1266: 
1.3       bertrand 1267:            liberation(s_etat_processus, s_objet_argument_1);
                   1268:            liberation(s_etat_processus, s_objet_argument_2);
1.1       bertrand 1269: 
1.3       bertrand 1270:            (*s_etat_processus).erreur_execution =
                   1271:                    d_ex_chiffrement_indisponible;
                   1272:            return;
                   1273: #      endif
                   1274:    }
                   1275:    else if (strncmp(tampon, "CAST5", 5) == 0)
1.1       bertrand 1276:    {
1.3       bertrand 1277: #      ifndef OPENSSL_NO_CAST
                   1278:            TEST_CIPHER("CAST5-ECB", EVP_cast5_ecb)
                   1279:            else TEST_CIPHER("CAST5-CBC", EVP_cast5_cbc)
                   1280:            else TEST_CIPHER("CAST5-CFB64", EVP_cast5_cfb64)
                   1281:            else TEST_CIPHER("CAST5-OFB", EVP_cast5_ofb)
                   1282:            else
                   1283:            {
                   1284:                free(tampon);
                   1285: 
                   1286:                liberation(s_etat_processus, s_objet_argument_1);
                   1287:                liberation(s_etat_processus, s_objet_argument_2);
                   1288: 
                   1289:                (*s_etat_processus).erreur_execution =
                   1290:                        d_ex_chiffrement_indisponible;
                   1291:                return;
                   1292:            }
                   1293: #      else
                   1294:            free(tampon);
                   1295: 
                   1296:            liberation(s_etat_processus, s_objet_argument_1);
                   1297:            liberation(s_etat_processus, s_objet_argument_2);
                   1298: 
                   1299:            (*s_etat_processus).erreur_execution =
                   1300:                    d_ex_chiffrement_indisponible;
                   1301:            return;
                   1302: #      endif
1.1       bertrand 1303:    }
1.3       bertrand 1304:    else if (strncmp(tampon, "RC5", 3) == 0)
1.1       bertrand 1305:    {
1.3       bertrand 1306: #      ifndef OPENSSL_NO_RC5
                   1307:            TEST_CIPHER("RC5-32-12-16-ECB", EVP_rc5_32_12_16_ebc)
                   1308:            else TEST_CIPHER("RC5-32-12-16-CBC", EVP_rc5_32_12_16_cbc)
                   1309:            else TEST_CIPHER("RC5-32-12-16-CFB64", EVP_rc5_32_12_16_cfb64)
                   1310:            else TEST_CIPHER("RC5-32-12-16-OFB", EVP_rc5_32_12_16_ofb)
                   1311:            else
                   1312:            {
                   1313:                free(tampon);
                   1314: 
                   1315:                liberation(s_etat_processus, s_objet_argument_1);
                   1316:                liberation(s_etat_processus, s_objet_argument_2);
                   1317: 
                   1318:                (*s_etat_processus).erreur_execution =
                   1319:                        d_ex_chiffrement_indisponible;
                   1320:                return;
                   1321:            }
                   1322: #      else
                   1323:            free(tampon);
                   1324: 
                   1325:            liberation(s_etat_processus, s_objet_argument_1);
                   1326:            liberation(s_etat_processus, s_objet_argument_2);
                   1327: 
                   1328:            (*s_etat_processus).erreur_execution =
                   1329:                    d_ex_chiffrement_indisponible;
                   1330:            return;
                   1331: #      endif
                   1332:    }
                   1333:    else if (strncmp(tampon, "AES", 3) == 0)
                   1334:    {
                   1335: #      ifndef OPENSSL_NO_AES
                   1336:            TEST_CIPHER("AES-128-ECB", EVP_aes_128_ecb)
                   1337:            else TEST_CIPHER("AES-128-CBC", EVP_aes_128_cbc)
                   1338:            else TEST_CIPHER("AES-128-CFB1", EVP_aes_128_cfb1)
                   1339:            else TEST_CIPHER("AES-128-CFB8", EVP_aes_128_cfb8)
                   1340:            else TEST_CIPHER("AES-128-CFB128", EVP_aes_128_cfb128)
                   1341:            else TEST_CIPHER("AES-128-OFB", EVP_aes_128_ofb)
                   1342:            else TEST_CIPHER("AES-128-CTR", EVP_aes_128_ctr)
                   1343:            else TEST_CIPHER("AES-128-CCM", EVP_aes_128_ccm)
                   1344:            else TEST_CIPHER("AES-128-GCM", EVP_aes_128_gcm)
                   1345:            else TEST_CIPHER("AES-128-XTS", EVP_aes_128_xts)
                   1346:            else TEST_CIPHER("AES-192-ECB", EVP_aes_192_ecb)
                   1347:            else TEST_CIPHER("AES-192-CBC", EVP_aes_192_cbc)
                   1348:            else TEST_CIPHER("AES-192-CFB1", EVP_aes_192_cfb1)
                   1349:            else TEST_CIPHER("AES-192-CFB8", EVP_aes_192_cfb8)
                   1350:            else TEST_CIPHER("AES-192-CFB128", EVP_aes_192_cfb128)
                   1351:            else TEST_CIPHER("AES-192-OFB", EVP_aes_192_ofb)
                   1352:            else TEST_CIPHER("AES-192-CTR", EVP_aes_192_ctr)
                   1353:            else TEST_CIPHER("AES-192-CCM", EVP_aes_192_ccm)
                   1354:            else TEST_CIPHER("AES-192-GCM", EVP_aes_192_gcm)
                   1355:            else TEST_CIPHER("AES-256-ECB", EVP_aes_256_ecb)
                   1356:            else TEST_CIPHER("AES-256-CBC", EVP_aes_256_cbc)
                   1357:            else TEST_CIPHER("AES-256-CFB1", EVP_aes_256_cfb1)
                   1358:            else TEST_CIPHER("AES-256-CFB8", EVP_aes_256_cfb8)
                   1359:            else TEST_CIPHER("AES-256-CFB128", EVP_aes_256_cfb128)
                   1360:            else TEST_CIPHER("AES-256-OFB", EVP_aes_256_ofb)
                   1361:            else TEST_CIPHER("AES-256-CTR", EVP_aes_256_ctr)
                   1362:            else TEST_CIPHER("AES-256-CCM", EVP_aes_256_ccm)
                   1363:            else TEST_CIPHER("AES-256-GCM", EVP_aes_256_gcm)
                   1364:            else TEST_CIPHER("AES-256-XTS", EVP_aes_256_xts)
                   1365:            else
                   1366:            {
                   1367:                free(tampon);
                   1368: 
                   1369:                liberation(s_etat_processus, s_objet_argument_1);
                   1370:                liberation(s_etat_processus, s_objet_argument_2);
                   1371: 
                   1372:                (*s_etat_processus).erreur_execution =
                   1373:                        d_ex_chiffrement_indisponible;
                   1374:                return;
                   1375:            }
                   1376: #      else
                   1377:            free(tampon);
                   1378: 
                   1379:            liberation(s_etat_processus, s_objet_argument_1);
                   1380:            liberation(s_etat_processus, s_objet_argument_2);
                   1381: 
                   1382:            (*s_etat_processus).erreur_execution =
                   1383:                    d_ex_chiffrement_indisponible;
                   1384:            return;
                   1385: #      endif
                   1386:    }
                   1387:    else if (strncmp(tampon, "CAMELLIA", 8) == 0)
                   1388:    {
                   1389: #      ifndef OPENSSL_NO_CAMELLIA
                   1390:            TEST_CIPHER("CAMELLIA-128-ECB", EVP_camellia_128_ecb)
                   1391:            else TEST_CIPHER("CAMELLIA-128-CBC", EVP_camellia_128_cbc)
                   1392:            else TEST_CIPHER("CAMELLIA-128-CFB1", EVP_camellia_128_cfb1)
                   1393:            else TEST_CIPHER("CAMELLIA-128-CFB8", EVP_camellia_128_cfb8)
                   1394:            else TEST_CIPHER("CAMELLIA-128-CFB128", EVP_camellia_128_cfb128)
                   1395:            else TEST_CIPHER("CAMELLIA-128-OFB", EVP_camellia_128_ofb)
                   1396:            else TEST_CIPHER("CAMELLIA-192-ECB", EVP_camellia_128_ecb)
                   1397:            else TEST_CIPHER("CAMELLIA-192-CBC", EVP_camellia_192_cbc)
                   1398:            else TEST_CIPHER("CAMELLIA-192-CFB1", EVP_camellia_192_cfb1)
                   1399:            else TEST_CIPHER("CAMELLIA-192-CFB8", EVP_camellia_192_cfb8)
                   1400:            else TEST_CIPHER("CAMELLIA-192-CFB128", EVP_camellia_192_cfb128)
                   1401:            else TEST_CIPHER("CAMELLIA-192-OFB", EVP_camellia_192_ofb)
                   1402:            else TEST_CIPHER("CAMELLIA-256-ECB", EVP_camellia_256_ecb)
                   1403:            else TEST_CIPHER("CAMELLIA-256-CBC", EVP_camellia_256_cbc)
                   1404:            else TEST_CIPHER("CAMELLIA-256-CFB1", EVP_camellia_256_cfb1)
                   1405:            else TEST_CIPHER("CAMELLIA-256-CFB8", EVP_camellia_256_cfb8)
                   1406:            else TEST_CIPHER("CAMELLIA-256-CFB128", EVP_camellia_256_cfb128)
                   1407:            else TEST_CIPHER("CAMELLIA-256-OFB", EVP_camellia_256_ofb)
                   1408:            else
                   1409:            {
                   1410:                free(tampon);
                   1411: 
                   1412:                liberation(s_etat_processus, s_objet_argument_1);
                   1413:                liberation(s_etat_processus, s_objet_argument_2);
                   1414: 
                   1415:                (*s_etat_processus).erreur_execution =
                   1416:                        d_ex_chiffrement_indisponible;
                   1417:                return;
                   1418:            }
                   1419: #      else
                   1420:            free(tampon);
                   1421: 
                   1422:            liberation(s_etat_processus, s_objet_argument_1);
                   1423:            liberation(s_etat_processus, s_objet_argument_2);
                   1424: 
                   1425:            (*s_etat_processus).erreur_execution =
                   1426:                    d_ex_chiffrement_indisponible;
                   1427:            return;
                   1428: #      endif
                   1429:    }
                   1430:    else if (strncmp(tampon, "SEED", 4) == 0)
                   1431:    {
                   1432: #      ifndef OPENSSL_NO_SEED
                   1433:            TEST_CIPHER("SEED-ECB", EVP_seed_ecb)
                   1434:            else TEST_CIPHER("SEED-CBC", EVP_seed_cbc)
                   1435:            else TEST_CIPHER("SEED-CFB128", EVP_seed_cfb128)
                   1436:            else TEST_CIPHER("SEED-OFB", EVP_seed_ofb)
                   1437:            else
                   1438:            {
                   1439:                free(tampon);
                   1440: 
                   1441:                liberation(s_etat_processus, s_objet_argument_1);
                   1442:                liberation(s_etat_processus, s_objet_argument_2);
                   1443: 
                   1444:                (*s_etat_processus).erreur_execution =
                   1445:                        d_ex_chiffrement_indisponible;
                   1446:                return;
                   1447:            }
                   1448: #      else
                   1449:            free(tampon);
                   1450: 
                   1451:            liberation(s_etat_processus, s_objet_argument_1);
                   1452:            liberation(s_etat_processus, s_objet_argument_2);
                   1453: 
                   1454:            (*s_etat_processus).erreur_execution =
                   1455:                    d_ex_chiffrement_indisponible;
                   1456:            return;
                   1457: #      endif
                   1458:    }
                   1459:    else
                   1460:    {
                   1461:        free(tampon);
                   1462: 
                   1463:        liberation(s_etat_processus, s_objet_argument_1);
                   1464:        liberation(s_etat_processus, s_objet_argument_2);
                   1465: 
                   1466:        (*s_etat_processus).erreur_execution = d_ex_chiffrement_indisponible;
                   1467:        return;
                   1468:    }
                   1469: 
                   1470:    free(tampon);
                   1471: 
                   1472:    if (generation_clef == d_vrai)
                   1473:    {
1.7       bertrand 1474:        if ((iv = malloc(((size_t) EVP_CIPHER_iv_length(EVP_chiffrement))
1.3       bertrand 1475:                * sizeof(unsigned char))) == NULL)
                   1476:        {
                   1477:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1478:            return;
                   1479:        }
                   1480: 
1.7       bertrand 1481:        if ((clef = malloc(((size_t) EVP_CIPHER_key_length(EVP_chiffrement))
1.3       bertrand 1482:                * sizeof(unsigned char))) == NULL)
                   1483:        {
                   1484:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1485:            return;
                   1486:        }
                   1487: 
                   1488:        longueur_clef = EVP_BytesToKey(EVP_chiffrement, EVP_sum,
                   1489:                (unsigned char *) &sel, (unsigned char *)
1.7       bertrand 1490:                (*s_objet_argument_2).objet,
                   1491:                (int) longueur_chaine(s_etat_processus,
1.3       bertrand 1492:                (unsigned char *) (*s_objet_argument_2).objet),
1.7       bertrand 1493:                (int) nombre_cycles, clef, iv);
1.3       bertrand 1494: 
                   1495:        if (longueur_clef != EVP_CIPHER_key_length(EVP_chiffrement))
                   1496:        {
                   1497:            free(iv);
                   1498:            free(clef);
                   1499: 
                   1500:            liberation(s_etat_processus, s_objet_argument_1);
                   1501:            liberation(s_etat_processus, s_objet_argument_2);
                   1502: 
                   1503:            (*s_etat_processus).erreur_execution = d_ex_chiffrement;
                   1504:            return;
                   1505:        }
                   1506: 
                   1507:        if ((s_objet_resultat_1 = allocation(s_etat_processus, LST)) == NULL)
                   1508:        {
                   1509:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1510:            return;
                   1511:        }
                   1512: 
                   1513:        if (((*s_objet_resultat_1).objet = allocation_maillon(s_etat_processus))
                   1514:                == NULL)
                   1515:        {
                   1516:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1517:            return;
                   1518:        }
                   1519: 
                   1520:        l_element_courant = (*s_objet_resultat_1).objet;
                   1521: 
                   1522:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1523:                == NULL)
                   1524:        {
                   1525:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1526:            return;
                   1527:        }
                   1528: 
                   1529:        if (((*(*l_element_courant).donnee).objet = malloc(
                   1530:                (strlen(algorithme_chiffrement) + 1) * sizeof(unsigned char)))
                   1531:                == NULL)
                   1532:        {
                   1533:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1534:            return;
                   1535:        }
                   1536: 
                   1537:        strcpy((*(*l_element_courant).donnee).objet, algorithme_chiffrement);
                   1538: 
                   1539:        if (((*l_element_courant).suivant = allocation_maillon(
                   1540:                s_etat_processus)) == NULL)
                   1541:        {
                   1542:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1543:            return;
                   1544:        }
                   1545: 
                   1546:        l_element_courant = (*l_element_courant).suivant;
                   1547: 
                   1548:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1549:                == NULL)
                   1550:        {
                   1551:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1552:            return;
                   1553:        }
                   1554: 
                   1555:        if (((*(*l_element_courant).donnee).objet = analyse_flux(
                   1556:                s_etat_processus, clef,
                   1557:                EVP_CIPHER_key_length(EVP_chiffrement))) == NULL)
                   1558:        {
                   1559:            return;
                   1560:        }
                   1561: 
                   1562:        free(clef);
                   1563: 
                   1564:        if (((*l_element_courant).suivant = allocation_maillon(
                   1565:                s_etat_processus)) == NULL)
                   1566:        {
                   1567:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1568:            return;
                   1569:        }
                   1570: 
                   1571:        l_element_courant = (*l_element_courant).suivant;
                   1572:        (*l_element_courant).suivant = NULL;
                   1573: 
                   1574:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1575:                == NULL)
                   1576:        {
                   1577:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1578:            return;
                   1579:        }
                   1580: 
                   1581:        if (((*(*l_element_courant).donnee).objet = analyse_flux(
                   1582:                s_etat_processus, iv,
                   1583:                EVP_CIPHER_iv_length(EVP_chiffrement))) == NULL)
                   1584:        {
                   1585:            return;
                   1586:        }
                   1587: 
                   1588:        free(iv);
                   1589: 
                   1590:        liberation(s_etat_processus, s_objet_argument_1);
                   1591:        liberation(s_etat_processus, s_objet_argument_2);
                   1592: 
                   1593:        if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1594:                s_objet_resultat_1) == d_erreur)
                   1595:        {
                   1596:            return;
                   1597:        }
                   1598:    }
                   1599:    else
                   1600:    {
                   1601:        // Chiffrement ou déchiffrement
                   1602: 
                   1603:        if (strcmp(direction, "ENCRYPT") == 0)
                   1604:        {
                   1605:            encodage = d_vrai;
                   1606:        }
                   1607:        else if (strcmp(direction, "DECRYPT") == 0)
                   1608:        {
                   1609:            encodage = d_faux;
                   1610:        }
                   1611:        else
                   1612:        {
                   1613:            free(direction);
                   1614:            liberation(s_etat_processus, s_objet_argument_1);
                   1615:            liberation(s_etat_processus, s_objet_argument_2);
                   1616: 
                   1617:            (*s_etat_processus).erreur_execution =
                   1618:                    d_ex_argument_invalide;
                   1619:            return;
                   1620:        }
                   1621: 
                   1622:        free(direction);
                   1623: 
                   1624:        // Conversion des clefs
                   1625: 
                   1626:        if ((clef_binaire = formateur_flux(s_etat_processus, clef,
                   1627:                &longueur_clef_binaire)) == NULL)
                   1628:        {
                   1629:            return;
                   1630:        }
                   1631: 
                   1632:        if ((iv_binaire = formateur_flux(s_etat_processus, iv,
                   1633:                &longueur_iv_binaire)) == NULL)
                   1634:        {
                   1635:            return;
                   1636:        }
                   1637: 
                   1638:        // Vérification de la longueur des clef et vecteur d'initialisation
                   1639: 
                   1640:        if (longueur_clef_binaire != EVP_CIPHER_key_length(EVP_chiffrement))
                   1641:        {
                   1642:            free(clef_binaire);
                   1643:            free(iv_binaire);
                   1644: 
                   1645:            liberation(s_etat_processus, s_objet_argument_1);
                   1646:            liberation(s_etat_processus, s_objet_argument_2);
                   1647: 
                   1648:            (*s_etat_processus).erreur_execution =
                   1649:                    d_ex_longueur_clef_chiffrement;
                   1650:            return;
                   1651:        }
                   1652: 
                   1653:        if (longueur_iv_binaire != EVP_CIPHER_iv_length(EVP_chiffrement))
                   1654:        {
                   1655:            free(clef_binaire);
                   1656:            free(iv_binaire);
                   1657: 
                   1658:            liberation(s_etat_processus, s_objet_argument_1);
                   1659:            liberation(s_etat_processus, s_objet_argument_2);
                   1660: 
                   1661:            (*s_etat_processus).erreur_execution =
                   1662:                    d_ex_longueur_clef_chiffrement;
                   1663:            return;
                   1664:        }
                   1665: 
                   1666:        if ((message = formateur_flux(s_etat_processus, (unsigned char *)
                   1667:                (*s_objet_argument_2).objet, &longueur_message)) == NULL)
                   1668:        {
                   1669:            return;
                   1670:        }
                   1671: 
                   1672:        if ((message_chiffre = chiffrement(EVP_chiffrement, encodage, message,
                   1673:                longueur_message, clef_binaire, longueur_clef_binaire,
                   1674:                iv_binaire, &longueur_message_chiffre)) == NULL)
                   1675:        {
                   1676:            free(clef_binaire);
                   1677:            free(iv_binaire);
                   1678:            free(message);
                   1679: 
                   1680:            liberation(s_etat_processus, s_objet_argument_1);
                   1681:            liberation(s_etat_processus, s_objet_argument_2);
                   1682: 
                   1683:            (*s_etat_processus).erreur_execution = d_ex_chiffrement;
                   1684:            return;
                   1685:        }
                   1686: 
                   1687:        free(clef_binaire);
                   1688:        free(message);
                   1689: 
                   1690:        if ((s_objet_resultat_2 = allocation(s_etat_processus, CHN)) == NULL)
                   1691:        {
                   1692:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1693:            return;
                   1694:        }
                   1695: 
                   1696:        if (((*s_objet_resultat_2).objet = analyse_flux(s_etat_processus,
                   1697:                message_chiffre, longueur_message_chiffre)) == NULL)
                   1698:        {
                   1699:            return;
                   1700:        }
                   1701: 
                   1702:        free(message_chiffre);
                   1703: 
                   1704:        if ((s_objet_resultat_1 = allocation(s_etat_processus, LST)) == NULL)
                   1705:        {
                   1706:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1707:            return;
                   1708:        }
                   1709: 
                   1710:        if (((*s_objet_resultat_1).objet = allocation_maillon(s_etat_processus))
                   1711:                == NULL)
                   1712:        {
                   1713:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1714:            return;
                   1715:        }
                   1716: 
                   1717:        l_element_courant = (*s_objet_resultat_1).objet;
                   1718: 
                   1719:        // Direction
                   1720: 
                   1721:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1722:                == NULL)
                   1723:        {
                   1724:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1725:            return;
                   1726:        }
                   1727: 
                   1728:        if (((*(*l_element_courant).donnee).objet =
                   1729:                malloc(8 * sizeof(unsigned char))) == NULL)
                   1730:        {
                   1731:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1732:            return;
                   1733:        }
                   1734: 
                   1735:        strcpy((*(*l_element_courant).donnee).objet,
                   1736:                (encodage == d_vrai) ? "ENCRYPT" : "DECRYPT");
                   1737: 
                   1738:        // Type de chiffrement
                   1739: 
                   1740:        if (((*l_element_courant).suivant = allocation_maillon(
                   1741:                s_etat_processus)) == NULL)
                   1742:        {
                   1743:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1744:            return;
                   1745:        }
                   1746: 
                   1747:        l_element_courant = (*l_element_courant).suivant;
                   1748: 
                   1749:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1750:                == NULL)
                   1751:        {
                   1752:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1753:            return;
                   1754:        }
                   1755: 
1.5       bertrand 1756:        if (((*(*l_element_courant).donnee).objet =
                   1757:                conversion_majuscule(algorithme_chiffrement)) == NULL)
1.3       bertrand 1758:        {
                   1759:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1760:            return;
                   1761:        }
                   1762: 
                   1763:        // Clef
                   1764: 
                   1765:        if (((*l_element_courant).suivant = allocation_maillon(
                   1766:                s_etat_processus)) == NULL)
                   1767:        {
                   1768:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1769:            return;
                   1770:        }
                   1771: 
                   1772:        l_element_courant = (*l_element_courant).suivant;
                   1773: 
                   1774:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1775:                == NULL)
                   1776:        {
                   1777:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1778:            return;
                   1779:        }
                   1780: 
                   1781:        if (((*(*l_element_courant).donnee).objet =
                   1782:                malloc((strlen(clef) + 1) * sizeof(unsigned char))) == NULL)
                   1783:        {
                   1784:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1785:            return;
                   1786:        }
                   1787: 
                   1788:        strcpy((*(*l_element_courant).donnee).objet, clef);
                   1789: 
                   1790:        // Vecteur d'initialisation
                   1791: 
                   1792:        if (((*l_element_courant).suivant = allocation_maillon(
                   1793:                s_etat_processus)) == NULL)
                   1794:        {
                   1795:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1796:            return;
                   1797:        }
                   1798: 
                   1799:        l_element_courant = (*l_element_courant).suivant;
                   1800:        (*l_element_courant).suivant = NULL;
                   1801: 
                   1802:        if (((*l_element_courant).donnee = allocation(s_etat_processus, CHN))
                   1803:                == NULL)
                   1804:        {
                   1805:            (*s_etat_processus).erreur_systeme = d_es_allocation_memoire;
                   1806:            return;
                   1807:        }
                   1808: 
                   1809:        if (((*(*l_element_courant).donnee).objet = analyse_flux(
                   1810:                s_etat_processus, iv_binaire, longueur_iv_binaire)) == NULL)
                   1811:        {
                   1812:            return;
                   1813:        }
                   1814:        
                   1815:        free(iv_binaire);
                   1816: 
                   1817:        liberation(s_etat_processus, s_objet_argument_1);
                   1818:        liberation(s_etat_processus, s_objet_argument_2);
                   1819: 
                   1820:        if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1821:                s_objet_resultat_2) == d_erreur)
                   1822:        {
                   1823:            return;
                   1824:        }
                   1825: 
                   1826:        if (empilement(s_etat_processus, &((*s_etat_processus).l_base_pile),
                   1827:                s_objet_resultat_1) == d_erreur)
                   1828:        {
                   1829:            return;
                   1830:        }
1.1       bertrand 1831:    }
                   1832: 
                   1833:    return;
                   1834: }
                   1835: 
                   1836: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>