        .title  chkpw
        $UAIDEF
TRUE=-1
FALSE=0
        .psect  $PDATA quad,pic,con,lcl,shr,noexe,nowrt
items:  .word   2
        .word   UAI$_SALT
        .address salt
        .long   0
        .word   1
        .word   UAI$_ENCRYPT
        .address encryp
        .long   0
        .word   8
        .word   UAI$_PWD
        .address pwd
        .long   0
        .long   0
zero:   .long   0
        .psect  $LOCAL quad,pic,con,lcl,noshr,noexe,wrt
argl_getuai:                            ; argumentlist SYS$GETUAI
        .long   7
        .long   0
        .long   0
        .blkl   1                       ; username
        .blkl   1                       ; item-list
        .long   0
        .long   0
        .long   0
argl_hashpassword:                       ; argumentlist SYS$HASH_PASSWORD
        .long   5
        .blkl   1                       ; password
        .blkl   1                       ; encryptation
        .blkl   1                       ; salt
        .blkl   1                       ; username
        .address hpwd                   ; hashed password
salt:   .blkw   1
encryp: .blkb   1
pwd:    .blkq   1
hpwd:   .blkq   1
        .psect  $CODE quad,pic,con,lcl,shr,exe,nowrt
;***************************************
;
;  CHKPW ( USERNAME , PASSWORD , OK )
;
;  check password
;
;***************************************
        .entry  chkpw,^m<>
        movl    B^4(ap),argl_getuai+12
        moval   items,argl_getuai+16
        callg   argl_getuai,G^SYS$GETUAI
        movl    B^4(ap),argl_hashpassword+16
        movl    B^8(ap),argl_hashpassword+4
        movl    salt,argl_hashpassword+12
        movb    encryp,argl_hashpassword+8
        callg   argl_hashpassword,G^SYS$HASH_PASSWORD
        cmpl    pwd,hpwd
        bneq    100$
        movl    #TRUE,@B^12(ap)
        ret
100$:   movl    #FALSE,@B^12(ap)
        ret
        .end
