~ubuntu-branches/ubuntu/precise/gnupg2/precise-proposed

« back to all changes in this revision

Viewing changes to mpi/i386-openbsd/mpih-lshift.S

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Urlichs
  • Date: 2006-01-24 04:31:42 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060124043142-pbg192or6qxv3yk2
Tags: 1.9.20-1
* New Upstream version. Closes:#306890,#344530
  * Closes:#320490: gpg-protect-tool fails to decrypt PKCS-12 files 
* Depend on libopensc2-dev, not -1-. Closes:#348106

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* i80386   lshift
 
2
 *      Copyright (C) 1992, 1994, 1998,
 
3
 *                    2001 Free Software Foundation, Inc.
 
4
 *
 
5
 * This file is part of GnuPG.
 
6
 *
 
7
 * GnuPG is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; either version 2 of the License, or
 
10
 * (at your option) any later version.
 
11
 *
 
12
 * GnuPG is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License
 
18
 * along with this program; if not, write to the Free Software
 
19
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
20
 *
 
21
 * Note: This code is heavily based on the GNU MP Library.
 
22
 *       Actually it's the same code with only minor changes in the
 
23
 *       way the data is stored; this is to support the abstraction
 
24
 *       of an optional secure memory allocation which may be used
 
25
 *       to avoid revealing of sensitive data due to paging etc.
 
26
 *       The GNU MP Library itself is published under the LGPL;
 
27
 *       however I decided to publish this code under the plain GPL.
 
28
 */
 
29
 
 
30
 
 
31
#include "sysdep.h"
 
32
#include "asm-syntax.h"
 
33
 
 
34
 
 
35
/*******************
 
36
 * mpi_limb_t
 
37
 * mpihelp_lshift( mpi_ptr_t wp,        (sp + 4)
 
38
 *                 mpi_ptr_t up,        (sp + 8)
 
39
 *                 mpi_size_t usize,    (sp + 12)
 
40
 *                 unsigned cnt)        (sp + 16)
 
41
 */
 
42
 
 
43
.text
 
44
        ALIGN (3)
 
45
        .globl C_SYMBOL_NAME(mpihelp_lshift)
 
46
C_SYMBOL_NAME(mpihelp_lshift:)
 
47
        pushl   %edi
 
48
        pushl   %esi
 
49
        pushl   %ebx
 
50
 
 
51
        movl    16(%esp),%edi           /* res_ptr */
 
52
        movl    20(%esp),%esi           /* s_ptr */
 
53
        movl    24(%esp),%edx           /* size */
 
54
        movl    28(%esp),%ecx           /* cnt */
 
55
 
 
56
        subl    $4,%esi                 /* adjust s_ptr */
 
57
 
 
58
        movl    (%esi,%edx,4),%ebx      /* read most significant limb */
 
59
        xorl    %eax,%eax
 
60
        shldl   %cl,%ebx,%eax           /* compute carry limb */
 
61
        decl    %edx
 
62
        jz      Lend
 
63
        pushl   %eax                    /* push carry limb onto stack */
 
64
        testb   $1,%edx
 
65
        jnz     L1                      /* enter loop in the middle */
 
66
        movl    %ebx,%eax
 
67
 
 
68
        ALIGN (3)
 
69
Loop:   movl    (%esi,%edx,4),%ebx      /* load next lower limb */
 
70
        shldl   %cl,%ebx,%eax           /* compute result limb */
 
71
        movl    %eax,(%edi,%edx,4)      /* store it */
 
72
        decl    %edx
 
73
L1:     movl    (%esi,%edx,4),%eax
 
74
        shldl   %cl,%eax,%ebx
 
75
        movl    %ebx,(%edi,%edx,4)
 
76
        decl    %edx
 
77
        jnz     Loop
 
78
 
 
79
        shll    %cl,%eax                /* compute least significant limb */
 
80
        movl    %eax,(%edi)             /* store it */
 
81
 
 
82
        popl    %eax                    /* pop carry limb */
 
83
 
 
84
        popl    %ebx
 
85
        popl    %esi
 
86
        popl    %edi
 
87
        ret
 
88
 
 
89
Lend:   shll    %cl,%ebx                /* compute least significant limb */
 
90
        movl    %ebx,(%edi)             /* store it */
 
91
 
 
92
        popl    %ebx
 
93
        popl    %esi
 
94
        popl    %edi
 
95
        ret
 
96