aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_ts.c
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2020-02-17 08:28:33 +0000
committerKazuki Yamaguchi <k@rhe.jp>2020-02-17 08:55:15 +0000
commit890a6476fa2493227ec0517c6f8b444da9415e49 (patch)
tree3a5a9b107260eb87b970507936755de515375797 /ext/openssl/ossl_ts.c
parent060764d398a2b096fd50fe344ab7c26255656c61 (diff)
downloadruby-openssl-890a6476fa2493227ec0517c6f8b444da9415e49.tar.gz
ts: simplify OpenSSL::Timestamp::Request#algorithmky/ts-simplify-tsreq-get-algorithm
Stop the special treatment of invalid hashAlgorithm of the message imprint. Those invalid values can only appear after the object is instantiated, before the user sets an actual message digest algorithm. OpenSSL::Timestamp::TokenInfo#algorithm already does the same. Also, remove the test case "test_create_request" since it does not make much sense. Those fields are to be set by the user after creation of the object and checking the initial value is pointless. Fixes: https://github.com/ruby/openssl/issues/335
Diffstat (limited to 'ext/openssl/ossl_ts.c')
-rw-r--r--ext/openssl/ossl_ts.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/ext/openssl/ossl_ts.c b/ext/openssl/ossl_ts.c
index 24f5289c..ba0df750 100644
--- a/ext/openssl/ossl_ts.c
+++ b/ext/openssl/ossl_ts.c
@@ -217,7 +217,7 @@ ossl_ts_req_initialize(int argc, VALUE *argv, VALUE self)
* algorithm that was used to create the message imprint digest.
*
* call-seq:
- * request.get_algorithm -> string or nil
+ * request.algorithm -> string
*/
static VALUE
ossl_ts_req_get_algorithm(VALUE self)
@@ -225,15 +225,10 @@ ossl_ts_req_get_algorithm(VALUE self)
TS_REQ *req;
TS_MSG_IMPRINT *mi;
X509_ALGOR *algor;
- int algi;
GetTSRequest(self, req);
mi = TS_REQ_get_msg_imprint(req);
algor = TS_MSG_IMPRINT_get_algo(mi);
- algi = OBJ_obj2nid(algor->algorithm);
- if (algi == NID_undef || algi == NID_ccitt)
- return Qnil;
-
return get_asn1obj(algor->algorithm);
}