Unnamed Fossil Project

Check-in [7834397c45]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:updated
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:7834397c45b42553a272a91fc4737614ed894809
User & Date: alexey@sudachen.name 2011-11-07 00:40:46
Context
2011-11-22
16:30
updated check-in: bd25538587 user: alexey@sudachen.name tags: trunk
2011-11-07
00:40
updated check-in: 7834397c45 user: alexey@sudachen.name tags: trunk
00:37
removed 'extra' directory check-in: 91394f2a1f user: alexey@sudachen.name tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to aes.hc.

3
4
5
6
7
8
9
10
















11
12
13
14
15
16
17

//
// The AES block cipher was designed by Vincent Rijmen and Joan Daemen.
//   http://csrc.nist.gov/encryption/aes/rijndael/Rijndael.pdf
//   http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
//

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

//
// The AES block cipher was designed by Vincent Rijmen and Joan Daemen.
//   http://csrc.nist.gov/encryption/aes/rijndael/Rijndael.pdf
//   http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
//

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/
    
Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to array.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/
    
Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to bigint.hc.

1
2
3
4
















5
6
7
8
9
10
11
..
60
61
62
63
64
65
66
67
68

69
70
71
72
73
74
75
...
184
185
186
187
188
189
190













191
192
193
194
195
196
197
....
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
....
1275
1276
1277
1278
1279
1280
1281


































1282
1283
1284

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................

typedef struct _YOYO_BIGINT_STATIC
  {
    YOYO_BIGINT bint;
    halflong_t space[YOYO_BIGINT_MINDIGITS-1];
  } YOYO_BIGINT_STATIC;

#define Bigint_Size_Of_Digits(Digits) ((((Digits-1)*sizeof(halflong_t)+sizeof(YOYO_BIGINT))+YOYO_BIGINT_BLOCKMASK)&~YOYO_BIGINT_BLOCKMASK)
#define Bigint_Digits_Of_Bits(Bits) ((bits+sizeof(halflong_t)*8-1)/(sizeof(halflong_t)*8))


#define Bigint_Init(Value) Bigint_Init_Digits(Value,1)
YOYO_BIGINT *Bigint_Init_Digits(quad_t val, int digits)
#ifdef _YOYO_BINGINT_BUILTIN
  {
    int i = 0;
    YOYO_BIGINT *bint;
................................................................................
            bint->digits = digits;
            return bint;
          }
      }
    
    return Bigint_Copy_Expand(bint,extra_digits);
  }













#endif
  ;
  
#define Bigint_Alloca(Digits) Bigint_Setup_(alloca(Bigint_Size_Of_Digits(Digits)), Digits)
YOYO_BIGINT *Bigint_Setup_(YOYO_BIGINT *bint, int digits)
#ifdef _YOYO_BINGINT_BUILTIN
  {
................................................................................
  {
    __Auto_Ptr(*rsa_mod)
      {
        YOYO_BIGINT *p, *q, *n, *phi;
        int pBits = Get_Random(bits/5,bits/2);
        int qBits = (bits+1)-pBits;

        STRICT_REQUIRE(pBits < bits/2 && pBist > 0 );
        STRICT_REQUIRE(pBits+qBits == bits+1);

        n = 0;
        while ( !n ) __Auto_Ptr(n)
          {
            Bigint_Generate_Rsa_PQ(&p,pBits,&q,qBits,&n);

................................................................................
    
    __Pool(*rsa_pub);
    __Pool(*rsa_priv);
  }
#endif
  ;



































#endif /* C_once_B4220D86_3019_4E13_8682_D7F809F4E829 */





|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
....
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
....
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/
    
Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................

typedef struct _YOYO_BIGINT_STATIC
  {
    YOYO_BIGINT bint;
    halflong_t space[YOYO_BIGINT_MINDIGITS-1];
  } YOYO_BIGINT_STATIC;

#define Bigint_Size_Of_Digits(Digits) (((((Digits)-1)*sizeof(halflong_t)+sizeof(YOYO_BIGINT))+YOYO_BIGINT_BLOCKMASK)&~YOYO_BIGINT_BLOCKMASK)
#define Bigint_Digits_Of_Bits(Bits) (((Bits)+sizeof(halflong_t)*8-1)/(sizeof(halflong_t)*8))
#define Bigint_Digits_Of_Bytes(Bytes) (((Bytes)+sizeof(halflong_t)-1)/sizeof(halflong_t))

#define Bigint_Init(Value) Bigint_Init_Digits(Value,1)
YOYO_BIGINT *Bigint_Init_Digits(quad_t val, int digits)
#ifdef _YOYO_BINGINT_BUILTIN
  {
    int i = 0;
    YOYO_BIGINT *bint;
................................................................................
            bint->digits = digits;
            return bint;
          }
      }
    
    return Bigint_Copy_Expand(bint,extra_digits);
  }
#endif
  ;
  
YOYO_BIGINT *Bigint_Expand_If_Small(YOYO_BIGINT *bint, int required)
#ifdef _YOYO_BINGINT_BUILTIN
  {
    if ( !bint )
      return Bigint_Copy_Expand(0,required);
    else if ( bint->digits < required )
      return Bigint_Expand(bint,required - bint->digits);
    else
      return bint;
  }
#endif
  ;
  
#define Bigint_Alloca(Digits) Bigint_Setup_(alloca(Bigint_Size_Of_Digits(Digits)), Digits)
YOYO_BIGINT *Bigint_Setup_(YOYO_BIGINT *bint, int digits)
#ifdef _YOYO_BINGINT_BUILTIN
  {
................................................................................
  {
    __Auto_Ptr(*rsa_mod)
      {
        YOYO_BIGINT *p, *q, *n, *phi;
        int pBits = Get_Random(bits/5,bits/2);
        int qBits = (bits+1)-pBits;

        STRICT_REQUIRE(pBits < bits/2 && pBits > 0 );
        STRICT_REQUIRE(pBits+qBits == bits+1);

        n = 0;
        while ( !n ) __Auto_Ptr(n)
          {
            Bigint_Generate_Rsa_PQ(&p,pBits,&q,qBits,&n);

................................................................................
    
    __Pool(*rsa_pub);
    __Pool(*rsa_priv);
  }
#endif
  ;

YOYO_BIGINT *Bigint_From_Bytes(YOYO_BIGINT *bint, void *data, int len)
#ifdef _YOYO_BINGINT_BUILTIN
  {
#if defined __i386 || defined __x86_64
    int digits = Bigint_Digits_Of_Bytes(len);
    bint = Bigint_Expand_If_Small(bint,digits);
    memset(bint->value,0,bint->digits*sizeof(halflong_t));
    memcpy(bint->value,data,len);
    return bint;
#else
  #error fixme!
#endif
  }
#endif
  ;
  
int Bigint_To_Bytes(YOYO_BIGINT *bint, void *out, int maxlen)
#ifdef _YOYO_BINGINT_BUILTIN
  {
#if defined __i386 || defined __x86_64
    int l = sizeof(halflong_t)*bint->digits;
    byte_t *p = (byte_t*)(bint->value+bint->digits) - 1;
    while ( p != (byte_t*)bint->value && !*p ) --l;
    if ( l > maxlen )
      __Raise(YOYO_ERROR_NO_ENOUGH,"raw bigint outbuffer to small!");
    memcpy(out,bint->value,l);
    return l;
#else
    #error fixme!
#endif
  }
#endif
  ;
  
#endif /* C_once_B4220D86_3019_4E13_8682_D7F809F4E829 */


Changes to blowfish.hc.

2
3
4
5
6
7
8
9
















10
11
12
13
14
15
16
...
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
...
352
353
354
355
356
357
358
359
360
361









362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
...
386
387
388
389
390
391
392
393
394
395









396
397
398
399
400
401
402
403
404
...
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440


441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
/*

//
// Blowfish Cipher 
//   Designed in 1993 by Bruce Schneier 
//

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
#ifdef _YOYO_BLOWFISH_BUILTIN
#define F(S,X) \
      ((( (S)[0][((X) >> 24)] + (S)[1][(((X) >> 16)&0x0ff)] ) \
       ^ (S)[2][((X) >> 8)&0x0ff] ) \
       + (S)[3][(X) & 0x0ff])
#endif

void Blowfish_Encrypt8(YOYO_BLOWFISH *self,void *block8)
#ifdef _YOYO_BLOWFISH_BUILTIN
  {
    uint_t  L;
    uint_t  R;
    uint_t  temp;
    int     i;

    L = Four_To_Unsigned((byte_t*)block8+0);
    R = Four_To_Unsigned((byte_t*)block8+4);
  
    for (i = 0; i < 16; ++i) 
      {
        L = L ^ self->P[i];
        R = F(self->S, L) ^ R;

        temp = L;
................................................................................
        R = temp;
      }

    temp = L;
    L = R;
    R = temp;

    R = R ^ self->P[16];
    L = L ^ self->P[16 + 1];










    Unsigned_To_Four(L,(byte_t*)block8+0);
    Unsigned_To_Four(R,(byte_t*)block8+4);
  }
#endif
  ;

void Blowfish_Decrypt8(YOYO_BLOWFISH *self,void *block8)
#ifdef _YOYO_BLOWFISH_BUILTIN
  {
    uint_t  L;
    uint_t  R;
    uint_t  temp;
    int     i;
    
    L = Four_To_Unsigned((byte_t*)block8+0);
    R = Four_To_Unsigned((byte_t*)block8+4);
    
    for (i = 16 + 1; i > 1; --i) 
      {
        L = L ^ self->P[i];
        R = F(self->S, L) ^ R;

        temp = L;
        L = R;
................................................................................
        R = temp;
      }

    temp = L;
    L = R;
    R = temp;

    R = R ^ self->P[1];
    L = L ^ self->P[0];










    Unsigned_To_Four(L,(byte_t*)block8+0);
    Unsigned_To_Four(R,(byte_t*)block8+4);
  }
#endif
  ;

#ifdef _YOYO_BLOWFISH_BUILTIN
#undef F
#endif
................................................................................
  ;

void *Blowfish_Init_Static(YOYO_BLOWFISH *self, void *key, int key_len) 
#ifdef _YOYO_BLOWFISH_BUILTIN
  {
    int i, j, k;
    uint_t data;
    struct { uint_t L; uint_t R; } LR = {0};

    for ( i = 0; i < 4; ++i ) 
      {
        for ( j = 0; j < 256; ++j )
          self->S[i][j] = Blowfish_S[i][j];
      }

    j = 0;
    for ( i = 0; i < 16 + 2; ++i ) 
      {
        data = 0;
        for ( k = 0; k < 4; ++k ) 
          {
            data = (data << 8) | ((byte_t*)key)[j];
            j = j + 1;
            if ( j >= key_len )
              j = 0;
          }
        self->P[i] = Blowfish_P[i] ^ data;
      }



    for ( i = 0; i < 16 + 2; i += 2 ) 
      {
        Blowfish_Encrypt8(self,&LR);
        self->P[i] = LR.L;
        self->P[i + 1] = LR.R;
      }

    for ( i = 0; i < 4; ++i ) 
      {
        for ( j = 0; j < 256; j += 2 ) 
          {
            Blowfish_Encrypt8(self,&LR);
            self->S[i][j] = LR.L;
            self->S[i][j + 1] = LR.R;
          }
      }
      
    return self;
  }
#endif
  ;







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|


|
|


<
<
<







 







|
|
|
>
>
>
>
>
>
>
>
>
|
|




|


|
|



<
<
<







 







|
|
|
>
>
>
>
>
>
>
>
>
|
|







 







|

|
<
<
<
<







|
|
<
<




>
>


|
|
|






|
|
|







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
...
343
344
345
346
347
348
349
350
351
352
353
354
355
356



357
358
359
360
361
362
363
...
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397



398
399
400
401
402
403
404
...
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
...
440
441
442
443
444
445
446
447
448
449




450
451
452
453
454
455
456
457
458


459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
/*

//
// Blowfish Cipher 
//   Designed in 1993 by Bruce Schneier 
//

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
#ifdef _YOYO_BLOWFISH_BUILTIN
#define F(S,X) \
      ((( (S)[0][((X) >> 24)] + (S)[1][(((X) >> 16)&0x0ff)] ) \
       ^ (S)[2][((X) >> 8)&0x0ff] ) \
       + (S)[3][(X) & 0x0ff])
#endif

void Blowfish_Encrypt8_(YOYO_BLOWFISH *self, uint_t *Lx, uint_t *Rx)
#ifdef _YOYO_BLOWFISH_BUILTIN
  {
    uint_t  L = *Lx;
    uint_t  R = *Rx;
    uint_t  temp;
    int     i;



  
    for (i = 0; i < 16; ++i) 
      {
        L = L ^ self->P[i];
        R = F(self->S, L) ^ R;

        temp = L;
................................................................................
        R = temp;
      }

    temp = L;
    L = R;
    R = temp;

    *Rx = R ^ self->P[16];
    *Lx = L ^ self->P[16 + 1];
  }
#endif
  ;

void Blowfish_Encrypt8(YOYO_BLOWFISH *self,void *block8)
#ifdef _YOYO_BLOWFISH_BUILTIN
  {
    uint_t L = Four_To_Unsigned_BE((byte_t*)block8+0);
    uint_t R = Four_To_Unsigned_BE((byte_t*)block8+4);
    Blowfish_Encrypt8_(self,&L,&R);
    Unsigned_To_Four_BE(L,(byte_t*)block8+0);
    Unsigned_To_Four_BE(R,(byte_t*)block8+4);
  }
#endif
  ;

void Blowfish_Decrypt8_(YOYO_BLOWFISH *self, uint_t *Lx, uint_t *Rx)
#ifdef _YOYO_BLOWFISH_BUILTIN
  {
    uint_t  L = *Lx;
    uint_t  R = *Rx;
    uint_t  temp;
    int     i;
    



    for (i = 16 + 1; i > 1; --i) 
      {
        L = L ^ self->P[i];
        R = F(self->S, L) ^ R;

        temp = L;
        L = R;
................................................................................
        R = temp;
      }

    temp = L;
    L = R;
    R = temp;

    *Rx = R ^ self->P[1];
    *Lx = L ^ self->P[0];
  }
#endif
  ;

void Blowfish_Decrypt8(YOYO_BLOWFISH *self,void *block8)
#ifdef _YOYO_BLOWFISH_BUILTIN
  {
    uint_t L = Four_To_Unsigned_BE((byte_t*)block8+0);
    uint_t R = Four_To_Unsigned_BE((byte_t*)block8+4);
    Blowfish_Decrypt8_(self,&L,&R);
    Unsigned_To_Four_BE(L,(byte_t*)block8+0);
    Unsigned_To_Four_BE(R,(byte_t*)block8+4);
  }
#endif
  ;

#ifdef _YOYO_BLOWFISH_BUILTIN
#undef F
#endif
................................................................................
  ;

void *Blowfish_Init_Static(YOYO_BLOWFISH *self, void *key, int key_len) 
#ifdef _YOYO_BLOWFISH_BUILTIN
  {
    int i, j, k;
    uint_t data;
    uint_t L = 0, R = 0;

    key_len = Yo_MIN(key_len,56);





    j = 0;
    for ( i = 0; i < 16 + 2; ++i ) 
      {
        data = 0;
        for ( k = 0; k < 4; ++k ) 
          {
            data = (data << 8) | ((byte_t*)key)[j % key_len];
            ++j;


          }
        self->P[i] = Blowfish_P[i] ^ data;
      }

    memcpy(self->S,Blowfish_S,sizeof(self->S));

    for ( i = 0; i < 16 + 2; i += 2 ) 
      {
        Blowfish_Encrypt8_(self,&L,&R);
        self->P[i] = L;
        self->P[i + 1] = R;
      }

    for ( i = 0; i < 4; ++i ) 
      {
        for ( j = 0; j < 256; j += 2 ) 
          {
            Blowfish_Encrypt8_(self,&L,&R);
            self->S[i][j] = L;
            self->S[i][j + 1] = R;
          }
      }
      
    return self;
  }
#endif
  ;

Changes to buffer.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to cipher.hc.

1
2
3
4
















5
6
7
8
9
10
11
...
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
...
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
...
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
...
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
...
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267


268






269


270
271






272
273
274
























275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
  }
#endif
  ;

void Oj_Encrypt_ECB(void *cipher, void *S, int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i;
    void (*f)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Encrypt8_OjMID,0);
    
    if ( f )
      _Oj_Encrypt_Decrypt_ECB_8(cipher,f,S,S_len);
    else if ( 0 != (f = Yo_Find_Method_Of(&cipher,Oj_Encrypt16_OjMID,0)) )
      _Oj_Encrypt_Decrypt_ECB_16(cipher,f,S,S_len);
    else
................................................................................
  }
#endif
  ;

void Oj_Decrypt_ECB(void *cipher, void *S, int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i;
    void (*f)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Decrypt8_OjMID,0);
    
    if ( f )
      _Oj_Encrypt_Decrypt_ECB_8(cipher,f,S,S_len);
    else if ( 0 != (f = Yo_Find_Method_Of(&cipher,Oj_Decrypt16_OjMID,0)) )
      _Oj_Encrypt_Decrypt_ECB_16(cipher,f,S,S_len);
    else
      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Decrypt8_OjMID or Oj_Decrypt16_OjMID mothod",0));
  }
#endif
  ;

quad_t _Oj_Encrypt_Decrypt_XEX_8(void *cipher, void (*f8)(void*,void*), void (*xex)(void*,void*), void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i,j, n = xex?8:16;
    byte_t q16[16] = {0};
    
    _Oj_Check_Buffer_Size_N_Alignment_8(S_len);
    
................................................................................
    for ( i = 0; i < S_len/8; ++i )
      {
        byte_t *p = (byte_t*)S+i*8;
        ++st;
        Quad_To_Eight(st,q16);
        
        if ( xex )
          xex(cipher,q16);
        else
          Md5_Digest(q16,8,q16);
        
        for ( j = 0; j < n; ++j )
          p[j%8] ^= q16[j];
        f8(cipher,p);
        for ( j = 0; j < n; ++j )
................................................................................
      }
    
    return st;
  }
#endif
  ;

quad_t _Oj_Encrypt_Decrypt_XEX_16(void *cipher, void (*f16)(void*,void*), void (*xex)(void*,void*), void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i,j, n = xex?16:32;
    byte_t q32[32] = {0};
    
    _Oj_Check_Buffer_Size_N_Alignment_16(S_len);
    
................................................................................
        byte_t *p = (byte_t*)S+i*16;
        ++st;
        Quad_To_Eight(st,q32);
        ++st;
        Quad_To_Eight(st,q32+8);
        
        if ( xex )
          xex(cipher,q32);
        else
          Sha2_Digest(q32,16,q32);
          
        for ( j = 0; j < n; ++j )
          p[j%16] ^= q32[j];
        f16(cipher,p);
        for ( j = 0; j < n; ++j )
................................................................................
      }
    
    return st;
  }
#endif
  ;

quad_t Oj_Encrypt_XEX(void *cipher, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    void (*encrypt)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Encrypt8_OjMID,0);
    if ( encrypt ) 
      return _Oj_Encrypt_Decrypt_XEX_8(cipher,encrypt,encrypt,S,S_len,st);
    else if ( 0 != (encrypt = Yo_Find_Method_Of(&cipher,Oj_Encrypt16_OjMID,0)) ) 
      return _Oj_Encrypt_Decrypt_XEX_16(cipher,encrypt,encrypt,S,S_len,st);
    else
      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Encrypt8_OjMID or Oj_Encrypt16_OjMID mothod",0));
    return 0;
  }
#endif
  ;

quad_t Oj_Decrypt_XEX(void *cipher, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    void (*encrypt)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Encrypt8_OjMID,0);
    void (*decrypt)(void*,void*);
    if ( encrypt )
      {
        decrypt = Yo_Find_Method_Of(&cipher,Oj_Decrypt8_OjMID,YO_RAISE_ERROR);
        return _Oj_Encrypt_Decrypt_XEX_8(cipher,decrypt,encrypt,S,S_len,st);
      }
    else if ( 0 != (encrypt = Yo_Find_Method_Of(&cipher,Oj_Encrypt16_OjMID,0)) )
      {
        decrypt = Yo_Find_Method_Of(&cipher,Oj_Decrypt16_OjMID,YO_RAISE_ERROR);
        return _Oj_Encrypt_Decrypt_XEX_16(cipher,decrypt,encrypt,S,S_len,st);
      }
    else
      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Encrypt8_OjMID or Oj_Encrypt16_OjMID mothod",0));
    return 0;
  }
#endif
  ;

quad_t Oj_Encrypt_XEX_MDSH(void *cipher, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    void (*f)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Encrypt8_OjMID,0);
    if ( f ) 


      return _Oj_Encrypt_Decrypt_XEX_8(cipher,f,0,S,S_len,st);






    else if ( 0 != (f = Yo_Find_Method_Of(&cipher,Oj_Encrypt16_OjMID,0)) ) 


      return _Oj_Encrypt_Decrypt_XEX_16(cipher,f,0,S,S_len,st);
    else






      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Encrypt8_OjMID or Oj_Encrypt16_OjMID mothod",0));
    return 0;
























  }
#endif
  ;

quad_t Oj_Decrypt_XEX_MDSH(void *cipher, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    void (*f)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Decrypt8_OjMID,0);
    if ( f ) 
      return _Oj_Encrypt_Decrypt_XEX_8(cipher,f,0,S,S_len,st);
    else if ( 0 != (f = Yo_Find_Method_Of(&cipher,Oj_Decrypt16_OjMID,0)) ) 
      return _Oj_Encrypt_Decrypt_XEX_16(cipher,f,0,S,S_len,st);
    else
      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Decrypt8_OjMID or Oj_Decrypt16_OjMID mothod",0));
    return 0;
  }
#endif
  ;

#endif /* C_once_1F19AF84_9BBE_46CC_87A4_8252243D7219 */




|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<







 







<













|







 







|







 







|







 







|







 







|




|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
<
<
<
<
<
<









|


|
|
>
>
|
>
>
>
>
>
>
|
>
>
|
|
>
>
>
>
>
>

|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







|
<
<
<
<
<
<
<
<






1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
...
138
139
140
141
142
143
144

145
146
147
148
149
150
151
...
154
155
156
157
158
159
160

161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
...
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
...
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
...
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260







261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329








330
331
332
333
334
335

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
  }
#endif
  ;

void Oj_Encrypt_ECB(void *cipher, void *S, int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {

    void (*f)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Encrypt8_OjMID,0);
    
    if ( f )
      _Oj_Encrypt_Decrypt_ECB_8(cipher,f,S,S_len);
    else if ( 0 != (f = Yo_Find_Method_Of(&cipher,Oj_Encrypt16_OjMID,0)) )
      _Oj_Encrypt_Decrypt_ECB_16(cipher,f,S,S_len);
    else
................................................................................
  }
#endif
  ;

void Oj_Decrypt_ECB(void *cipher, void *S, int S_len)
#ifdef _YOYO_CIPHER_BUILTIN
  {

    void (*f)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Decrypt8_OjMID,0);
    
    if ( f )
      _Oj_Encrypt_Decrypt_ECB_8(cipher,f,S,S_len);
    else if ( 0 != (f = Yo_Find_Method_Of(&cipher,Oj_Decrypt16_OjMID,0)) )
      _Oj_Encrypt_Decrypt_ECB_16(cipher,f,S,S_len);
    else
      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Decrypt8_OjMID or Oj_Decrypt16_OjMID mothod",0));
  }
#endif
  ;

quad_t _Oj_Encrypt_Decrypt_XEX_8(void *cipher, void (*f8)(void*,void*), void *cipher2, void (*xex)(void*,void*), void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i,j, n = xex?8:16;
    byte_t q16[16] = {0};
    
    _Oj_Check_Buffer_Size_N_Alignment_8(S_len);
    
................................................................................
    for ( i = 0; i < S_len/8; ++i )
      {
        byte_t *p = (byte_t*)S+i*8;
        ++st;
        Quad_To_Eight(st,q16);
        
        if ( xex )
          xex(cipher2,q16);
        else
          Md5_Digest(q16,8,q16);
        
        for ( j = 0; j < n; ++j )
          p[j%8] ^= q16[j];
        f8(cipher,p);
        for ( j = 0; j < n; ++j )
................................................................................
      }
    
    return st;
  }
#endif
  ;

quad_t _Oj_Encrypt_Decrypt_XEX_16(void *cipher, void (*f16)(void*,void*), void *cipher2, void (*xex)(void*,void*), void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    int i,j, n = xex?16:32;
    byte_t q32[32] = {0};
    
    _Oj_Check_Buffer_Size_N_Alignment_16(S_len);
    
................................................................................
        byte_t *p = (byte_t*)S+i*16;
        ++st;
        Quad_To_Eight(st,q32);
        ++st;
        Quad_To_Eight(st,q32+8);
        
        if ( xex )
          xex(cipher2,q32);
        else
          Sha2_Digest(q32,16,q32);
          
        for ( j = 0; j < n; ++j )
          p[j%16] ^= q32[j];
        f16(cipher,p);
        for ( j = 0; j < n; ++j )
................................................................................
      }
    
    return st;
  }
#endif
  ;

quad_t Oj_Encrypt_XEX_2(void *cipher, void *cipher2, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    void (*encrypt)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Encrypt8_OjMID,0);
    if ( encrypt ) 
      {
        if ( !cipher2 )
          return _Oj_Encrypt_Decrypt_XEX_8(cipher,encrypt,0,0,S,S_len,st);
        else
          {
            void (*encrypt2)(void*,void*) = Yo_Find_Method_Of(&cipher2,Oj_Encrypt8_OjMID,YO_RAISE_ERROR);
            return _Oj_Encrypt_Decrypt_XEX_8(cipher,encrypt,cipher2,encrypt2,S,S_len,st);
          }
      }
    else if ( 0 != (encrypt = Yo_Find_Method_Of(&cipher,Oj_Encrypt16_OjMID,0)) ) 
      {
        if ( !cipher2 )
          return _Oj_Encrypt_Decrypt_XEX_16(cipher,encrypt,0,0,S,S_len,st);
        else
          {
            void (*encrypt2)(void*,void*) = Yo_Find_Method_Of(&cipher2,Oj_Encrypt16_OjMID,YO_RAISE_ERROR);
            return _Oj_Encrypt_Decrypt_XEX_16(cipher,encrypt,cipher2,encrypt2,S,S_len,st);
          }







      }
    else
      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Encrypt8_OjMID or Oj_Encrypt16_OjMID mothod",0));
    return 0;
  }
#endif
  ;

quad_t Oj_Decrypt_XEX_2(void *cipher, void *cipher2, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    void (*decrypt)(void*,void*) = Yo_Find_Method_Of(&cipher,Oj_Decrypt8_OjMID,0);
    if ( decrypt )
      {
        if ( !cipher2 )
          return _Oj_Encrypt_Decrypt_XEX_8(cipher,decrypt,0,0,S,S_len,st);
        else
          {
            void (*encrypt)(void*,void*) = Yo_Find_Method_Of(&cipher2,Oj_Encrypt8_OjMID,YO_RAISE_ERROR);
            return _Oj_Encrypt_Decrypt_XEX_8(cipher,decrypt,cipher2,encrypt,S,S_len,st);
          }
      }
    else if ( 0 != (decrypt = Yo_Find_Method_Of(&cipher,Oj_Decrypt16_OjMID,0)) )
      {
        if ( !cipher2 )
          return _Oj_Encrypt_Decrypt_XEX_16(cipher,decrypt,0,0,S,S_len,st);
        else
          {
            void (*encrypt)(void*,void*) = Yo_Find_Method_Of(&cipher2,Oj_Encrypt16_OjMID,YO_RAISE_ERROR);
            return _Oj_Encrypt_Decrypt_XEX_16(cipher,decrypt,cipher2,encrypt,S,S_len,st);
          }
      }
    else
      __Raise(YOYO_ERROR_METHOD_NOT_FOUND,
              __yoTa("cipher does not contain Oj_Decrypt8_OjMID or Oj_Decrypt16_OjMID mothod",0));
    return 0;
  }
#endif
  ;

quad_t Oj_Encrypt_XEX(void *cipher, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    return Oj_Encrypt_XEX_2(cipher,cipher,S,S_len,st);
  }
#endif
  ;

quad_t Oj_Decrypt_XEX(void *cipher, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    return Oj_Decrypt_XEX_2(cipher,cipher,S,S_len,st);
  }
#endif
  ;

quad_t Oj_Encrypt_XEX_MDSH(void *cipher, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    return Oj_Decrypt_XEX_2(cipher,0,S,S_len,st);
  }
#endif
  ;

quad_t Oj_Decrypt_XEX_MDSH(void *cipher, void *S, int S_len, quad_t st)
#ifdef _YOYO_CIPHER_BUILTIN
  {
    return Oj_Decrypt_XEX_2(cipher,0,S,S_len,st);








  }
#endif
  ;

#endif /* C_once_1F19AF84_9BBE_46CC_87A4_8252243D7219 */

Changes to crc.hc.

1
2
3
4
















5
6
7
8
9
10
11
..
32
33
34
35
36
37
38













39
40
41
42
43
44
45

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................

#ifdef _LIBYOYO
#define _YOYO_CRC_BUILTIN
#endif

#include "yoyo.hc"














uint_t    Crc_32(uint_t crc, void *, int len);
ushort_t  Crc_16(ushort_t crc, void *, int len);
byte_t    Crc_8(byte_t crc, void *, int len);
byte_t    Crc_8_Of_Cstr(char *S);
uint_t    Adler_32(uint_t adler, void *, int len);

#define Digest_Crc_32(Data,Len) Crc_32(0,Data,Len)



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................

#ifdef _LIBYOYO
#define _YOYO_CRC_BUILTIN
#endif

#include "yoyo.hc"

#ifdef _YOYO_CRC_BUILTIN
# define _YOYO_CRC_BUILTIN_CODE(Code) Code
# define _YOYO_CRC_EXTERN 
#else
# define _YOYO_CRC_BUILTIN_CODE(Code)
# define _YOYO_CRC_EXTERN extern 
#endif

_YOYO_CRC_EXTERN char Oj_Digest_Update_OjMID[] _YOYO_CRC_BUILTIN_CODE( = "digest-update/@*i"); 
void Oj_Digest_Update(void *dgst,void *buf,int L) _YOYO_CRC_BUILTIN_CODE(
  { ((void(*)(void*,void*,int))Yo_Find_Method_Of(&dgst,Oj_Digest_Update_OjMID,YO_RAISE_ERROR))
        (dgst,buf,L); });

uint_t    Crc_32(uint_t crc, void *, int len);
ushort_t  Crc_16(ushort_t crc, void *, int len);
byte_t    Crc_8(byte_t crc, void *, int len);
byte_t    Crc_8_Of_Cstr(char *S);
uint_t    Adler_32(uint_t adler, void *, int len);

#define Digest_Crc_32(Data,Len) Crc_32(0,Data,Len)

Changes to datetime.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to defpars.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to dicto.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to file.hc.

1
2
3
4
















5
6
7
8
9
10
11
....
1696
1697
1698
1699
1700
1701
1702































1703
1704
1705
1706
1707

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
    while ( count > 0 )
      {
        int L = Yo_MIN(count,sizeof(bf));
        Oj_Write_Full(fobj,bf,L);
        count -= L;
      }
  }































#endif
  ;

#endif /* C_once_E9479D04_5D69_4A1A_944F_0C99A852DC0B */




|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
....
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
    while ( count > 0 )
      {
        int L = Yo_MIN(count,sizeof(bf));
        Oj_Write_Full(fobj,bf,L);
        count -= L;
      }
  }
#endif
  ;

int Oj_Apply_File(void *foj, void *accu, void (*algo)(void *accu,void *buf, int L))
#ifdef _YOYO_FILE_BUILTIN
  {
    char bf[YOYO_FILE_COPY_BUFFER_SIZE];
    int count = 0;
    int (*xread)(void*,void*,int,int) = Yo_Find_Method_Of(&foj,Oj_Read_OjMID,YO_RAISE_ERROR);
    for ( ;; )
      {
        int i = xread(foj,bf,YOYO_FILE_COPY_BUFFER_SIZE,0);
        if ( !i ) break;
        algo(accu,bf,i);
        count += i;
      }
    return count;
  }
#endif
  ;

_YOYO_FILE_EXTERN char Oj_Digest_File_Update_OjMID[] _YOYO_FILE_BUILTIN_CODE( = "digest-file-update/@*"); 
void Oj_Digest_File_Update(void *dgst,void *foj) _YOYO_FILE_BUILTIN_CODE(
  { void(*update)(void*,void*,int) = Yo_Find_Method_Of(&dgst,Oj_Digest_Update_OjMID,YO_RAISE_ERROR);
    Oj_Apply_File(foj,dgst,update); });

void File_Update_Digest(void *dgst, char *filename)
#ifdef _YOYO_FILE_BUILTIN
  {
    __Auto_Release Oj_Digest_File_Update(dgst,Cfile_Open(filename,"r"));
  }
#endif
  ;

#endif /* C_once_E9479D04_5D69_4A1A_944F_0C99A852DC0B */

Changes to libcrypt.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to libyoyo.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to logout.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to lzss.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2005-2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2005-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to md5.hc.

1
2
3
4
5
6

7
8















9
10
11
12
13
14
15
..
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
..
75
76
77
78
79
80
81



82
83
84
85
86
87

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
...
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393

394
395
396
397
398
399
400
401
...
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429















430
431
432
433
434

/*

// The MD5 algorithm was designed by Ron Rivest in 1991.
// http://www.ietf.org/rfc/rfc1321.txt



(C)2011, Alexéy Sudáchen, alexey@sudachen.name
















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.

RSA MD5 Message-Digest Algorithm
(C) 1991-2, RSA Data Security, Inc. Created 1991.

License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.

*/

#ifndef C_once_C5021104_5DB9_4FCC_BAFC_AFB22BD458D3
#define C_once_C5021104_5DB9_4FCC_BAFC_AFB22BD458D3

#ifdef _LIBYOYO
#define _YOYO_MD5_BUILTIN
#endif

#include "yoyo.hc"


typedef struct _YOYO_MD5
  {
    uint_t state[4];   /* state (ABCD) */
    uint_t count[2];   /* number of bits, modulo 2^64 (lsb first) */
    int    finished;
    byte_t buffer[64];
................................................................................
    md5->state[2] = 0x98badcfe; 
    md5->state[3] = 0x10325476;
    return md5;
  }
#endif
  ;




void *Md5_Init()
#ifdef _YOYO_MD5_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Clone_OjMID, Md5_Clone },

        {0}};
    
    YOYO_MD5 *md5 = __Object(sizeof(YOYO_MD5),funcs);
    return Md5_Start(md5);
  }
#endif
  ;

void Md5_Update(YOYO_MD5 *md5, void *data, int len);
void *Md5_Finish(YOYO_MD5 *md5, void *digest);

#define YOYO_MD5_INITIALIZER {{0x67452301,0xefcdab89,0x98badcfe,0x10325476},{0},0,{0}}

void *Md5_Digest(void *data, int len, void *digest)
#ifdef _YOYO_MD5_BUILTIN
  {
    YOYO_MD5 md5 = YOYO_MD5_INITIALIZER;
    Md5_Update(&md5,data,len);
................................................................................
    
    memset(sum,0,sizeof(sum));
    return hmac;
  }
#endif
  ;

void *Hmac_Md5_Init(void *key, int key_len)
#ifdef _YOYO_MD5_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Clone_OjMID, Hmac_Md5_Clone },
        {0}};
    
    YOYO_HMAC_MD5 *md5 = __Object(sizeof(YOYO_HMAC_MD5),funcs);
    return Hmac_Md5_Start(md5,key,key_len);
  }
#endif
  ;

void Hmac_Md5_Update(YOYO_HMAC_MD5 *hmac, void *input, int input_length)
#ifdef _YOYO_MD5_BUILTIN
  {

    Md5_Update(&hmac->md5,input,input_length);
  }
#endif
  ;

void *Hmac_Md5_Finish(YOYO_HMAC_MD5 *hmac, void *digest)
#ifdef _YOYO_MD5_BUILTIN
  {
................................................................................
    Md5_Update(&hmac->md5,tmpb,16);
    memset(tmpb,0,16);
    return Md5_Finish(&hmac->md5,digest);
  }
#endif
  ;

void Hmac_Md5_Reset(YOYO_HMAC_MD5 *hmac)
#ifdef _YOYO_MD5_BUILTIN
  {
    Md5_Start(&hmac->md5);
    Md5_Update(&hmac->md5,hmac->ipad,64);
  }
#endif
  ;

void *Hmac_Md5_Digest(void *data, int len, void *key, int key_len, void *digest)
#ifdef _YOYO_MD5_BUILTIN
  {
    YOYO_HMAC_MD5 hmac5;
    Hmac_Md5_Start(&hmac5,key,key_len);
    Md5_Update(&hmac5.md5,data,len);
    return Hmac_Md5_Finish(&hmac5,digest);
  }















#endif
  ;

#endif /* C_once_C5021104_5DB9_4FCC_BAFC_AFB22BD458D3 */







>

<
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







<
<
<
<
<
<
<
<










>







 







>
>
>






>








<
<
<







 







|


|
<
<
<
<
<
<




|


>
|







 







<
<
<
<
<
<
<
<
<








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
..
40
41
42
43
44
45
46








47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107



108
109
110
111
112
113
114
...
379
380
381
382
383
384
385
386
387
388
389






390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
...
410
411
412
413
414
415
416









417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444

/*

// The MD5 algorithm was designed by Ron Rivest in 1991.
// http://www.ietf.org/rfc/rfc1321.txt

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile


In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.









*/

#ifndef C_once_C5021104_5DB9_4FCC_BAFC_AFB22BD458D3
#define C_once_C5021104_5DB9_4FCC_BAFC_AFB22BD458D3

#ifdef _LIBYOYO
#define _YOYO_MD5_BUILTIN
#endif

#include "yoyo.hc"
#include "crc.hc"

typedef struct _YOYO_MD5
  {
    uint_t state[4];   /* state (ABCD) */
    uint_t count[2];   /* number of bits, modulo 2^64 (lsb first) */
    int    finished;
    byte_t buffer[64];
................................................................................
    md5->state[2] = 0x98badcfe; 
    md5->state[3] = 0x10325476;
    return md5;
  }
#endif
  ;

void Md5_Update(YOYO_MD5 *md5, void *data, int len);
void *Md5_Finish(YOYO_MD5 *md5, void *digest);

void *Md5_Init()
#ifdef _YOYO_MD5_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Clone_OjMID, Md5_Clone },
        {Oj_Digest_Update_OjMID, Md5_Update },
        {0}};
    
    YOYO_MD5 *md5 = __Object(sizeof(YOYO_MD5),funcs);
    return Md5_Start(md5);
  }
#endif
  ;




#define YOYO_MD5_INITIALIZER {{0x67452301,0xefcdab89,0x98badcfe,0x10325476},{0},0,{0}}

void *Md5_Digest(void *data, int len, void *digest)
#ifdef _YOYO_MD5_BUILTIN
  {
    YOYO_MD5 md5 = YOYO_MD5_INITIALIZER;
    Md5_Update(&md5,data,len);
................................................................................
    
    memset(sum,0,sizeof(sum));
    return hmac;
  }
#endif
  ;

void Hmac_Md5_Update(YOYO_HMAC_MD5 *hmac, void *input, int input_length)
#ifdef _YOYO_MD5_BUILTIN
  {
    Md5_Update(&hmac->md5,input,input_length);






  }
#endif
  ;

void Hmac_Md5_Reset(YOYO_HMAC_MD5 *hmac)
#ifdef _YOYO_MD5_BUILTIN
  {
    Md5_Start(&hmac->md5);
    Md5_Update(&hmac->md5,hmac->ipad,64);
  }
#endif
  ;

void *Hmac_Md5_Finish(YOYO_HMAC_MD5 *hmac, void *digest)
#ifdef _YOYO_MD5_BUILTIN
  {
................................................................................
    Md5_Update(&hmac->md5,tmpb,16);
    memset(tmpb,0,16);
    return Md5_Finish(&hmac->md5,digest);
  }
#endif
  ;










void *Hmac_Md5_Digest(void *data, int len, void *key, int key_len, void *digest)
#ifdef _YOYO_MD5_BUILTIN
  {
    YOYO_HMAC_MD5 hmac5;
    Hmac_Md5_Start(&hmac5,key,key_len);
    Md5_Update(&hmac5.md5,data,len);
    return Hmac_Md5_Finish(&hmac5,digest);
  }
#endif
  ;

void *Hmac_Md5_Init(void *key, int key_len)
#ifdef _YOYO_MD5_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Clone_OjMID, Hmac_Md5_Clone },
        {Oj_Digest_Update_OjMID, Hmac_Md5_Update },
        {0}};
    
    YOYO_HMAC_MD5 *md5 = __Object(sizeof(YOYO_HMAC_MD5),funcs);
    return Hmac_Md5_Start(md5,key,key_len);
  }
#endif
  ;

#endif /* C_once_C5021104_5DB9_4FCC_BAFC_AFB22BD458D3 */

Changes to newdes96.hc.

3
4
5
6
7
8
9
10
















11
12
13
14
15
16
17

//
// NEWDES96 
// Released to the public domain by Robert Scott
// -  Originally published in Cryptologia, Jan. 1985
//

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

//
// NEWDES96 
// Released to the public domain by Robert Scott
// -  Originally published in Cryptologia, Jan. 1985
//

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to pefile.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to pictpng.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to picture.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to prog.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to random.hc.

1
2
3
4
5
















6
7
8
9
10
11
12
13

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person ornd_bcontaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in



|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in

Changes to sha1.hc.

2
3
4
5
6
7
8
9
















10
11
12
13
14
15
16
..
36
37
38
39
40
41
42

43
44
45
46
47
48
49
..
69
70
71
72
73
74
75



76
77
78
79
80
81

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
...
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
...
408
409
410
411
412
413
414















415
416
417
418
419
/*

//
// The SHA-1 standard was published by NIST in 1993.
//   http://www.itl.nist.gov/fipspubs/fip180-1.htm
//

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
#define C_once_1B3E01E2_7457_494E_A17C_3A12388FC4AF

#ifdef _LIBYOYO
#define _YOYO_SHA1_BUILTIN
#endif

#include "yoyo.hc"


typedef struct _YOYO_SHA1
  {
    uint_t state[5];   /* state (ABCDE) */
    uint_t count[2];   /* number of bits, modulo 2^64 (lsb first) */
    int    finished;
    byte_t buffer[64]; /* input buffer */
................................................................................
    sha1->state[3] = 0x10325476;
    sha1->state[4] = 0xc3d2e1f0;
    return sha1;
  }
#endif
  ;




void *Sha1_Init()
#ifdef _YOYO_SHA1_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Clone_OjMID, Sha1_Clone },

        {0}};
    
    YOYO_SHA1 *sha1 = __Object(sizeof(YOYO_SHA1),funcs);
    return Sha1_Start(sha1);
  }
#endif
  ;

void Sha1_Update(YOYO_SHA1 *sha1, void *data, int len);
void *Sha1_Finish(YOYO_SHA1 *sha1, void *digest);

void *Sha1_Digest(void *data, int len, void *digest)
#ifdef _YOYO_SHA1_BUILTIN
  {
    YOYO_SHA1 sha1 = YOYO_SHA1_INITIALIZER;
    Sha1_Update(&sha1,data,len);
    return Sha1_Finish(&sha1,digest);
  }
................................................................................
    
    memset(sum,0,sizeof(sum));
    return hmac;
  }
#endif
  ;

void *Hmac_Sha1_Init(void *key, int key_len)
#ifdef _YOYO_SHA1_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Clone_OjMID, Hmac_Sha1_Clone },
        {0}};
    
    YOYO_HMAC_SHA1 *sha1 = __Object(sizeof(YOYO_HMAC_SHA1),funcs);
    return Hmac_Sha1_Start(sha1,key,key_len);
  }
#endif
  ;

void Hmac_Sha1_Update(YOYO_HMAC_SHA1 *hmac, void *input, int input_length)
#ifdef _YOYO_SHA1_BUILTIN
  {
    Sha1_Update(&hmac->sha1,input,input_length);
  }
#endif
  ;
................................................................................
#ifdef _YOYO_SHA1_BUILTIN
  {
    YOYO_HMAC_SHA1 hmac1;
    Hmac_Sha1_Start(&hmac1,key,key_len);
    Sha1_Update(&hmac1.sha1,data,len);
    return Hmac_Sha1_Finish(&hmac1,digest);
  }















#endif
  ;

#endif /* C_once_1B3E01E2_7457_494E_A17C_3A12388FC4AF */








|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>







 







>
>
>






>








<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
..
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110



111
112
113
114
115
116
117
...
373
374
375
376
377
378
379














380
381
382
383
384
385
386
...
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
/*

//
// The SHA-1 standard was published by NIST in 1993.
//   http://www.itl.nist.gov/fipspubs/fip180-1.htm
//

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
#define C_once_1B3E01E2_7457_494E_A17C_3A12388FC4AF

#ifdef _LIBYOYO
#define _YOYO_SHA1_BUILTIN
#endif

#include "yoyo.hc"
#include "crc.hc"

typedef struct _YOYO_SHA1
  {
    uint_t state[5];   /* state (ABCDE) */
    uint_t count[2];   /* number of bits, modulo 2^64 (lsb first) */
    int    finished;
    byte_t buffer[64]; /* input buffer */
................................................................................
    sha1->state[3] = 0x10325476;
    sha1->state[4] = 0xc3d2e1f0;
    return sha1;
  }
#endif
  ;

void Sha1_Update(YOYO_SHA1 *sha1, void *data, int len);
void *Sha1_Finish(YOYO_SHA1 *sha1, void *digest);

void *Sha1_Init()
#ifdef _YOYO_SHA1_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Clone_OjMID, Sha1_Clone },
        {Oj_Digest_Update_OjMID, Sha1_Update },
        {0}};
    
    YOYO_SHA1 *sha1 = __Object(sizeof(YOYO_SHA1),funcs);
    return Sha1_Start(sha1);
  }
#endif
  ;




void *Sha1_Digest(void *data, int len, void *digest)
#ifdef _YOYO_SHA1_BUILTIN
  {
    YOYO_SHA1 sha1 = YOYO_SHA1_INITIALIZER;
    Sha1_Update(&sha1,data,len);
    return Sha1_Finish(&sha1,digest);
  }
................................................................................
    
    memset(sum,0,sizeof(sum));
    return hmac;
  }
#endif
  ;















void Hmac_Sha1_Update(YOYO_HMAC_SHA1 *hmac, void *input, int input_length)
#ifdef _YOYO_SHA1_BUILTIN
  {
    Sha1_Update(&hmac->sha1,input,input_length);
  }
#endif
  ;
................................................................................
#ifdef _YOYO_SHA1_BUILTIN
  {
    YOYO_HMAC_SHA1 hmac1;
    Hmac_Sha1_Start(&hmac1,key,key_len);
    Sha1_Update(&hmac1.sha1,data,len);
    return Hmac_Sha1_Finish(&hmac1,digest);
  }
#endif
  ;

void *Hmac_Sha1_Init(void *key, int key_len)
#ifdef _YOYO_SHA1_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Clone_OjMID, Hmac_Sha1_Clone },
        {Oj_Digest_Update_OjMID, Hmac_Sha1_Update },
        {0}};
    
    YOYO_HMAC_SHA1 *sha1 = __Object(sizeof(YOYO_HMAC_SHA1),funcs);
    return Hmac_Sha1_Start(sha1,key,key_len);
  }
#endif
  ;

#endif /* C_once_1B3E01E2_7457_494E_A17C_3A12388FC4AF */

Changes to sha2.hc.

2
3
4
5
6
7
8
9
















10
11
12
13
14
15
16
..
36
37
38
39
40
41
42

43
44
45
46
47
48
49
..
70
71
72
73
74
75
76



77
78
79
80
81
82

83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
...
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
...
410
411
412
413
414
415
416















417
418
419
420
421
/*

//
// The SHA-256 Secure Hash Standard was published by NIST in 2002.
//   http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
//

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
#define C_once_18F7EAA7_0DBC_4720_BA4A_7E0B1A9A5B1E

#ifdef _LIBYOYO
#define _YOYO_SHA2_BUILTIN
#endif

#include "yoyo.hc"


typedef struct _YOYO_SHA2
  {
    uint_t state[8];   /* state (ABCDEFGH) */
    uint_t count[2];   /* number of bits, modulo 2^64 (lsb first) */
    int    finished;
    byte_t buffer[64]; /* input buffer */
................................................................................
    sha2->state[6] = 0x1f83d9ab;
    sha2->state[7] = 0x5be0cd19;
    return sha2;
  }
#endif
  ;




void *Sha2_Init()
#ifdef _YOYO_SHA2_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Clone_OjMID, Sha2_Clone },

        {0}};
    
    YOYO_SHA2 *sha2 = __Object(sizeof(YOYO_SHA2),funcs);
    return Sha2_Start(sha2);
  }
#endif
  ;

void Sha2_Update(YOYO_SHA2 *sha2, void *data, int len);
void *Sha2_Finish(YOYO_SHA2 *sha2, void *digest);

#define YOYO_SHA2_INITIALIZER {\
  {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, \
   0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19} \
   ,{0},0,{0}}

void *Sha2_Digest(void *data, int len, void *digest)
#ifdef _YOYO_SHA2_BUILTIN
................................................................................
    
    memset(sum,0,sizeof(sum));
    return hmac;
  }
#endif
  ;

void *Hmac_Sha2_Init(void *key, int key_len)
#ifdef _YOYO_SHA2_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Clone_OjMID, Hmac_Sha2_Clone },
        {0}};
    
    YOYO_HMAC_SHA2 *sha2 = __Object(sizeof(YOYO_HMAC_SHA2),funcs);
    return Hmac_Sha2_Start(sha2,key,key_len);
  }
#endif
  ;

void Hmac_Sha2_Update(YOYO_HMAC_SHA2 *hmac, void *input, int input_length)
#ifdef _YOYO_SHA2_BUILTIN
  {
    Sha2_Update(&hmac->sha2,input,input_length);
  }
#endif
  ;
................................................................................
#ifdef _YOYO_SHA2_BUILTIN
  {
    YOYO_HMAC_SHA2 hmac2;
    Hmac_Sha2_Start(&hmac2,key,key_len);
    Sha2_Update(&hmac2.sha2,data,len);
    return Hmac_Sha2_Finish(&hmac2,digest);
  }















#endif
  ;

#endif /* C_once_18F7EAA7_0DBC_4720_BA4A_7E0B1A9A5B1E */








|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>







 







>
>
>






>








<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>





2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
..
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111



112
113
114
115
116
117
118
...
375
376
377
378
379
380
381














382
383
384
385
386
387
388
...
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
/*

//
// The SHA-256 Secure Hash Standard was published by NIST in 2002.
//   http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf
//

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
#define C_once_18F7EAA7_0DBC_4720_BA4A_7E0B1A9A5B1E

#ifdef _LIBYOYO
#define _YOYO_SHA2_BUILTIN
#endif

#include "yoyo.hc"
#include "crc.hc"

typedef struct _YOYO_SHA2
  {
    uint_t state[8];   /* state (ABCDEFGH) */
    uint_t count[2];   /* number of bits, modulo 2^64 (lsb first) */
    int    finished;
    byte_t buffer[64]; /* input buffer */
................................................................................
    sha2->state[6] = 0x1f83d9ab;
    sha2->state[7] = 0x5be0cd19;
    return sha2;
  }
#endif
  ;

void Sha2_Update(YOYO_SHA2 *sha2, void *data, int len);
void *Sha2_Finish(YOYO_SHA2 *sha2, void *digest);

void *Sha2_Init()
#ifdef _YOYO_SHA2_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Clone_OjMID, Sha2_Clone },
        {Oj_Digest_Update_OjMID, Sha2_Update },
        {0}};
    
    YOYO_SHA2 *sha2 = __Object(sizeof(YOYO_SHA2),funcs);
    return Sha2_Start(sha2);
  }
#endif
  ;




#define YOYO_SHA2_INITIALIZER {\
  {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, \
   0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19} \
   ,{0},0,{0}}

void *Sha2_Digest(void *data, int len, void *digest)
#ifdef _YOYO_SHA2_BUILTIN
................................................................................
    
    memset(sum,0,sizeof(sum));
    return hmac;
  }
#endif
  ;















void Hmac_Sha2_Update(YOYO_HMAC_SHA2 *hmac, void *input, int input_length)
#ifdef _YOYO_SHA2_BUILTIN
  {
    Sha2_Update(&hmac->sha2,input,input_length);
  }
#endif
  ;
................................................................................
#ifdef _YOYO_SHA2_BUILTIN
  {
    YOYO_HMAC_SHA2 hmac2;
    Hmac_Sha2_Start(&hmac2,key,key_len);
    Sha2_Update(&hmac2.sha2,data,len);
    return Hmac_Sha2_Finish(&hmac2,digest);
  }
#endif
  ;

void *Hmac_Sha2_Init(void *key, int key_len)
#ifdef _YOYO_SHA2_BUILTIN
  {
    static YOYO_FUNCTABLE funcs[] = 
      { {0},
        {Oj_Clone_OjMID, Hmac_Sha2_Clone },
        {Oj_Digest_Update_OjMID, Hmac_Sha2_Update },
        {0}};
    
    YOYO_HMAC_SHA2 *sha2 = __Object(sizeof(YOYO_HMAC_SHA2),funcs);
    return Hmac_Sha2_Start(sha2,key,key_len);
  }
#endif
  ;

#endif /* C_once_18F7EAA7_0DBC_4720_BA4A_7E0B1A9A5B1E */

Changes to string.hc.

1
2
3
4
















5
6
7
8
9
10
11
....
1618
1619
1620
1621
1622
1623
1624

































1625
1626
1627
1628
1629
1630
1631

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
#endif
  ;

#define Str_Ansi_Upper(S,L) ((char*)__Pool(Str_Ansi_Upper_Npl(S,L)))
#define Str_Ansi_Upper_Npl(S,L) Str_Ansi_Transform_Npl(S,L,(void*)toupper)
#define Str_Ansi_Lower(S,L) ((char*)__Pool(Str_Ansi_Lower_Npl(S,L)))
#define Str_Ansi_Lower_Npl(S,L) Str_Ansi_Transform_Npl(S,L,(void*)tolower)


































char *Str_Safe_Oneline_Quote(char *S)
#ifdef _YOYO_STRING_BUILTIN  
  {
    int S_len = S? strlen(S):0;
    int R_count = 0;
    int R_capacity = S_len+1;



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
....
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
#endif
  ;

#define Str_Ansi_Upper(S,L) ((char*)__Pool(Str_Ansi_Upper_Npl(S,L)))
#define Str_Ansi_Upper_Npl(S,L) Str_Ansi_Transform_Npl(S,L,(void*)toupper)
#define Str_Ansi_Lower(S,L) ((char*)__Pool(Str_Ansi_Lower_Npl(S,L)))
#define Str_Ansi_Lower_Npl(S,L) Str_Ansi_Transform_Npl(S,L,(void*)tolower)

char *Str_Utf8_Transform_Npl(char *S, int L, wchar_t (*transform)(wchar_t) )
#ifdef _YOYO_STRING_BUILTIN  
  {
    char *E, *R = 0;
    int R_capacity = 1;
    int R_count = 0;
    
    if ( S )
      {
        if ( L < 0 ) L = strlen(S);
        R_capacity = L+1;
        for( E = S+L; S < E; ) 
          { 
            int wc_L = 0;
            byte_t b[8];
            wchar_t wc = Utf8_Get_Wide(&S); 
            wc = transform(wc);
            Utf8_Wide_Encode(b,wc,&wc_L);
            R_count += __Elm_Append_Npl(&R,R_count,b,1,wc_L,&R_capacity);
          }
      }
    
    __Elm_Append_Npl(&R,R_count,"\0",1,1,&R_capacity);
    return R;
  }
#endif
  ;
  
#define Str_Utf8_Upper(S,L) ((char*)__Pool(Str_Utf8_Upper_Npl(S,L)))
#define Str_Utf8_Upper_Npl(S,L) Str_Utf8_Transform_Npl(S,L,(void*)towupper)
#define Str_Utf8_Lower(S,L) ((char*)__Pool(Str_Utf8_Lower_Npl(S,L)))
#define Str_Utf8_Lower_Npl(S,L) Str_Utf8_Transform_Npl(S,L,(void*)towlower)

char *Str_Safe_Oneline_Quote(char *S)
#ifdef _YOYO_STRING_BUILTIN  
  {
    int S_len = S? strlen(S):0;
    int R_count = 0;
    int R_capacity = S_len+1;

Changes to tests/aes.c.

1
2

3

4
5
6
7
8
9
10



#include "../libyoyo.hc"


int main(int argc, char **argv)
  {
    YOYO_AES ctxe, ctxd;
    YOYO_BUFFER *bf, *bbf, *bbbf;
    char passwd[] = "1234567\0\0\0\0";
    byte_t sign[32] = {0};

<
>

>







1

2
3
4
5
6
7
8
9
10
11


#define _LIBYOYO
#include "../libyoyo.hc"
#include "../libcrypt.hc"

int main(int argc, char **argv)
  {
    YOYO_AES ctxe, ctxd;
    YOYO_BUFFER *bf, *bbf, *bbbf;
    char passwd[] = "1234567\0\0\0\0";
    byte_t sign[32] = {0};

Changes to tests/sha1.c.

1

2

3
4
5
6
7
8
9


#include "../libyoyo.hc"


/*
 * FIPS-180-1 test vectors
 */
byte_t Data_Buf[3][57] = 
{
    { "abc" },

>

>







1
2
3
4
5
6
7
8
9
10
11

#define _LIBYOYO
#include "../libyoyo.hc"
#include "../libcrypt.hc"

/*
 * FIPS-180-1 test vectors
 */
byte_t Data_Buf[3][57] = 
{
    { "abc" },

Changes to tests/sha2.c.

1

2

3
4
5
6
7
8
9


#include "../libyoyo.hc"


byte_t Data_Buf[3][57] = 
  {
    { "abc" },
    { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" },
    { "" }
  };

>

>







1
2
3
4
5
6
7
8
9
10
11

#define _LIBYOYO
#include "../libyoyo.hc"
#include "../libcrypt.hc"

byte_t Data_Buf[3][57] = 
  {
    { "abc" },
    { "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" },
    { "" }
  };

Changes to uname.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2005-2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2005-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to winlpc.hc.

1
2
3
4
















5
6
7
8
9
10
11
..
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.

Thanks to Leoshkevich Ilya for his RSDN article http://www.rsdn.ru/article/baseserv/lpc.xml
It was very helpfull!

*/

#ifndef C_once_37ADA665_BE0A_456F_9491_3A81B3EB8980
#define C_once_37ADA665_BE0A_456F_9491_3A81B3EB8980

#include "yoyo.hc"



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.

// Thanks to Leoshkevich Ilya for his RSDN article http://www.rsdn.ru/article/baseserv/lpc.xml
// It was very helpfull!

*/

#ifndef C_once_37ADA665_BE0A_456F_9491_3A81B3EB8980
#define C_once_37ADA665_BE0A_456F_9491_3A81B3EB8980

#include "yoyo.hc"

Changes to winlpc.inc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to winreg.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to x86dis.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2005-2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2005-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to xdata.hc.

1
2
3
4
















5
6
7
8
9
10
11
..
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Except as contained in this notice, the tag of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.

*/

#ifndef C_once_E46D6A8A_889E_4AE9_9F89_5B0AB5263C95
#define C_once_E46D6A8A_889E_4AE9_9F89_5B0AB5263C95



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Except as contained in this notice, the name of a copyright holder shall not
be used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization of the copyright holder.

*/

#ifndef C_once_E46D6A8A_889E_4AE9_9F89_5B0AB5263C95
#define C_once_E46D6A8A_889E_4AE9_9F89_5B0AB5263C95

Changes to xntdef.hc.

1
2
3
4
















5
6
7
8
9
10
11

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

Changes to yoyo.hc.

1
2
3
4
















5
6
7
8
9
10
11
...
293
294
295
296
297
298
299


300
301
302
303
304
305
306
...
420
421
422
423
424
425
426

427
428
429
430

431
432
433
434
435
436
437
...
445
446
447
448
449
450
451

























452
453
454
455
456
457
458
...
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
...
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
....
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
....
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
....
1780
1781
1782
1783
1784
1785
1786
































1787
1788
1789
1790
1791
1792
1793

1794
1795
1796

1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807

1808
1809
1810

1811
1812
1813
1814


1815
1816
1817
1818
1819
1820
1821

/*

(C)2011, Alexéy Sudáchen, alexey@sudachen.name

















Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
    YOYO_ERROR_ALREADY_EXISTS   = YOYO_IO_ERROR_GROUP|(YOYO_ERROR_BASE+24),
    YOYO_ERROR_INCONSISTENT     = YOYO_STORAGE_ERROR_GROUP|(YOYO_ERROR_BASE+25),
    YOYO_ERROR_TO_BIG           = YOYO_STORAGE_ERROR_GROUP|(YOYO_ERROR_BASE+26),
    YOYO_ERROR_ZERODIVIDE       = YOYO_FATAL_ERROR_GROUP|(YOYO_ERROR_BASE+27),
    YOYO_ERROR_LIMIT_REACHED    = YOYO_RUNTIME_ERROR_GROUP|(YOYO_ERROR_BASE+28),
    YOYO_ERROR_UNSUPPORTED      = YOYO_RUNTIME_ERROR_GROUP|(YOYO_ERROR_BASE+29),
    YOYO_ERROR_IO_EOF           = YOYO_IO_ERROR_GROUP|(YOYO_ERROR_BASE+30),


  };

#define YOYO_ERROR_IS_USER_ERROR(err) !(err&YOYO_XXXX_ERROR_GROUP)

enum _YOYO_FLAGS
  {
    YO_RAISE_ERROR            = 0x70000000,
................................................................................

#if defined __i386 || defined __x86_64
#define Four_To_Unsigned(Four)  (*(uint_t*)(Four))
#else
uint_t Four_To_Unsigned(void *b)
#ifdef _YOYO_CORE_BUILTIN
  {

    uint_t q =   (unsigned int)((unsigned char*)b)[0]
              | ((unsigned int)((unsigned char*)b)[1] << 8)
              | ((unsigned int)((unsigned char*)b)[2] << 16)
              | ((unsigned int)((unsigned char*)b)[3] << 24);

    return q;
  }
#endif
  ;
#endif

#if defined __i386 || defined __x86_64
................................................................................
    p[1] = (byte_t)(q>>8);
    p[2] = (byte_t)(q>>16);
    p[3] = (byte_t)(q>>24);
  }
#endif
  ;
#endif


























uint_t Two_To_Unsigned(void *b)
#ifdef _YOYO_CORE_BUILTIN
  {
    uint_t q =   (unsigned int)((unsigned char*)b)[0]
              | ((unsigned int)((unsigned char*)b)[1] << 8);
    return q;
................................................................................
          }
      }
    return pooled;
  }
#endif
  ;

void *Yo_Unwind_Scope(void *pooled,int min_top)
#ifdef _YOYO_CORE_BUILTIN
  {
    YOYO_C_SUPPORT_INFO *nfo = Yo_Tls_Get(Yo_Csup_Nfo_Tls);
    int L = min_top>=0?min_top:0;
    int counter = 0;
    if ( nfo )
      {
        YOYO_AUTORELEASE *q_p = 0;
        nfo->stats.unwinding = 1;
        while ( nfo->auto_top >= L )
          {
            YOYO_AUTORELEASE *q = &nfo->auto_pool[nfo->auto_top];
            STRICT_REQUIRE(nfo->auto_top <= nfo->auto_count);
            if ( q->ptr )
              {
                //printf("%p/%p ?= %p\n", q->ptr, q->cleanup, pooled);
                if ( !pooled || q->ptr != pooled )
                  { 
                    q->cleanup(q->ptr);
                    ++counter;
                  }
                else
                  q_p = q;
              }
            --nfo->auto_top;
            if ( q->cleanup == Yo_Pool_Marker_Tag && !min_top )
              break;
          }
        REQUIRE(nfo->auto_top < nfo->auto_count);
        if ( q_p )
          {
            ++nfo->auto_top;
            nfo->auto_pool[nfo->auto_top] = *q_p;
................................................................................
#endif
  ;

void Yo_Thread_Cleanup()
#ifdef _YOYO_CORE_BUILTIN
  {
    YOYO_C_SUPPORT_INFO *nfo;
    Yo_Unwind_Scope(0,-1);
    if ( !!(nfo = Yo_Tls_Get(Yo_Csup_Nfo_Tls)) )
      {
        free(nfo->err.msg);
        free(nfo->auto_pool);
        free(nfo);
        Yo_Tls_Set(Yo_Csup_Nfo_Tls,0);
      }
................................................................................
            free( old_msg );
          }
          
        for ( i = YOYO_MAX_CS_COUNT-1; i >= 0; --i ) 
          if (  locks[i].cs ) 
            locks[i].unlock(locks[i].cs);
        
        Yo_Unwind_Scope(0,nfo->jb[nfo->jb_top].auto_top);
        
        --nfo->jb_top;
        STRICT_REQUIRE(nfo->jb_top >= -1);
        
      #ifdef _TRACEXPT
        StdErr_Print_Nl(Yo_Btrace());
      #endif  
................................................................................
      StdErr_Print_Nl(Yo_Format(__yoTa("\n%s: %s",0),(pfx?pfx:__yoTa("error",0)),msg));
    else if ( YOYO_ERROR_IS_USER_ERROR(code) )
      StdErr_Print_Nl(Yo_Format(__yoTa("\n%s(%d): %s",0),(pfx?pfx:__yoTa("error",0)),code,msg));
    else
      StdErr_Print_Nl(Yo_Format(__yoTa("\n%s(%08x): %s",0),(pfx?pfx:__yoTa("error",0)),code,msg));
    if ( code & YOYO_FATAL_ERROR_GROUP )
      abort();
    Yo_Unwind_Scope(0,-1);
    exit(code);
  }
#endif
  ;

#define __Pool(Ptr)                     Yo_Pool_Ptr(Ptr,0)
#define __Pool_Ptr(Ptr,Free)            Yo_Pool_Ptr(Ptr,Free)
................................................................................

#define __Atomic_Increment(Ptr)         Yo_Atomic_Increment(Ptr)
#define __Atomic_Decrement(Ptr)         Yo_Atomic_Decrement(Ptr)
#define __Tls_Define(Name)              YO_TLS_DEDINE(Name)
#define __Tls_Declare(Name)             YO_TLS_DECLARE(Name)
#define __Tls_Set(Name,Val)             Yo_Tls_Set(Name,Val)
#define __Tls_Get(Name)                 Yo_Tls_Get(Name)

































#define __Auto_Release \
  switch ( 0 ) \
    if ( 0 ); else \
      while ( 1 ) \
        if ( 1 ) \
          { \

            Yo_Unwind_Scope(0,0); \
            break; \
          case 0: Yo_Push_Scope(); \

            goto YOYO_LOCAL_ID(Body);\
          } \
        else \
          YOYO_LOCAL_ID(Body):

#define __Auto_Ptr(Ptr) \
  switch ( 0 ) \
    if ( 0 ); else \
      while ( 1 ) \
        if ( 1 ) \
          { \

            Yo_Unwind_Scope(Ptr,0); \
            break; \
          case 0: Yo_Push_Scope(); \

            goto YOYO_LOCAL_ID(Body);\
          } \
        else \
          YOYO_LOCAL_ID(Body):



#define __Interlock_Opt(Decl,Lx,Lock,Unlock,Unlock_Proc) \
  switch ( 0 ) \
    while ( 1 ) \
      if ( 1 ) \
        goto YOYO_LOCAL_ID(Do_Unlock); \
      else if ( 1 ) \



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>







 







>
|
<
|
|
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|




|








|
|
|



|





|







 







|







 







|







 







|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







>
|

<
>











>
|

<
>




>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
...
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
...
438
439
440
441
442
443
444
445
446

447
448
449
450
451
452
453
454
455
456
...
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
...
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
...
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
....
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
....
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
....
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872

1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887

1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901

/*

Copyright © 2010-2011, Alexéy Sudáchen, alexey@sudachen.name, Chile

In USA, UK, Japan and other countries allowing software patents:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    http://www.gnu.org/licenses/

Otherwise:

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
................................................................................
    YOYO_ERROR_ALREADY_EXISTS   = YOYO_IO_ERROR_GROUP|(YOYO_ERROR_BASE+24),
    YOYO_ERROR_INCONSISTENT     = YOYO_STORAGE_ERROR_GROUP|(YOYO_ERROR_BASE+25),
    YOYO_ERROR_TO_BIG           = YOYO_STORAGE_ERROR_GROUP|(YOYO_ERROR_BASE+26),
    YOYO_ERROR_ZERODIVIDE       = YOYO_FATAL_ERROR_GROUP|(YOYO_ERROR_BASE+27),
    YOYO_ERROR_LIMIT_REACHED    = YOYO_RUNTIME_ERROR_GROUP|(YOYO_ERROR_BASE+28),
    YOYO_ERROR_UNSUPPORTED      = YOYO_RUNTIME_ERROR_GROUP|(YOYO_ERROR_BASE+29),
    YOYO_ERROR_IO_EOF           = YOYO_IO_ERROR_GROUP|(YOYO_ERROR_BASE+30),
    YOYO_ERROR_DNS              = YOYO_IO_ERROR_GROUP|(YOYO_ERROR_BASE+31),
    YOYO_ERROR_SUBSYSTEM_INIT   = YOYO_RUNTIME_ERROR_GROUP|(YOYO_ERROR_BASE+32),
  };

#define YOYO_ERROR_IS_USER_ERROR(err) !(err&YOYO_XXXX_ERROR_GROUP)

enum _YOYO_FLAGS
  {
    YO_RAISE_ERROR            = 0x70000000,
................................................................................

#if defined __i386 || defined __x86_64
#define Four_To_Unsigned(Four)  (*(uint_t*)(Four))
#else
uint_t Four_To_Unsigned(void *b)
#ifdef _YOYO_CORE_BUILTIN
  {
    byte_t *p = b;
    uint_t q =   p[0]

              |  (p[1] << 8)
              |  (p[2] << 16)
              |  (p[3] << 24);
    return q;
  }
#endif
  ;
#endif

#if defined __i386 || defined __x86_64
................................................................................
    p[1] = (byte_t)(q>>8);
    p[2] = (byte_t)(q>>16);
    p[3] = (byte_t)(q>>24);
  }
#endif
  ;
#endif

uint_t Four_To_Unsigned_BE(void *b)
#ifdef _YOYO_CORE_BUILTIN
  {
    byte_t *p = b;
    uint_t q =   p[3]
              |  (p[2] << 8)
              |  (p[1] << 16)
              |  (p[0] << 24);
    return q;
  }
#endif
  ;

void Unsigned_To_Four_BE(uint_t q, void *b)
#ifdef _YOYO_CORE_BUILTIN
  {
    byte_t *p = b;
    p[3] = (byte_t)q;
    p[2] = (byte_t)(q>>8);
    p[1] = (byte_t)(q>>16);
    p[0] = (byte_t)(q>>24);
  }
#endif
  ;

uint_t Two_To_Unsigned(void *b)
#ifdef _YOYO_CORE_BUILTIN
  {
    uint_t q =   (unsigned int)((unsigned char*)b)[0]
              | ((unsigned int)((unsigned char*)b)[1] << 8);
    return q;
................................................................................
          }
      }
    return pooled;
  }
#endif
  ;

void *Yo_Unwind_Scope(void *pooled,int min_top,void *mark)
#ifdef _YOYO_CORE_BUILTIN
  {
    YOYO_C_SUPPORT_INFO *nfo = Yo_Tls_Get(Yo_Csup_Nfo_Tls);
    int L = min_top>=0?min_top:0;
    //int counter = 0;
    if ( nfo )
      {
        YOYO_AUTORELEASE *q_p = 0;
        nfo->stats.unwinding = 1;
        while ( nfo->auto_top >= L )
          {
            YOYO_AUTORELEASE *q = &nfo->auto_pool[nfo->auto_top];
            STRICT_REQUIRE(nfo->auto_top <= nfo->auto_count);
            //printf("ptr: %p, cleanup: %p ?= pooled: %p, mark: %p\n", q->ptr, q->cleanup, pooled, mark);
            if ( q->ptr && (q->cleanup != Yo_Pool_Marker_Tag) )
              {
                if ( !pooled || q->ptr != pooled )
                  { 
                    q->cleanup(q->ptr);
                    //++counter;
                  }
                else
                  q_p = q;
              }
            --nfo->auto_top;
            if ( q->cleanup == Yo_Pool_Marker_Tag && !min_top && mark == q->ptr )
              break;
          }
        REQUIRE(nfo->auto_top < nfo->auto_count);
        if ( q_p )
          {
            ++nfo->auto_top;
            nfo->auto_pool[nfo->auto_top] = *q_p;
................................................................................
#endif
  ;

void Yo_Thread_Cleanup()
#ifdef _YOYO_CORE_BUILTIN
  {
    YOYO_C_SUPPORT_INFO *nfo;
    Yo_Unwind_Scope(0,-1,0);
    if ( !!(nfo = Yo_Tls_Get(Yo_Csup_Nfo_Tls)) )
      {
        free(nfo->err.msg);
        free(nfo->auto_pool);
        free(nfo);
        Yo_Tls_Set(Yo_Csup_Nfo_Tls,0);
      }
................................................................................
            free( old_msg );
          }
          
        for ( i = YOYO_MAX_CS_COUNT-1; i >= 0; --i ) 
          if (  locks[i].cs ) 
            locks[i].unlock(locks[i].cs);
        
        Yo_Unwind_Scope(0,nfo->jb[nfo->jb_top].auto_top,0);
        
        --nfo->jb_top;
        STRICT_REQUIRE(nfo->jb_top >= -1);
        
      #ifdef _TRACEXPT
        StdErr_Print_Nl(Yo_Btrace());
      #endif  
................................................................................
      StdErr_Print_Nl(Yo_Format(__yoTa("\n%s: %s",0),(pfx?pfx:__yoTa("error",0)),msg));
    else if ( YOYO_ERROR_IS_USER_ERROR(code) )
      StdErr_Print_Nl(Yo_Format(__yoTa("\n%s(%d): %s",0),(pfx?pfx:__yoTa("error",0)),code,msg));
    else
      StdErr_Print_Nl(Yo_Format(__yoTa("\n%s(%08x): %s",0),(pfx?pfx:__yoTa("error",0)),code,msg));
    if ( code & YOYO_FATAL_ERROR_GROUP )
      abort();
    Yo_Unwind_Scope(0,-1,0);
    exit(code);
  }
#endif
  ;

#define __Pool(Ptr)                     Yo_Pool_Ptr(Ptr,0)
#define __Pool_Ptr(Ptr,Free)            Yo_Pool_Ptr(Ptr,Free)
................................................................................

#define __Atomic_Increment(Ptr)         Yo_Atomic_Increment(Ptr)
#define __Atomic_Decrement(Ptr)         Yo_Atomic_Decrement(Ptr)
#define __Tls_Define(Name)              YO_TLS_DEDINE(Name)
#define __Tls_Declare(Name)             YO_TLS_DECLARE(Name)
#define __Tls_Set(Name,Val)             Yo_Tls_Set(Name,Val)
#define __Tls_Get(Name)                 Yo_Tls_Get(Name)

#ifdef _STRONGPOOL

#define __Auto_Release \
  switch ( 0 ) \
    if ( 0 ); else \
      while ( 1 ) \
        if ( 1 ) \
          { \
            Yo_Unwind_Scope(0,0,0); \
            break; \
          case 0: Yo_Push_Scope(); \
            goto YOYO_LOCAL_ID(Body);\
          } \
        else \
          YOYO_LOCAL_ID(Body):

#define __Auto_Ptr(Ptr) \
  switch ( 0 ) \
    if ( 0 ); else \
      while ( 1 ) \
        if ( 1 ) \
          { \
            Yo_Unwind_Scope(Ptr,0,0); \
            break; \
          case 0: Yo_Push_Scope(); \
            goto YOYO_LOCAL_ID(Body);\
          } \
        else \
          YOYO_LOCAL_ID(Body):

#else

#define __Auto_Release \
  switch ( 0 ) \
    if ( 0 ); else \
      while ( 1 ) \
        if ( 1 ) \
          { \
            int YOYO_LOCAL_ID(Mark); \
            Yo_Unwind_Scope(0,0,&YOYO_LOCAL_ID(Mark)); \
            break; \

          case 0: Yo_Pool_Ptr(&YOYO_LOCAL_ID(Mark),Yo_Pool_Marker_Tag); \
            goto YOYO_LOCAL_ID(Body);\
          } \
        else \
          YOYO_LOCAL_ID(Body):

#define __Auto_Ptr(Ptr) \
  switch ( 0 ) \
    if ( 0 ); else \
      while ( 1 ) \
        if ( 1 ) \
          { \
            int YOYO_LOCAL_ID(Mark); \
            Yo_Unwind_Scope(Ptr,0,&YOYO_LOCAL_ID(Mark)); \
            break; \

          case 0: Yo_Pool_Ptr(&YOYO_LOCAL_ID(Mark),Yo_Pool_Marker_Tag); \
            goto YOYO_LOCAL_ID(Body);\
          } \
        else \
          YOYO_LOCAL_ID(Body):

#endif /* _STRONGPOOL */

#define __Interlock_Opt(Decl,Lx,Lock,Unlock,Unlock_Proc) \
  switch ( 0 ) \
    while ( 1 ) \
      if ( 1 ) \
        goto YOYO_LOCAL_ID(Do_Unlock); \
      else if ( 1 ) \