home *** CD-ROM | disk | FTP | other *** search
/ Serving the Web / ServingTheWeb1995.disc1of1.iso / linux / slacksrce / d / libc / libc-4.6 / libc-4 / libc-linux / sysdeps / m68k / crypt.S < prev    next >
Encoding:
Text File  |  1994-11-19  |  2.0 KB  |  93 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.sun3.S    2.8 01/11/92
  20. |
  21. | Assembly code for SUN3 68000 based workstations.
  22. |
  23.  
  24. #define L1    d0
  25. #define L2    d1
  26. #define R1    d2
  27. #define R2    d3
  28. #define ITR    d4
  29. #define SCR1    d5
  30. #define SCR2    d6
  31.  
  32. #define I       d7
  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.     movl     KPTR@+,SCR1 ;        eorl     I,SCR1 ;        \
  42.     movl    SBX@(0,SCR1:w),SCR2 ;     eorl    SCR2,O1 ;        \
  43.     movl    SBX@(4,SCR1:w),SCR2 ;    eorl    SCR2,O2 ;        \
  44.     swap    SCR1 ;                            \
  45.     movl    SBY@(0,SCR1:w),SCR2 ;    eorl    SCR2,O1 ;        \
  46.     movl    SBY@(4,SCR1:w),SCR2 ;    eorl    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.     .proc
  55.     .globl _ufc_doit
  56. _ufc_doit:
  57. |
  58. | Preamble
  59. |
  60.     moveml    d2-d7/a2-a4,sp@-
  61.  
  62.     moveml    sp@(40),L1/L2/R1/R2/ITR
  63. |
  64. | Setup address registers with sb pointers
  65. |
  66.     movl    #_ufc_sb0,SB0 ; movl #_ufc_sb1,SB1 
  67.     movl    #_ufc_sb2,SB2 ; movl #_ufc_sb3,SB3
  68. | And loop...
  69. |
  70. Lagain:    
  71.     movl  #_ufc_keytab,KPTR
  72.     moveq #7,I
  73. Lagain1:
  74.     H
  75.     dbra   I,Lagain1    
  76. | Permute
  77.     exg L1,R1
  78.     exg L2,R2
  79. |
  80.     subql    #1,ITR
  81.     jne    Lagain
  82. |
  83. | Output conversion
  84. |
  85.     moveml L1/L2/R1/R2,sp@-
  86.     jbsr _ufc_dofinalperm ; addl #16,sp
  87. |
  88. | Postamble
  89. |
  90.     moveml     sp@+,d2-d7/a2-a4
  91.     rts
  92.