1 /* $OpenBSD: ppccap.c,v 1.6 2014/07/17 23:48:24 deraadt Exp $ */
4 #include <sys/sysctl.h>
5 #include <machine/cpu.h>
9 #include <openssl/bn.h>
12 #define PPC_FPU64 (1<<0)
13 #define PPC_ALTIVEC (1<<1)
15 static int OPENSSL_ppccap_P
= 0;
18 #ifdef OPENSSL_BN_ASM_MONT
19 extern int bn_mul_mont_int(BN_ULONG
*, const BN_ULONG
*, const BN_ULONG
*,
20 const BN_ULONG
*, const BN_ULONG
*, int);
22 bn_mul_mont(BN_ULONG
*rp
, const BN_ULONG
*ap
, const BN_ULONG
*bp
,
23 const BN_ULONG
*np
, const BN_ULONG
*n0
, int num
)
25 return bn_mul_mont_int(rp
, ap
, bp
, np
, n0
, num
);
30 void OPENSSL_cpuid_setup(void) __attribute__((constructor
));
33 OPENSSL_cpuid_setup(void)
35 static const int mib
[2] = { CTL_MACHDEP
, CPU_ALTIVEC
};
36 static int trigger
= 0;
44 size
= sizeof altivec
;
45 if (sysctl(mib
, 2, &altivec
, &size
, NULL
, 0) != -1) {
47 OPENSSL_ppccap_P
|= PPC_ALTIVEC
;