Commit 2c783509 authored by Matt Caswell's avatar Matt Caswell
Browse files

Backport hw_ibmca.c from master due to failed merge

Reviewed-by: default avatarTim Hudson <tjh@openssl.org>
parent 6bd72a27
Loading
Loading
Loading
Loading
+6 −4
Changes for demos/engines/ibmca/hw_ibmca.c: 6 added lines, 4 removed lines.
Original line number Original line Diff line number Diff line
@@ -764,10 +764,12 @@ they could cause potential side affects on either the card or the result */
        BN_bn2bin(dmq1, pkey);  /* Copy over dmq1 */
        BN_bn2bin(dmq1, pkey);  /* Copy over dmq1 */


        pkey += qSize;     /* move pointer */
        pkey += qSize;     /* move pointer */
	pkey += pSize - BN_num_bytes(p);  /* set up for zero padding of next field */
	/* set up for zero padding of next field */
	pkey += pSize - BN_num_bytes(p);


        BN_bn2bin(p, pkey);
        BN_bn2bin(p, pkey);
        pkey += BN_num_bytes(p);  /* increment pointer by number of bytes moved  */
	/* increment pointer by number of bytes moved  */
        pkey += BN_num_bytes(p);


        BN_bn2bin(q, pkey);
        BN_bn2bin(q, pkey);
        pkey += qSize ;  /* move the pointer */
        pkey += qSize ;  /* move the pointer */
@@ -776,8 +778,8 @@ they could cause potential side affects on either the card or the result */


        /* Prepare the argument and response */
        /* Prepare the argument and response */


	outLen = CORRECT_ENDIANNESS(privKey->qLength) * 2;  /* Correct endianess is used 
	/* Correct endianess is used because the fields were converted above */
						because the fields were converted above */
	outLen = CORRECT_ENDIANNESS(privKey->qLength) * 2;


        if (outLen > 256) {
        if (outLen > 256) {
		IBMCAerr(IBMCA_F_IBMCA_MOD_EXP_CRT,IBMCA_R_OUTLEN_TO_LARGE);
		IBMCAerr(IBMCA_F_IBMCA_MOD_EXP_CRT,IBMCA_R_OUTLEN_TO_LARGE);