Operating System - HP-UX
1753374 Members
5299 Online
108792 Solutions
New Discussion юеВ

Re: can't get new crypt2() function to work

 
SOLVED
Go to solution
d miller_2
Advisor

can't get new crypt2() function to work

Hello,

I've been reading about the new crypt2 library introduced by the PHI11i3 bundle, which enabled SHA512 password hashing. I'm trying to understand exactly what the new libraries do, but get can't get my test programs to compile. Here's what I get an 'ld: Unsatisfied symbol "crypt2"' error every time I try to compile my program. Here's what I did:


# swlist PHI11i3
# Initializing...
# Contacting target "rx16u831"...
#
# Target: rx16u831:/
#
# PHI11i3 B.11.31.02 HP-UX 11.31 Password Hashing Infrastructure
PHI11i3.SHA11i3 B.11.31.02 HP-UX 11.31 SHA11i3 Product


# cat /tmp/encrypter.c
#include
#include
main()
{
char *result;
result=crypt2("aa","user1");
printf("\nThe password hash is %s\n", result);
}


# cc -Llibsec encrypter.c -o encrypter
ld: Unsatisfied symbol "crypt2" in file encrypter.o
1 errors.


I'm guessing that I need to specify another -L, but I'm not sure what it should be.

Thanks in advance for your help.

Darren
25 REPLIES 25
James R. Ferguson
Acclaimed Contributor

Re: can't get new crypt2() function to work

Hi Darren:

I don't have 11.31 available nor do I have the PHI product for 11.23 installed, but at least in earlier interfaces you should have specified:

#include

Regards!

...JRF...

d miller_2
Advisor

Re: can't get new crypt2() function to work

James,

I added "#include ", but still no luck. Thanks for taking a look.

Regards,
Darren
James R. Ferguson
Acclaimed Contributor

Re: can't get new crypt2() function to work

Hi (again) Darren:

Try looking for a 'crypt2' header:

# find /usr/include -type f -name "crypt*"

Regards!

...JRF...
d miller_2
Advisor

Re: can't get new crypt2() function to work

James,

I tried two variations on the find command, but the files found were already included in my program.

# find /usr/include -type f -name "crypt*"
/usr/include/crypt.h

# find /usr/include -type f -exec grep -l crypt2 {} \;
/usr/include/prot.h

# cat encrypter.c
#include
#include
#include
main()
{
char *result;
result=crypt2("aa","user1");
printf("\nThe password hash is %s\n", result);
}

# cc encrypter.c -o encrypter
ld: Unsatisfied symbol "crypt2" in file encrypter.o
1 errors.

Thanks again,
Darren
Olivier Masse
Honored Contributor

Re: can't get new crypt2() function to work

Try "swlist -l file PHI11i3" as root to see what files are included in the package, this could give you a hint on what needs to be included.

Good luck
d miller_2
Advisor

Re: can't get new crypt2() function to work

Olivier,

Good idea. I actually did try that earlier, but no luck. The product appears to simply deliver a man page and a toggle file to enable the functionality. I wonder if the functionality was there in the original 11i v3 release but wasn't enabled because it hadn't been fully tested(?). Seems strange. The functionality does work, though. If I change a user's password, the resulting ciphertext is much longer than it was in the past.

Darren

# swlist -l file PHI11i3
# Initializing...
# Contacting target "rx16u831"...
#
# Target: rx16u831:/
#
# PHI11i3 B.11.31.02 HP-UX 11.31 Password Hashing Infrastructure
# PHI11i3.SHA11i3 B.11.31.02 HP-UX 11.31 SHA11i3 Product
# PHI11i3.SHA11i3.SHA-CONF B.11.31.02 SHA11i3 Configuration Files
PHI11i3.SHA11i3.SHA-CONF: /etc/default/ENABLE_CRYPT_ENHANCEMENT
# PHI11i3.SHA11i3.SHA-ENG-A-MAN B.11.31.02 SHA11i3 English Manpages
PHI11i3.SHA11i3.SHA-ENG-A-MAN: /usr/share/man/man3.Z/crypt2.3c
kobylka
Valued Contributor

Re: can't get new crypt2() function to work

Hello Darren!

Assuming the PHI11i3 bundle is correctly installed ( https://h20392.www2.hp.com/portal/swdepot/displayInstallInfo.do?productNumber=PHI11i3 )

you could try this:

1. Take a look at prot.h (and if you were so kind please attach it in next post since I have no 11i v3) to see how crypt2 is included, declared, defined.

2. Do brute force on symbol matching in libs:

find / -name '*.sl' -exec nm {} \; -print | grep -i -e crypt2 -e '^/' | more

Note the *.sl for PA-RISC (use *.so for IPF). If you're sure all your libs are only in /usr/lib and /opt:

for l in /usr/lib /opt
do
find $l -name '*.sl' -exec nm {} \; -print | grep -i -e crypt2 -e '^/'
done


If the symbol is there, it will show up...

Kind regards,

Kobylka
d miller_2
Advisor

Re: can't get new crypt2() function to work

Kobylka,

THanks so much for looking at my issue! I ran the for loop as you suggested and got a long list of several hundred file paths. I think these might be the pertinent lines:

/usr/lib/hpux32/librwtool_v2.so
[418] | 67351168| 640|FUNC |GLOB |0| .text|crypt2
[356] | 67351840| 400|FUNC |GLOB |0| .text|crypt2_passwd_hash
[543] | 67353600| 304|FUNC |GLOB |0| .text|crypt2_passwd_match
[431] | 67352256| 1344|FUNC |GLOB |0| .text|crypt2_passwd_salt

/usr/lib/hpux64/libprocsm.so
[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

I tried re-compiling with those libraries specifically included, though, and still got ld errors:


# cc -v -L/usr/lib/hpux32/librwtool_v2.so -L/usr/lib/hpux64/libprocsm.so /tmp/encrypter.c -o /tmp/encrypter

/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/lib/hpux32:/opt/langtools/lib/hpux32:/usr/lib/hpux64:/opt/langtools/lib/hpux64
/usr/ccs/bin/ld -o /tmp/encrypter -u___exit -umain -L /usr/lib/hpux32/librwtool_v2.so -L /usr/lib/hpux64/libprocsm.so encrypter.o -lc
ld: Unsatisfied symbol "crypt2" in file encrypter.o
ld: Unsatisfied symbol "crypt_2passwd_salt" in file encrypter.o
2 errors.
removing /var/tmp/AAA026567

Per your request, I've attached the prot.h file from my system. You probably already discovered this, but the man page is available on the web at http://docs.hp.com/en/B3921-60631/crypt2.3C.html.

Thanks again for taking a look.

Darren

d miller_2
Advisor

Re: can't get new crypt2() function to work

Oops... previous attached copy of prot.h cot truncated. Here's the complete file.

Darren