src/jdk.crypto.ec/share/native/libsunec/impl/ecdecode.c
changeset 50731 ed322b4cfe49
parent 47216 71c04702a3d5
child 52678 7a16ce664d85
equal deleted inserted replaced
50729:7755c93d3923 50731:ed322b4cfe49
     1 /*
     1 /*
     2  * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * Use is subject to license terms.
     3  * Use is subject to license terms.
     4  *
     4  *
     5  * This library is free software; you can redistribute it and/or
     5  * This library is free software; you can redistribute it and/or
     6  * modify it under the terms of the GNU Lesser General Public
     6  * modify it under the terms of the GNU Lesser General Public
     7  * License as published by the Free Software Foundation; either
     7  * License as published by the Free Software Foundation; either
   170     }
   170     }
   171     printf("\n");
   171     printf("\n");
   172 #endif
   172 #endif
   173 
   173 
   174     if ((encodedParams->len != ANSI_X962_CURVE_OID_TOTAL_LEN) &&
   174     if ((encodedParams->len != ANSI_X962_CURVE_OID_TOTAL_LEN) &&
   175         (encodedParams->len != SECG_CURVE_OID_TOTAL_LEN)) {
   175         (encodedParams->len != SECG_CURVE_OID_TOTAL_LEN) &&
       
   176         (encodedParams->len != BRAINPOOL_CURVE_OID_TOTAL_LEN)) {
   176             PORT_SetError(SEC_ERROR_UNSUPPORTED_ELLIPTIC_CURVE);
   177             PORT_SetError(SEC_ERROR_UNSUPPORTED_ELLIPTIC_CURVE);
   177             return SECFailure;
   178             return SECFailure;
   178     };
   179     };
   179 
   180 
   180     oid.len = encodedParams->len - 2;
   181     oid.len = encodedParams->len - 2;
   560     case ECCurve_SECG_PRIME_521R1:
   561     case ECCurve_SECG_PRIME_521R1:
   561         /* Populate params for secp521r1
   562         /* Populate params for secp521r1
   562          * (the NIST P-521 curve)
   563          * (the NIST P-521 curve)
   563          */
   564          */
   564         CHECK_SEC_OK( gf_populate_params(ECCurve_SECG_PRIME_521R1, ec_field_GFp,
   565         CHECK_SEC_OK( gf_populate_params(ECCurve_SECG_PRIME_521R1, ec_field_GFp,
       
   566             params, kmflag) );
       
   567         break;
       
   568 
       
   569     case ECCurve_BrainpoolP256r1:
       
   570         /* Populate params for brainpoolP256r1 */
       
   571         CHECK_SEC_OK( gf_populate_params(ECCurve_BrainpoolP256r1, ec_field_GFp,
       
   572             params, kmflag) );
       
   573         break;
       
   574 
       
   575     case ECCurve_BrainpoolP320r1:
       
   576         /* Populate params for brainpoolP320r1 */
       
   577         CHECK_SEC_OK( gf_populate_params(ECCurve_BrainpoolP320r1, ec_field_GFp,
       
   578             params, kmflag) );
       
   579         break;
       
   580 
       
   581     case ECCurve_BrainpoolP384r1:
       
   582         /* Populate params for brainpoolP384r1 */
       
   583         CHECK_SEC_OK( gf_populate_params(ECCurve_BrainpoolP384r1, ec_field_GFp,
       
   584             params, kmflag) );
       
   585         break;
       
   586 
       
   587     case ECCurve_BrainpoolP512r1:
       
   588         /* Populate params for brainpoolP512r1 */
       
   589         CHECK_SEC_OK( gf_populate_params(ECCurve_BrainpoolP512r1, ec_field_GFp,
   565             params, kmflag) );
   590             params, kmflag) );
   566         break;
   591         break;
   567 
   592 
   568     default:
   593     default:
   569         break;
   594         break;