LM,

I attempted to duplicate your work and mostly get to the same place as you.  
Here are my notes.

nmake -f ms\ntdll.mak test
//The tests fail for me with 'rsa_test' is not recognized as an internal or 
external command.

- I get the same 'rsa_test' error

perl Configure VC-WIN32 no-asm fips
- I didn't specify directories, so I think openssl grabs the fips files from 
\usr\local\SSL\fips-2.0:

I hadn't run this before:
openssl-fips-2.0.2\outdll>nmake -f ms\ntdll.mak test
- My fips tests all complete or "failure as expeted".

I also did:
openssl-1.0.1c>nmake -f ms\ntdll.mak install

My source code is the same as yours except I changed:
1) Change the exit() to call my own Exit() function
2) Used TCHAR inside my _tmain so argv matches types
3) Used C++ cout, cin in a few places and added needed header files
none of which should make a difference for the linking issues we see

Differences in my previous attempt to use fipslink:
I created a full VED.mak file based on ntdll.mak that has fipslink and bunch of 
symbols in it instead of your shorter batch file method.
I ran into problems because I wasn't using the installed locations (from 
ntdll.mak install).
I didn't use the "msincore" step.
I'm building in Debug mode, not Release

I finished testing with your batch and rsp files.  I had to change paths to get 
it to work in my environment.
I get the same link errors as you, but I also get my previous link errors as 
well.  

I tried removing fips_premain.obj and then just got my older link errors.
I tried adding fipscanister.lib, which removed my older link errors, but the 
others stayed.

I end up with two fips_premain.obj.  One that goes with my VS project and the 
other that is created by fipslink.

If I use the fipslink one I get additional warnings:
MSVCRT.lib(MSVCRT.DLL) : error LNK2005: _fopen already defined in 
LIBC.lib(fopen.obj)
...and similar for about 6 system calls.

Thanks,
-Jon

-----Original Message-----
From: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] 
On Behalf Of Memmott, Lester
Sent: Wednesday, February 06, 2013 11:40 AM
To: openssl-users@openssl.org
Subject: RE: fipslink

Jon,

I’m having trouble with fipslink as well and thought it might help to compare 
notes.  These are the linker errors I’m getting using Visual Studio 2008:
fips_premain.obj : error LNK2001: unresolved external symbol "unsigned char * 
FIPS_signature" (?FIPS_signature@@3PAEA)
fips_premain.obj : error LNK2001: unresolved external symbol "void const * 
__cdecl FIPS_text_start(void)" (?FIPS_text_start@@YAPBXXZ)
fips_premain.obj : error LNK2001: unresolved external symbol "unsigned int 
__cdecl FIPS_incore_fingerprint(unsigned char *,unsigned int)" 
(?FIPS_incore_fingerprint@@YAIPAEI@Z)

What linker errors do you get?

Below are more details on how I did this using a batch file to setup the 
environment variables that calls the perl script.  

Also not that I had to edit fipslink.pl to make it run.  I added "perl" to 
these two lines (about line 57 & 58):
print "perl $fips_premain_dso $fips_target\n";
system("perl $fips_premain_dso $fips_target >$fips_target.sha1");

Thanks,
LM

=======================================================
I created this batch file to run the perl script:


@echo off
rem  This batch file is intended to build FipsSample.exe in a FIPS enabled 
fashion.  
rem  Built the project first in Visual Studio 2008 and then run this as a post 
build step.
rem  See section 5.3.2 "Linking under Windows" of the OpenSSL FIPS User Guide 
for details about this.
rem  http://www.openssl.org/docs/fips/UserGuide-2.0.pdf 
rem  Note:  I think the docs are wrong on a couple of items.  
rem       It should be FIPS_SHA1_EXE and not PREMAIN_SHA1_EXE.
rem  Associated files:  link.rsp
@echo on

set FIPSLIB_D=c:\openssl-fips-2.0.2\out32dll
set FIPS_CC=cl
set FIPS_CC_ARGS=/O2 /Oi /GL /I "C:\openssl-1.0.1c\inc32" /D "WIN32" /D 
"NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /EHsc /MD /Gy /Fo"Release\\" 
/Fd"Release\vc90.pdb" /W3 /c /Zi /TP
set FIPS_LINK=link
set FIPS_SHA1_EXE=C:\openssl-fips-2.0.2\out32dll\fips_standalone_sha1.exe

rem The following wasn't documented in the user guide but the script tries to 
use it.  msincore seems like the right script, but I'm not sure.
set FIPS_SIG=C:\openssl-fips-2.0.2\util\msincore

rem Not used to compile an EXE:  set 
PREMAIN_DSO_EXE=C:\openssl-1.0.1c\out32dll\fips_premain_dso.exe
set PREMAIN_DSO_EXE=
set FIPS_TARGET=..\Release\FipsSample.exe

perl c:\openssl-fips-2.0.2\util\fipslink.pl @"link.rsp"

=======================================================
link.rsp:

/OUT:"C:\openssl-TestUtils\FipsSample - Clean\Release\FipsSample.exe" 
/INCREMENTAL:NO /LIBPATH:"C:\openssl-1.0.1c\out32dll" /MANIFEST 
/MANIFESTFILE:"Release\FipsSample.exe.intermediate.manifest" 
/MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG 
/PDB:"c:\openssl-TestUtils\FipsSample - Clean\Release\FipsSample.pdb" 
/SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /DYNAMICBASE /NXCOMPAT /MACHINE:X86 
libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib 
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

".\Release\FipsSample.obj"

".\Release\stdafx.obj"

".\Release\fips_premain.obj"

=======================================================
Build Output:

C:\openssl-TestUtils\FipsSample - Clean\FipsSample>g

C:\openssl-TestUtils\FipsSample - Clean\FipsSample>set 
FIPSLIB_D=c:\openssl-fips-2.0.2\out32dll

C:\openssl-TestUtils\FipsSample - Clean\FipsSample>set FIPS_CC=cl

C:\openssl-TestUtils\FipsSample - Clean\FipsSample>set FIPS_CC_ARGS=/O2 /Oi /GL 
/I "C:\openssl-1.0.1c\inc32" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD
 /EHsc /MD /Gy /Fo"Release\\" /Fd"Release\vc90.pdb" /W3 /c /Zi /TP

C:\openssl-TestUtils\FipsSample - Clean\FipsSample>set FIPS_LINK=link

C:\openssl-TestUtils\FipsSample - Clean\FipsSample>set 
FIPS_SHA1_EXE=C:\openssl-fips-2.0.2\out32dll\fips_standalone_sha1.exe

C:\openssl-TestUtils\FipsSample - Clean\FipsSample>set 
FIPS_SIG=C:\openssl-fips-2.0.2\util\msincore

C:\openssl-TestUtils\FipsSample - Clean\FipsSample>rem Not used to comple an 
EXE:  set PREMAIN_DSO_EXE=C:\openssl-1.0.1c\out32dll\fips_premain_dso.exe

C:\openssl-TestUtils\FipsSample - Clean\FipsSample>set PREMAIN_DSO_EXE=

C:\openssl-TestUtils\FipsSample - Clean\FipsSample>set 
FIPS_TARGET=..\Release\FipsSample.exe

C:\openssl-TestUtils\FipsSample - Clean\FipsSample>perl 
c:\openssl-fips-2.0.2\util\fipslink.pl @"link.rsp"
Integrity check OK
cl /O2 /Oi /GL /I "C:\openssl-1.0.1c\inc32" /D "WIN32" /D "NDEBUG" /D 
"_CONSOLE" /D "_MBCS" /FD /EHsc /MD /Gy /Fo"Release\\" /Fd"Release\vc90.pdb" 
/W3 /c /Zi /T
P c:\openssl-fips-2.0.2\out32dll/fips_premain.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

fips_premain.c
link @link.rsp
Microsoft (R) Incremental Linker Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

"/OUT:C:\openssl-TestUtils\FipsSample - Clean\Release\FipsSample.exe" 
/INCREMENTAL:NO "/LIBPATH:C:\openssl-1.0.1c\out32dll" /MANIFEST 
"/MANIFESTFILE:Release\Fip
sSample.exe.intermediate.manifest" "/MANIFESTUAC:level='asInvoker' 
uiAccess='false'" /DEBUG "/PDB:c:\openssl-TestUtils\FipsSample - 
Clean\Release\FipsSample.pdb
" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /DYNAMICBASE /NXCOMPAT 
/MACHINE:X86 libeay32.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi
32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
".\Release\FipsSample.obj"
".\Release\stdafx.obj"
".\Release\fips_premain.obj"
fips_premain.obj : error LNK2001: unresolved external symbol "unsigned char * 
FIPS_signature" (?FIPS_signature@@3PAEA)
fips_premain.obj : error LNK2001: unresolved external symbol "void const * 
__cdecl FIPS_text_start(void)" (?FIPS_text_start@@YAPBXXZ)
fips_premain.obj : error LNK2001: unresolved external symbol "unsigned int 
__cdecl FIPS_incore_fingerprint(unsigned char *,unsigned int)" 
(?FIPS_incore_fingerpr
int@@YAIPAEI@Z)
C:\openssl-TestUtils\FipsSample - Clean\Release\FipsSample.exe : fatal error 
LNK1120: 3 unresolved externals
First stage Link failure at c:\openssl-fips-2.0.2\util\fipslink.pl line 55.

=======================================================


---------------------------------------------------------------------------------------------------------------------------
From: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] 
On Behalf Of Jon Evers
Sent: Tuesday, February 05, 2013 2:09 PM
To: openssl-users@openssl.org
Subject: fipslink

Does anyone have a windows make file that uses fipslink to build an executable 
that they can forward to me?
Alternatively a Visual Studio project that uses that would also help?
The smaller and simpler the project the better.

I’m trying to build a windows executable that uses the fips libraries and I 
think I’m not using this utility correctly.  I’m stuck with linker errors.

Thanks,
-Jon Evers
 
:I"Ϯrm
(Z+K+1x
h[z(Z+
fyfh)z{,

Live customer support is available 24/7/365 from the U.S. for all customers 
worldwide and locally in other countries. Find out more at www.go2vanguard.com.

Enable Yourself Learn more about Vanguard zSecurity University training classes 
offered online, on-demand by request, or in a traditional classroom setting in 
cities worldwide. www.go2vanguard.com

This e-mail and any attachments are intended solely for the use of the 
addressee and may contain information that is PRIVILEGED and CONFIDENTIAL. If 
you are not the intended recipient of this e-mail, you are hereby notified that 
any dissemination of this e-mail or any attachments is strictly prohibited. If 
you have received this e-mail in error, please do not read this email, please 
delete all copies of this e-mail and any attachments and notify the sender 
immediately. Thank you.

Reply via email to