6161#define BLFRND (s ,p ,i ,j ,n ) (i ^= F(s,j) ^ (p)[n])
6262
6363void
64- Blowfish_encipher (blf_ctx * c , u_int32_t * x )
64+ Vapor_Blowfish_encipher (blf_ctx * c , u_int32_t * x )
6565{
6666 u_int32_t Xl ;
6767 u_int32_t Xr ;
@@ -86,7 +86,7 @@ Blowfish_encipher(blf_ctx *c, u_int32_t *x)
8686}
8787
8888void
89- Blowfish_decipher (blf_ctx * c , u_int32_t * x )
89+ Vapor_Blowfish_decipher (blf_ctx * c , u_int32_t * x )
9090{
9191 u_int32_t Xl ;
9292 u_int32_t Xr ;
@@ -111,7 +111,7 @@ Blowfish_decipher(blf_ctx *c, u_int32_t *x)
111111}
112112
113113void
114- Blowfish_initstate (blf_ctx * c )
114+ Vapor_Blowfish_initstate (blf_ctx * c )
115115{
116116 /* P-box and S-box tables initialized with digits of Pi */
117117
@@ -391,8 +391,8 @@ Blowfish_initstate(blf_ctx *c)
391391}
392392
393393u_int32_t
394- Blowfish_stream2word (const u_int8_t * data , u_int16_t databytes ,
395- u_int16_t * current )
394+ Vapor_Blowfish_stream2word (const u_int8_t * data , u_int16_t databytes ,
395+ u_int16_t * current )
396396{
397397 u_int8_t i ;
398398 u_int16_t j ;
@@ -412,7 +412,7 @@ Blowfish_stream2word(const u_int8_t *data, u_int16_t databytes,
412412}
413413
414414void
415- Blowfish_expand0state (blf_ctx * c , const u_int8_t * key , u_int16_t keybytes )
415+ Vapor_Blowfish_expand0state (blf_ctx * c , const u_int8_t * key , u_int16_t keybytes )
416416{
417417 u_int16_t i ;
418418 u_int16_t j ;
@@ -423,23 +423,23 @@ Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes)
423423 j = 0 ;
424424 for (i = 0 ; i < BLF_N + 2 ; i ++ ) {
425425 /* Extract 4 int8 to 1 int32 from keystream */
426- temp = Blowfish_stream2word (key , keybytes , & j );
426+ temp = Vapor_Blowfish_stream2word (key , keybytes , & j );
427427 c -> P [i ] = c -> P [i ] ^ temp ;
428428 }
429429
430430 j = 0 ;
431431 data [0 ] = 0x00000000 ;
432432 data [1 ] = 0x00000000 ;
433433 for (i = 0 ; i < BLF_N + 2 ; i += 2 ) {
434- Blowfish_encipher (c , data );
434+ Vapor_Blowfish_encipher (c , data );
435435
436436 c -> P [i ] = data [0 ];
437437 c -> P [i + 1 ] = data [1 ];
438438 }
439439
440440 for (i = 0 ; i < 4 ; i ++ ) {
441441 for (k = 0 ; k < 256 ; k += 2 ) {
442- Blowfish_encipher (c , data );
442+ Vapor_Blowfish_encipher (c , data );
443443
444444 c -> S [i ][k ] = data [0 ];
445445 c -> S [i ][k + 1 ] = data [1 ];
@@ -449,8 +449,8 @@ Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes)
449449
450450
451451void
452- Blowfish_expandstate (blf_ctx * c , const u_int8_t * data , u_int16_t databytes ,
453- const u_int8_t * key , u_int16_t keybytes )
452+ Vapor_Blowfish_expandstate (blf_ctx * c , const u_int8_t * data , u_int16_t databytes ,
453+ const u_int8_t * key , u_int16_t keybytes )
454454{
455455 u_int16_t i ;
456456 u_int16_t j ;
@@ -461,27 +461,27 @@ Blowfish_expandstate(blf_ctx *c, const u_int8_t *data, u_int16_t databytes,
461461 j = 0 ;
462462 for (i = 0 ; i < BLF_N + 2 ; i ++ ) {
463463 /* Extract 4 int8 to 1 int32 from keystream */
464- temp = Blowfish_stream2word (key , keybytes , & j );
464+ temp = Vapor_Blowfish_stream2word (key , keybytes , & j );
465465 c -> P [i ] = c -> P [i ] ^ temp ;
466466 }
467467
468468 j = 0 ;
469469 d [0 ] = 0x00000000 ;
470470 d [1 ] = 0x00000000 ;
471471 for (i = 0 ; i < BLF_N + 2 ; i += 2 ) {
472- d [0 ] ^= Blowfish_stream2word (data , databytes , & j );
473- d [1 ] ^= Blowfish_stream2word (data , databytes , & j );
474- Blowfish_encipher (c , d );
472+ d [0 ] ^= Vapor_Blowfish_stream2word (data , databytes , & j );
473+ d [1 ] ^= Vapor_Blowfish_stream2word (data , databytes , & j );
474+ Vapor_Blowfish_encipher (c , d );
475475
476476 c -> P [i ] = d [0 ];
477477 c -> P [i + 1 ] = d [1 ];
478478 }
479479
480480 for (i = 0 ; i < 4 ; i ++ ) {
481481 for (k = 0 ; k < 256 ; k += 2 ) {
482- d [0 ]^= Blowfish_stream2word (data , databytes , & j );
483- d [1 ] ^= Blowfish_stream2word (data , databytes , & j );
484- Blowfish_encipher (c , d );
482+ d [0 ] ^= Vapor_Blowfish_stream2word (data , databytes , & j );
483+ d [1 ] ^= Vapor_Blowfish_stream2word (data , databytes , & j );
484+ Vapor_Blowfish_encipher (c , d );
485485
486486 c -> S [i ][k ] = d [0 ];
487487 c -> S [i ][k + 1 ] = d [1 ];
@@ -491,43 +491,43 @@ Blowfish_expandstate(blf_ctx *c, const u_int8_t *data, u_int16_t databytes,
491491}
492492
493493void
494- blf_key (blf_ctx * c , const u_int8_t * k , u_int16_t len )
494+ vapor_blf_key (blf_ctx * c , const u_int8_t * k , u_int16_t len )
495495{
496496 /* Initialize S-boxes and subkeys with Pi */
497- Blowfish_initstate (c );
497+ Vapor_Blowfish_initstate (c );
498498
499499 /* Transform S-boxes and subkeys with key */
500- Blowfish_expand0state (c , k , len );
500+ Vapor_Blowfish_expand0state (c , k , len );
501501}
502502
503503void
504- blf_enc (blf_ctx * c , u_int32_t * data , u_int16_t blocks )
504+ vapor_blf_enc (blf_ctx * c , u_int32_t * data , u_int16_t blocks )
505505{
506506 u_int32_t * d ;
507507 u_int16_t i ;
508508
509509 d = data ;
510510 for (i = 0 ; i < blocks ; i ++ ) {
511- Blowfish_encipher (c , d );
511+ Vapor_Blowfish_encipher (c , d );
512512 d += 2 ;
513513 }
514514}
515515
516516void
517- blf_dec (blf_ctx * c , u_int32_t * data , u_int16_t blocks )
517+ vapor_blf_dec (blf_ctx * c , u_int32_t * data , u_int16_t blocks )
518518{
519519 u_int32_t * d ;
520520 u_int16_t i ;
521521
522522 d = data ;
523523 for (i = 0 ; i < blocks ; i ++ ) {
524- Blowfish_decipher (c , d );
524+ Vapor_Blowfish_decipher (c , d );
525525 d += 2 ;
526526 }
527527}
528528
529529void
530- blf_ecb_encrypt (blf_ctx * c , u_int8_t * data , u_int32_t len )
530+ vapor_blf_ecb_encrypt (blf_ctx * c , u_int8_t * data , u_int32_t len )
531531{
532532 u_int32_t l , r , d [2 ];
533533 u_int32_t i ;
@@ -537,7 +537,7 @@ blf_ecb_encrypt(blf_ctx *c, u_int8_t *data, u_int32_t len)
537537 r = data [4 ] << 24 | data [5 ] << 16 | data [6 ] << 8 | data [7 ];
538538 d [0 ] = l ;
539539 d [1 ] = r ;
540- Blowfish_encipher (c , d );
540+ Vapor_Blowfish_encipher (c , d );
541541 l = d [0 ];
542542 r = d [1 ];
543543 data [0 ] = l >> 24 & 0xff ;
@@ -553,7 +553,7 @@ blf_ecb_encrypt(blf_ctx *c, u_int8_t *data, u_int32_t len)
553553}
554554
555555void
556- blf_ecb_decrypt (blf_ctx * c , u_int8_t * data , u_int32_t len )
556+ vapor_blf_ecb_decrypt (blf_ctx * c , u_int8_t * data , u_int32_t len )
557557{
558558 u_int32_t l , r , d [2 ];
559559 u_int32_t i ;
@@ -563,7 +563,7 @@ blf_ecb_decrypt(blf_ctx *c, u_int8_t *data, u_int32_t len)
563563 r = data [4 ] << 24 | data [5 ] << 16 | data [6 ] << 8 | data [7 ];
564564 d [0 ] = l ;
565565 d [1 ] = r ;
566- Blowfish_decipher (c , d );
566+ Vapor_Blowfish_decipher (c , d );
567567 l = d [0 ];
568568 r = d [1 ];
569569 data [0 ] = l >> 24 & 0xff ;
@@ -579,7 +579,7 @@ blf_ecb_decrypt(blf_ctx *c, u_int8_t *data, u_int32_t len)
579579}
580580
581581void
582- blf_cbc_encrypt (blf_ctx * c , u_int8_t * iv , u_int8_t * data , u_int32_t len )
582+ vapor_blf_cbc_encrypt (blf_ctx * c , u_int8_t * iv , u_int8_t * data , u_int32_t len )
583583{
584584 u_int32_t l , r , d [2 ];
585585 u_int32_t i , j ;
@@ -591,7 +591,7 @@ blf_cbc_encrypt(blf_ctx *c, u_int8_t *iv, u_int8_t *data, u_int32_t len)
591591 r = data [4 ] << 24 | data [5 ] << 16 | data [6 ] << 8 | data [7 ];
592592 d [0 ] = l ;
593593 d [1 ] = r ;
594- Blowfish_encipher (c , d );
594+ Vapor_Blowfish_encipher (c , d );
595595 l = d [0 ];
596596 r = d [1 ];
597597 data [0 ] = l >> 24 & 0xff ;
@@ -608,7 +608,7 @@ blf_cbc_encrypt(blf_ctx *c, u_int8_t *iv, u_int8_t *data, u_int32_t len)
608608}
609609
610610void
611- blf_cbc_decrypt (blf_ctx * c , u_int8_t * iva , u_int8_t * data , u_int32_t len )
611+ vapor_blf_cbc_decrypt (blf_ctx * c , u_int8_t * iva , u_int8_t * data , u_int32_t len )
612612{
613613 u_int32_t l , r , d [2 ];
614614 u_int8_t * iv ;
@@ -621,7 +621,7 @@ blf_cbc_decrypt(blf_ctx *c, u_int8_t *iva, u_int8_t *data, u_int32_t len)
621621 r = data [4 ] << 24 | data [5 ] << 16 | data [6 ] << 8 | data [7 ];
622622 d [0 ] = l ;
623623 d [1 ] = r ;
624- Blowfish_decipher (c , d );
624+ Vapor_Blowfish_decipher (c , d );
625625 l = d [0 ];
626626 r = d [1 ];
627627 data [0 ] = l >> 24 & 0xff ;
@@ -641,7 +641,7 @@ blf_cbc_decrypt(blf_ctx *c, u_int8_t *iva, u_int8_t *data, u_int32_t len)
641641 r = data [4 ] << 24 | data [5 ] << 16 | data [6 ] << 8 | data [7 ];
642642 d [0 ] = l ;
643643 d [1 ] = r ;
644- Blowfish_decipher (c , d );
644+ Vapor_Blowfish_decipher (c , d );
645645 l = d [0 ];
646646 r = d [1 ];
647647 data [0 ] = l >> 24 & 0xff ;
0 commit comments