- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: can't get new crypt2() function to work
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-23-2009 10:38 AM
тАО09-23-2009 10:38 AM
Re: can't get new crypt2() function to work
Ok, we got the symbols, now try to link them like this:
1. If your executable is 32bit you must use the 32bit library:
# cc -v /tmp/encrypter.c -o /tmp/encrypter -L/usr/lib/hpux32 -lrwtool_v2
2. If 64bit:
# cc -v /tmp/encrypter.c -o /tmp/encrypter -L/usr/lib/hpux64 -lprocsm
In your compile command you mixed both libraries (one is 32bit and the other 64 bit). This is not allowed.
Furthermore note the flags:
-L is used to specify a library search path
-l is used to specify the shortened name of the library to link with
Kind regards,
Kobylka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-23-2009 11:03 AM
тАО09-23-2009 11:03 AM
Re: can't get new crypt2() function to work
Thanks for continueing to look at this. I'm on a 64-bit Itanium so I tried the hpux64 library as you suggested. Still no luck. I tried the 32-bit command, but that didn't work either. ):
# cc -v /tmp/encrypter.c -o /tmp/encrypter -L/usr/lib/hpux64 -lprocsm
/usr/ccs/lbin/ecom -architecture 32 -ia64abi all -ext on -lang c -exception off -sysdir /usr/include -inline_power 0 -link_type dynamic -fpeval float -tls_dyn on -target_os 11.31 --sys_include /usr/include -D__hpux -D__unix -D__ia64=1 -D_BIG_ENDIAN=1 -D_ILP32 -D__unordered= -D__synchronous= -D__non_sequential= -D__side_effect_free= -D__HP_cc=61200 -D__STDC_EXT__ -D_HPUX_SOURCE -D_INCLUDE_LONGLONG -D_INLINE_ASM -D_BIND_LIBCALLS -D_Math_errhandling=MATH_ERREXCEPT -D_FLT_EVAL_METHOD=0 -ucode hdriver=optlevel%1%:inline=inl_level%0% -plusolistoption -Ol06const! -plusolistoption -Ol13moderate! -plusooption -Oq01,al,ag,cn,sz,ic,vo,Mf,Po,es,rs,Rf,Pr,sp,in,cl,om,vc,pi,fa,pe,rr,pa,pv,nf,cp,lx,Pg,ug,lu,lb,uj,dn,sg,pt,kt,em,np,ar,rp,dl,fs,bp,wp,pc,mp,lr,cx,cr,pi,so,Rc,fa,ft,fe,ap,st,lc,Bl,sr,ib,pl,sd,ll,rl,dl,Lt,ol,fl,lm,ts,rd,dp,If! /tmp/encrypter.c
"/tmp/encrypter.c", line 16: warning #2513-D: a value of type "int" cannot be
assigned to an entity of type "char *"
salt = crypt_2passwd_salt(oldhash, username);
^
LPATH=
/usr/ccs/bin/ld -o /tmp/encrypter -u___exit -umain encrypter.o -L /usr/lib/hpux64 -lprocsm -lc
ld: Mismatched ABI for -lprocsm, found /usr/lib/hpux64/libprocsm.so
Fatal error.
removing /var/tmp/AAA000991
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-23-2009 11:18 AM
тАО09-23-2009 11:18 AM
Re: can't get new crypt2() function to work
For 64 bit the 64bit data model flag must be included:
# cc +DD64 -v /tmp/encrypter.c -o /tmp/encrypter -L/usr/lib/hpux64 -lprocsm
It should work using just -L/usr/lib too.
In the case of 32 bit executable you can use +DD32 or not, by default the compiler generates 32 bit binaries.
Kind regards,
Kobylka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-23-2009 11:21 AM
тАО09-23-2009 11:21 AM
Re: can't get new crypt2() function to work
# cc +DD64 -v /tmp/encrypter.c -o /tmp/encrypter -L/usr/lib/hpux64 -lprocsm
/usr/ccs/lbin/ecom -architecture 64 -ia64abi all -ext on -lang c -exception off -sysdir /usr/include -inline_power 0 -link_type dynamic -fpeval float -tls_dyn on -target_os 11.31 --sys_include /usr/include -D__hpux -D__unix -D__ia64=1 -D_BIG_ENDIAN=1 -D_LP64 -D__LP64__ -D__unordered= -D__synchronous= -D__non_sequential= -D__side_effect_free= -D__HP_cc=61200 -D__STDC_EXT__ -D_HPUX_SOURCE -D_INCLUDE_LONGLONG -D_INLINE_ASM -D_BIND_LIBCALLS -D_Math_errhandling=MATH_ERREXCEPT -D_FLT_EVAL_METHOD=0 -ucode hdriver=optlevel%1%:inline=inl_level%0% -plusolistoption -Ol06const! -plusolistoption -Ol13moderate! -plusooption -Oq01,al,ag,cn,sz,ic,vo,Mf,Po,es,rs,Rf,Pr,sp,in,cl,om,vc,pi,fa,pe,rr,pa,pv,nf,cp,lx,Pg,ug,lu,lb,uj,dn,sg,pt,kt,em,np,ar,rp,dl,fs,bp,wp,pc,mp,lr,cx,cr,pi,so,Rc,fa,ft,fe,ap,st,lc,Bl,sr,ib,pl,sd,ll,rl,dl,Lt,ol,fl,lm,ts,rd,dp,If! /tmp/encrypter.c
"/tmp/encrypter.c", line 16: warning #2513-D: a value of type "int" cannot be
assigned to an entity of type "char *"
salt = crypt_2passwd_salt(oldhash, username);
^
LPATH=
/usr/ccs/bin/ld -o /tmp/encrypter -u___exit -umain encrypter.o -L /usr/lib/hpux64 -lprocsm -lc
ld: Unsatisfied symbol "crypt2" in file encrypter.o
ld: Unsatisfied symbol "crypt_2passwd_salt" in file encrypter.o
2 errors.
removing /var/tmp/AAA001527
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-23-2009 11:44 AM
тАО09-23-2009 11:44 AM
Re: can't get new crypt2() function to work
When you tried earlier in this post to lookup the "crypt2" symbol using:
find / -name '*.sl' -exec nm {} \; -print | grep -i -e crypt2 -e '^/' | more
be sure to pick the correct libraries:
The nm gets executed first (showing the macthing symbols, if any) and THEN prints the name of the library (not before the symbols are displayed). Please make sure the libraries are the correct ones.
Kind regards,
Kobylka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-23-2009 11:56 AM
тАО09-23-2009 11:56 AM
Re: can't get new crypt2() function to work
Still no luck. ):
Darren
# find /usr -name '*.so' -exec nm {} \; -print | grep -i -e crypt2 -e '^/' | more
[418] | 4611686018427643296| 656|FUNC |GLOB |0| .text|crypt2
[356] | 4611686018427644000| 400|FUNC |GLOB |0| .text|crypt2_passwd_h
ash
[543] | 4611686018427645824| 336|FUNC |GLOB |0| .text|crypt2_passwd_m
atch
[431] | 4611686018427644416| 1408|FUNC |GLOB |0| .text|crypt2_passwd_s
alt
/usr/lib/hpux64/libsec.so
# file /usr/lib/hpux64/libsec.so
/usr/lib/hpux64/libsec.so: ELF-64 shared object file - IA64
# cc +DD64 -v /tmp/encrypter.c -o /tmp/encrypter -L/usr/lib/hpux64 -llibsec
/usr/ccs/lbin/ecom -architecture 64 -ia64abi all -ext on -lang c -exception off -sysdir /usr/include -inline_power 0 -link_type dynamic -fpeval float -tls_dyn on -target_os 11.31 --sys_include /usr/include -D__hpux -D__unix -D__ia64=1 -D_BIG_ENDIAN=1 -D_LP64 -D__LP64__ -D__unordered= -D__synchronous= -D__non_sequential= -D__side_effect_free= -D__HP_cc=61200 -D__STDC_EXT__ -D_HPUX_SOURCE -D_INCLUDE_LONGLONG -D_INLINE_ASM -D_BIND_LIBCALLS -D_Math_errhandling=MATH_ERREXCEPT -D_FLT_EVAL_METHOD=0 -ucode hdriver=optlevel%1%:inline=inl_level%0% -plusolistoption -Ol06const! -plusolistoption -Ol13moderate! -plusooption -Oq01,al,ag,cn,sz,ic,vo,Mf,Po,es,rs,Rf,Pr,sp,in,cl,om,vc,pi,fa,pe,rr,pa,pv,nf,cp,lx,Pg,ug,lu,lb,uj,dn,sg,pt,kt,em,np,ar,rp,dl,fs,bp,wp,pc,mp,lr,cx,cr,pi,so,Rc,fa,ft,fe,ap,st,lc,Bl,sr,ib,pl,sd,ll,rl,dl,Lt,ol,fl,lm,ts,rd,dp,If! /tmp/encrypter.c
"/tmp/encrypter.c", line 16: warning #2513-D: a value of type "int" cannot be
assigned to an entity of type "char *"
salt = crypt_2passwd_salt(oldhash, username);
^
LPATH=
/usr/ccs/bin/ld -o /tmp/encrypter -u___exit -umain encrypter.o -L /usr/lib/hpux64 -llibsec -lc
ld: Can't find library for -llibsec
Fatal error.
removing /var/tmp/AAA009384
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-23-2009 12:01 PM
тАО09-23-2009 12:01 PM
Re: can't get new crypt2() function to work
# cc +DD64 -v /tmp/encrypter.c -o /tmp/encrypter -L/usr/lib/hpux64 -lsec
try also
# cc +DD64 -v /tmp/encrypter.c -o /tmp/encrypter -L/usr/lib -lsec
Kind regards,
Kobylka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-23-2009 12:10 PM
тАО09-23-2009 12:10 PM
Re: can't get new crypt2() function to work
# cc +DD64 /tmp/encrypter.c -o /tmp/encrypter -L/usr/lib -lsec
"/tmp/encrypter.c", line 16: warning #2513-D: a value of type "int" cannot be
assigned to an entity of type "char *"
salt = crypt_2passwd_salt(oldhash, username);
^
ld: Mismatched ABI (not an ELF file) for -lsec, found /usr/lib/libsec.sl
Fatal error.
# cc +DD64 /tmp/encrypter.c -o /tmp/encrypter -L/usr/lib/hpux64 -lsec
"/tmp/encrypter.c", line 16: warning #2513-D: a value of type "int" cannot be
assigned to an entity of type "char *"
salt = crypt_2passwd_salt(oldhash, username);
^
ld: Unsatisfied symbol "crypt_2passwd_salt" in file encrypter.o
1 errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-23-2009 12:19 PM
тАО09-23-2009 12:19 PM
Solutionld: Unsatisfied symbol "crypt_2passwd_salt" in file encrypter.o
1 errors.
The symbol should be "crypt2_passwd_salt". Correct your code and compile again in 64 bit with 64 bit libpath:
# cc +DD64 /tmp/encrypter.c -o /tmp/encrypter -L/usr/lib/hpux64 -lsec
Kind regards,
Kobylka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-23-2009 12:29 PM
тАО09-23-2009 12:29 PM
Re: can't get new crypt2() function to work
Boy do Ifeel sheepish! That spelling mistake was the cause of the problem from the very beginning! Thank you very, very much for your assistance. If I could, I'd give you 15 points for sticking with this issue through so many iterations. For the benefit of future ITRC users, here's the final solution. Thanks again!
# cat /tmp/encrypter.c
#include
#include
main()
{
char *username;
char *oldhash;
char *salt;
char *key;
char *hashstring;
username = "user1";
key = "mypass";
oldhash = "$6$"; /* "$6$" = SHA512, "aa" = 3DES */
salt = crypt2_passwd_salt(oldhash, username);
hashstring = crypt2(key, salt);
printf("username = %s\n", username);
printf("salt = %s\n", salt);
printf("key = %s\n", key);
printf("hashstring = %s\n", hashstring);
}
# cc +DD64 /tmp/encrypter.c -o /tmp/encrypter -L/usr/lib/hpux64 -lsec
# /tmp/encrypter
username = user1
salt = $6$VSw26.nD
key = mypass
hashstring = $6$VSw26.nD$yAt6TGoOlc9DLUY341qs0Kqo8D8HXFvZicqTSltK0z6ayTJ/dj9pn7RbHQ8mhC.t7QabgjRUg0Ts/QnKcAm7A1