home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / crypt / crypt.sun3.S < prev    next >
Encoding:
Text File  |  1992-09-02  |  2.4 KB  |  108 lines

  1. |
  2. | UFC-crypt: ultra fast crypt(3) implementation
  3. | Copyright (C) 1991, 1992, Free Software Foundation, Inc.
  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.14 5/28/92
  20. |
  21. | Assembly code for SUN3 68000 based workstations.
  22. | crypt.next68.S is generated automatically on basis of this module
  23. |
  24.  
  25. #define L1    d0
  26. #define L2    d1
  27. #define R1    d2
  28. #define R2    d3
  29. #define SCR1    d4
  30. #define SCR2    d5
  31.  
  32. #define I       d7
  33. #define ITR    a6@(24)
  34.  
  35. #define SB0    a0
  36. #define SB1    a1
  37. #define SB2    a2
  38. #define SB3    a3
  39. #define KPTR    a4
  40.     
  41. #define F(I,O1,O2,SBX,SBY)                        \
  42.     movl     KPTR@+,SCR1 ;        eorl     I,SCR1 ;        \
  43.     movl    SBX@(0,SCR1:w),SCR2 ;     eorl    SCR2,O1 ;        \
  44.     movl    SBX@(4,SCR1:w),SCR2 ;    eorl    SCR2,O2 ;        \
  45.     swap    SCR1 ;                            \
  46.     movl    SBY@(0,SCR1:w),SCR2 ;    eorl    SCR2,O1 ;        \
  47.     movl    SBY@(4,SCR1:w),SCR2 ;    eorl    SCR2,O2 ;
  48.  
  49. #define G(I1,I2,O1,O2)            \
  50.     F(I1,O1,O2,SB1,SB0) F(I2,O1,O2,SB3,SB2)
  51.  
  52. #define H G(R1,R2,L1,L2) ; G(L1,L2,R1,R2)
  53.  
  54.     .data
  55.     .ascii "UFC-crypt crypt.sun3.S, @(#)crypt.sun3.S    2.14 5/28/92\0"
  56.     .even
  57.  
  58. | The next does not like .bss. We can probably do without
  59. |    .bss
  60. |    .even
  61.     .lcomm _ary,16
  62.  
  63.     .text
  64.     .proc
  65.     .globl __ufc_doit
  66. __ufc_doit:
  67. |
  68. | Preamble
  69. |
  70.     link a6,#-56
  71.     moveml #15612,sp@
  72.  
  73.     movl    a6@(20),R2
  74.     movl    a6@(16),R1
  75.     movl    a6@(12),L2
  76.     movl    a6@(8),L1
  77. |
  78. | Setup address registers with sb pointers
  79. |
  80.     movl    #__ufc_sb0,SB0 ; movl #__ufc_sb1,SB1 
  81.     movl    #__ufc_sb2,SB2 ; movl #__ufc_sb3,SB3
  82. | And loop...
  83. |
  84. Lagain:    
  85.     movl  #__ufc_keytab,KPTR
  86.     moveq #8,I
  87. Lagain1:
  88.     H
  89.     subql #1,I
  90.     tstl  I
  91.     jne   Lagain1    
  92. | Permute
  93.     movl L1,SCR1 ; movl R1,L1 ; movl SCR1,R1
  94.     movl L2,SCR1 ; movl R2,L2 ; movl SCR1,R2
  95. |
  96.     subql    #1,ITR
  97.     jne    Lagain
  98. |
  99. | Postamble
  100. |
  101.     movl    L1, _ary
  102.     movl    L2, _ary+4
  103.     movl    R1, _ary+8
  104.     movl    R2, _ary+12
  105.     movl    #_ary,d0
  106.     moveml     a6@(-56),#15612 ; unlk a6 ; rts
  107.