OLD | NEW |
1 /* crypto/ec/ec_lib.c */ | 1 /* crypto/ec/ec_lib.c */ |
2 /* | 2 /* |
3 * Originally written by Bodo Moeller for the OpenSSL project. | 3 * Originally written by Bodo Moeller for the OpenSSL project. |
4 */ | 4 */ |
5 /* ==================================================================== | 5 /* ==================================================================== |
6 * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. | 6 * Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 | 73 |
74 /* functions for EC_GROUP objects */ | 74 /* functions for EC_GROUP objects */ |
75 | 75 |
76 EC_GROUP *EC_GROUP_new(const EC_METHOD *meth) | 76 EC_GROUP *EC_GROUP_new(const EC_METHOD *meth) |
77 { | 77 { |
78 EC_GROUP *ret; | 78 EC_GROUP *ret; |
79 | 79 |
80 if (meth == NULL) | 80 if (meth == NULL) |
81 { | 81 { |
82 » » ECerr(EC_F_EC_GROUP_NEW, ERR_R_PASSED_NULL_PARAMETER); | 82 » » ECerr(EC_F_EC_GROUP_NEW, EC_R_SLOT_FULL); |
83 return NULL; | 83 return NULL; |
84 } | 84 } |
85 if (meth->group_init == 0) | 85 if (meth->group_init == 0) |
86 { | 86 { |
87 ECerr(EC_F_EC_GROUP_NEW, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); | 87 ECerr(EC_F_EC_GROUP_NEW, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); |
88 return NULL; | 88 return NULL; |
89 } | 89 } |
90 | 90 |
91 ret = OPENSSL_malloc(sizeof *ret); | 91 ret = OPENSSL_malloc(sizeof *ret); |
92 if (ret == NULL) | 92 if (ret == NULL) |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 OPENSSL_free(point); | 733 OPENSSL_free(point); |
734 } | 734 } |
735 | 735 |
736 | 736 |
737 void EC_POINT_clear_free(EC_POINT *point) | 737 void EC_POINT_clear_free(EC_POINT *point) |
738 { | 738 { |
739 if (!point) return; | 739 if (!point) return; |
740 | 740 |
741 if (point->meth->point_clear_finish != 0) | 741 if (point->meth->point_clear_finish != 0) |
742 point->meth->point_clear_finish(point); | 742 point->meth->point_clear_finish(point); |
743 » else if (point->meth != NULL && point->meth->point_finish != 0) | 743 » else if (point->meth->point_finish != 0) |
744 point->meth->point_finish(point); | 744 point->meth->point_finish(point); |
745 OPENSSL_cleanse(point, sizeof *point); | 745 OPENSSL_cleanse(point, sizeof *point); |
746 OPENSSL_free(point); | 746 OPENSSL_free(point); |
747 } | 747 } |
748 | 748 |
749 | 749 |
750 int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) | 750 int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) |
751 { | 751 { |
752 if (dest->meth->point_copy == 0) | 752 if (dest->meth->point_copy == 0) |
753 { | 753 { |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 { | 1155 { |
1156 if (group->meth->mul == 0) | 1156 if (group->meth->mul == 0) |
1157 /* use default */ | 1157 /* use default */ |
1158 return ec_wNAF_have_precompute_mult(group); | 1158 return ec_wNAF_have_precompute_mult(group); |
1159 | 1159 |
1160 if (group->meth->have_precompute_mult != 0) | 1160 if (group->meth->have_precompute_mult != 0) |
1161 return group->meth->have_precompute_mult(group); | 1161 return group->meth->have_precompute_mult(group); |
1162 else | 1162 else |
1163 return 0; /* cannot tell whether precomputation has been perform
ed */ | 1163 return 0; /* cannot tell whether precomputation has been perform
ed */ |
1164 } | 1164 } |
OLD | NEW |