Parcourir la source

[crypto] Define ASN.1 OID-identified algorithms for all supported digests

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown il y a 13 ans
Parent
révision
d56499ab18
3 fichiers modifiés avec 33 ajouts et 0 suppressions
  1. 11
    0
      src/crypto/md5.c
  2. 11
    0
      src/crypto/sha1.c
  3. 11
    0
      src/crypto/sha256.c

+ 11
- 0
src/crypto/md5.c Voir le fichier

@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
30 30
 #include <assert.h>
31 31
 #include <ipxe/rotate.h>
32 32
 #include <ipxe/crypto.h>
33
+#include <ipxe/asn1.h>
33 34
 #include <ipxe/md5.h>
34 35
 
35 36
 /** MD5 variables */
@@ -284,3 +285,13 @@ struct digest_algorithm md5_algorithm = {
284 285
 	.update		= md5_update,
285 286
 	.final		= md5_final,
286 287
 };
288
+
289
+/** "md5" object identifier */
290
+static uint8_t oid_md5[] = { ASN1_OID_MD5 };
291
+
292
+/** "md5" OID-identified algorithm */
293
+struct asn1_algorithm oid_md5_algorithm __asn1_algorithm = {
294
+	.name = "md5",
295
+	.digest = &md5_algorithm,
296
+	.oid = ASN1_OID_CURSOR ( oid_md5 ),
297
+};

+ 11
- 0
src/crypto/sha1.c Voir le fichier

@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
30 30
 #include <assert.h>
31 31
 #include <ipxe/rotate.h>
32 32
 #include <ipxe/crypto.h>
33
+#include <ipxe/asn1.h>
33 34
 #include <ipxe/sha1.h>
34 35
 
35 36
 /** SHA-1 variables */
@@ -258,3 +259,13 @@ struct digest_algorithm sha1_algorithm = {
258 259
 	.update		= sha1_update,
259 260
 	.final		= sha1_final,
260 261
 };
262
+
263
+/** "sha1" object identifier */
264
+static uint8_t oid_sha1[] = { ASN1_OID_SHA1 };
265
+
266
+/** "sha1" OID-identified algorithm */
267
+struct asn1_algorithm oid_sha1_algorithm __asn1_algorithm = {
268
+	.name = "sha1",
269
+	.digest = &sha1_algorithm,
270
+	.oid = ASN1_OID_CURSOR ( oid_sha1 ),
271
+};

+ 11
- 0
src/crypto/sha256.c Voir le fichier

@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
30 30
 #include <assert.h>
31 31
 #include <ipxe/rotate.h>
32 32
 #include <ipxe/crypto.h>
33
+#include <ipxe/asn1.h>
33 34
 #include <ipxe/sha256.h>
34 35
 
35 36
 /** SHA-256 variables */
@@ -242,3 +243,13 @@ struct digest_algorithm sha256_algorithm = {
242 243
 	.update		= sha256_update,
243 244
 	.final		= sha256_final,
244 245
 };
246
+
247
+/** "sha256" object identifier */
248
+static uint8_t oid_sha256[] = { ASN1_OID_SHA256 };
249
+
250
+/** "sha256" OID-identified algorithm */
251
+struct asn1_algorithm oid_sha256_algorithm __asn1_algorithm = {
252
+	.name = "sha256",
253
+	.digest = &sha256_algorithm,
254
+	.oid = ASN1_OID_CURSOR ( oid_sha256 ),
255
+};

Chargement…
Annuler
Enregistrer