10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * CDDL HEADER START
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*8933Sopensolaris@drydog.com * Common Development and Distribution License (the "License").
6*8933Sopensolaris@drydog.com * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate *
80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate * See the License for the specific language governing permissions
110Sstevel@tonic-gate * and limitations under the License.
120Sstevel@tonic-gate *
130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate *
190Sstevel@tonic-gate * CDDL HEADER END
200Sstevel@tonic-gate */
210Sstevel@tonic-gate /*
22*8933Sopensolaris@drydog.com * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
230Sstevel@tonic-gate * Use is subject to license terms.
240Sstevel@tonic-gate */
250Sstevel@tonic-gate
260Sstevel@tonic-gate /*
270Sstevel@tonic-gate * This file contains bignum implementation code that
280Sstevel@tonic-gate * is specific to AMD64, but which is still more appropriate
290Sstevel@tonic-gate * to write in C, rather than assembly language.
300Sstevel@tonic-gate * bignum_amd64_asm.s does all the assembly language code
310Sstevel@tonic-gate * for AMD64 specific bignum support. The assembly language
320Sstevel@tonic-gate * source file has pure code, no data. Let the C compiler
330Sstevel@tonic-gate * generate what is needed to handle the variations in
340Sstevel@tonic-gate * data representation and addressing, for example,
350Sstevel@tonic-gate * statically linked vs PIC.
360Sstevel@tonic-gate */
370Sstevel@tonic-gate
380Sstevel@tonic-gate #include "bignum.h"
390Sstevel@tonic-gate
400Sstevel@tonic-gate /*
41*8933Sopensolaris@drydog.com * The bignum interface deals with arrays of 64-bit "chunks" or "digits".
42*8933Sopensolaris@drydog.com * Data should be aligned on 8-byte address boundaries for best performance.
430Sstevel@tonic-gate */
440Sstevel@tonic-gate
450Sstevel@tonic-gate
460Sstevel@tonic-gate void
big_mul_vec(BIG_CHUNK_TYPE * r,BIG_CHUNK_TYPE * a,int alen,BIG_CHUNK_TYPE * b,int blen)47*8933Sopensolaris@drydog.com big_mul_vec(BIG_CHUNK_TYPE *r, BIG_CHUNK_TYPE *a, int alen,
48*8933Sopensolaris@drydog.com BIG_CHUNK_TYPE *b, int blen)
490Sstevel@tonic-gate {
50*8933Sopensolaris@drydog.com int i;
510Sstevel@tonic-gate
52*8933Sopensolaris@drydog.com r[alen] = big_mul_set_vec(r, a, alen, b[0]);
530Sstevel@tonic-gate for (i = 1; i < blen; ++i)
54*8933Sopensolaris@drydog.com r[alen + i] = big_mul_add_vec(r + i, a, alen, b[i]);
550Sstevel@tonic-gate }
56