home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / d / libc / libc-4.6 / libc-4 / libc-linux / ufc / crypt.s300.S < prev    next >
Encoding:
Text File  |  1992-02-12  |  2.3 KB  |  101 lines

  1.  #
  2.  # UFC-crypt: ultra fast crypt(3) implementation
  3.  # Copyright (C) 1991, 1992, Michael Glad, email: glad@daimi.aau.dk
  4.  #
  5.  # This library is free software, you can redistribute it and/or
  6.  # modify it under the terms of the GNU Library General Public
  7.  # License as published by the Free Software Foundation, either
  8.  # version 2 of the License, or (at your option) any later version.
  9.  #
  10.  # This library is distributed in the hope that it will be useful,
  11.  # but WITHOUT ANY WARRANTY, without even the implied warranty of
  12.  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  # Library General Public License for more details.
  14.  #
  15.  # You should have received a copy of the GNU Library General Public
  16.  # License along with this library, if not, write to the Free
  17.  # Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  #
  19.  # @(#)crypt.s300.S    2.5 12/30/91
  20.  #
  21.  # MC680x0/Hp9000 s300/s400 assembly code
  22.  #
  23.  
  24. #define L1    %d0
  25. #define L2    %d1
  26. #define R1    %d2
  27. #define R2    %d3
  28. #define SCR1    %d4
  29. #define SCR2    %d5
  30.  
  31. #define I    %d7
  32. #define ITR    24(%a6)
  33.  
  34. #define SB0    %a0
  35. #define SB1    %a1
  36. #define SB2    %a2
  37. #define SB3    %a3
  38. #define KPTR    %a4
  39.     
  40. #define F(I,O1,O2,SBX,SBY)                        \
  41.     mov.l     (KPTR)+,SCR1 ;        eor.l     I,SCR1 ;        \
  42.     mov.l    0(SBX,SCR1.w),SCR2 ;     eor.l    SCR2,O1 ;        \
  43.     mov.l    4(SBX,SCR1.w),SCR2 ;    eor.l    SCR2,O2 ;        \
  44.     swap.w    SCR1 ;                            \
  45.     mov.l    0(SBY,SCR1.w),SCR2 ;    eor.l    SCR2,O1 ;        \
  46.     mov.l    4(SBY,SCR1.w),SCR2 ;    eor.l    SCR2,O2 ;
  47.  
  48. #define G(I1,I2,O1,O2)            \
  49.     F(I1,O1,O2,SB1,SB0) F(I2,O1,O2,SB3,SB2)
  50.  
  51. #define H G(R1,R2,L1,L2) ; G(L1,L2,R1,R2)
  52.  
  53.     text
  54.     global _ufc_doit
  55. _ufc_doit:
  56.  #
  57.  # Preamble
  58.  #
  59.     link    %a6,&-56
  60.     movem.l &15612,(%sp)
  61.  
  62.     mov.l   20(%a6),R2 
  63.     mov.l   16(%a6),R1 
  64.     mov.l   12(%a6),L2 
  65.     mov.l    8(%a6),L1
  66.  #
  67.  # Setup address registers with sb pointers
  68.  #
  69.     mov.l    &_ufc_sb0,SB0 ; mov.l &_ufc_sb1,SB1 
  70.     mov.l   &_ufc_sb2,SB2 ; mov.l &_ufc_sb3,SB3
  71.  #
  72.  # And loop...
  73.  #
  74. Lagain:    
  75.     mov.l    &_ufc_keytab,KPTR
  76.     moveq    &8,I
  77. Lagain1:
  78.     H
  79.     subq.l    &1,I
  80.     bne    Lagain1
  81.  # Permute
  82.     mov.l L1,SCR1 ; mov.l R1,L1 ; mov.l SCR1,R1
  83.     mov.l L2,SCR1 ; mov.l R2,L2 ; mov.l SCR1,R2
  84.  #
  85.     subq.l    &1,ITR
  86.     tst.l    ITR
  87.     bne    Lagain
  88.  #
  89.  # Output conversion
  90.  #
  91.     mov.l R2,-(%sp) ; mov.l R1,-(%sp) 
  92.     mov.l L2,-(%sp) ; mov.l L1,-(%sp)
  93.     jsr _ufc_dofinalperm ; add.l &16,%sp
  94.  #
  95.  # Postamble
  96.  #
  97.     movem.l    (-56)(%a6),&15612 ; unlk %a6 ; rts
  98.  
  99.  
  100.  
  101.