1"""Defines a set of genrules to copy test vectors from Wycheproof. 2 3This is needed to assist the transition to using Bazel Modules, in that Bazel 4Modules packages use a different folder naming for dependencies compared to 5WORKSPACE-based packages. 6""" 7 8package(default_visibility = ["//:__subpackages__"]) 9 10licenses(["notice"]) 11 12genrule( 13 name = "aes_cmac", 14 srcs = ["@wycheproof//testvectors:aes_cmac"], 15 outs = ["aes_cmac_test.json"], 16 cmd = "cp $(SRCS) $(@D)/", 17 testonly = 1, 18) 19 20genrule( 21 name = "aes_gcm", 22 srcs = ["@wycheproof//testvectors:aes_gcm"], 23 outs = ["aes_gcm_test.json"], 24 cmd = "cp $(SRCS) $(@D)/", 25 testonly = 1, 26) 27 28genrule( 29 name = "aes_gcm_siv", 30 srcs = ["@wycheproof//testvectors:aes_gcm_siv"], 31 outs = ["aes_gcm_siv_test.json"], 32 cmd = "cp $(SRCS) $(@D)/", 33 testonly = 1, 34) 35 36genrule( 37 name = "aes_eax", 38 srcs = ["@wycheproof//testvectors:aes_eax"], 39 outs = ["aes_eax_test.json"], 40 cmd = "cp $(SRCS) $(@D)/", 41 testonly = 1, 42) 43 44genrule( 45 name = "aes_siv_cmac", 46 srcs = ["@wycheproof//testvectors:aes_siv_cmac"], 47 outs = [ 48 "aead_aes_siv_cmac_test.json", 49 "aes_siv_cmac_test.json", 50 ], 51 cmd = "cp $(SRCS) $(@D)/", 52 testonly = 1, 53) 54 55genrule( 56 name = "chacha20_poly1305", 57 srcs = ["@wycheproof//testvectors:chacha20_poly1305"], 58 outs = [ 59 "chacha20_poly1305_test.json", 60 "xchacha20_poly1305_test.json", 61 ], 62 cmd = "cp $(SRCS) $(@D)/", 63 testonly = 1, 64) 65 66genrule( 67 name = "hmac", 68 srcs = ["@wycheproof//testvectors:hmac"], 69 outs = [ 70 "hmac_sha1_test.json", 71 "hmac_sha224_test.json", 72 "hmac_sha256_test.json", 73 "hmac_sha384_test.json", 74 "hmac_sha3_224_test.json", 75 "hmac_sha3_256_test.json", 76 "hmac_sha3_384_test.json", 77 "hmac_sha3_512_test.json", 78 "hmac_sha512_test.json", 79 ], 80 cmd = "cp $(SRCS) $(@D)/", 81 testonly = 1, 82) 83 84genrule( 85 name = "rsa_pss", 86 srcs = ["@wycheproof//testvectors:rsa_pss"], 87 outs = [ 88 "rsa_pss_2048_sha1_mgf1_20_test.json", 89 "rsa_pss_2048_sha256_mgf1_0_test.json", 90 "rsa_pss_2048_sha256_mgf1_32_test.json", 91 "rsa_pss_3072_sha256_mgf1_32_test.json", 92 "rsa_pss_4096_sha256_mgf1_32_test.json", 93 "rsa_pss_4096_sha512_mgf1_32_test.json", 94 "rsa_pss_misc_test.json", 95 ], 96 cmd = "cp $(SRCS) $(@D)/", 97 testonly = 1, 98) 99 100genrule( 101 name = "rsa_signature", 102 srcs = ["@wycheproof//testvectors:rsa_signature"], 103 outs = [ 104 # Signature verification 105 "rsa_signature_2048_sha224_test.json", 106 "rsa_signature_2048_sha256_test.json", 107 "rsa_signature_2048_sha512_test.json", 108 "rsa_signature_3072_sha256_test.json", 109 "rsa_signature_3072_sha384_test.json", 110 "rsa_signature_3072_sha512_test.json", 111 "rsa_signature_4096_sha384_test.json", 112 "rsa_signature_4096_sha512_test.json", 113 "rsa_signature_2048_sha3_224_test.json", 114 "rsa_signature_2048_sha3_256_test.json", 115 "rsa_signature_2048_sha3_384_test.json", 116 "rsa_signature_2048_sha3_512_test.json", 117 "rsa_signature_3072_sha3_256_test.json", 118 "rsa_signature_3072_sha3_384_test.json", 119 "rsa_signature_3072_sha3_512_test.json", 120 "rsa_signature_test.json", 121 # Signature generation 122 "rsa_sig_gen_misc_test.json", 123 ], 124 cmd = "cp $(SRCS) $(@D)/", 125 testonly = 1, 126) 127 128genrule( 129 name = "ecdsa_webcrypto", 130 srcs = ["@wycheproof//testvectors:ecdsa_webcrypto"], 131 outs = ["ecdsa_webcrypto_test.json"], 132 cmd = "cp $(SRCS) $(@D)/", 133 testonly = 1, 134) 135 136genrule( 137 name = "ecdsa", 138 srcs = ["@wycheproof//testvectors:ecdsa"], 139 outs = [ 140 "ecdsa_brainpoolP224r1_sha224_test.json", 141 "ecdsa_brainpoolP256r1_sha256_test.json", 142 "ecdsa_brainpoolP320r1_sha384_test.json", 143 "ecdsa_brainpoolP384r1_sha384_test.json", 144 "ecdsa_brainpoolP512r1_sha512_test.json", 145 "ecdsa_secp224r1_sha224_test.json", 146 "ecdsa_secp224r1_sha256_test.json", 147 "ecdsa_secp224r1_sha3_224_test.json", 148 "ecdsa_secp224r1_sha3_256_test.json", 149 "ecdsa_secp224r1_sha3_512_test.json", 150 "ecdsa_secp224r1_sha512_test.json", 151 "ecdsa_secp256k1_sha256_test.json", 152 "ecdsa_secp256k1_sha3_256_test.json", 153 "ecdsa_secp256k1_sha3_512_test.json", 154 "ecdsa_secp256k1_sha512_test.json", 155 "ecdsa_secp256r1_sha256_test.json", 156 "ecdsa_secp256r1_sha3_256_test.json", 157 "ecdsa_secp256r1_sha3_512_test.json", 158 "ecdsa_secp256r1_sha512_test.json", 159 "ecdsa_secp384r1_sha384_test.json", 160 "ecdsa_secp384r1_sha3_384_test.json", 161 "ecdsa_secp384r1_sha3_512_test.json", 162 "ecdsa_secp384r1_sha512_test.json", 163 "ecdsa_secp521r1_sha3_512_test.json", 164 "ecdsa_secp521r1_sha512_test.json", 165 "ecdsa_test.json", # deprecated: use the files above 166 ], 167 cmd = "cp $(SRCS) $(@D)/", 168 testonly = 1, 169) 170 171genrule( 172 name = "eddsa", 173 srcs = ["@wycheproof//testvectors:eddsa"], 174 outs = [ 175 "ed448_test.json", 176 "eddsa_test.json", 177 ], 178 cmd = "cp $(SRCS) $(@D)/", 179 testonly = 1, 180) 181 182genrule( 183 name = "ecdh", 184 srcs = ["@wycheproof//testvectors:ecdh"], 185 outs = [ 186 "ecdh_brainpoolP224r1_test.json", 187 "ecdh_brainpoolP256r1_test.json", 188 "ecdh_brainpoolP320r1_test.json", 189 "ecdh_brainpoolP384r1_test.json", 190 "ecdh_brainpoolP512r1_test.json", 191 "ecdh_secp224r1_test.json", 192 "ecdh_secp256k1_test.json", 193 "ecdh_secp256r1_test.json", 194 "ecdh_secp384r1_test.json", 195 "ecdh_secp521r1_test.json", 196 "ecdh_test.json", # deprecated use the files above 197 ], 198 cmd = "cp $(SRCS) $(@D)/", 199 testonly = 1, 200) 201