On 21 May 2017 at 21:16, Joseph Reichman <[email protected]> wrote:

> TPROT like  the shift instruction second operand address is not used to
> address data rather for simplistic terms is prog key checking if  the user
> can access/store the storage.
>
> So what If I am not sure what the key is.
>

I assume by "not sure" you mean you won't know until run time, but then you
will be sure. This kind of situation is why, as with the shift
instructions, the second operand has a base register. Put the key in the
register, use a displacement of zero, and you're set. Standard addressing
arithmetic is performed on the displacement and the register, but the
result is, as you say, not used to address data. It would be very rare, but
not impossible, for both the base and the displacement values to be
non-zero. Normally the key is in either the register or the displacement,
and not split across the two, but if you like obfuscated code it can be
done.

>
> I guess I can do the following.  Is my understanding  ?
>
>                     MVC      PROGKEY,CHKKEY
>                     EX          R0,TPROT
>                     BC          3,ERROR_ADDRESS
>


> TPROT       TPROT      ADRESS,0
>                    ORG          TPROT+5
> PROGKEY  DS             X
>

This is doubly overcomplicated. First you change the instruction in
storage, and then you EXecute it. Don't do either.

Tony H.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to